Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save daubac402/5e380f9e067c190181005a6481bdabf5 to your computer and use it in GitHub Desktop.
Save daubac402/5e380f9e067c190181005a6481bdabf5 to your computer and use it in GitHub Desktop.
Calculate the current Apache memory usage and Average proccess size
# You can change httpd to apache, apache2, ... that match with your env
ps -ylC httpd | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}'
@daubac402
Copy link
Author

daubac402 commented Jul 16, 2019

In my case, i ussually set these if I have 2 GB RAM for httpd (prefolk):
2 x 1024 / 66 (max mem is used by a httpd process) = 31 => 30

StartServers 5
MinSpareServers 5
MaxSpareServers 10
ServerLimit 30
MaxClients 30
MaxRequestsPerChild 10000

To check what is your current Server MPM, run
httpd -V | grep -i mpm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment