介绍
ab是apche自带的一个web服务测试工具,很方便使用··

案例说明
- 10个连接,请求100··
ab -c 10 -n 100 http://192.168.1.128/

-t 测试时长
-c 请求的并发客户端
-n 请求的次··

  • 10个连接,每次100请求执行5··
    ab -c 10 -n 100 -t 5 http://192.168.1.128/
    [root@localhost nginx-new]# wc -l logs/access.log 
    101 logs/access.log
    [root@localhost nginx-new]#  ab -c 10 -n 100 -t 5 http://192.168.1.128/
    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 192.168.1.128 (be patient)
    Completed 5000 requests
    Completed 10000 requests
    Completed 15000 requests
    Completed 20000 requests
    Completed 25000 requests
    Completed 30000 requests
    Completed 35000 requests
    Completed 40000 requests
    Completed 45000 requests
    Completed 50000 requests
    Finished 50000 requests
    
    Server Software:        nginx/1.9.15
    Server Hostname:        192.168.1.128
    Server Port:            80
    
    Document Path:          /
    Document Length:        612 bytes
    
    Concurrency Level:      10
    Time taken for tests:   4.527 seconds
    Complete requests:      50000
    Failed requests:        0
    Write errors:           0
    Total transferred:      42250000 bytes
    HTML transferred:       30600000 bytes
    Requests per second:    11045.80 [#/sec] (mean)
    Time per request:       0.905 [ms] (mean)
    Time per request:       0.091 [ms] (mean, across all concurrent requests)
    Transfer rate:          9114.94 [Kbytes/sec] received
    
    Connection Times (ms)
                  min  mean[+/-sd] median   max
    Connect:        0    0   0.1      0       2
    Processing:     0    1   0.3      1       8
    Waiting:        0    1   0.3      1       8
    Total:          0    1   0.3      1       9
    
    Percentage of the requests served within a certain time (ms)
      50%      1             #1ms完成99%请求
      66%      1
      75%      1
      80%      1
      90%      1
      95%      1
      98%      2
      99%      2
     100%      9 (longest request)