Skip to content

Instantly share code, notes, and snippets.

@thebouv
Created February 20, 2017 14:20
Show Gist options
  • Save thebouv/2bdffc36de52fa6f5da1e200273f8be6 to your computer and use it in GitHub Desktop.
Save thebouv/2bdffc36de52fa6f5da1e200273f8be6 to your computer and use it in GitHub Desktop.
One line to get average mem used by running apache processes, great for estimating MaxClients
ps -ylC httpd --sort:rss | awk '{sum+=$8; ++n} END {print "Tot="sum"("n")";print "Avg="sum"/"n"="sum/n/1024"MB"}'
# above is a one liner, not really a script
# MaxClients = 80% of max memory on system / average mem from one-liner above
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment