Apache MaxClients
Apache web server has a configuration option called MaxClients. MaxClients determines the maximum number of concurrent connections that Apache will service.
MaxClients is not the same as maximum number of users. That is because a user generally downloads web pages and then spends time reading them and during that time Apache can service other users.
In Apache prefork MPM the MaxClients figure also determines the maximum number of Apache child processes that can be active. The more child processes that are spawned the higher the memory usage so MaxClients is an important server tuning option.
To determine what number you want to use for MaxClients you have to figure out how much RAM you can dedicate to Apache. You take your total memory figure and deduct a suitable amount for other software running on your server. So for example if you have a control panel like Cpanel or a DBMS like mysql running you will have to deduct the memory usage of those programs from your total available memory. Also deduct a suitable number for operating system overhead.
Then you try and determine how much memory a typical Apache process is using. You can use the ps command to find that out. For example in CentOS Linux:
If you are using some other distribution then replace httpd with your Apache binary name. For example apache2 on Debian.
The above command should give you a list of Apache process and their resident set size. An average of that number should give you a rough idea of how much memory an Apache child process will use.
Now you simply divide the amount of memory you can devote to Apache with the average process size to arrive at a suitable figure for Apache MaxClients.
I find that on control panel less servers a number of 75 per GB of RAM is a good starting point.
MaxClients is not the same as maximum number of users. That is because a user generally downloads web pages and then spends time reading them and during that time Apache can service other users.
In Apache prefork MPM the MaxClients figure also determines the maximum number of Apache child processes that can be active. The more child processes that are spawned the higher the memory usage so MaxClients is an important server tuning option.
To determine what number you want to use for MaxClients you have to figure out how much RAM you can dedicate to Apache. You take your total memory figure and deduct a suitable amount for other software running on your server. So for example if you have a control panel like Cpanel or a DBMS like mysql running you will have to deduct the memory usage of those programs from your total available memory. Also deduct a suitable number for operating system overhead.
Then you try and determine how much memory a typical Apache process is using. You can use the ps command to find that out. For example in CentOS Linux:
If you are using some other distribution then replace httpd with your Apache binary name. For example apache2 on Debian.
The above command should give you a list of Apache process and their resident set size. An average of that number should give you a rough idea of how much memory an Apache child process will use.
Now you simply divide the amount of memory you can devote to Apache with the average process size to arrive at a suitable figure for Apache MaxClients.
I find that on control panel less servers a number of 75 per GB of RAM is a good starting point.
No comments:
Post a Comment