V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
geew
V2EX  ›  问与答

nginx 并发量计算

  •  
  •   geew · 2013-11-06 16:38:37 +08:00 · 4581 次点击
    这是一个创建于 4046 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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)
    5 条回复    1970-01-01 08:00:00 +08:00
    tinypig
        1
    tinypig  
       2013-11-06 16:50:38 +08:00
    Requests per second: 125.37 [#/sec] (mean)

    平均每秒125.37个请求。
    geew
        2
    geew  
    OP
       2013-11-06 16:57:15 +08:00
    @tinypig 如果有人问你你这服务器能承受多少并发 怎么回答呢
    qiuai
        3
    qiuai  
       2013-11-06 17:03:54 +08:00
    @geew 打到死.然后就知道了.一般直接告诉他能撑住峰值多少和日多少PV就好.谁会去真正在乎这个
    LazyZhu
        4
    LazyZhu  
       2013-11-06 17:17:49 +08:00
    开发环境用nginx-systemtap-toolkit找瓶颈
    https://github.com/agentzh/nginx-systemtap-toolkit
    geew
        5
    geew  
    OP
       2013-11-06 17:39:38 +08:00
    @qiuai
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5121 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 03:52 · PVG 11:52 · LAX 19:52 · JFK 22:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.