压力测试工具Benchmark

[b](1)WEB服务[/b]

[url=http://httpd.apache.org/docs/2.2/programs/ab.html]ab(Apache Bench)[/url]
使用:
[quote]$ ab -n 100000 -c 100 -t 1 -k http://127.0.0.1:8080/[/quote]
结果:
[quote]Concurrency Level: 100
Time taken for tests: 1.000 seconds
Complete requests: 11996
Failed requests: 0
Write errors: 0
Keep-Alive requests: 11923
Total transferred: 10184239 bytes
HTML transferred: 7341552 bytes
Requests per second: 11996.00 [#/sec] (mean)
Time per request: 8.336 [ms] (mean)
Time per request: 0.083 [ms] (mean, across all concurrent requests)
Transfer rate: 9945.55 [Kbytes/sec] received[/quote]

[url=https://github.com/lighttpd/weighttp]Weighttp[/url]
使用:
[quote]$ weighttp -n 10000 -c 1000 -t 4 -k http://127.0.0.1:8080/[/quote]
结果:
[quote]finished in 1 sec, 707 millisec and 611 microsec, 5856 req/s, 1847 kbyte/s
requests: 10000 total, 10000 started, 10000 done, 10000 succeeded, 0 failed, 0 errored
status codes: 10000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 3230000 bytes total, 1720000 bytes http, 1510000 bytes data[/quote]

[url=https://github.com/wg/wrk]wrk[/url]

使用:
[quote]$ wrk -t12 -c400 -d30s http://127.0.0.1:8080/index.html[/quote]
结果:
[quote]Running 30s test @ http://127.0.0.1:8080/index.html
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 635.91us 0.89ms 12.92ms 93.69%
Req/Sec 56.20k 8.07k 62.00k 86.54%
22464657 requests in 30.00s, 17.76GB read
Requests/sec: 748868.53
Transfer/sec: 606.33MB[/quote]

[url=http://code.google.com/p/httperf/]httperf[/url]

使用:
[quote]$ httperf --server=127.0.0.1 --port=8080 --rate=100 --num-conns=100 --num-calls=100000 --timeout=5 --hog --uri=/[/quote]
结果:
[quote]Maximum connect burst length: 1

Total: connections 10 requests 10 replies 10 test-duration 9.286 s

Connection rate: 1.1 conn/s (928.6 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 284.2 avg 303.2 max 376.2 median 284.5 stddev 38.4
Connection time [ms]: connect 91.8
Connection length [replies/conn]: 1.000

Request rate: 1.1 req/s (928.6 ms/req)
Request size [B]: 68.0

Reply rate [replies/s]: min 1.0 avg 1.0 max 1.0 stddev 0.0 (1 samples)
Reply time [ms]: response 99.1 transfer 112.3
Reply size [B]: header 241.0 content 29147.0 footer 0.0 (total 29388.0)
Reply status: 1xx=0 2xx=10 3xx=0 4xx=0 5xx=0

CPU time [s]: user 1.99 system 7.27 (user 21.5% system 78.3% total 99.7%)
Net I/O: 31.0 KB/s (0.3*10^6 bps)

Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0[/quote]

[b](2)数据库[/b]

[url=https://launchpad.net/sysbench]SysBench[/url]
使用:
[quote]$ sysbench --test=oltp --db-driver=mysql --mysql-password=sbtest prepare
$ sysbench --test=oltp --db-driver=mysql --mysql-password=sbtest run[/quote]
结果:
[quote]sysbench 0.4.12: multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 1

Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Maximum number of requests for OLTP test is limited to 10000
Threads started!
Done.

OLTP test statistics:
queries performed:
read: 140000
write: 50000
other: 20000
total: 210000
transactions: 10000 (25.72 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 190000 (488.63 per sec.)
other operations: 20000 (51.43 per sec.)

Test execution summary:
total time: 388.8436s
total number of events: 10000
total time taken by event execution: 388.7773
per-request statistics:
min: 28.61ms
avg: 38.88ms
max: 178.72ms
approx. 95 percentile: 44.83ms

Threads fairness:
events (avg/stddev): 10000.0000/0.00
execution time (avg/stddev): 388.7773/0.00[/quote]

[url=http://www.postgresql.org/docs/9.3/static/pgbench.html]pgbench[/url]
使用:
[quote]$ pgbench -i testdb
$ pgbench -c 10 -t 1000 testdb[/quote]
结果:
[quote]starting vacuum...end.
transaction type: TPC-B (sort of)
scaling factor: 1
query mode: simple
number of clients: 10
number of transactions per client: 1000
number of transactions actually processed: 10000/10000
tps = 657.505424 (including connections establishing)
tps = 659.935326 (excluding connections establishing)[/quote]

[url=https://dev.mysql.com/doc/refman/5.1/en/mysqlslap.html]mysqlslap[/url]

使用:
[quote]mysqlslap -a -c 500 -i 10 -uroot -p123456[/quote]

结果:
[quote]Benchmark
Running for engine innodb
Average number of seconds to run all queries: 9.451 seconds
Minimum number of seconds to run all queries: 9.288 seconds
Maximum number of seconds to run all queries: 9.704 seconds
Number of clients running queries: 50
Average number of queries per client: 2000[/quote]

参考:
http://gwan.com/en_apachebench_httperf.html
http://d.hatena.ne.jp/sh2/20120723
http://www.aikaiyuan.com/7569.html
http://en.wikipedia.org/wiki/Transaction_Processing_Performance_Council
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值