maven 安装
在编译过程中出现一下错误:
[ERROR] Plugin org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-enforcer-plugin:jar:3.0.0-M1: Could not transfer artifact org.apache.maven.plugins:maven-enforcer-plugin:pom:3.0.0-M1 from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
[root@cdh2 YCSB-0.13.0]# ls
解决方案;
将maven文件里的源修改为阿里云源
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
- YCSB使用说明
[root@cdh2 ycsb]# cat hbase098-binding/README.mdHBase (0.98.x) Driver for YCSB
This driver is a binding for the YCSB facilities to operate against a HBase 0.98.x Server cluster.
To run against an HBase 0.94.x cluster, use the hbase094
binding.
To run against an HBase >= 1.0 cluster, use the hbase10
binding.
Quickstart
1. Start a HBase Server
You need to start a single node or a cluster to point the client at. Please see Apache HBase Reference Guide for more details and instructions.
2. Set up YCSB
You need to clone the repository and compile everything.
git clone git://github.com/brianfrankcooper/YCSB.git
cd YCSB
mvn clean package
3. Create a HBase table for testing
For best results, use the pre-splitting strategy recommended in HBASE-4163:
hbase(main):001:0> n_splits = 200 # HBase recommends (10 * number of regionservers)
hbase(main):002:0> create 'usertable', 'family', {SPLITS => (1..n_splits).map {|i| "user#{1000+i*(9999-1000)/n_splits}"}}
Failing to do so will cause all writes to initially target a single region server.
4. Run the Workload
Before you can actually run the workload, you need to “load” the data first.
You should specify a HBase config directory(or any other directory containing your hbase-site.xml) and a table name and a column family(-cp is used to set java classpath and -p is used to set various properties).
bin/ycsb load hbase -P workloads/workloada -cp /HBASE-HOME-DIR/conf -p table=usertable -p columnfamily=family
Then, you can run the workload:
bin/ycsb run hbase -P workloads/workloada -cp /HBASE-HOME-DIR/conf -p table=usertable -p columnfamily=family
Please see the general instructions in the doc
folder if you are not sure how it all works. You can apply additional properties (as seen in the next section) like this:
bin/ycsb run hbase -P workloads/workloada -cp /HBASE-HOME-DIR/conf -p table=usertable -p columnfamily=family -p clientbuffering=true
Configuration Options
Following options can be configurable using -p
.
columnfamily
: The HBase column family to target.debug
: If true, debugging logs are activated. The default is false.hbase.usepagefilter
: If true, HBase
PageFilters
are used to limit the number of records consumed in a scan operation. The default is true.principal
: If testing need to be done against a secure HBase cluster using Kerberos Keytab,
this property can be used to pass the principal in the keytab file.keytab
: The Kerberos keytab file name and location can be passed through this property.writebuffersize
: The maximum amount, in bytes, of data to buffer on the client side before a flush is forced. The default is 12MB.
Additional HBase settings should be provided in the hbase-site.xml
file located in your /HBASE-HOME-DIR/conf
directory. Typically this will be /etc/hbase/conf
.[root@cdh2 ycsb]#
- HBase中创建测试表
hbase(main):001:0> n_splits = 200 # HBase recommends (10 * number of regionservers)
hbase(main):002:0> create 'usertable', 'family', {SPLITS => (1..n_splits).map {|i| "user#{1000+i*(9999-1000)/n_splits}"}}
create 'usertable', {NAME=>'f1', VERSIONS=>'1',COMPRESSION=>'LZO'}
加载
bin/ycsb load hbase -P workloads/workloada -cp /HBASE-HOME-DIR/conf -p table=usertable -p columnfamily=family
例如:
bin/ycsb load hbase10 -P workloads/workloada -cp /etc/hbase/conf.cloudera.hbase/ -p table=usertable -p columnfamily=family
因为ycsb是精简版的hbase10-binding目录下没有conf目录,需要制定本地hbase的配置文件所在目录,即/etc/hbase/conf.cloudera.hbase
注意:
由于本人使用cdh安装的hbase,配置文件所在的目录在/etc/hbase/conf.cloudera.hbase目录,与bin安装的方式有所区别
打印log
Loading workload...
Starting test.
19/04/25 18:29:21 INFO zookeeper.RecoverableZooKeeper: Process identifier=hconnection-0x66886381 connecting to ZooKeeper ensemble=cdh3:2181
19/04/25 18:29:21 INFO zookeeper.ZooKeeper: Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
19/04/25 18:29:21 INFO zookeeper.ZooKeeper: Client environment:host.name=cdh2
19/04/25 18:29:21 INFO zookeeper.ZooKeeper: Client environment:java.version=1.7.0_80
19/04/25 18:29:21 INFO zookeeper.ZooKeeper: Client environment:java.vendor=Oracle Corporation
19/04/25 18:29:21 INFO zookeeper.ZooKeeper: Client environment:java.home=/usr/java/jdk1.7.0_80/jre
19/04/25 18:29:21 INFO zookeeper.ZooKeeper: Client environment:java.class.path=/etc/hbase/conf.cloudera.hbase/:/soft/ycsb-0.13.0/hbase10-binding/conf:/soft/ycsb-0.13.0/conf:/soft/ycsb-0.13.0/lib/core-0.13.0.jar:/soft/ycsb-0.13.0/lib/htrace-core4-4.1.0-incubating.jar:/soft/ycsb-0.13.0/lib/jackson-mapper-asl-1.9.4.jar:/soft/ycsb-0.13.0/lib/jackson-core-asl-1.9.4.jar:/soft/ycsb-0.13.0/lib/HdrHistogram-2.1.4.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/activation-1.1.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/apacheds-i18n-2.0.0-M15.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/apacheds-kerberos-codec-2.0.0-M15.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/api-asn1-api-1.0.0-M20.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/api-util-1.0.0-M20.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/avro-1.7.4.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/commons-beanutils-1.7.0.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/commons-beanutils-core-1.8.0.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/commons-cli-1.2.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/commons-codec-1.9.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/commons-collections-3.2.1.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/commons-compress-1.4.1.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/commons-configuration-1.6.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/commons-digester-1.8.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/commons-el-1.0.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/commons-httpclient-3.1.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/commons-io-2.4.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/commons-lang-2.6.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/commons-logging-1.2.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/commons-math3-3.1.1.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/commons-net-3.1.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/findbugs-annotations-1.3.9-1.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/guava-12.0.1.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/hadoop-annotations-2.5.1.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/hadoop-auth-2.5.1.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/hadoop-common-2.5.1.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/hadoop-mapreduce-client-core-2.5.1.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/hadoop-yarn-api-2.5.1.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/hadoop-yarn-common-2.5.1.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/hbase-annotations-1.0.2.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/hbase-client-1.0.2.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/hbase-common-1.0.2.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/hbase-protocol-1.0.2.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/htrace-core-3.1.0-incubating.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/httpclient-4.2.5.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/httpcore-4.2.4.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/jackson-core-asl-1.9.4.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/jackson-mapper-asl-1.8.8.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/jaxb-api-2.2.2.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/jcodings-1.0.8.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/jetty-util-6.1.26.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/joni-2.1.2.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/jsch-0.1.42.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/jsr305-1.3.9.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/log4j-1.2.17.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/netty-3.6.2.Final.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/netty-all-4.0.23.Final.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/paranamer-2.3.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/protobuf-java-2.5.0.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/slf4j-api-1.6.4.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/slf4j-log4j12-1.7.7.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/snappy-java-1.0.4.1.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/stax-api-1.0-2.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/xmlenc-0.52.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/xz-1.0.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/zookeeper-3.4.6.jar:/soft/ycsb-0.13.0/hbase10-binding/lib/hbase10-binding-0.13.0.jar
19/04/25 18:29:21 INFO zookeeper.ZooKeeper: Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
19/04/25 18:29:21 INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=/tmp
19/04/25 18:29:21 INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA>
19/04/25 18:29:21 INFO zookeeper.ZooKeeper: Client environment:os.name=Linux
19/04/25 18:29:21 INFO zookeeper.ZooKeeper: Client environment:os.arch=amd64
19/04/25 18:29:21 INFO zookeeper.ZooKeeper: Client environment:os.version=3.10.0-862.el7.x86_64
19/04/25 18:29:21 INFO zookeeper.ZooKeeper: Client environment:user.name=root
19/04/25 18:29:21 INFO zookeeper.ZooKeeper: Client environment:user.home=/root
19/04/25 18:29:21 INFO zookeeper.ZooKeeper: Client environment:user.dir=/soft/ycsb-0.13.0
19/04/25 18:29:21 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=cdh3:2181 sessionTimeout=60000 watcher=hconnection-0x668863810x0, quorum=cdh3:2181, baseZNode=/hbase
19/04/25 18:29:21 INFO zookeeper.ClientCnxn: Opening socket connection to server cdh3/192.168.0.142:2181. Will not attempt to authenticate using SASL (unknown error)
19/04/25 18:29:21 INFO zookeeper.ClientCnxn: Socket connection established to cdh3/192.168.0.142:2181, initiating session
19/04/25 18:29:21 INFO zookeeper.ClientCnxn: Session establishment complete on server cdh3/192.168.0.142:2181, sessionid = 0x16a53e9b80e000a, negotiated timeout = 60000
19/04/25 18:29:21 WARN util.DynamicClassLoader: Failed to identify the fs of dir hdfs://cdh1:8020/hbase/lib, ignored
java.io.IOException: No FileSystem for scheme: hdfs
at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:2579)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2586)
at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:89)
at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2625)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2607)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:368)
at org.apache.hadoop.fs.Path.getFileSystem(Path.java:296)
at org.apache.hadoop.hbase.util.DynamicClassLoader.<init>(DynamicClassLoader.java:104)
at org.apache.hadoop.hbase.protobuf.ProtobufUtil.<clinit>(ProtobufUtil.java:232)
at org.apache.hadoop.hbase.ClusterId.parseFrom(ClusterId.java:64)
at org.apache.hadoop.hbase.zookeeper.ZKClusterId.readClusterIdZNode(ZKClusterId.java:75)
at org.apache.hadoop.hbase.client.ZooKeeperRegistry.getClusterId(ZooKeeperRegistry.java:86)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.retrieveClusterId(ConnectionManager.java:833)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.<init>(ConnectionManager.java:623)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:238)
at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:218)
at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:119)
at com.yahoo.ycsb.db.HBaseClient10.init(HBaseClient10.java:152)
at com.yahoo.ycsb.DBWrapper.init(DBWrapper.java:86)
at com.yahoo.ycsb.ClientThread.run(Client.java:423)
at java.lang.Thread.run(Thread.java:745)
DBWrapper: report latency for each error is false and specific error codes to track for latency are: []
19/04/25 18:29:34 INFO client.ConnectionManager$HConnectionImplementation: Closing master protocol: MasterService
19/04/25 18:29:34 INFO client.ConnectionManager$HConnectionImplementation: Closing zookeeper sessionid=0x16a53e9b80e000a
19/04/25 18:29:34 INFO zookeeper.ZooKeeper: Session: 0x16a53e9b80e000a closed
19/04/25 18:29:34 INFO zookeeper.ClientCnxn: EventThread shut down
[OVERALL], RunTime(ms), 14862 // 数据加载所用时间:14862 14.862秒
[OVERALL], Throughput(ops/sec), 67.28569506122999 // 加载操作的吞吐量,平均并发量每条67.28条
[TOTAL_GCS_MarkSweepCompact], Count, 0
[TOTAL_GC_TIME_MarkSweepCompact], Time(ms), 0
[TOTAL_GC_TIME_%_MarkSweepCompact], Time(%), 0.0
[TOTAL_GCS_Copy], Count, 8
[TOTAL_GC_TIME_Copy], Time(ms), 229
[TOTAL_GC_TIME_%_Copy], Time(%), 1.5408424169021666
[TOTAL_GCs], Count, 8
[TOTAL_GC_TIME], Time(ms), 229
[TOTAL_GC_TIME_%], Time(%), 1.5408424169021666
[CLEANUP], Operations, 2 执行cleanup的操作总数,2
[CLEANUP], AverageLatency(us), 61237.0 // 平均响应时间61.237ms
[CLEANUP], MinLatency(us), 10 // 最小响应时间 0.01
[CLEANUP], MaxLatency(us), 122495 // 最大响应时间 122.495ms
[CLEANUP], 95thPercentileLatency(us), 122495 // 95%的cleanup操作延时在122.495ms以内
[CLEANUP], 99thPercentileLatency(us), 122495 // 99%的cleanup操作延时在122.495ms以内
[INSERT], Operations, 1000 // 执行insert操作总数,1000
[INSERT], AverageLatency(us), 12081.785 // 每次insert操作的平均延时12.081ms
[INSERT], MinLatency(us), 3234 // 所有insert操作最小延时,3.234ms以内
[INSERT], MaxLatency(us), 440319 // 所有insert操作最大延时,440.319ms
[INSERT], 95thPercentileLatency(us), 34751 95%的insert操作延时在34.751ms以内
[INSERT], 99thPercentileLatency(us), 78399 // 99%的insert操作延时在78.399ms 以内
[INSERT], Return=OK, 1000 成功返回数 1000
运行
bin/ycsb run hbase -P workloads/workloada -cp /HBASE-HOME-DIR/conf -p table=usertable -p columnfamily=family -p clientbuffering=true
例如:
bin/ycsb run hbase10 -P workloads/workloada -cp /etc/hbase/conf.cloudera.hbase/ -p table=usertable -p columnfamily=family
打印log
[OVERALL], RunTime(ms), 5637 // 数据加载所用时间:5.637
[OVERALL], Throughput(ops/sec), 177.39932588256164 // 加载操作的吞吐量,平均并发量每秒177.39条
[TOTAL_GCS_MarkSweepCompact], Count, 0
[TOTAL_GC_TIME_MarkSweepCompact], Time(ms), 0
[TOTAL_GC_TIME_%_MarkSweepCompact], Time(%), 0.0
[TOTAL_GCS_Copy], Count, 7
[TOTAL_GC_TIME_Copy], Time(ms), 77
[TOTAL_GC_TIME_%_Copy], Time(%), 1.3659748092957247
[TOTAL_GCs], Count, 7
[TOTAL_GC_TIME], Time(ms), 77
[TOTAL_GC_TIME_%], Time(%), 1.3659748092957247
[CLEANUP], Operations, 1 //执行cleanup的操作总数,1
[CLEANUP], AverageLatency(us), 578304.0 // 平均响应时间:57.8304
[CLEANUP], MinLatency(us), 578048 // 最小相应时间0.578ms
[CLEANUP], MaxLatency(us), 578559 //最大响应时间0.578ms
[CLEANUP], 95thPercentileLatency(us), 578559 // 95%的insert操作延时在0.578ms以内
[CLEANUP], 99thPercentileLatency(us), 578559 // 99%的insert操作延时在0.578ms以内
[READ], Operations, 506 // 执行read操作总数,506次
[READ], AverageLatency(us), 4099.938735177866 // 平均响应时间4.099ms
[READ], MinLatency(us), 910 // 最小响应时间0.91ms
[READ], MaxLatency(us), 442623 // 最大响应时间44.2623ms
[READ], 95thPercentileLatency(us), 10479 // 95%的read操作延时在10.479ms
[READ], 99thPercentileLatency(us), 26911 // 99%的insert操作延时在26.11ms以内
[READ], Return=OK, 506 成功返回506
[UPDATE], Operations, 495
[UPDATE], AverageLatency(us), 1019.2525252525253
[UPDATE], MinLatency(us), 31
[UPDATE], MaxLatency(us), 451583
[UPDATE], 95thPercentileLatency(us), 95
[UPDATE], 99thPercentileLatency(us), 127
[UPDATE], Return=OK, 494
测试用例
目录结构
[root@cdh2 hbase_ycsb_testcase]# ll
总用量 0
-rw-r--r-- 1 root root 0 4月 25 19:13 TR1003
-rw-r--r-- 1 root root 0 4月 25 19:14 TR1003.report
-rw-r--r-- 1 root root 0 4月 25 19:14 ycsb_load.sh
-rw-r--r-- 1 root root 0 4月 25 19:14 ycsb_run.sh
[root@cdh2 hbase_ycsb_testcase]#
ycsb_load.sh脚本的内容
echo "******Loading test begin******"
# define the path of ycsb
YCSB="/root/ycsb-hbase10-binding-0.10.0"
# define the path of hbase_site.xml
hbase=$YCSB"/bin"
# define test path
test=$YCSB"/workloads/test/"
# define the file path of workload
workload=$test$1
# define the log file name
report=$test$1".report"
# define ycbs runner
runner=$YCSB"/bin/ycsb"
# define measurement param
raw_file=$test$1".raw"
measurement_param="measurement.raw.output_file="$raw_file
# run test
$runner load hbase10 -cp $hbase -P $workload -s -jvm-args='-Xmx32g' 1>>$report 2>>$report
echo "******Loading test end******"
脚本内容较为简单,ycsb_run.sh脚本的内容与上述内容几乎一样(最后一句的ycsb运行命令中的load改为run),其中$1变量时用户在运行时所指定的配置文件(workload、TR1003等)。
-jvm-args='-Xmx32g' 这个是用来配置ycsb运行时jvm虚拟机的内存大小的,这里的意思是最多给ycsb clinet进程分配32G的内存
具体用法:sh ycsb_load.sh TR1003
ycsb配置文件TR1003(作用跟workload文件相同)
# The thread count
threadcount=100
# The number of fields in a record
fieldcount=1
# The size of each field (in bytes)
fieldlength=9216
# Number of Records will be loaded
recordcount=1500000000
# Number of Operations will be handle in run parsh
operationcount=2000000
readallfields=true
#insertorder=hashed
#insertstart=0
#insertcount=500000000
# Control Porption of hbase operation type
readproportion=0
updateproportion=0
scanproportion=1
insertproportion=0
# The following param always be fixed
# The table name
table=usertable
# The colume family
columnfamily=cf
# The workload class
workload=com.yahoo.ycsb.workloads.CoreWorkload
# The measurement type
measurementtype=raw
maxscanlength=1000000
#hbase.usepagefilter=false
#scanlengthdistribution=zipfian
#requestdistribution=latest
这个配置文件是单独用来load阶段加载数据库时候用的,其中clientbuffer配置项是配置hbase client端的写缓存,配置写缓存有利用减少写hbase操作时的rpc开销,具体作用可以查看hbase测试调优文档,默认是不配的,该配置项默认的值是配置项writebuffersize=1024*1024*12(12M),requestdistribution是指操作需求分布采用的方式,。
Run阶段配置文件TR1003:
# The thread count
threadcount=100
# The number of fields in a record
fieldcount=1
# The size of each field (in bytes)
fieldlength=9216
# Number of Records will be loaded
recordcount=1500000000
# Number of Operations will be handle in run parsh
operationcount=2000000
readallfields=true
#insertorder=hashed
#insertstart=0
#insertcount=500000000
# Control Porption of hbase operation type
readproportion=0
updateproportion=0
scanproportion=1
insertproportion=0
# The following param always be fixed
# The table name
table=usertable
# The colume family
columnfamily=cf
# The workload class
workload=com.yahoo.ycsb.workloads.CoreWorkload
# The measurement type
measurementtype=raw
maxscanlength=1000000
#hbase.usepagefilter=false
#scanlengthdistribution=zipfian
#requestdistribution=latest
说明
这个配置文件用在run阶段,与ycsb_run.sh配合使用,这里run阶段主要就是读hbase数据库的数据。
scan:
Maxscanlength配置项用来指定scan的条数(在ycsb代码中的实现方式是取1~Maxscanlength中的随机值作为一次scan的条数)
hbase.usepagefilter配置项是scan一次的结果是否采取分页显示,默认是开启的
scanlengthdistribution配置项决定了以何种方式从1~Maxscanlength区间中取值,还是默认的uniform(等概率随机分布)。
另外值得注意的是在执行scan操作中,ycsb每秒操作数currentops/sec可能会很小:
2016-08-30 04:21:40:791 60 sec: 1 operations; 0.1 current ops/sec; est completion in 1388 days 21hours SCAN count: 1, average latency(us): 49083737.00
这个是由于ycsb计算方式的原因,它只计算每次具体的操作数,而不是scan总数,所以0.1可以理解为在10秒钟的时间内执行了1次scan操作,所以这10秒的平均操作数是0.1 current ops/sec。
对于scan操作我们可以通过带宽来计算一次操作到底扫描了多少条数据。
注意
Load阶段其实就是装载数据即往hbase中插入数据,workload文件中的recordcount就是将要插入的条数,run阶段就是对hbase进行各种操作,operationcount就是操作数,因此load阶段必须要正确执行完成,否则在run阶段会有类似于[READ-FAILED]之类的错误。
ycsb的帮助信息如下:
[root@cdh2 ycsb]# ycsb --help
usage: /soft/ycsb/bin/ycsb command database [options]
Commands:
load Execute the load phase
run Execute the transaction phase
shell Interactive mode
Databases:
accumulo https://github.com/brianfrankcooper/YCSB/tree/master/accumulo
aerospike https://github.com/brianfrankcooper/YCSB/tree/master/aerospike
arangodb https://github.com/brianfrankcooper/YCSB/tree/master/arangodb
arangodb3 https://github.com/brianfrankcooper/YCSB/tree/master/arangodb3
asynchbase https://github.com/brianfrankcooper/YCSB/tree/master/asynchbase
azuredocumentdb https://github.com/brianfrankcooper/YCSB/tree/master/azuredocumentdb
azuretablestorage https://github.com/brianfrankcooper/YCSB/tree/master/azuretablestorage
basic https://github.com/brianfrankcooper/YCSB/tree/master/basic
basicts https://github.com/brianfrankcooper/YCSB/tree/master/basicts
cassandra-cql https://github.com/brianfrankcooper/YCSB/tree/master/cassandra
cassandra2-cql https://github.com/brianfrankcooper/YCSB/tree/master/cassandra2
cloudspanner https://github.com/brianfrankcooper/YCSB/tree/master/cloudspanner
couchbase https://github.com/brianfrankcooper/YCSB/tree/master/couchbase
couchbase2 https://github.com/brianfrankcooper/YCSB/tree/master/couchbase2
dynamodb https://github.com/brianfrankcooper/YCSB/tree/master/dynamodb
elasticsearch https://github.com/brianfrankcooper/YCSB/tree/master/elasticsearch
elasticsearch5 https://github.com/brianfrankcooper/YCSB/tree/master/elasticsearch5
geode https://github.com/brianfrankcooper/YCSB/tree/master/geode
googlebigtable https://github.com/brianfrankcooper/YCSB/tree/master/googlebigtable
googledatastore https://github.com/brianfrankcooper/YCSB/tree/master/googledatastore
hbase094 https://github.com/brianfrankcooper/YCSB/tree/master/hbase094
hbase098 https://github.com/brianfrankcooper/YCSB/tree/master/hbase098
hbase10 https://github.com/brianfrankcooper/YCSB/tree/master/hbase10
hbase12 https://github.com/brianfrankcooper/YCSB/tree/master/hbase12
hypertable https://github.com/brianfrankcooper/YCSB/tree/master/hypertable
infinispan https://github.com/brianfrankcooper/YCSB/tree/master/infinispan
infinispan-cs https://github.com/brianfrankcooper/YCSB/tree/master/infinispan
jdbc https://github.com/brianfrankcooper/YCSB/tree/master/jdbc
kudu https://github.com/brianfrankcooper/YCSB/tree/master/kudu
memcached https://github.com/brianfrankcooper/YCSB/tree/master/memcached
mongodb https://github.com/brianfrankcooper/YCSB/tree/master/mongodb
mongodb-async https://github.com/brianfrankcooper/YCSB/tree/master/mongodb
nosqldb https://github.com/brianfrankcooper/YCSB/tree/master/nosqldb
orientdb https://github.com/brianfrankcooper/YCSB/tree/master/orientdb
rados https://github.com/brianfrankcooper/YCSB/tree/master/rados
redis https://github.com/brianfrankcooper/YCSB/tree/master/redis
rest https://github.com/brianfrankcooper/YCSB/tree/master/rest
riak https://github.com/brianfrankcooper/YCSB/tree/master/riak
s3 https://github.com/brianfrankcooper/YCSB/tree/master/s3
solr https://github.com/brianfrankcooper/YCSB/tree/master/solr
solr6 https://github.com/brianfrankcooper/YCSB/tree/master/solr6
tarantool https://github.com/brianfrankcooper/YCSB/tree/master/tarantool
Options:
-P file Specify workload file
-cp path Additional Java classpath entries
-jvm-args args Additional arguments to the JVM
-p key=value Override workload property
-s Print status to stderr
-target n Target ops/sec (default: unthrottled)
-threads n Number of client threads (default: 1)
Workload Files:
There are various predefined workloads under workloads/ directory.
See https://github.com/brianfrankcooper/YCSB/wiki/Core-Properties
for the list of workload properties.
positional arguments:
{load,run,shell} Command to run.
{accumulo,aerospike,arangodb,arangodb3,asynchbase,azuredocumentdb,azuretablestorage,basic,basicts,cassandra-cql,cassandra2-cql,cloudspanner,couchbase,couchbase2,dynamodb,elasticsearch,elasticsearch5,geode,googlebigtable,googledatastore,hbase094,hbase098,hbase10,hbase12,hypertable,infinispan,infinispan-cs,jdbc,kudu,memcached,mongodb,mongodb-async,nosqldb,orientdb,rados,redis,rest,riak,s3,solr,solr6,tarantool}
Database to test.
optional arguments:
-h, --help show this help message and exit
-cp CLASSPATH Additional classpath entries, e.g. '-cp
/tmp/hbase-1.0.1.1/conf'. Will be prepended to the
YCSB classpath.
-jvm-args JVM_ARGS Additional arguments to pass to 'java', e.g. '-Xmx4g'