YCSB测试工具应用之Mongo压力测试
https://github.com/brianfrankcooper/YCSB/tree/master/mongodb
Centos 6.7
mongodb 3.2.10
安装java
yum install java-devel
安装maven
wget http://ftp.heanet.ie/mirrors/www.apache.org/dist/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz
tar xzf apache-maven-*-bin.tar.gz -C /usr/local
cd /usr/local
sudo ln -s apache-maven-* maven
sudo vi /etc/profile.d/maven.sh
安装ycsb
curl -O --location https://github.com/brianfrankcooper/YCSB/releases/download/0.5.0/ycsb-0.5.0.tar.gz
tar xfvz ycsb-0.5.0.tar.gz
cd ycsb-0.5.0
mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database]
YCSB的运行分为两个阶段:测试数据加载阶段和测试操作执行阶段
加载测试数据集,分同步模式和异步模式
./bin/ycsb load mongodb -s -P workloads/workloada -p mongodb.url=mongodb://movie:movie123@192.168.2.56:40001/movie?w=0
./bin/ycsb load mongodb-async -s -P workloads/workloada -p mongodb.url=mongodb://movie:movie123@192.168.2.56:40001/movie?w=0
执行阶段,分同步模式和异步模式
启动100个线程并发执行测试操作
./bin/ycsb run mongodb -s -P workloads/workloada -p mongodb.url=mongodb://movie:movie123@192.168.2.56:40001/movie?w=0
./bin/ycsb run mongodb-async -threads 100 -s -P workloads/workloada -p mongodb.url=mongodb://movie:movie123@192.168.2.56:40001/movie?w=0
load data之后 可以开始模拟压测了.YCSB 主要分为以下几种模式:
Workload A: Update heavy workload
This workload has a mix of 50/50 reads and writes. An application example is a session store recording recent actions.
Workload B: Read mostly workload
This workload has a 95/5 reads/write mix. Application example: photo tagging; add a tag is an update, but most operations are to read tags.
Workload C: Read only
This workload is 100% read. Application example: user profile cache, where profiles are constructed elsewhere (e.g., Hadoop).
Workload D: Read latest workload
In this workload, new records are inserted, and the most recently inserted records are the most popular. Application example: user status updates; people want to read the latest.
Workload E: Short ranges
In this workload, short ranges of records are queried, instead of individual records. Application example: threaded conversations, where each scan is for the posts in a given thread (assumed to be clustered by thread id).
Workload F: Read-modify-write
In this workload, the client will read a record, modify it, and write back the changes. Application example: user database, where user records are read and modified by the user or to record user activity.
模式可以根据实现需要调整,以更合适企业场景
./bin/ycsb run mongodb -threads 100 -s -P workloads/workloadd -p mongodb.url=mongodb://movie:movie123@192.168.2.56:40001/movie?w=0
[OVERALL], RunTime(ms), 704740.0 #执行时间
[OVERALL], Throughput(ops/sec), 1418.9630218236514 #每秒操作数,吞吐量
[CLEANUP], Operations, 100.0
[CLEANUP], AverageLatency(us), 279.56
[CLEANUP], MinLatency(us), 0.0
[CLEANUP], MaxLatency(us), 27823.0
[CLEANUP], 95thPercentileLatency(us), 2.0
[CLEANUP], 99thPercentileLatency(us), 18.0
[INSERT], Operations, 50147.0 #insert操作数
[INSERT], AverageLatency(us), 69745.87736055996 #insert平均操作时间
[INSERT], MinLatency(us), 461.0 #insert 最小操作时间
[INSERT], MaxLatency(us), 3080191.0 #insert 最大操作时间
[INSERT], 95thPercentileLatency(us), 138623.0 #insert 95%操作时间
[INSERT], 99thPercentileLatency(us), 150911.0 #insert 99%操作时间
[INSERT], Return=OK, 50147 #insert 操作成功数
[READ], Operations, 949853.0
[READ], AverageLatency(us), 70395.02938033569
[READ], MinLatency(us), 262.0
[READ], MaxLatency(us), 3135487.0
[READ], 95thPercentileLatency(us), 138751.0
[READ], 99thPercentileLatency(us), 151039.0
[READ], Return=OK, 675134
[READ], Return=NOT_FOUND, 274719
https://github.com/brianfrankcooper/YCSB/tree/master/mongodb
Centos 6.7
mongodb 3.2.10
安装java
yum install java-devel
安装maven
wget http://ftp.heanet.ie/mirrors/www.apache.org/dist/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz
tar xzf apache-maven-*-bin.tar.gz -C /usr/local
cd /usr/local
sudo ln -s apache-maven-* maven
sudo vi /etc/profile.d/maven.sh
安装ycsb
curl -O --location https://github.com/brianfrankcooper/YCSB/releases/download/0.5.0/ycsb-0.5.0.tar.gz
tar xfvz ycsb-0.5.0.tar.gz
cd ycsb-0.5.0
mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database]
YCSB的运行分为两个阶段:测试数据加载阶段和测试操作执行阶段
加载测试数据集,分同步模式和异步模式
./bin/ycsb load mongodb -s -P workloads/workloada -p mongodb.url=mongodb://movie:movie123@192.168.2.56:40001/movie?w=0
./bin/ycsb load mongodb-async -s -P workloads/workloada -p mongodb.url=mongodb://movie:movie123@192.168.2.56:40001/movie?w=0
执行阶段,分同步模式和异步模式
启动100个线程并发执行测试操作
./bin/ycsb run mongodb -s -P workloads/workloada -p mongodb.url=mongodb://movie:movie123@192.168.2.56:40001/movie?w=0
./bin/ycsb run mongodb-async -threads 100 -s -P workloads/workloada -p mongodb.url=mongodb://movie:movie123@192.168.2.56:40001/movie?w=0
load data之后 可以开始模拟压测了.YCSB 主要分为以下几种模式:
Workload A: Update heavy workload
This workload has a mix of 50/50 reads and writes. An application example is a session store recording recent actions.
Workload B: Read mostly workload
This workload has a 95/5 reads/write mix. Application example: photo tagging; add a tag is an update, but most operations are to read tags.
Workload C: Read only
This workload is 100% read. Application example: user profile cache, where profiles are constructed elsewhere (e.g., Hadoop).
Workload D: Read latest workload
In this workload, new records are inserted, and the most recently inserted records are the most popular. Application example: user status updates; people want to read the latest.
Workload E: Short ranges
In this workload, short ranges of records are queried, instead of individual records. Application example: threaded conversations, where each scan is for the posts in a given thread (assumed to be clustered by thread id).
Workload F: Read-modify-write
In this workload, the client will read a record, modify it, and write back the changes. Application example: user database, where user records are read and modified by the user or to record user activity.
模式可以根据实现需要调整,以更合适企业场景
./bin/ycsb run mongodb -threads 100 -s -P workloads/workloadd -p mongodb.url=mongodb://movie:movie123@192.168.2.56:40001/movie?w=0
[OVERALL], RunTime(ms), 704740.0 #执行时间
[OVERALL], Throughput(ops/sec), 1418.9630218236514 #每秒操作数,吞吐量
[CLEANUP], Operations, 100.0
[CLEANUP], AverageLatency(us), 279.56
[CLEANUP], MinLatency(us), 0.0
[CLEANUP], MaxLatency(us), 27823.0
[CLEANUP], 95thPercentileLatency(us), 2.0
[CLEANUP], 99thPercentileLatency(us), 18.0
[INSERT], Operations, 50147.0 #insert操作数
[INSERT], AverageLatency(us), 69745.87736055996 #insert平均操作时间
[INSERT], MinLatency(us), 461.0 #insert 最小操作时间
[INSERT], MaxLatency(us), 3080191.0 #insert 最大操作时间
[INSERT], 95thPercentileLatency(us), 138623.0 #insert 95%操作时间
[INSERT], 99thPercentileLatency(us), 150911.0 #insert 99%操作时间
[INSERT], Return=OK, 50147 #insert 操作成功数
[READ], Operations, 949853.0
[READ], AverageLatency(us), 70395.02938033569
[READ], MinLatency(us), 262.0
[READ], MaxLatency(us), 3135487.0
[READ], 95thPercentileLatency(us), 138751.0
[READ], 99thPercentileLatency(us), 151039.0
[READ], Return=OK, 675134
[READ], Return=NOT_FOUND, 274719
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/91975/viewspace-2126059/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/91975/viewspace-2126059/