We have an apache server 2.4.X which we are using as a reverse proxy in front of one Java Application . We have enabled Apache status module Apache Status and we are able to see that number of idle worker threads will always be zero , Hence performance of our application is poor . Our hosting server have 32 cores and 64 GB of RAM . We are using mpm_worker module of Apache . Apache mpm_worker .Our Current mpm_worker configuration is :
<IfModule mpm_worker_module>
ServerLimit 150
StartServers 8
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestWorkers 150
MaxConnectionsPerChild 10000
</IfModule>
.We went through Apache performance tuning article and found that we can have 2930 request workers as per our server configuration .My questions are .
-
Changing MaxRequestWorkers alone to 2930 will work ?
-
Do we need to change ThreadsPerChild also ?
-
StartServers which represents Apache child processes also needs to be changed /Or can we change
this also for optimum performance based on our server configuration. -
What should be ServerLimit value for updated MaxRequestWorkers case which will be 2930 ?
Best Answer
To be able to create a suiting profile for your Server you need to understand what each Configuration of this Directive means:
The maximum Number of Processes that the Server will create
The Number of Processes that the Server will create on Start-Up
The Number of Threads that each Process will create
The Minimum Number of Threads that must exist. (Mostly at Start-Up)
The Maximum Number of Threads that the Server will keep running.
Maximum number of connections that the Server will accept simultaneously.
The Maximum Number of Connections that each Process will accept. This determines the Time of Life of a Child Process.
Having said this. How many Child Processes are running usually?
Did you already reach the
ServerLimit
of Child Processes?You should also look at the
MaxClients
Setting that it will admit all the Request that are coming in.If no Worker Threads are available increase the number of
MaxSpareThreads
Launching new Child Processes will consume CPU Cycles so on a busy Site the
MaxSpareThreads
limit should be big.But disposing old Processes will also free your System Memory, so you should limit the Time of Life of the Processes with
MaxConnectionsPerChild
.On the other Hand Application Run Time keeps your Threads busy. Being faster with your Java Application will free Threads and Memory.
As an Example: Receiving 50 requests / second and each Request takes 4 seconds to complete. you would need 200 Threads to cover this Demand.
If each Request took only 2 seconds you could cover it with only 100 Threads.