目标服务使用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]