My situation is following: We run Magento Professional on a 15Gb ram instance, rackspace.
When running htop, we could see that 'apache2 -k start' keeps spawning more child processes, some of them eats ~900Mb of memory.
When memory is almost used up, all sites time out or become very slow. When memory is all used up, it seems that some of these processes got killed to free memory.
Then the same procedures happen.
My question is, could we setup ubuntu / apache to kill off child processes and free memory when memory usage reaches 85-90% ?
Best Answer
Save this code as apache-free.sh file and set as executable and add permissions
add a crontab schedule, to run every 1 minute (feel free to redefine this time)
This script saves a log file in
/var/log/apache-free.log
with some informations about execution and memory saves.** Remember: It's only a bandaid! It's necessary detect the real problem with your server.
I hope helps you!