Welcome! 閮餃
蝢撖園 蝢撖嗥曄 蝢撖嗉憯 蝢撖嗉賣 蝢撖嗅啣

Advanced

Change History

Message: Apache (prefork) 鞎頛嚗靽格寡身摰賡 (performance tuning)

Changed By: HP
Change Date: April 25, 2010 02:50AM

隡箸刻頛嚗靽格 Apache (prefork) 蝟餌絞鞎頛嚗靽格閮剖賡tuning)rmance tuning)
Apache 撖阡雿嚗嗅祕賣臭誑臬憭 process瑁蝔撘璅∠脰嚗蝔梁 MPM (Mutil-Processing Module)

MPM 拍車嚗prefork worker

隞交函蝟餌絞(top)嚗啁 httpd2-prefork worker 嗅祕撠望 apache 瑁蝔撘

冽祆撠 prefork performance tuning 雿閮隢

Apache 質身摰瑼其 Linux distribution 航賣銝靘憒 SUSE/openSUSE 臬 /etc/apache2/server-tuning.conf
Apache 撖阡雿嚗嗅祕賣臭誑臬憭 process瑁蝔撘璅∠脰嚗蝔梁 MPM (Mutil-Processing Module)

MPM 拍車嚗prefork worker

隞交函蝟餌絞(top)嚗啁 httpd2-prefork worker 嗅祕撠望 apache 瑁蝔撘

冽祆撠 prefork performance tuning 雿閮隢

Apache 質身摰瑼其 Linux distribution 航賣銝銝祈身摰瑼(航)臬 <b>/etc/httpd/conf/httpd.conf</b> 嚗 openSUSE / Linux SUSE 臬 <b>/etc/apache2/server-tuning.conf</b>


隞 prefork MPM 憪閮剖箔嚗

&lt;IfModule prefork.c>
ServerLimit 150 (ServerLimit 閮剖憭扳潛潦摨銝 MaxClients)
StartServers 5 (apache 銝瑁 process賂銋撠望臬臬 request )
MinSpareServers 5
MaxSpareServers 10
MaxClients 150 (摰寧摰蝢拙停胯憭批臬 connection 詻)
MaxRequestsPerChild 10000 (銝Apache severd/mpm_common.html#startservers
<b>StartServers 128</b>
kage)
&lt;/IfModule>

蝪∟閮銋嚗賡嗡蜓閬航矽 ServerLimit MaxClients銝蝑閬箏敺憒荔鋆∠ ServerClientChild嚗嗅祕賣臬銝隞嗡鈭血喉銝 Apache Process

賡塚臭誑擃隞乩閮剖嚗

&lt;IfModule prefork.c>
# number of server processes to start
# http://httpd.apache.org/docs/2.2/mod/mpm_common.html#startservers
<b>StartServers 128</b>
# minimum number of server processes which are kept spare
# http://httpd.apache.org/docs/2.2/mod/prefork.html#minspareservers
<b>MinSpareServers 16</b>
# maximum number of server processes which are kept spare
# http://httpd.apache.org/docs/2.2/mod/prefork.html#maxspareservers
<b>MaxSpareServers 64</b>
# highest possible MaxClients setting for the lifetime of the Apache process.
# http://httpd.apache.org/docs/2.2/mod/mpm_common.html#serverlimit
<b>ServerLimit 2048</b>
# maximum number of server processes allowed to start
# http://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxclients
<b>MaxClients 2048</b>
# maximum number of requests a server process serves
# http://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxrequestsperchild
<b>MaxRequestsPerChild 10000</b>
&lt;/IfModule>

apache 隢 stop start

靘憒嚗

/etc/init.d/apache2 stop
/etc/init.d/apache2 start


<b>甇文嚗撠 SUSE Linux 銝臭誑雿鞎頛憭抒嚗銝閬撘 aod_module</b>

AOD Art of Defense 憒函 web server 蝔撘冽啣神撠望瘜冽 SQL injection Cross-Stie Scripting 蝑餅閰梧瘝隞暻潭餅鈭隞嗥(銝賡瘙撣賊)臭誑桐閬 load AOD module

AOD 閮剖瑼 /etc/apache2/conf.d/aod.conf

蝪∪桐隤芣 aod.conf 批捆 mark 韏瑚撠勗末鈭銝銝 aod.conf 批捆嚗嗅祕皛踹末

蝑鈭箇鈭綽銝瑁 aod module 嚗賢嗾銋敹思

隞 ab2 -c 1000 -n 10000 http://localhost/index.html 皜祈岫箔

祉撟喳 1-3 蝘銝瑁 aod 敺嚗撟喳芾 300~400 ms 撌血喋臭誑亙 concurrent request 銋憭批(憭扯游停臭 Apache MaxClients 閮剖)

敺銋臭璅嚗 apache server 隢 stop start


蝡嚗
<a href=http://httpd.apache.org/docs/2.0/mod/prefork.html>Apache MPM prefork</a> (摰寞隞)
<a href=http://diary.tw/tim/506>ApachePreFork MPM</a> (2008)

賊蝡嚗
<a href=http://twntwn.info/blog/ajer001/archives/1793>靽格迤 Apache Worker MPM APC 閮剖</a> (2007)
Changed By: HP
Change Date: April 24, 2010 11:09PM

隡箸刻頛嚗靽格 Apache (prefork) 蝟餌絞嗉質身摰蝟餌絞閮剖賡鈔mance tuning)
Changed By: HP
Change Date: April 24, 2010 06:50PM

隡箸刻頛嚗靽格 Apache 蝟餌絞嗉質身摰(prefork) 蝟餌絞嗉質身摰蝟餌絞閮剖賡鈔mance tuning)

Original Message

雿: HP
Date: April 24, 2010 01:08AM

隡箸刻頛嚗靽格 Apache 蝟餌絞嗉質身摰(prefork) 蝟餌絞嗉質身摰蝟餌絞閮剖賡鈔mance tuning)
銝 Apache 撖阡雿賣臭誑臬憭 process 憭 process瑁蝔撘璅∠嚗蝔梁 脰嚗蝔梁 MPM (Mutil-Processing Module)

MPM 拍車嚗prefork worker

隞交函蝟餌絞(top)嚗啁 httpd2-prefork worker 嗅祕撠望 apache 瑁蝔撘

冽祆撠 prefork performance tuning 雿閮隢

質身摰瑼其 Linux distribution 航賣銝靘憒 SUSE/openSUSE 臬 /etc/apache2/server-tuning.conf
質身摰瑼其 Linux distribution 航賣銝靘憒 SUSE/openSUSE ServerLimit 150 臬 /etc/apache2/server -tuning.conf
Apache 撖阡雿嚗嗅祕賣臭誑5
g Module)

MPM 拍車嚗prefork worker

隞交函蝟餌絞(top)嚗啁 httpd2-prefork worker 嗅祕撠望 apache 瑁蝔撘

冽祆撠 prefo10000
銝祈身摰
臭誑擃隞乩閮剖嚗
銝 MaxClients)
StartServers 5 (apache 銝瑁 process賂銋撠望臬臬 request )
MinSpareServers MaxSpareServers 1 128
nts 150 (摰寧摰蝢拙停胯憭批臬 connection 詻)
MaxRequestsPerChild 10000 (銝Apache severkage)
</IfModule>

蝪∟閮銋嚗賡嗡蜓閬航矽 ServerLimit MaxClient銝蝑閬箏敺憒荔鋆∠ Server 16
tChild嚗嗅祕賣臬銝隞嗡鈭血喉銝 Apache Process

賡塚臭誑擃隞乩閮剖嚗

<IfModule prefork.c>
# number of server processes to start
# http://httppache.org/docs/2.2/ 64
common.html#startservers
StartServers 128
# minimum number of server processes which are kept spare
# http://httpd.apache.org/docs2/mod/prefork.html 2048
ervers
MinSpareServers 16
# maximum number of server processes which are kept spare
# http://httpd.apache.orocs/2.2/mod/prefor 2048
spareservers
MaxSpareServers 64
# highest possible MaxClients setting for the lifetime of the Apache process.
# http:MaxRequestsPerChild 10000
m_common.html#serverlimit
ServerLimit 2048
# maximum number of server pro甇文嚗撠 SUSE Linux sses allowE Linux 銝臭誑雿鞎頛憭抒嚗銝閬撘 aod_module

AOD Art of Defense 憒函 web server 蝔撘冽啣神撠望瘜冽 SQL injection Cross-Stie Scripting 蝑餅閰梧瘝隞暻潭餅鈭隞嗥(銝賡瘙撣賊)臭誑桐閬 load AOD module

AOD 閮剖瑼 /etc/apache2/conf.d/aod.conf

蝪∪桐隤芣 aod.conf 批捆 mark 韏瑚撠勗末鈭銝銝 aod.conf 批捆嚗嗅祕皛踹末

蝑鈭箇鈭綽銝瑁 aod module 嚗賢嗾銋敹思

隞 ab2 -c 1000 -n 10000 http://localhost/index.html 皜祈岫箔

祉撟喳 1-3 蝘銝瑁 aod 敺嚗撟喳芾 300~400 ms 撌血喋臭誑亙 concurrent request 銋憭批(憭扯游停臭 Apache MaxClients 閮剖)

敺銋臭璅嚗 apache server 隢 stop start


蝡嚗
Apache MPM prefork (摰寞隞)
ApachePreFork MPM (2008)

賊蝡嚗
靽格迤 Apache Worker MPM APC 閮剖 (2007)