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
Last revisionBoth sides next revision
apache:architecture [2014/09/26 13:44] – [MPM Prefork Architecture] adminapache:architecture [2016/01/27 04:58] – [optimize load module apache] admin
Line 11: Line 11:
 Config example:<code> Config example:<code>
 <IfModule mpm_prefork_module> <IfModule mpm_prefork_module>
-    StartServers          4 +    StartServers          6 
-    MinSpareServers       2 +    MinSpareServers       6 
-    MaxSpareServers      6+    MaxSpareServers      12
     MaxClients          12     MaxClients          12
     MaxRequestsPerChild   0     MaxRequestsPerChild   0
-</IfModule> +</IfModule></code>
-</code>+
 check config: check config:
-  * check number of httpd process with client request:<code bash>+  * check number of httpd process with none client request:<code bash>
 ps -eaf | grep httpd ps -eaf | grep httpd
 </code>output:<code> </code>output:<code>
-root      1349     1  0 20:39 ?        00:00:00 /usr/local/apache/bin/httpd +root      1629     1  0 20:56 ?        00:00:00 /usr/local/apache/bin/httpd 
-apache    1351  1349  0 20:39 ?        00:00:00 /usr/local/apache/bin/httpd +apache    1631  1629  0 20:56 ?        00:00:00 /usr/local/apache/bin/httpd 
-apache    1352  1349  0 20:39 ?        00:00:00 /usr/local/apache/bin/httpd +apache    1632  1629  0 20:56 ?        00:00:00 /usr/local/apache/bin/httpd 
-apache    1353  1349  0 20:39 ?        00:00:00 /usr/local/apache/bin/httpd +apache    1633  1629  0 20:56 ?        00:00:00 /usr/local/apache/bin/httpd 
-apache    1354  1349  0 20:39 ?        00:00:00 /usr/local/apache/bin/httpd +apache    1634  1629  0 20:56 ?        00:00:00 /usr/local/apache/bin/httpd 
-</code> => processes = StartServers + 1+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> => processes = MinSpareServers + 1
   * run load test with 20 concurrecy requests to server:<code bash>   * run load test with 20 concurrecy requests to server:<code bash>
 ab -n 200 -c 20 http://shop.babies.vn/ ab -n 200 -c 20 http://shop.babies.vn/
Line 182: Line 183:
 apache    5360  0.1  7.6 283964 38312 ?      15:59   0:00 /usr/sbin/httpd apache    5360  0.1  7.6 283964 38312 ?      15:59   0:00 /usr/sbin/httpd
 </code>With VSZ is Virtual Memory Size(address space allocated) , and RSS is Resident Set Size (physically resident memory) </code>With VSZ is Virtual Memory Size(address space allocated) , and RSS is Resident Set Size (physically resident memory)
-  * pmap -x 6726 | sort -ak +2<code bash>+  * pmap -x 6726 | sort -nk +2<code bash>
 pmap -x 6812 | sort -nk +2 pmap -x 6812 | sort -nk +2
 00007fcacac95000    2048             0 -----  mod_mime_magic.so 00007fcacac95000    2048             0 -----  mod_mime_magic.so
Line 197: Line 198:
 ===== Optimize apache and PHP config ===== ===== Optimize apache and PHP config =====
 ==== optimize load module apache ==== ==== optimize load module apache ====
-Config load modules below: +Config Optimize load modules for httpd with Explain directives with these modules:
-<code bash> +
-LoadModule authz_host_module modules/mod_authz_host.so +
-LoadModule log_config_module modules/mod_log_config.so +
-LoadModule expires_module modules/mod_expires.so +
-LoadModule deflate_module modules/mod_deflate.so +
-LoadModule headers_module modules/mod_headers.so +
-LoadModule env_module modules/mod_env.so +
-LoadModule setenvif_module modules/mod_setenvif.so +
-LoadModule mime_module modules/mod_mime.so +
-LoadModule autoindex_module modules/mod_autoindex.so +
-LoadModule negotiation_module modules/mod_negotiation.so +
-LoadModule dir_module modules/mod_dir.so +
-LoadModule alias_module modules/mod_alias.so +
-LoadModule rewrite_module modules/mod_rewrite.so +
-</code> +
-Explain directives with these modules: +
 <code bash> <code bash>
 LoadModule authz_host_module modules/mod_authz_host.so#Order LoadModule authz_host_module modules/mod_authz_host.so#Order
 +LoadModule access_compat_module modules/mod_access_compat.so#Require
 LoadModule log_config_module modules/mod_log_config.so#LogFormat,TransferLog LoadModule log_config_module modules/mod_log_config.so#LogFormat,TransferLog
 LoadModule expires_module modules/mod_expires.so LoadModule expires_module modules/mod_expires.so
Line 231: Line 216:
 </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