使用简单的Gevent应用程序获得Apache Benchmark恐怖结果

时间:2014-04-14 15:38:12

标签: python gevent apachebench

我有一个简单的Python代码来运行Gevent。

使用Apache Benchmark测试,拥有10000个用户和5个并发但速度很慢..每个请求大约2秒(1.419毫秒),这很糟糕。

我的代码是

from gevent import wsgi, monkey

class WebServer(object): 
    def application(self, environ, start_response):
        start_response("200 OK", []) 
        return ["Hello world!"]

if __name__ == "__main__":
    monkey.patch_all()
    app = WebServer()
    wsgi.WSGIServer(('', 8888), app.application, log=None).serve_forever()

结果非常糟糕

Server Software:        
Server Hostname:        127.0.0.1
Server Port:            8888

Document Path:          /
Document Length:        12 bytes

Concurrency Level:      5
Time taken for tests:   28.379 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Total transferred:      10700000 bytes
HTML transferred:       1200000 bytes
Requests per second:    3523.73 [#/sec] (mean)
Time per request:       1.419 [ms] (mean)
Time per request:       0.284 [ms] (mean, across all concurrent requests)
Transfer rate:          368.20 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       4
Processing:     0    1   0.1      1      10
Waiting:        0    1   0.1      1      10
Total:          0    1   0.1      1      10

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      1
  95%      1
  98%      2
  99%      2
 100%     10 (longest request)

为什么?这个家伙得到了比我的更好的结果,使用相同的代码 http://blindvic.blogspot.it/2013/04/hello-world-gevent-vs-nodejs.html

告诉我,如果我在这里遗漏了什么......

我搜索了是否有任何调整要做,但找不到任何东西。

1 个答案:

答案 0 :(得分:1)

美国人使用"。"作为小数点,而不是数千和数百之间的分隔符。 " 1.419"超过1且小于2,不超过1,000。