Switch to or Enable Apache Event MPM in Ubuntu 14.04 for HTTP Connections

By | 2014/06/18

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:

/etc/apache2/mods-available/mpm_event.conf

# 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

Done!

One thought on “Switch to or Enable Apache Event MPM in Ubuntu 14.04 for HTTP Connections

  1. Abhishek Saini

    ###@###:/home/web/www# sudo apt-get install apache2-mpm-event
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package apache2-mpm-event

    Package not found.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.