Lower memory usage by 22% and higher performance with apache2-mpm-worker
Apache Multi-Processing Modules (MPM) prefork is the original like apache 1.3 implementation which is used where multi-threading could cause issues i.e. PHP hosting. The worker MPM is a multi-threaded and claims to provide higher performance and lower memory footprint than prefork.When the time came to update one of our hosting servers, we decided to included the move to the worker mpm implementation, I tested the performance mpm implementation and found that it achieved a savings of 17.4MiB - 20.8 MiB and 8 less child processes:
Apache MPM Prefork
After clean apache reboot:$ ./ps_mem.py Private + Shared = RAM used Program 64.7 MiB + 11.8 MiB = 76.5 MiB apache2 (23)After each of our sites was accessed once:
$ ./ps_mem.py Private + Shared = RAM used Program 245.8 MiB + 12.8 MiB = 258.6 MiB apache2 (31)
Apache MPM Worker
Results with apache2-mpm-worker module after a clean apache reboot:$ ./ps_mem.py Private + Shared = RAM used Program 53.1 MiB + 6.0 MiB = 59.1 MiB apache2 (20)After each site was hit once with an web browser:
$ ./ps_mem.py Private + Shared = RAM used Program 225.7 MiB + 12.1 MiB = 237.8 MiB apache2 (21)From this semi scientific test it is clearly worthwhile using apache2-mpm-worker on a server that is purely serving and hosting django projects.