Trying to determine the best maxclients setting…

… is really difficult!

I have a Plesk box with Apache 2. The server doesn’t take a lot of hits, but runs a lot of scripts, so its pretty memory intensive. However, the load isn’t too high. I am trying to determine what are the best setting for my prefork MPM settings. I am getting conflicting suggestions on MaxClients.

I’ve learned that MaxClients limits the number of children Apache creates to handle requests. Each child only accepts one connection at a time and so these ‘children’ should equal the total number of concurrent connections.

Setting this too low has a very negative effect on performance. While all clients are busy handling connections, new connections will be put in the TCP queue and eventually timeout, while the machine itself will seem perfectly responsive and fast.

I’ve learned that it is generally a good idea to set MaxClients as high as the machine can handle in terms of memory. However, setting it too high will cause the machine to swap memory between hard ram and cache needlessly, which effectively kills performance.

I found this on ye old interweb, from Webmonkey:

The single biggest hardware issue affecting Web server performance is RAM. A Web server should never, ever, have to swap. Swapping increases the latency of each request beyond a point that users consider “fast enough.” This causes users to hit Stop and Reload, further increasing the load. You can, and should, control the MaxClients setting so that your server does not spawn so many children that it starts swapping.

Anyway — any suggestions for my Maxclients setting? Anyway, I created a LinkBag full of Apache performance tuning tips, as I’ve been reading through the interweb. It’s here, check it out! And feel free to comment if you have any suggestions.

Comments 1

  1. stanlet wrote:

    Here’s a small hint — do not perform a ‘graceful restart’ of Apache. The Memory becomes bloated. You must Stop/Start it. I had the same problem as youand SW-soft fixed it with this.

    Posted 12 Oct 2007 at 8:53 am

Post a Comment

Your email is never published nor shared. Required fields are marked *