设为首页 加入收藏

TOP

数据库优化-基准测试(四)(四)
2015-11-21 01:36:33 来源: 作者: 【 】 浏览:9
Tags:数据库 优化 基准 测试
55Gb Total transferred 33.077Gb (338.71Mb/sec) 21677.60 Requests/sec executed Test execution summary: total time: 100.0003s total number of events: 2167767 total time taken by event execution: 796.3734 per-request statistics: min: 0.01ms avg: 0.37ms max: 15.18ms approx. 95 percentile: 1.77ms

执行测试4(文件数29,随机读写,读写比率为4,文件块大小16K,线程数16, ?file-fsync-all 每执行完一次写操作,就执行一次fsync,默认是off):

sysbench --num-threads=16 --test=fileio --file-num=29 ?file-total-size=290G --file-fsync-all=on --file-test-mode=rndrw --max-time=100 ?file-rw-ratio=4 --file-block-size=16384 --max-requests=0 run
Number of threads: 16
Extra file open flags: 0
29 files, 10Gb each
290Gb total file size
Block size 16Kb
Number of random requests for random IO: 0
Read/Write ratio for combined random IO test: 4.00
Calling fsync() after each write operation.
Using synchronous I/O mode
Doing random r/w test
Operations performed: 2028938 Read, 507238 Write, 507238 Other = 3043414 Total
Read 30.959Gb Written 7.7398Gb Total transferred 38.699Gb (396.26Mb/sec)
25360.46 Requests/sec executed
Test execution summary:
total time: 100.0051s
total number of events: 2536176
total time taken by event execution: 1594.7509
per-request statistics:
min: 0.01ms
avg: 0.63ms
max: 17.41ms
approx. 95 percentile: 1.84ms
结论
更多的线程 = 更多的吞吐量
1个线程:117.14MB/sec
8个线程:338.71 MB/s ( 2.89x )
16个线程:396.26 MB/s ( 3.41x ) 更多的线程 = 更长的响应时间
1个线程:平均0.13ms , 95% 0.16ms
8个线程:平均0.37ms , 95% 1.77ms
16个线程:平均0.63ms , 95% 1.84ms

Sysbench ? OLTP

OLTP工作负载:

 --oltp-tables-count:模拟多个表(Percona扩展)
 --oltp-test-modes: [complex] 
    simple : 非常简单的查询模式,PK查找
    complex : 事务模式
    nontrx : 非事务查询模式
 --oltp-read-only:on为只读测试,off为读写混合模式[off]
 --oltp-skip-trx:忽略BEGIN/COMMIT语句[off]

延迟:

--oltp-reconnect-mode : [session] 
    session : 从不断开
    query : 每次查询后断开
    transaction : 每次事务后断开
    random : 随即地
--oltp-connect-delay:在连接数据库后延迟的时间(毫秒)[10000] 
--oltp-user-delay-min:每次请求后延迟的最小时间(毫秒)[0]
--oltp-user-delay-max:每次请求后延迟的最大时间(毫秒)[0]

例子1:表数量4,线程数1

#--test:指定Lua脚本
#--oltp-table-size:指定表的大小,即表的行数
$ sysbench --test=tests/db/oltp.lua --oltp-tables-count=4 --oltp-table-size=500000 --oltp-test-mode=simple run
Number of threads: 1
OLTP test statistics:
queries performed:
read: 140000
write: 40000
other: 20000
total: 200000
transactions: 10000 (217.87 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 180000 (3921.61 per sec.)
other operations: 20000 (435.73 per sec.)
General statistics:
total time: 45.8995s
total number of events: 10000
total time taken by event execution: 45.7667s
response time:
min: 2.62ms
avg: 4.58ms
max: 1273.69ms
approx. 95 percentile: 4.86ms
Threads fairness:
events (avg/stddev): 10000.0000/0.00
execution time (avg/stddev): 45.7667/0.00

例子2:表数量16,线程数16

$ sysbench --test=tests/db/oltp.lua ?oltp-tables-count=16
--oltp-table-size=500000 --oltp-test-mode=simple ?num-threads=16 run
Number of threads: 16
OLTP test statistics:
queries performed:
read: 140000
write: 40000
other: 20000
total: 200000
transactions: 10000 (777.78 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 180000 (13999.96 per sec.)
other operations: 20000 (1555.55 per sec.)
General statistics:
total time: 12.8572s
total number of events: 10000
total time taken by event execution: 204.7219s
response time:
min: 3.07ms
avg: 20.47ms
max: 178.74ms
approx. 95 percentile: 44.42ms
Threads fairnes
首页 上一页 1 2 3 4 下一页 尾页 4/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Redis学习笔记---字符串类型 下一篇MongoDB的master-slave及replset..

评论

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