服务器压力测试ab与webbench

时间:2022-11-21 04:52:21

今天下午整了一下服务器压力测试,没看出个什么结果来,感觉我知道的还是太少了。用了两款测试工具,一个是apache自带的ab压力测试,另一个是webbench。网上大多数都泛泛的带过,没有细细的讲解。先把测试结果贴上来,若有高手看到,可以帮忙讲解下,不胜感激!

ab压力测试

[root@localhost conf]# ab -n 30000 -c 200 http://XXXXXX/index.php

This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking www.nazca.com.cn (be patient)
Completed 3000 requests
Completed 6000 requests
Completed 9000 requests
Completed 12000 requests
Completed 15000 requests
Completed 18000 requests
Completed 21000 requests
Completed 24000 requests
Completed 27000 requests
Finished 30000 requests


Server Software:        Apache/2.2.3
Server Hostname:        www.nazca.com.cn
Server Port:            80

Document Path:          /news/index.php
Document Length:        13198 bytes

Concurrency Level:      200
Time taken for tests:   96.788697 seconds
Complete requests:      30000
Failed requests:        2954
   (Connect: 0, Length: 2954, Exceptions: 0)
Write errors:           0
Total transferred:      408116715 bytes
HTML transferred:       395936715 bytes
Requests per second:    309.95 [#/sec] (mean)
Time per request:       645.258 [ms] (mean)
Time per request:       3.226 [ms] (mean, across all concurrent requests)
Transfer rate:          4117.74 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0  168 776.4      0   20999
Processing:    17  466 404.2    428   11396
Waiting:       15  465 404.2    427   11394
Total:         36  635 877.3    429   21444

Percentage of the requests served within a certain time (ms)
  50%    429
  66%    436
  75%    442
  80%    447
  90%    464
  95%   3415
  98%   3442
  99%   3466
 100%  21444 (longest request)

 

webbench压力测定

[root@localhost ~]# webbench -c 500 -t 20 http://xxxxx/index.php
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://xxxxx/index.php
500 clients, running 20 sec.

Speed=1470 pages/min, 170728 bytes/sec.
Requests: 251 susceed, 239 failed.

 

webbench 做测试的时候会经常出现

 

[root@localhost ~]# webbench -c 500 -t 20 http://xxxxx/index.php

Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://xxxxx/index.php
500 clients, running 20 sec.

Connect to server failed. Aborting benchmark.

 

我感觉apache的配置有问题!现贴上来,改日继续研究!