(1)WEB服务
ab(Apache Bench)
使用:
引用
$ ab -n 100000 -c 100 -t 1 -k http://127.0.0.1:8080/
结果:
引用
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
Weighttp
使用:
引用
$ weighttp -n 10000 -c 1000 -t 4 -k http://127.0.0.1:8080/
结果:
引用
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
wrk
使用:
引用
$ wrk -t12 -c400 -d30s http://127.0.0.1:8080/index.html
结果:
引用
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
httperf
使用:
引用
$ httperf --server=127.0.0.1 --port=8080 --rate=100 --num-conns=100 --num-calls=100000 --timeout=5 --hog --uri=/
结果:
引用
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
: 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
[b](2)数据库
SysBench
使用:
引用
$ sysbench --test=oltp --db-driver=mysql --mysql-password=sbtest prepare
$ sysbench --test=oltp --db-driver=mysql --mysql-password=sbtest run
结果:
引用
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
pgbench
使用:
引用
$ pgbench -i testdb
$ pgbench -c 10 -t 1000 testdb
结果:
引用
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)
mysqlslap
使用:
引用
mysqlslap -a -c 500 -i 10 -uroot -p123456
结果:
引用
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
参考:
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