User Tools

Site Tools


apache:architecture

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
apache:architecture [2014/05/24 20:37] – [optimize load module apache] adminapache:architecture [2015/06/25 05:32] – [Config disable warning log from browser] admin
Line 3: Line 3:
 MPM(Multi Processing Module) MPM(Multi Processing Module)
 ===== MPM Prefork Architecture ===== ===== MPM Prefork Architecture =====
 +Basic configuration:
   * StartServers: number of server processes to start   * StartServers: number of server processes to start
   * MinSpareServers: minimum number of server processes which are kept spare   * MinSpareServers: minimum number of server processes which are kept spare
-  * MaxSpareServers: maximum number of server processes which are kept spare+  * MaxSpareServers: maximum **number of server processes which are kept spare** 
 +  * MaxClients:  maximum number of server processes allowed to start => Limist number of httpd created and processing the request. For example: MaxClients 10, And clients send **100 concurrency requests to server**, The server only **create max 10 server process httpd** for processing, and **99 remain requests will waiting in the queues**
 {{:apache:preforkmodel.png|}} {{:apache:preforkmodel.png|}}
 +Config example:<code>
 +<IfModule mpm_prefork_module>
 +    StartServers          6
 +    MinSpareServers       6
 +    MaxSpareServers      12
 +    MaxClients          12
 +    MaxRequestsPerChild   0
 +</IfModule></code>
 +check config:
 +  * check number of httpd process with none client request:<code bash>
 +ps -eaf | grep httpd
 +</code>output:<code>
 +root      1629      0 20:56 ?        00:00:00 /usr/local/apache/bin/httpd
 +apache    1631  1629  0 20:56 ?        00:00:00 /usr/local/apache/bin/httpd
 +apache    1632  1629  0 20:56 ?        00:00:00 /usr/local/apache/bin/httpd
 +apache    1633  1629  0 20:56 ?        00:00:00 /usr/local/apache/bin/httpd
 +apache    1634  1629  0 20:56 ?        00:00:00 /usr/local/apache/bin/httpd
 +apache    1635  1629  0 20:56 ?        00:00:00 /usr/local/apache/bin/httpd
 +apache    1636  1629  0 20:56 ?        00:00:00 /usr/local/apache/bin/httpd
 +</code> => 7 processes = MinSpareServers + 1
 +  * run load test with 20 concurrecy requests to server:<code bash>
 +ab -n 200 -c 20 http://shop.babies.vn/
 +</code> And check number of httpd processes:<code>
 +ps -eaf | grep httpd
 +root      1013      0 19:50 ?        00:00:00 /usr/local/apache/bin/httpd
 +apache    1144  1013  0 20:10 ?        00:00:09 /usr/local/apache/bin/httpd
 +apache    1210  1013  1 20:29 ?        00:00:05 /usr/local/apache/bin/httpd
 +apache    1216  1013  2 20:30 ?        00:00:05 /usr/local/apache/bin/httpd
 +apache    1219  1013  2 20:30 ?        00:00:06 /usr/local/apache/bin/httpd
 +apache    1220  1013  2 20:30 ?        00:00:05 /usr/local/apache/bin/httpd
 +apache    1226  1013  8 20:33 ?        00:00:06 /usr/local/apache/bin/httpd
 +apache    1227  1013  8 20:33 ?        00:00:06 /usr/local/apache/bin/httpd
 +apache    1228  1013  8 20:33 ?        00:00:06 /usr/local/apache/bin/httpd
 +apache    1229  1013  7 20:33 ?        00:00:05 /usr/local/apache/bin/httpd
 +apache    1230  1013  6 20:33 ?        00:00:04 /usr/local/apache/bin/httpd
 +apache    1231  1013  8 20:33 ?        00:00:05 /usr/local/apache/bin/httpd
 +apache    1288  1013  8 20:34 ?        00:00:03 /usr/local/apache/bin/httpd
 +</code> => max httpd processes = 13 = maxClients + 1
 ===== MPM worker Architecture ===== ===== MPM worker Architecture =====
   * StartServers: initial number of server processes to start   * StartServers: initial number of server processes to start
Line 192: Line 232:
 </code> </code>
 ==== optimize load module php ==== ==== optimize load module php ====
 +===== Custom Config for Apache =====
 +==== Config disable warning log from browser ====
 +With this config, the log will display in PHP error log but they don't display in browser side\\\
 +Update httpd.conf
 +<code php>
 +<IfModule mod_php5.c>
 +    php_admin_flag display_errors off
 +</IfModule>
 +</code>
 +
apache/architecture.txt · Last modified: 2022/10/29 16:15 by 127.0.0.1