編輯Apache\conf\HTTPd.conf 。。


 

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

 

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 50

 

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 10


 

KeepAliveTimeout 這個參數決定一個HTTP進程在什麼都不做之前能夠等待多長時間 。。

 

而一個apache進程完成了一個任務 並有了一定的記憶體佔用(漸進模式)並不會馬上退出 。。

 

而是等待一個keepalivetimeout時間 。。

 

若使用者的連結請求持續不斷的到來 則積累起來的無用的apache進程就會相當多 。。

 

直到timeout 這些進程才會被殺死 。。

 

但是 keepalive對於靜態的檔 比如影像檔的傳送是很有效的 。。

 

所以 keepalive要設置為on 但是keepalvietimeout要設置的小些 比如10 。。

 

MaxRequestsPerChild 這個參數是表示 apache進程在處理了多少個請求之後 。。

 

必須退出 重新開始 以免在處理中的記憶體問題 。。

 

對於php腳本來說 把這個參數設置的小一些是有好處的 。。

 

可以避免程式使用的記憶體持續增長對apache帶來的壓力 。。

 

讓這個參數定期釋放記憶體 因為php是在腳本執行完畢後 自動釋放只用的資源(記憶體)的 。。
比如設置為50 。。

 

如果太小的話 重新產生一個apache進程也是要消耗資源的 這是一個平衡問題 。。

 

要根據你電腦的配置以及綜合情況決定
arrow
arrow
    全站熱搜

    戮克 發表在 痞客邦 留言(0) 人氣()