当前位置: 首页 > 工具软件 > YCSB > 使用案例 >

YCSB简介

程墨竹
2023-12-01

YCSB

如何运行:https://github.com/brianfrankcooper/YCSB/wiki/Running-a-Workload
推荐操作顺利:https://github.com/brianfrankcooper/YCSB/wiki/Core-Workloads
如何扩展:https://github.com/brianfrankcooper/YCSB/wiki/Implementing-New-Workloads

示例:使用时先建表,然后加载数据,最后执行相关事务

建表:create 'usertable','f1','f2','f3'

加载数据:./ycsb load hbase -P ../workloads/workloada -p threads=10 -p columnfamily=f1 -p recordcount=10000 -s > load.dat
 
结果如下:
[OVERALL], RunTime(ms), 2295.0
[OVERALL], Throughput(ops/sec), 4357.298474945534
[INSERT], Operations, 10000
[INSERT], AverageLatency(us), 198.2618
[INSERT], MinLatency(us), 9
[INSERT], MaxLatency(us), 788883
[INSERT], 95thPercentileLatency(ms), 0
[INSERT], 99thPercentileLatency(ms), 0
[INSERT], Return=0, 10000
执行事务:./ycsb run hbase -P ../workloads/workloada -threads 10 -p measurementtype=timeseries -p
   columnfamily=f1 -p timeseries.granularity=2000 > transactions.dat
 
结果如下:
[OVERALL], RunTime(ms), 541.0
[OVERALL], Throughput(ops/sec), 1848.4288354898335
[UPDATE], Operations, 502
[UPDATE], AverageLatency(us), 4569.788844621514
[UPDATE], MinLatency(us), 56
[UPDATE], MaxLatency(us), 373970
[UPDATE], Return=0, 502
[UPDATE], 0, 4569.788844621514
[READ], Operations, 498
[READ], AverageLatency(us), 4618.516064257028
[READ], MinLatency(us), 742
[READ], MaxLatency(us), 379287
[READ], Return=0, 498
[READ], 0, 4618.516064257028

相关参数说明:

fieldcountthe number of fields in a record (default: 10)
fieldlengththe size of each field (default: 100)
readallfieldsshould reads read all fields (true) or just one (false) (default: true)
readproportionwhat proportion of operations should be reads (default: 0.95)
updateproportionwhat proportion of operations should be updates (default: 0.05)
insertproportionwhat proportion of operations should be inserts (default: 0)
scanproportionwhat proportion of operations should be scans (default: 0)
readmodifywriteproportionwhat proportion of operations should be read a record, modify it, write it back (default: 0)
requestdistributionwhat distribution should be used to select the records to operate on – uniform, zipfian or latest (default: uniform)
maxscanlengthfor scans, what is the maximum number of records to scan (default: 1000)
scanlengthdistributionfor scans, what distribution should be used to choose the number of records to scan, for each scan, between 1 and maxscanlength (default: uniform)
insertordershould records be inserted in order by key (“ordered”), or in hashed order (“hashed”) (default: hashed)
operationcountNumber of operations to perform.
maxexecutiontimeMaximum execution time in seconds. The benchmark runs until either the operation count has exhausted or the maximum specified time has elapsed, whichever is earlier.
tableThe name of the table (default: usertable)

其他:

-sfor a long running workload, it may be useful to have the Client report status, just to assure you it has not crashed and to give you some idea of its progress. By specifying "-s" on the command line, the Client will report status every 10 seconds to stderr.
-threadsthe number of client threads. By default, the YCSB Client uses a single worker thread, but additional threads can be specified. This is often done to increase the amount of load offered against the database.
-targetthe target number of operations per second. By default, the YCSB Client will try to do as many operations as it can. For example, if each operation takes 100 milliseconds on average, the Client will do about 10 operations per second per worker thread. However, you can throttle the target number of operations per second. For example, to generate a latency versus throughput curve, you can try different target throughputs, and measure the resulting latency for each

相关help:

Commands:
    load          Execute the load phase
    run           Execute the transaction phase
    shell         Interactive mode
 
Databases:
    basic         https://github.com/brianfrankcooper/YCSB/tree/master/basic
    cassandra-10  https://github.com/brianfrankcooper/YCSB/tree/master/cassandra
    cassandra-7   https://github.com/brianfrankcooper/YCSB/tree/master/cassandra
    cassandra-8   https://github.com/brianfrankcooper/YCSB/tree/master/cassandra
    gemfire       https://github.com/brianfrankcooper/YCSB/tree/master/gemfire
    hbase         https://github.com/brianfrankcooper/YCSB/tree/master/hbase
    infinispan    https://github.com/brianfrankcooper/YCSB/tree/master/infinispan
    jdbc          https://github.com/brianfrankcooper/YCSB/tree/master/jdbc
    mapkeeper     https://github.com/brianfrankcooper/YCSB/tree/master/mapkeeper
    mongodb       https://github.com/brianfrankcooper/YCSB/tree/master/mongodb
    nosqldb       https://github.com/brianfrankcooper/YCSB/tree/master/nosqldb
    redis         https://github.com/brianfrankcooper/YCSB/tree/master/redis
    voldemort     https://github.com/brianfrankcooper/YCSB/tree/master/voldemort
 
Options:
    -P file       Specify workload file
    -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.
 类似资料: