Calculate Apache settings

Calculate Apache settings

To work out a good setting for MaxClients, first find out the average apache process memory use in megabytes. You’ll want to run the following snippet a number of times, and average the results:

ps -ef | grep apache2 | grep -v ^$USER | awk '{ print $2 '} | xargs pmap -d | grep ^mapped: | awk '{ print $4}' | cut -dK -f1 | awk '{SUM += $1} END { print int((SUM/NR)/1000) }'

You can now divide the ideal amount of memory usage in megabytes (after OS and MySQL usage is accounted), by the average process memory value to get a rough estimate of MaxClients.

Share Post :

Leave a Reply