apache 压力测试 -- ab工具使用

apache 压力测试 -- ab工具使用

对apache进行性能测试,结果如下:
=================================

[root@Base etc]# cd /usr/local/apache2/bin/ab -n 10000 -c 500 http://www.abcd.com/
-bash: cd: /usr/local/apache2/bin/ab: Not a directory
[root@Base etc]# /usr/local/apache2/bin/ab -n 10000 -c 500 http://www.abcd.com/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.10 $>; apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking www.abcd.com (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
Finished 10000 requests


Server Software:        Apache/2.0.50
Server Hostname:        www.abcd.com
Server Port:            80

Document Path:          /
Document Length:        117004 bytes

Concurrency Level:      500
Time taken for tests:   6.556017 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      1180411690 bytes
HTML transferred:       1177530910 bytes
Requests per second:    1525.32 [#/sec] (mean)
Time per request:       327.801 [ms] (mean)
Time per request:       0.656 [ms] (mean, across all concurrent requests)
Transfer rate:          175830.08 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   42 336.7      3    3004
Processing:    22  116 192.4    100    3469
Waiting:        8   83 189.8     72    3403
Total:         38  158 486.6    104    6470

Percentage of the requests served within a certain time (ms)
  50%    104
  66%    107
  75%    110
  80%    112
  90%    117
  95%    135
  98%    168
  99%   3108
100%   6470 (longest request)
[root@Base etc]#


======================================================================
[root@Base etc]# /usr/local/apache2/bin/ab -n 10000 -c 500 http://www.abcd.com/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.10 $>; apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking www.abcd.com (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
Finished 10000 requests


Server Software:        Apache/2.0.50
Server Hostname:        www.abcd.com
Server Port:            80

Document Path:          /
Document Length:        117004 bytes

Concurrency Level:      500
Time taken for tests:   6.556017 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      1180411690 bytes
HTML transferred:       1177530910 bytes
Requests per second:    1525.32 [#/sec] (mean)
Time per request:       327.801 [ms] (mean)
Time per request:       0.656 [ms] (mean, across all concurrent requests)
Transfer rate:          175830.08 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   42 336.7      3    3004
Processing:    22  116 192.4    100    3469
Waiting:        8   83 189.8     72    3403
Total:         38  158 486.6    104    6470

Percentage of the requests served within a certain time (ms)
  50%    104
  66%    107
  75%    110
  80%    112
  90%    117
  95%    135
  98%    168
  99%   3108
100%   6470 (longest request)
[root@Base etc]# /usr/local/apache2/bin/ab -n 100000 -c 500 http://www.abcd.com/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.10 $>; apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking www.abcd.com (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Finished 100000 requests


Server Software:        Apache/2.0.50
Server Hostname:        www.abcd.com
Server Port:            80

Document Path:          /
Document Length:        117004 bytes

Concurrency Level:      500
Time taken for tests:   57.165445 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Total transferred:      -1130288720 bytes
HTML transferred:       -1158910985 bytes
Requests per second:    1749.31 [#/sec] (mean)
Time per request:       285.827 [ms] (mean)
Time per request:       0.572 [ms] (mean, across all concurrent requests)
Transfer rate:          -19308.82 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   42 441.7     13    9009
Processing:    23  239 462.0    140   27652
Waiting:        4   67 299.5     15   15903
Total:         41  282 694.5    153   27665

Percentage of the requests served within a certain time (ms)
  50%    153
  66%    159
  75%    166
  80%    177
  90%    429
  95%    808
  98%   1488
  99%   2449
100%  27665 (longest request)
=============================================
[root@Base conf]# /usr/local/apache2/bin/ab -n 100000 -c 500 http://www.abcd.com/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.10 $>; apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking www.abcd.com (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Finished 100000 requests


Server Software:        Apache/2.0.50
Server Hostname:        www.abcd.com
Server Port:            80

Document Path:          /
Document Length:        117004 bytes

Concurrency Level:      500
Time taken for tests:   56.941957 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Total transferred:      -1127696396 bytes
HTML transferred:       -1156320086 bytes
Requests per second:    1756.17 [#/sec] (mean)
Time per request:       284.710 [ms] (mean)
Time per request:       0.569 [ms] (mean, across all concurrent requests)
Transfer rate:          -19340.15 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   39 332.2     18    9005
Processing:    21  243 445.6    186   14930
Waiting:        5   64 414.8     20   14103
Total:         37  282 638.8    205   17933

Percentage of the requests served within a certain time (ms)
  50%    205
  66%    212
  75%    217
  80%    222
  90%    377
  95%    591
  98%   1025
  99%   1461
100%  17933 (longest request)
[root@Base conf]#
==========================================

感觉服务器有点慢,但不知道怎么调整好,文件大量由静态htm或图片组成。请问那位比较熟悉ab的用法,看看上面的结果怎么样,怎么调整合适,谢谢!
如果只有静态页面和图片的话,可以用Zeus或者TUX,效率比apche高很多
Squid
Transfer rate:          175830.08 [Kbytes/sec] received

是否已经把网络的出口带宽或磁盘性能吃满了
一般来说,纯静态的站点更依赖IO
动态站点才依赖CPU和内存
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.sourcingmap.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Finished 500 requests


Server Software:        Apache/2.2.6
Server Hostname:        www.sourcingmap.com
Server Port:            80

Document Path:          /
Document Length:        86039 bytes

Concurrency Level:      50
Time taken for tests:   82.41671 seconds
Complete requests:      500
Failed requests:        495
   (Connect: 0, Length: 495, Exceptions: 0)
Write errors:           0
Total transferred:      43061057 bytes
HTML transferred:       42839259 bytes
Requests per second:    6.09 [#/sec] (mean)
Time per request:       8204.167 [ms] (mean)
Time per request:       164.083 [ms] (mean, across all concurrent requests)
Transfer rate:          512.56 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   1.3      0      10
Processing:  1532 7889 3120.4   7365   21230
Waiting:     1520 7816 3109.5   7302   21218
Total:       1533 7889 3120.3   7365   21231

Percentage of the requests served within a certain time (ms)
  50%   7365
  66%   8418
  75%   9298
  80%   9947
  90%  12202
  95%  14016
  98%  15710
  99%  19179
100%  21231 (longest request)


丢包率非常高,为什么,请高手指点