Browse Source

Tune the prefork configuration

The current config keeps 6 servers around with no traffic.
Girish Ramakrishnan 7 years ago
parent
commit
6d9ebfa753
3 changed files with 19 additions and 3 deletions
  1. 2 3
      Dockerfile
  2. 17 0
      apache/mpm_prefork.conf
  3. 0 0
      apache/wordpress.conf

+ 2 - 3
Dockerfile

@@ -31,11 +31,10 @@ RUN chown -R www-data:www-data /app/code
 # configure apache
 RUN rm /etc/apache2/sites-enabled/*
 RUN sed -e 's,^ErrorLog.*,ErrorLog "|/bin/cat",' -i /etc/apache2/apache2.conf
-RUN sed -e "s,MaxSpareServers[^:].*,MaxSpareServers 5," -i /etc/apache2/mods-available/mpm_prefork.conf
+COPY apache/mpm_prefork.conf /etc/apache2/mods-available/mpm_prefork.conf
 
 RUN a2disconf other-vhosts-access-log
-ADD apache2-wordpress.conf /etc/apache2/sites-available/wordpress.conf
-RUN ln -sf /etc/apache2/sites-available/wordpress.conf /etc/apache2/sites-enabled/wordpress.conf
+ADD apache/wordpress.conf /etc/apache2/sites-enabled/wordpress.conf
 RUN echo "Listen 8000" > /etc/apache2/ports.conf
 
 # configure mod_php

+ 17 - 0
apache/mpm_prefork.conf

@@ -0,0 +1,17 @@
+<IfModule mpm_prefork_module>
+    # On startup, start these many servers
+	StartServers	2
+
+    # At any given time, keep atleast these many servers
+	MinSpareServers	2
+
+    # At any given time, keep atmost these many idle servers (this is always >= MinSpareServers+1)
+	MaxSpareServers 3
+
+    # Maximum number of servers at any given instant. Requests will be queued after this
+	MaxRequestWorkers	  150
+
+    # Recycle process after handling these many requests. This protected against accidental memory leaks
+	MaxConnectionsPerChild   100
+</IfModule>
+

+ 0 - 0
apache2-wordpress.conf → apache/wordpress.conf