Performance TuningΒΆ
The number of threads are related to the HTTP connections.
To estimate the maximum number of threads use the following formula:
number_of_users * time_taken_to_respond_to_each_request / time_between_each_user's_request
For example: if you have 10,000 users, if every request takes 10 ms to process in Jetty, and each user takes 10S to look at the response before generating another request, according to the formula you need 10000 * 0.01 / 10 = 10 threads. (0.01 = 10 ms / 1 s)
To estimate the number of threads the server can handle on a machine (not an MFP device), like Windows or Linux on which the Genius Server is installed, use the following guideline:
Compute-intensive tasks multiplied by N CPUs.
The optimum utilization is almost guaranteed with a thread pool of N +1.
As for I/O or other blocking operations, you can use a larger pool, since not all of the threads can be scheduled at all times.
So, iF N is number of CPU's and U is target utilization, the formula is:
Num_threads = N*U*(1+Waiting time/Compute time)
Note
Increasing threads too much can lead to an excessive use of system resources.
Lower limit - TCP/IP sockets are file descriptors, so you are looking at num_threads higher than num_processors due to the I/Os involved.
Higher limit - You should consider how much memory your JVM has, the number of threads your OS can create (Linux -> cat /proc/sys/kernel/threads-max ), the number of file descriptors OS allows and how much CPU utilization you are targeting.
In practice, you should use a test client and generate incremental loads to determinate the max threads and the average for HTTP response.
Estimate of configuration table:
Number of users |
Time of Response |
Time between two requests |
Number of threads |
|---|---|---|---|
100 |
1 sec |
5 sec |
20 |
200 |
1 sec |
5 sec |
40 |
300 |
1 sec |
5 sec |
60 |
400 |
1 sec |
5 sec |
80 |
100 |
500 ms |
5 sec |
10 |
200 |
500 ms |
5 sec |
20 |
300 |
500 ms |
5 sec |
30 |
400 |
500 ms |
5 sec |
40 |
By default, the Genius Server uses maximum 200 threads. This value can handle a large number of users.
By default, the Max idle time is 60000 ms. Note that this time is sufficient when you are waiting for a new request to be received on a connection.
Warning
These formulas are by no means precise, they are just theoretical. We do suggest to test the server before.
Note
To configure the Genius Server, the first formula (* number_of_users * time_taken_to_respond_to_each_request / time_between_each_user's_request) is preferred, since through the second one (Num_threads = N*U*(1+Waiting time/Compute time) a lot system resources are used.