分类: LINUX
2009-08-11 11:44:15
1.Apache性能测试(ab)
并发600 访问1200次页面
参数说明: -n 表示请求总数, -c 表示并发数. -t 表示请求时间限制
[root@21server srv]# /usr/local/apache2/bin/ab -c 600 -n 1200
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
Licensed to The Apache Software Foundation,
Benchmarking (be patient)
Completed 120 requests
Completed 240 requests
Completed 360 requests
Completed 480 requests
Completed 600 requests
Completed 720 requests
Completed 840 requests
Completed 960 requests
Completed 1080 requests
Completed 1200 requests
Finished 1200 requests
Server Software:
Server Hostname:
Document Path: /index.php(测试的页面文档)
Document Length: 1434 bytes
Concurrency Level: 600(并发数)
Time taken for tests: 3.312 seconds(整个测试持续的时间)
Complete requests: 1200(完成的请求数量)
Failed requests: 113(失败的请求数量)
(Connect: 0, Receive: 0, Length: 113, Exceptions: 0)
Write errors: 0
Non-2xx responses: 113
Total transferred: 1852641 bytes(整个场景中的网络传输量)
HTML transferred: 1694417 bytes
Requests per second: 362.27 [#/sec] (mean)(相当于 LR 中的 每秒事务数 ,后面括号中的 mean 表示这是一个平均值)
Time per request: 1656.208 [ms] (mean)(相当于 LR 中的 平均事务响应时间 ,后面括号中的 mean 表示这是一个平均值
Time per request: 2.760 [ms] (mean, across all concurrent requests)(每个请求实际运行时间的平均值)
Transfer rate: 546.19 [Kbytes/sec] received(平均每秒网络上的流量,可以帮助排除是否存在网络流量过大导致响应时间延长的问题)
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 320 910.1 2 3007
Processing: 8 135 63.4 107 328
Waiting: 8 135 63.4 107 328
Total: 42 455 885.8 184 3092
(网络上消耗的时间的分解)
Percentage of the requests served within a certain time (ms)
50% 184
66% 209
75% 221
80% 252
90% 3001
95% 3075
98% 3084
99% 3084
100% 3092 (longest request)
整个场景中所有请求的响应情况。在场景中每个请求都有一个响应时间,其中50%的用户响应时间小于184 毫秒,60% 的用户响应时间小于209 毫秒,最大的响应时间小于3092 毫秒
2.webbench压力测试apache
wget http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz
tar zxvf webbench-1.5.tar.gz
cd webbench-1.5
make && make install
[root@21server webbench-1.5]# ./webbench -c 500 -t 30
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET
500 clients, running 30 sec.
Speed=70678 pages/min, 1821036 bytes/sec.(一分钟访问70678 个页面, 一秒传送1821036 字节)
Requests: 35110 susceed, 229 failed.(35110个请求成功,229个请求失败)
参数说明:-c表示并发数,-t表示时间(秒)