2012-07-25 60 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?如果没有,你应该看看它。

对于那些不好的时候,几率是在实际的应用程序中,虽然在配置中没有那么多。