Reduce MAMP memory usage by limiting the number of Apache processes

When developing web sites on a Mac it is common to use MAMP. By default MAMP will run several Apache processes because that’s just what Apache does by default – having several processes means several requests can be served at once. But, in a local development scenario, this is very unlikely to happen because the only user is the one operating the computer. Each process consumes roughly 40 MB so roughly 400 MB of RAM can be used for no real reason.

When I put the following snippet at the top of httpd.conf, the number of processes was reduced to 4.

<IfModule prefork.c>
    StartServers    2
    MinSpareServers   1
    MaxSpareServers   4
    MaxClients     7
    MaxRequestsPerChild   100
</IfModule>

On my memory-starved laptop this made a significant difference. 🙂

In MAMP you can edit the httpd.conf file by going to File -> Edit Template -> Apache -> httpd.conf. Any changes you make here won’t take affect until you restart Apache.

2 comments

  • Is this still good to this day?

    • Rimu Atkinson /

      Yes.
      The details about how to get to the settings file could be a bit different but the settings of MinSpareServers, MaxSpareServers, etc have remained the same for years.

Leave a Reply

Your email address will not be published.

top