Skip to content

Benchmark HerdDB: YCSB usage

Alessandro Luccaroni edited this page Aug 7, 2018 · 2 revisions

YCSB is a popular benchmark tool for NoSQL and SQL DB. It have ready adapters for different NoSQL DB like Cassandra, Mongo, Redis and others.

YCSB comes with 6 out of the box workloads, each testing a different common use case

  • 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 (95/5 read/insert mix). 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 (95/5 read/insert mix). 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 (50/50 read/read-modify-write mix)

Prerequisite

You will need both herddb and YCSB installed to test HerdDB performance.

Download a release pack of herd and unzip it

mkidr /opt/herddb
unzip herd-services-X.X.X.zip /opt/herddb/

You may want to configure the jdk and memory usage of the server:

vim /opt/herddb/bin/setenv.sh
  • edit the JAVA_HOME properties
  • edit the JAVA_OPTS properties (set the memory with -Xmx, -Xms options)

YCSB

install

Test Bed

To perform the out-of-the-box workloads you need to create a table inside HerdDB and provide a valid jdbc connection to YCSB.

Use the HerdDB cli to create an YCSB valid table:

./bin/herddb-cli.sh -sc
herd: CREATE TABLE usertable ( YCSB_KEY VARCHAR(191) NOT NULL, FIELD0 STRING, FIELD1 STRING, FIELD2 STRING, FIELD3 STRING, FIELD4 STRING, FIELD5 STRING, FIELD6 STRING, FIELD7 STRING, FIELD8 STRING, FIELD9 STRING, PRIMARY KEY (YCSB_KEY));

for YCSB 0.14.0 or later you should use the following instead:

./bin/herddb-cli.sh -sc
herd: CREATE TABLE usertable ( YCSB_KEY TEXT NOT NULL, FIELD0 STRING, FIELD1 STRING, FIELD2 STRING, FIELD3 STRING, FIELD4 STRING, FIELD5 STRING, FIELD6 STRING, FIELD7 STRING, FIELD8 STRING, FIELD9 STRING, PRIMARY KEY (YCSB_KEY));

Create a YCSB jdbc configuration file (eg. jdbc-binding/herd.properties) and copy the herddb jdbc driver in the YCSB installation:

db.driver=herddb.jdbc.Driver
db.url=jdbc:herddb:server:127.0.0.1:7000
db.user=sa
db.passwd=hdb
cp /PATHTOHERD/herddb-jdbc-*.jar jdbc-binding/

Run the Benchmark

Each benchmark have two phases:

  1. upload the test data to DB
  2. execute the bench

Loading test data

./bin/ycsb load jdbc -P workloads/workloada -P jdbc-binding/herd.properties -cp jdbc-binding/herddb-jdbc-*.jar -threads 200 -s > workloada_load.txt

Execute the bench

./bin/ycsb run jdbc -P workloads/workloada -P jdbc-binding/herd.properties -cp jdbc-binding/herddb-jdbc-*.jar -threads 200 -s > workloada_run.txt

The results will be available at workloada_run.txt:

[OVERALL], RunTime(ms), 100416.0
[OVERALL], Throughput(ops/sec), 9958.572339069471
[READ], Operations, 499450.0
[READ], AverageLatency(us), 3718.303457803584
[READ], MinLatency(us), 247.0
[READ], MaxLatency(us), 1003519.0
[READ], 95thPercentileLatency(us), 6111.0
[READ], 99thPercentileLatency(us), 10263.0
[READ], Return=OK, 499450
[UPDATE], Operations, 500550.0
[UPDATE], AverageLatency(us), 15606.28137249026
[UPDATE], MinLatency(us), 2060.0
[UPDATE], MaxLatency(us), 980479.0
[UPDATE], 95thPercentileLatency(us), 18767.0
[UPDATE], 99thPercentileLatency(us), 216191.0
[UPDATE], Return=OK, 500550

Tweak the bench

To run test on more data or to use a custom workload you may want to edit the workload/workloadX files and/or create a custom workload file.

More resources

See the YCSB documentation

Clone this wiki locally