Normally we increase the server thread based on the following criteria:
- Available JVM heap size or available RAM on the server.
- No of request going to be received on the server per sec.
- Processing time per request.
- No of available processor.
Normaly you can create near about 2000 threads per core if available ram is 2 GB. As, per thread default stack size allocated is 1 MB. So it means around 2000 threads MAX but all the threads can not be used for your java application as some memory will be used by other resources of OS as well and also when you are setting the max no of threads for your java application you also need to consider the size of the received payload as till that request get processed everything will be in memory (RAM) + consider the average processing time of one request and wait time for request.
To get the no of processor available in your system, you can use the following java program.
public static void main(String arg)
int i = Runtime.getRuntime().availableProcessors();
System.out.println(“No of available Processor :” + i);
This is what my finding is after reading different - 2 articles on different - 2 forums.
I would request to members of this forum who have idea on this can add more to it and can correct my info if it is incorrect.