来自 CherryPy 邮件列表的交叉发布。
大家好,
我是cherrypy的新手,我正在尝试了解以下琐碎基准的结果。鉴于这个“hello world”应用程序:
import cherrypy
class Hello:
@cherrypy.expose
def index(self):
return 'hello'
cherrypy.server.thread_pool = 50
cherrypy.quickstart(Hello())
我跑了ab -c 10 -n 1000
,我得到了这些结果:
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software: CherryPy/3.2.4
Server Hostname: localhost
Server Port: 8080
Document Path: /
Document Length: 5 bytes
Concurrency Level: 10
Time taken for tests: 4.494 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 143000 bytes
HTML transferred: 5000 bytes
Requests per second: 222.53 [#/sec] (mean)
Time per request: 44.938 [ms] (mean)
Time per request: 4.494 [ms] (mean, across all concurrent requests)
Transfer rate: 31.08 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 31.6 0 998
Processing: 2 16 183.1 5 4493
Waiting: 1 15 183.1 5 4492
Total: 2 17 185.7 5 4493
Percentage of the requests served within a certain time (ms)
50% 5
66% 7
75% 11
80% 13
90% 18
95% 21
98% 24
99% 25
100% 4493 (longest request)
请注意,最长的请求需要超过 4 秒才能完成。鉴于我在应用程序中将线程数设置为 50,并且 ab 使用 10 个并发请求,我希望cherrypy 能够轻松处理它。我错过了什么?我尝试了不同的#threads 和并发请求,结果相似。我正在使用 CherryPy v.3.2.4
谢谢你的帮助,L。