0

我有一个简单的 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

告诉我我是否在这里遗漏了什么..

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

4

1 回答 1

1

美国人使用“。” 作为小数点,而不是千和百之间的分隔符。“1.419”大于1小于2,不大于1000。

于 2014-04-14T16:00:38.353 回答