nginx 并发量计算

2013-11-06 16:38:37 +08:00
 geew
ab -c 1000 -n 7000 http://api.test.com/testpage

模拟1000个并发, 7000个请求的结果如下, 但是并发量怎么算的呢?

Benchmarking api.test.com(be patient)
Completed 700 requests
Completed 1400 requests
Completed 2100 requests
Completed 2800 requests
Completed 3500 requests
Completed 4200 requests
Completed 4900 requests
Completed 5600 requests
Completed 6300 requests
Completed 7000 requests
Finished 7000 requests


Server Software: nginx
Server Hostname: api.test.com
Server Port: 80

Document Path: /testpage
Document Length: 32132 bytes

Concurrency Level: 1000
Time taken for tests: 55.834 seconds
Complete requests: 7000
Failed requests: 5521
(Connect: 0, Receive: 0, Length: 5521, Exceptions: 0)
Write errors: 0
Non-2xx responses: 5521
Total transferred: 49585547 bytes
HTML transferred: 48549014 bytes
Requests per second: 125.37 [#/sec] (mean)
Time per request: 7976.292 [ms] (mean)
Time per request: 7.976 [ms] (mean, across all concurrent requests)
Transfer rate: 867.27 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 2 707 2338.4 76 25211
Processing: 4 1600 3426.4 95 36119
Waiting: 3 1510 3237.2 69 30258
Total: 10 2307 4157.0 187 37218

Percentage of the requests served within a certain time (ms)
50% 187
66% 1156
75% 3166
80% 3601
90% 7677
95% 10719
98% 15419
99% 21056
100% 37218 (longest request)
4590 次点击
所在节点    问与答
5 条回复
tinypig
2013-11-06 16:50:38 +08:00
Requests per second: 125.37 [#/sec] (mean)

平均每秒125.37个请求。
geew
2013-11-06 16:57:15 +08:00
@tinypig 如果有人问你你这服务器能承受多少并发 怎么回答呢
qiuai
2013-11-06 17:03:54 +08:00
@geew 打到死.然后就知道了.一般直接告诉他能撑住峰值多少和日多少PV就好.谁会去真正在乎这个
LazyZhu
2013-11-06 17:17:49 +08:00
开发环境用nginx-systemtap-toolkit找瓶颈
https://github.com/agentzh/nginx-systemtap-toolkit
geew
2013-11-06 17:39:38 +08:00
@qiuai

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/88282

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX