我用ab给web服务器做压力测试

4 篇文章 0 订阅
2 篇文章 0 订阅

目标服务使用POST接收数据。

首先POST参数包括:game,type,platform

新建一个文件

vi /tmp/post.dat

输入:

game=1&type=1$platform=xy_ios

保存文件.


[root@iZ11gwfi6i5Z bin]#./ab -n 10000 -c 1000 -p /tmp/post.dat -T 'application/json' http://115.159.91.33:8000/zoneinfo_process.php
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 115.159.96.34 (be patient)
Completed 1000 requests
apr_socket_recv: Connection reset by peer (104)
Total of 1309 requests completed
[root@iZ11gwfi6i5Z bin]# ./ab -n 10000 -c 1000 -p /tmp/post.dat -T 'application/json' http://115.159.96.34:8000/zoneinfo_process.php
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 115.159.96.34 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests




Server Software:        nginx/1.0.15
Server Hostname:        115.159.96.34
Server Port:            8000


Document Path:          /zoneinfo_process.php
Document Length:        22 bytes


Concurrency Level:      1000
Time taken for tests:   37.058 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      1774425 bytes
Total POSTed:           1945944
HTML transferred:       220550 bytes
Requests per second:    269.85 [#/sec] (mean)
Time per request:       3705.775 [ms] (mean)
Time per request:       3.706 [ms] (mean, across all concurrent requests)
Transfer rate:          46.76 [Kbytes/sec] received
                        51.28 kb/s sent
                        98.04 kb/s total


Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       14 1166 1195.2    899   20385
Processing:   540 1532 4531.3    902   36752
Waiting:      540 1526 4523.2    902   36752
Total:        556 2698 4580.8   1802   37048

Percentage of the requests served within a certain time (ms)
  50%   1802
  66%   1849
  75%   1851
  80%   1899
  90%   2850
  95%   3798
  98%  14243
  99%  36691
 100%  37048 (longest request)


以上数据看出单个请求的处理时间:3.706ms
50%的请求是在1802ms完成的

总共发送了10000个请求,处理都是成功的。

平均每秒网络上的流量46.76 [Kbytes/sec]


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值