设为首页 加入收藏

TOP

数据库优化-基准测试(四)(一)
2015-11-21 01:36:33 来源: 作者: 【 】 浏览:4
Tags:数据库 优化 基准 测试

基准测试工具:sysbench

简述

sysbench多线程基准测试工具,可以测试:

文件I/O性能 Scheduler性能 内存分配和转换速度 POSIX线程实现性能 数据库服务器性能(OLTP)

工具初始开发用于MySQL的性能测试,现在已经扩展到其它数据库
获取工具的网址:
https://code.launchpad.net/~sysbench-developers/sysbench/0.5
http://sysbench.sourceforge.net/
http://dev.mysql.com/downloads/benchmarks.html
源码下载
bzr branch lp:sysbench
http://sourceforge.net/projects/sysbench/ (0.4.12)
http://downloads.mysql.com/source/sysbench-0.4.12.5.tar.gz

Sysbench的安装

$ bzr branch lp:sysbench
$ cd sysbench
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

Sysbench CPU测试

例子1:处理素数的一个简单测试

$ sysbench --test=cpu --cpu-max-prime=20000 run
Running the test with following options:
Number of threads: 1
Primer numbers limit: 20000
General statistics:
total time: 54.5050s
total number of events: 10000
total time taken by event execution: 54.4840s
response time:
min: 5.20ms
avg: 5.45ms
max: 45.02ms
approx. 95 percentile: 5.69ms
Threads fairness:
events (avg/stddev): 10000.0000/0.00
execution time (avg/stddev): 54.4840/0.00

例子2:处理素数的多线程测试,线程数为4

$ sysbench --num-threads=4 --test=cpu --cpu-max-prime=20000 run
Running the test with following options:
Number of threads: 4
Primer numbers limit: 20000
General statistics:
total time: 16.5565s
total number of events: 10000
total time taken by event execution: 66.1771s
response time:
min: 5.89ms
avg: 6.62ms
max: 101.86ms
approx. 95 percentile: 8.43ms
Threads fairness:
events (avg/stddev): 2500.0000/136.15
execution time (avg/stddev): 16.5443/0.00

例子3:处理素数的多线程测试,线程数为8

$ sysbench --num-threads=8 --test=cpu --cpu-max-prime=20000 run
Running the test with following options:
Number of threads: 8
Primer numbers limit: 20000
General statistics:
total time: 16.1659s
total number of events: 10000
total time taken by event execution: 129.1411s
response time:
min: 5.89ms
avg: 12.91ms
max: 49.95ms
approx. 95 percentile: 25.30ms
Threads fairness:
events (avg/stddev): 1250.0000/54.65
execution time (avg/stddev): 16.1426/0.01

Sysbench 线程测试(scheduler)

例子:Lock mutex => Yield CPU => Run queue => Unlock mutex

$ sysbench --num-threads=64 --test=threads run
Running the test with following options:
Number of threads: 64
General statistics:
total time: 3.4055s
total number of events: 10000
total time taken by event execution: 217.2030s
response time:
min: 0.56ms
avg: 21.72ms
max: 162.65ms
approx. 95 percentile: 59.37ms
Threads fairness:
events (avg/stddev): 156.2500/10.98
execution time (avg/stddev): 3.3938/0.01

Sysbench mutexs测试

例子:线程试图获取相同的mutex集合,测试mutexe实现

$ sysbench --num-threads=128 --test=mutex --mutex-locks=100000 --mutex-loops=100
--mutex-num=2048 run
Running the test with following options:
Number of threads: 128
General statistics:
total time: 10.4538s
total number of events: 128
total time taken by event execution: 1274.8660s
response time:
min: 8069.55ms
avg: 9959.89ms
max: 10453.19ms
approx. 95 percentile: 10436.39ms
Threads fairness:
events (avg/stddev): 1.0000/0.00
execution time (avg/stddev): 9.9599/0.52

Sysbench memory测试

例子1:顺序读或写内存

$ sysbench --num-threads=1 --test=memory run ?memory-block-size=16k
--memory-total-size=4G --memory-oper=read
Running the test with following options:
Number of threads: 1
Operations performed: 262144 (302035.23 ops/sec)
4096.00 MB transferred (4719.30 MB/sec)
General statistics:
total time: 0.8679
首页 上一页 1 2 3 4 下一页 尾页 1/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Redis学习笔记---字符串类型 下一篇MongoDB的master-slave及replset..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: