apache2/php workaround

ledy asked:

Since i faced issues with apache2 processes eating all my memory within short time, i found a workaround like this cronjob:

0,15,30,45 * * * * [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete

Before my RAM load is 2GB and after cronjob ran, it’s 500MB load => 1.5GB free.

The cronjob is set to run on 0,15,30,45 every hour. Isn’t there a proper solution which keeps the apache2 in check to avoid running out of memory within any 15min?


My answer:

I don’t see any issues here; it certainly doesn’t look like you’re running out of memory, with only 608MB used. I suspect you need to read Linux Ate My RAM.

See also this question and answer.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.