A few days ago, I received a complaint that the mail services on my server stopped working. When the user attempted to send an email, they got the error message “temporary error, please try again later.” The reason for this error was the fact the anti virus process had been killed, and my mail system refused to handle mails due this problem.
The reason the anti virus process was killed is because the system ran out of memory:
Mar 23 20:36:09 stock kernel: Out of memory: Kill process 24582 (clamd) score 66 or sacrifice child
In the recent month, the number of sites being hosted at my server has increased. Also, due requirements of some new software on my server, I have enabled a number of php modules that hadn’t been enabled before (such as PDO modules for both MySQL and PostgreSQL). These changes are, so far I can tell, responsible for the growth in Apache’s memory usage.
I will still have to investigate how to reduce the memory usage, as the server is running again, but the available memory is still rather low.
« A look at Drupal Compiling CCFinder on ArchLinux (x86_64) »
Okay, I’ve found a solution to reduce the memory usage.
http://serverfault.com/questions/21106/how-to-reduce-memory-usage-on-a-unix-webserver
It mentions to switch to prefork MPM
http://wiki.vpslink.com/Low_memory_MySQL_/_Apache_configurations
The trick is to uncomment
to enable the MPM prefork.
(Note: prefork is the default for ArchLinux. You can configure to use the MPM worker, but as the site linked above mentions the worker is a memory hog, and I wish to reduce the memory usage, I use the default choice of prefork, and able it by uncommenting the include of that config file)