![如何從 apache 伺服器日誌中解析「[info] 伺服器似乎很忙」?](https://rvso.com/image/658839/%E5%A6%82%E4%BD%95%E5%BE%9E%20apache%20%E4%BC%BA%E6%9C%8D%E5%99%A8%E6%97%A5%E8%AA%8C%E4%B8%AD%E8%A7%A3%E6%9E%90%E3%80%8C%5Binfo%5D%20%E4%BC%BA%E6%9C%8D%E5%99%A8%E4%BC%BC%E4%B9%8E%E5%BE%88%E5%BF%99%E3%80%8D%EF%BC%9F.png)
我已經多次看到這個問題被問過,但沒有任何真正的答案;所以我決定發布我的決議。
info
在 apache error.log 中可以看到以下訊息:
[info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 16 children, there are 41 idle, and 129 total children
答案1
解決方案似乎很明顯;增加StartServers
直到它消失。雖然確實如此,但任意增加該值是不好的做法,除非您了解其含義並且增加的值實際上會有所幫助。
我正在閱讀 httpd 原始碼,它的內容如下:
/*
* idle_spawn_rate is the number of children that will be spawned on the
* next maintenance cycle if there aren't enough idle servers. It is
* doubled up to MAX_SPAWN_RATE, and reset only when a cycle goes by
* without the need to spawn.
*/
此外,在原始程式碼中,在以下情況下會記錄實際錯誤:
if (retained->idle_spawn_rate >= 8) {
ap_log_error(APLOG_MARK, APLOG_INFO, 0, ap_server_conf, APLOGNO(00162)
"server seems busy, (you may need "
"to increase StartServers, or Min/MaxSpareServers), "
"spawning %d children, there are %d idle, and "
"%d total children", retained->idle_spawn_rate,
idle_count, total_non_dead);
}
那麼這意味著什麼;拋出這個錯誤當由於沒有足夠的伺服器來處理請求而在下一個週期產生的子級數量大於 8 時。
那麼如何解決它呢?
每次拋出此錯誤時,您都會看到類似的內容spawning 16 children
;這意味著必須產生 16 個子級,因為缺少伺服器來處理請求。基本上,增加StartServers
生成子代的數量,直到錯誤消失。您也可以增加Min/MaxSpareServers
此數量。