
我們有一個使用 PHP-CGI 的標準 lighttpd 部署,我們的錯誤日誌充斥著以下內容。這導致了一個巨大的問題,因為我們不斷向客戶返回 500 美元:
2012-10-14 14:28:38: (mod_fastcgi.c.3001) backend is overloaded; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 36
2012-10-14 14:28:38: (mod_fastcgi.c.2764) fcgi-server re-enabled: 0 /tmp/php-7735.socket
2012-10-14 14:28:39: (mod_fastcgi.c.2764) fcgi-server re-enabled: 0 /tmp/php-7735.socket
2012-10-14 14:28:40: (mod_fastcgi.c.3001) backend is overloaded; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 37
2012-10-14 14:28:40: (mod_fastcgi.c.2764) fcgi-server re-enabled: 0 /tmp/php-7735.socket
2012-10-14 14:28:41: (mod_fastcgi.c.3001) backend is overloaded; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 57
2012-10-14 14:28:41: (mod_fastcgi.c.3001) backend is overloaded; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 57
2012-10-14 14:28:42: (mod_fastcgi.c.3597) all handlers for /index.php? on .php are down.
有人知道發生了什麼事嗎?我們重新啟動了所有 php 和 lighttpd 相關進程,但這並沒有解決問題。我們最終重新啟動了整個盒子,現在它消失了,儘管我們擔心它稍後可能會回來...
總的來說,我們的部署長期以來一直表現良好,這是第一次發生這種情況。
答案1
這基本上意味著所有 php 進程都忙於處理請求,並且沒有可用的空閒 php 進程來處理新的傳入請求。這會導致 500 錯誤。
通常這表示您正在運行的 php 程式碼速度很慢,淹沒了 php 進程。嘗試啟用 mysql 慢日誌以查看慢查詢是否是罪魁禍首,嘗試使用 php 操作碼快取(例如 APC)來加快速度。