0

Keeping all factors constant , assuming my apache server is configured as below , in event mpm

<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 2
MaxSpareServers 5
MaxClients 200 #
ServerLimit 200 #
MaxRequestsPerChild 100
</IfModule>

Since MaxClients is set to 200 , this will be the maximum number of active connections at any point in time,

Lets assume my site receives 200 visitors each second, and each visitor loads up a page that has multiple images, and other resources that will load once the page is visited,

does it mean that the extra resources requested by the server will be handled by one of the clients in apache or will be handled by the children of the clients ?

I don't understand why apache has the MaxRequestsPerChild since the clients are capped by the ServerLimit directive,

How is MaxRequestsPerChild applicable in the scenario above ?

salimsaid
  • 101
  • 2

1 Answers1

0

MaxRequestsperChild indicate when the worker process has to shudown and be renewed, generally you want a much bigger number or 0 in MaxRequestsperChild unless you know there is a memory leak somewhere and keeping the processes opened without renewing them is going to cause problems.

Since prefork is process model, and opening a process is more cpu demanding than opening threads in the same processes, having a MaxRequestsperChild of 100 will make apache be constantly renewing processes when you receive some load.

Also keep in mind MaxClients and ServerLimit "is the same" in prefork but not with "event" that is a threaded model.

I would recommend you to switch to mpm_event asap, but if you can't, for the reason I mentioned earlier, create much many more spare servers beforehand according to max number of clients you expect, and if the max concurrent number you expect is 200, increase it a little more and have about 50-100 spare servers for load spikes.

As I mentioned earlier if you have 200 concurrent clients you don't ever want maxrequestsperchild to be 100 for the process to be renewed unless you want your server to run in slow motion.

ezra-s
  • 2,215
  • 1
  • 7
  • 13