2012-07-25 90 views
-1

,所以我「AB -c 50 -n 5000 http://lala.la」今天跑了此命令的服務器上,我得到了這些「神奇」的結果:很差的Web服務器性能

Document Path:  /
Document Length:  26476 bytes 

Concurrency Level:  50 
Time taken for tests: 1800.514 seconds 
Complete requests:  2427 
Failed requests:  164 
    (Connect: 0, Receive: 0, Length: 164, Exceptions: 0) 
Write errors:   0 
Total transferred:  65169733 bytes 
HTML transferred:  64345285 bytes 
Requests per second: 1.35 [#/sec] (mean) 
Time per request:  37093.408 [ms] (mean) 
Time per request:  741.868 [ms] (mean, across all concurrent requests) 
Transfer rate:   35.35 [Kbytes/sec] received 

Connection Times (ms) 
       min mean[+/-sd] median max 
Connect:  0 0 2.7  0  22 
Processing: 4335 36740 9513.2 33755 102808 
Waiting:  7 33050 8655.1 30407 72691 
Total:  4355 36741 9512.4 33755 102808 

Percentage of the requests served within a certain time (ms) 
    50% 33754 
    66% 37740 
    75% 40977 
    80% 43010 
    90% 47742 
    95% 56277 
    98% 62663 
    99% 71301 
100% 102808 (longest request) 

這是一個新安裝的Nginx服務器,使用Cloudflare和APC。

不要以爲我曾經見過這麼差的表現,那麼究竟是什麼造成了它呢?

謝謝。

+0

直到你開始排除故障,你纔會知道,但我的猜測會試圖在一次導致內存耗盡和分頁的時候提供太多的請求。 – 2012-07-25 12:15:38

+0

你提到APC這一事實讓我認爲這實際上是「糟糕的PHP性能」。你的頭版有多複雜? – kolbyjack 2012-07-25 12:23:26

+0

我建議更新你的問題來解釋你自己做過的調查研究問題。由於問題可能存在於任何地方,因此您最好將所涉及的所有主要軟件,硬件和網絡組件以及您所做的調整並分別瞭解其性能。 – 2012-07-26 00:29:50

回答

1

對於初學者來說,嘗試直接測試原點,並從混合中取出混濁(除非您將html設置爲可緩存,並且您試圖測試cloudflare的服務能力)。鑑於cloudflare的目的之一是保護網站,認爲您的測試可能會受到限制(至少繞過它將移除可能的調查來源)並非不合理。

爲您的nginx的訪問日誌格式添加$ request_time,這將告訴您服務器端的性能視圖。如果它仍然看起來很可怕,那麼你可能不得不使用New Relic或DynaTrace之類的東西來獲得更多關於時間到了哪裏的細節(如果你沒有測試應用程序本身)。

你是否使用php-fpm連接nginx到php?如果沒有,你應該看看它。

對於那些不好的時候,機率是在實際的應用程序中,雖然在配置中沒有那麼多。