使用ycsb对mariadb做性能测试

Posted 雅冰石

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用ycsb对mariadb做性能测试相关的知识,希望对你有一定的参考价值。

本文详细演示在16G,4核cpu配置下用ycsb(版本0.17)对mariadb(版本10.3.18)单实例进行性能测试。

测试表数据量:一百万条数据

一 安装ycsb

安装包下载地址:

https://github.com/brianfrankcooper/YCSB/releases/download/0.17.0/ycsb-0.17.0.tar.gz

tar xfvz ycsb-0.17.0.tar.gz

cd ycsb-0.17.0

二 配置mariadb

2.1 建库建表

create database ycsb;

use ycsb;

CREATE TABLE usertable (

YCSB_KEY VARCHAR(255) PRIMARY KEY,

FIELD0 TEXT, FIELD1 TEXT,

FIELD2 TEXT, FIELD3 TEXT,

FIELD4 TEXT, FIELD5 TEXT,

FIELD6 TEXT, FIELD7 TEXT,

FIELD8 TEXT, FIELD9 TEXT

);

三 使用ycsb对mariadb做性能测试

3.1 配置ycsb的连接信息

cd jdbc-binding/conf

mv db.properties db.properties_bak

vi db.properties

db.driver=com.mysql.jdbc.Driver

db.url=jdbc:mysql://172.18.16.116:3306/ycsb

db.user=root

db.passwd=123456

3.2 将JDBC驱动程序添加到CLASSPATH下

jdbc驱动下载地址:

MySQL :: Download MySQL Connector/J (Archived Versions)

cd /opt/

tar -xvf mysql-connector-java-5.1.49.tar.gz

cp mysql-connector-java-5.1.49/mysql-connector-java-5.1.49.jar /opt/ycsb-0.17.0/jdbc-binding/lib/

3.3 验证50/50 的读取和写入

3.3.1 配置workload

cd ycsb-0.17.0/workloads/

mv workloada workloada_bak

vi workloada

recordcount=1000000

operationcount=100000

workload=site.ycsb.workloads.CoreWorkload

readallfields=true

readproportion=0.5

updateproportion=0.5

scanproportion=0

insertproportion=0

requestdistribution=zipfian

threadcount=100

3.3.2 加载数据

../bin/ycsb load jdbc -P workloada -P ../jdbc-binding/conf/db.properties > a_load.txt

cat a_load.txt

[OVERALL], RunTime(ms), 131983

[OVERALL], Throughput(ops/sec), 7576.733367176075

[TOTAL_GCS_PS_Scavenge], Count, 318

[TOTAL_GC_TIME_PS_Scavenge], Time(ms), 423

[TOTAL_GC_TIME_%_PS_Scavenge], Time(%), 0.32049582143154803

[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, 318

[TOTAL_GC_TIME], Time(ms), 423

[TOTAL_GC_TIME_%], Time(%), 0.32049582143154803

[CLEANUP], Operations, 100

[CLEANUP], AverageLatency(us), 117.64

[CLEANUP], MinLatency(us), 43

[CLEANUP], MaxLatency(us), 4627

[CLEANUP], 95thPercentileLatency(us), 104

[CLEANUP], 99thPercentileLatency(us), 506

[INSERT], Operations, 1000000

[INSERT], AverageLatency(us), 13123.248375

[INSERT], MinLatency(us), 1183

[INSERT], MaxLatency(us), 157567

[INSERT], 95thPercentileLatency(us), 22943

[INSERT], 99thPercentileLatency(us), 42719

[INSERT], Return=OK, 1000000

OPS为7576。

3.3.3 开始读写测试

../bin/ycsb run jdbc -P workloada -P ../jdbc-binding/conf/db.properties > a_run.txt

cat a_run.txt

[OVERALL], Throughput(ops/sec), 7672.830507174097

[TOTAL_GCS_PS_Scavenge], Count, 5

[TOTAL_GC_TIME_PS_Scavenge], Time(ms), 29

[TOTAL_GC_TIME_%_PS_Scavenge], Time(%), 0.22251208470804879

[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, 5

[TOTAL_GC_TIME], Time(ms), 29

[TOTAL_GC_TIME_%], Time(%), 0.22251208470804879

[READ], Operations, 50193

[READ], AverageLatency(us), 622.6863307632539

[READ], MinLatency(us), 196

[READ], MaxLatency(us), 37695

[READ], 95thPercentileLatency(us), 1305

[READ], 99thPercentileLatency(us), 3097

[READ], Return=OK, 50193

[CLEANUP], Operations, 100

[CLEANUP], AverageLatency(us), 119.21

[CLEANUP], MinLatency(us), 44

[CLEANUP], MaxLatency(us), 4403

[CLEANUP], 95thPercentileLatency(us), 131

[CLEANUP], 99thPercentileLatency(us), 505

[UPDATE], Operations, 49807

[UPDATE], AverageLatency(us), 22214.912783343705

[UPDATE], MinLatency(us), 1249

[UPDATE], MaxLatency(us), 650239

[UPDATE], 95thPercentileLatency(us), 22063

[UPDATE], 99thPercentileLatency(us), 451839

[UPDATE], Return=OK, 49807

ops为7672。

3.4 验证95/5的读/写混合

3.4.1 配置workload

mv workloadb workloadb_bak

vi workloadb

recordcount=1000000

operationcount=100000

workload=site.ycsb.workloads.CoreWorkload

readallfields=true

readproportion=0.95

updateproportion=0.05

scanproportion=0

insertproportion=0

requestdistribution=zipfian

threadcount=100

3.4.2 开始读写测试

../bin/ycsb run jdbc -P workloadb -P ../jdbc-binding/conf/db.properties > b_run.txt

cat b_run.txt

[OVERALL], RunTime(ms), 3374

[OVERALL], Throughput(ops/sec), 29638.41138114997

[TOTAL_GCS_PS_Scavenge], Count, 5

[TOTAL_GC_TIME_PS_Scavenge], Time(ms), 49

[TOTAL_GC_TIME_%_PS_Scavenge], Time(%), 1.4088556641748131

[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, 5

[TOTAL_GC_TIME], Time(ms), 49

[TOTAL_GC_TIME_%], Time(%), 1.4088556641748131

[READ], Operations, 94901

[READ], AverageLatency(us), 1856.332915353895

[READ], MinLatency(us), 173

[READ], MaxLatency(us), 423935

[READ], 95thPercentileLatency(us), 4883

[READ], 99thPercentileLatency(us), 17327

[READ], Return=OK, 94901

[CLEANUP], Operations, 100

[CLEANUP], AverageLatency(us), 179.95

[CLEANUP], MinLatency(us), 43

[CLEANUP], MaxLatency(us), 5763

[CLEANUP], 95thPercentileLatency(us), 131

[CLEANUP], 99thPercentileLatency(us), 5055

[UPDATE], Operations, 5099

[UPDATE], AverageLatency(us), 16231.637183761522

[UPDATE], MinLatency(us), 1532

[UPDATE], MaxLatency(us), 245887

[UPDATE], 95thPercentileLatency(us), 43839

[UPDATE], 99thPercentileLatency(us), 108031

[UPDATE], Return=OK, 5099

OPS为29638。

本篇文章参考了:

YCSB/jdbc at master · brianfrankcooper/YCSB · GitHub

使用YCSB测试Hbase与Mysql数据库性能_neymar1204的博客-CSDN博客

以上是关于使用ycsb对mariadb做性能测试的主要内容,如果未能解决你的问题,请参考以下文章

使用ycsb对mongo单实例做性能测试

使用ycsb对mongo单实例做性能测试

利用雅虎ycsb对cassandra做性能测试

ycsb对hbase性能测试的研究

YCSB测试Mysql,MongoDB,TokuMX,Couchbase性能

NoSQL性能测试工具(YCSB)