a1022
09-13-2001, 12:02 PM
I have a dedicated Dual 800Mhz with 512MB of ram. What I'm wondering is what should my maxClients be to maximize the traffic it can handle? I do run a bit of scripting but my load is usually a 0.20. Currently it's at 300 maxClients.
Gunzour
09-13-2001, 05:13 PM
You want to set your maxclients to a number that lets you handle the greatest number of connections without resorting to memory swapping. Basically you need to look at how much memory each Apache process takes up, and divide that into the total amount of memory you have available for Apache.
On a server with 512 MB RAM, if each Apache process takes 2 MB RAM, you can set maxclients to 256 (512 / 2). BUT, you also need to allow memory for anything else running on the system, including the operating system itself, and any other services running on that machine, such as a database, name server, etc., so your actual maxclients setting might be closer to 200 in this case. How much memory each Apache process takes depends greatly on how it was compiled, what modules were compiled in, etc. The best thing to do is look at your production server and see how much memory each process is actually taking.
You want to prevent memory swapping because swapping is highly detrimental to web server performance, as your Apache server will spend lots of time waiting for memory to page in from the swap file (remember, disk is much slower than RAM).
Maxclients is basically a ceiling to prevent Apache from killing your whole server when it gets overloaded. On a well running server, you should never hit maxclients; if you do, you need to add more memory or move some of your traffic to another server.
Doug
Synergy
09-13-2001, 05:58 PM
Here is my 2 cents:
You should watch your load... I suggest getting a extra server for load balancing....
Keep your load under 7.0..... and give clients a option to move to another server.... If you want a script that shows you average load, please feel free to email me and ill email it to you.
Depending on what type of clients you have... I usually limit the server to 200 max... But sometimes 125 is already pushing it because 1 out of 10 clients have a popular site...
a1022
09-14-2001, 11:04 AM
Interesting... I thought my maxClients at 300 was low but now I know that that should be around the right number. It's amazing how apache can eat up my 512MB because at 300 it's getting very close to the swap. And I thought 512MB is a lot of ram. My first server was 64MB! :D
Synergy: Wouldn't the 'top' command show me the average load?
So what happens when a server reaches maxClients? Will the connection be refused and do a 'Page Cannot Be Display'?
I am also curious as to what I should set the min spare and max spares.
BlueBox
09-14-2001, 01:35 PM
i think the balance between MaxClients and MaxSpare/MinSpare is very important to the performance of your server and avoiding the dreaded 'death spiral'
At any one time Apache will attempt to keep an amount of spare servers alive to handle new requests, so that when a new request comes in it doesn't have to spawn a new server - this is the MinSpare number, set this too high and at busy periods your server can start spawning to many especially if the MaxSpare is also set high and at quiet periods you have too many servers running using up your resources.
So if you have sudden bursts of activity then increase your MinSpare
the problems start if you have too many server processes running and you get near your unix file limits so you need to be careful.
we tend to evaluate each server seperatly depending upon its specific circumstances.
Gary Reid