This is a slight update from my previous post, but I stumbled across the following command / method to help calculate the value of "pm.max_children" for PHP5-FPM.
echo "pm.max_children = $(( $(awk '/MemTotal:/ { printf "%d\n",
($2*0.66) }' /proc/meminfo) / $(ps --no-headers -o "rss,cmd" -C php5-fpm
| awk '{ sum+=$1 } END { printf ("%d\n", sum/NR) }') ))"
Now whats interesting is that the suggested value return, is a ridiculously high value, but I think what comes out of this, is that it illustrates how much more RAM you can give PHP5-FPM.
But (un)fortunately real world exists, and there are other existing services in play (e.g. MySQL could be installed).
So if you use the above command, I highly suggest you adjust the PHP5-FPM value sparingly, and thereafter recheck your Munin / Cacti etc
HTH
Brent
Monday, June 6, 2016
Adjusting PHP5-FPM child processes (Apache)
Every now and then, on a clients server, we get the following dreaded message:
WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 4 idle, and 48 total children
So we will start off, by determining the non-swapped physical memory usage by each PHP5-FPM processes (notice its in kilo Bytes)
ps -ylC php5-fpm --sort:rss
ps --no-headers -o "rss,cmd" -C php5-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
Thereafter I ran the following command to give me the total memory, of my current PHP5-FPM configuration.
ps -ylC php5-fpm --sort:rss | awk '!/RSS/ { s+=$8 } END { printf "%s\n", "Total memory used by PHP-FPM child processes: "; printf "%dM\n", s/1024 }'
In my case I still had plenty of RAM left.
Remember the appropriate value for pm.max_children can be calculated as:
pm.max_children = Total RAM of your server / Max child process size - in my case it was 67MB
WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 4 idle, and 48 total children
So we will start off, by determining the non-swapped physical memory usage by each PHP5-FPM processes (notice its in kilo Bytes)
ps -ylC php5-fpm --sort:rss
ps --no-headers -o "rss,cmd" -C php5-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
Thereafter I ran the following command to give me the total memory, of my current PHP5-FPM configuration.
ps -ylC php5-fpm --sort:rss | awk '!/RSS/ { s+=$8 } END { printf "%s\n", "Total memory used by PHP-FPM child processes: "; printf "%dM\n", s/1024 }'
In my case I still had plenty of RAM left.
Remember the appropriate value for pm.max_children can be calculated as:
pm.max_children = Total RAM of your server / Max child process size - in my case it was 67MB
pm.max_children = 70
pm.start_servers = 20
pm.min_spare_servers = 20
pm.max_spare_servers = 35
pm.max_requests = 500
Thursday, June 2, 2016
Debian upgrade Wheezy to Jessie
Good day Guys
Here is my tip / howto to upgrade Debian Wheezy to Jessie.
I highly recommend first ensuring that your server is update.
So run:
Here is my tip / howto to upgrade Debian Wheezy to Jessie.
I highly recommend first ensuring that your server is update.
So run:
# apt-get update
# apt-get upgrade
# apt-get dist-upgrade
# apt-get -f install
Fix any outstanding issues.
If all is good. You can start by changing you sources.list to reflect Jessie
sed -i 's/wheezy/jessie/g' /etc/apt/sources.list
sed -i 's/wheezy/jessie/g' /etc/apt/sources.list.d/*
The second sed is to ensure all other third pary repos reflect Jessie too.
There after you are good to go.
Run:
# rm -rf /etc/apt/preferences.d/*
# apt-get update
# apt-get upgrade
# apt-get dist-upgrade
# apt-get -f install
This can take awhile.
After the upgrade it is recommended to reboot your system:
# reboot
After your server has come up, for safety sake, run another
# apt-get update
# apt-get upgrade# apt-get -f installYou should have a new and shiny new OS, and you can verify, by using eitherhostnamectl orlsb_release -aHTHBrent
Subscribe to:
Posts (Atom)