Apache 2.4 offers a new event driven MPM which makes Apache work a little like nginx. Here is how to switch to and use event MPM on Ubuntu 14.04!
Only Works for HTTP Connections!
Note for SSL connections, using this module will revert to work like the worker module. So if using an entirely HTTPS site, unfortunately there will be no benefit to using event MPM right now. (Old HN discussion)
1. First, install this Ubuntu package:
$ sudo apt-get install apache2-mpm-event
2. Next, as a way to prevent accidental memory leaks from webapps, I suggest changing MaxConnectionsPerChild to 1000 in:
# event MPM # StartServers: initial number of server processes to start # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker threads which are kept spare # ThreadsPerChild: constant number of worker threads in each server process # MaxRequestWorkers: maximum number of worker threads # MaxConnectionsPerChild: maximum number of requests a server process serves
StartServers 2 MinSpareThreads 25 MaxSpareThreads 75 ThreadLimit 64 ThreadsPerChild 25 MaxRequestWorkers 150 MaxConnectionsPerChild 1000# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
3. Finally, restart apache:
$ sudo service apache2 restart