Created
May 9, 2017 20:17
-
-
Save moraleslevi/4c286c5f385c8aca91f352ef9a8b6e46 to your computer and use it in GitHub Desktop.
This is a script you can run on apache servers to help calculate MaxRequestWorkers/ServerLimit based on available free memory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo -e "\n*** Memory Output ***\n" | |
free -m | |
echo -e "\nEnter the amount of free memory (in MB), followed by [ENTER]:" | |
read FREE | |
ps -G www-data -ylC apache --sort:rss | awk -v free="$FREE" '{ s += $8; } END \ | |
{ print "\nAverage Size:", s/(NR-1)/1024, "MB\n Num Servers:", NR-1, \ | |
"\n Total Usage:", (s/(NR-1)/1024)*(NR-1), "MB\n Max Servers:", \ | |
free/(s/(NR-1)/1024) }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment