基础环境
CentOS 7.5
MongoDB 4.2分片集群
YCSB 0.17
部署YCSB
安装包和部署步骤见以下链接:
https://github.com/brianfrankcooper/YCSB/tree/master/mongodb?spm=a2c4g.11186623.2.2.49ff38dc0tfGjX
https://blog.csdn.net/vkingnew/article/details/82027461
https://www.ucloud.cn/yun/77438.html
数据准备
./bin/ycsb load mongodb -s -P workloads/workloada -p mongodb.url=mongodb://ycsb:123456@172.16.254.137:30000/ycsb
测试场景一
参数文件
recordcount=1000
operationcount=100000
workload=site.ycsb.workloads.CoreWorkload
readallfields=true
readproportion=0.5
updateproportion=0.5
scanproportion=0
insertproportion=0
requestdistribution=zipfian
测试脚本
./bin/ycsb run mongodb -s -P workloads/workloada -p mongodb.url=mongodb://ycsb:123456@172.16.254.137:30000/ycsb
测试报告
[OVERALL], RunTime(ms), 236582
[OVERALL], Throughput(ops/sec), 422.68642584812034
[TOTAL_GCS_PS_Scavenge], Count, 129
[TOTAL_GC_TIME_PS_Scavenge], Time(ms), 294
[TOTAL_GC_TIME_%_PS_Scavenge], Time(%), 0.12426980919934738
[TOTAL_GCS_PS_MarkSweep], Count, 0
[TOTAL_GC_TIME_PS_MarkSweep], Time(ms), 0
[TOTAL_GC_TIME_%_PS_MarkSweep], Time(%), 0.0
[TOTAL_GCs], Count, 129
[TOTAL_GC_TIME], Time(ms), 294
[TOTAL_GC_TIME_%], Time(%), 0.12426980919934738
[READ], Operations, 50062
[READ], AverageLatency(us), 2277.1574847189486
[READ], MinLatency(us), 902
[READ], MaxLatency(us), 505087
[READ], 95thPercentileLatency(us), 3923
[READ], 99thPercentileLatency(us), 5323
[READ], Return=OK, 50062
[CLEANUP], Operations, 1
[CLEANUP], AverageLatency(us), 4602.0
[CLEANUP], MinLatency(us), 4600
[CLEANUP], MaxLatency(us), 4603
[CLEANUP], 95thPercentileLatency(us), 4603
[CLEANUP], 99thPercentileLatency(us), 4603
[UPDATE], Operations, 49938
[UPDATE], AverageLatency(us), 2416.4448716408347
[UPDATE], MinLatency(us), 1022
[UPDATE], MaxLatency(us), 505599
[UPDATE], 95thPercentileLatency(us), 3993
[UPDATE], 99thPercentileLatency(us), 5443
[UPDATE], Return=OK, 49938
测试场景二
参数文件
recordcount=1000
operationcount=100000
workload=site.ycsb.workloads.CoreWorkload
readallfields=true
readproportion=0
updateproportion=0
scanproportion=1
insertproportion=0
requestdistribution=zipfian
maxscanlength=100
scanlengthdistribution=uniform
测试脚本
./bin/ycsb run mongodb -s -P workloads/workloade -p mongodb.url=mongodb://ycsb:123456@172.16.254.137:30000/ycsb
测试报告
[OVERALL], RunTime(ms), 568640
[OVERALL], Throughput(ops/sec), 175.85818795723128
[TOTAL_GCS_PS_Scavenge], Count, 2013
[TOTAL_GC_TIME_PS_Scavenge], Time(ms), 4263
[TOTAL_GC_TIME_%_PS_Scavenge], Time(%), 0.749683455261677
[TOTAL_GCS_PS_MarkSweep], Count, 0
[TOTAL_GC_TIME_PS_MarkSweep], Time(ms), 0
[TOTAL_GC_TIME_%_PS_MarkSweep], Time(%), 0.0
[TOTAL_GCs], Count, 2013
[TOTAL_GC_TIME], Time(ms), 4263
[TOTAL_GC_TIME_%], Time(%), 0.749683455261677
[CLEANUP], Operations, 1
[CLEANUP], AverageLatency(us), 3405.0
[CLEANUP], MinLatency(us), 3404
[CLEANUP], MaxLatency(us), 3405
[CLEANUP], 95thPercentileLatency(us), 3405
[CLEANUP], 99thPercentileLatency(us), 3405
[SCAN], Operations, 100000
[SCAN], AverageLatency(us), 5666.21491
[SCAN], MinLatency(us), 1365
[SCAN], MaxLatency(us), 513535
[SCAN], 95thPercentileLatency(us), 9095
[SCAN], 99thPercentileLatency(us), 11591
[SCAN], Return=OK, 100000
我们进行了两个场景的测试,一个是正常查询(场景一),一个是走全表扫描(场景二),可以看到第一次测试总耗时和平均耗时都要低,OPS比第二次高出很多。