PHP-FPM/MYSQL/NGINX 的 CPU 使用率非常奇怪

PHP-FPM/MYSQL/NGINX 的 CPU 使用率非常奇怪

我有

  • php-fpm 7.0.11 - 帶有 ioncube
  • nginx 1.10.x
  • 瑪麗亞資料庫 10.1

我使用 PHP-FPM 進行靜態處理,從來沒有遇到任何問題。 CPU 使用率高是隨機發生的,現在是永久性的。我沒有做任何改變。

此時,大多數 PHP-FPM 進程處於 R 狀態,CPU 使用率為 100%。

這是頂部輸出 我的 CPU 是 16 個線程

top - 08:21:15 up 31 min,  2 users,  load average: 799.18, 782.54, 620.78
Tasks: 1082 total, 799 running, 283 sleeping,   0 stopped,   0 zombie
%Cpu(s): 98.5 us,  1.3 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.2 si,  0.0 

我的網頁伺服器每秒收到超過 5000 個請求,但有了這個數量,之前一切都很好。

很奇怪,因為:

  • 如果我用 PHP 檔案的原始來源取代 ioncubed ,負載會減少到 8 ,CPU 使用率也只有 15-20%

  • 如果我保留 ioncube,但停止 mysql,平均負載和 cpu 也會減少。

  • 有時,當我更改 sysctl 配置時,CPU 會減少 10 秒,但隨後又會達到 100%

我無法解釋這一點,因為如果它是 ioncube,我就會遇到 2) 的問題,但我沒有。

我真的已經失去了頭髮,試圖找到它的真正原因,這讓我發瘋,因為當我沒有改變任何事情時就發生了這種情況。

我的sysctl檔案如下:

net.core.wmem_max= 1677721600
net.core.rmem_max= 1677721600
net.ipv4.tcp_rmem= 1024000 8738000 1677721600
net.ipv4.tcp_wmem= 1024000 8738000 1677721600
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_no_metrics_save = 1
net.core.netdev_max_backlog = 8000
net.ipv4.route.flush=1
fs.file-max=265536
net.core.somaxconn = 65535
vm.max_map_count=655300

相關內容