Changes between Version 3 and Version 4 of jazz/11-04-13


Ignore:
Timestamp:
Apr 14, 2011, 5:18:57 PM (13 years ago)
Author:
jazz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • jazz/11-04-13

    v3 v4  
    4242}}}
    4343 * <參考> [http://haka.sharera.com/blog/BlogTopic/32309.htm CLOSE_WAIT 生成的原因]
     44
     45 * 另外我也做了兩個小調校:
     46 * <1> 限制每個 process 的記憶體使用 - 在 /etc/profile 中加入
     47{{{
     48ulimit -v 524288
     49}}}
     50 * 其結果是最高可以使用的記憶體是 524288 = 512 * 1024 kbytes = 512 MB。
     51{{{
     52virtual memory          (kbytes, -v) 524288
     53}}}
     54 * <2> 把 /etc/apache2/apache2.conf 改成只使用 prefork 模組,並且降低 KeepAlive 的時間,還有降低預設開啟的 apache process 數量。
     55{{{
     56#!diff
     57--- /etc/apache2/apache2.conf.org       2011-04-12 10:32:53.000000000 +0800
     58+++ /etc/apache2/apache2.conf   2011-04-14 00:38:39.000000000 +0800
     59@@ -64,7 +64,7 @@
     60 #
     61 # Timeout: The number of seconds before receives and sends time out.
     62 #
     63-Timeout 300
     64+Timeout 30
     65 
     66 #
     67 # KeepAlive: Whether or not to allow persistent connections (more than
     68@@ -83,7 +83,7 @@
     69 # KeepAliveTimeout: Number of seconds to wait for the next request from the
     70 # same client on the same connection.
     71 #
     72-KeepAliveTimeout 15
     73+KeepAliveTimeout 2
     74 
     75 ##
     76 ## Server-Pool Size Regulation (MPM specific)
     77@@ -96,11 +96,11 @@
     78 # MaxClients: maximum number of server processes allowed to start
     79 # MaxRequestsPerChild: maximum number of requests a server process serves
     80 <IfModule mpm_prefork_module>
     81-    StartServers          5
     82-    MinSpareServers       5
     83-    MaxSpareServers      10
     84-    MaxClients          150
     85-    MaxRequestsPerChild   0
     86+    StartServers          1
     87+    MinSpareServers       1
     88+    MaxSpareServers       1
     89+    MaxClients            5
     90+    MaxRequestsPerChild 100
     91 </IfModule>
     92 
     93 # worker MPM
     94@@ -113,15 +113,15 @@
     95 #              and starting Apache.
     96 # ThreadsPerChild: constant number of worker threads in each server process
     97 # MaxRequestsPerChild: maximum number of requests a server process serves
     98-<IfModule mpm_worker_module>
     99-    StartServers          2
     100-    MinSpareThreads      25
     101-    MaxSpareThreads      75
     102-    ThreadLimit          64
     103-    ThreadsPerChild      25
     104-    MaxClients          150
     105-    MaxRequestsPerChild   0
     106-</IfModule>
     107+#<IfModule mpm_worker_module>
     108+#    StartServers          1
     109+#    MinSpareThreads       1
     110+#    MaxSpareThreads       1
     111+#    ThreadLimit           1
     112+#    ThreadsPerChild       1
     113+#    MaxClients            5
     114+#    MaxRequestsPerChild  50
     115+#</IfModule>
     116 
     117 # event MPM
     118 # StartServers: initial number of server processes to start
     119@@ -130,15 +130,15 @@
     120 # MaxSpareThreads: maximum number of worker threads which are kept spare
     121 # ThreadsPerChild: constant number of worker threads in each server process
     122 # MaxRequestsPerChild: maximum number of requests a server process serves
     123-<IfModule mpm_event_module>
     124-    StartServers          2
     125-    MaxClients          150
     126-    MinSpareThreads      25
     127-    MaxSpareThreads      75
     128-    ThreadLimit          64
     129-    ThreadsPerChild      25
     130-    MaxRequestsPerChild   0
     131-</IfModule>
     132+#<IfModule mpm_event_module>
     133+#    StartServers          1
     134+#    MinSpareThreads       1
     135+#    MaxSpareThreads       1
     136+#    ThreadLimit           1
     137+#    ThreadsPerChild       1
     138+#    MaxClients            5
     139+#    MaxRequestsPerChild  50
     140+#</IfModule>
     141 
     142 # These need to be set in /etc/apache2/envvars
     143 User ${APACHE_RUN_USER}
     144}}}