YCSB benchmark on PostgreSQL

go-ycsb is a Go port of YCSB. It fully supports all YCSB generators and the Core workload so we can do the basic CRUD benchmarks with Go.

YCSB benchmark on PostgreSQL
Photo by Pietro Mattia / Unsplash

Create a PostgreSQL database

You can follow this post to install PostgreSQL and create the database cluster.

To create a database:

$ db_host=10.10.10.243; db_port=5432; db_user=postgres; db_name=testdb

$ psql --host=$db_host --port=$db_port --username=$db_user -w -c "create database $db_name"
$ psql --host=$db_host --port=$db_port --username=$db_user -w -c "\l"
$ psql --host=$db_host --port=$db_port --username=$db_user -w -d $db_name -c "\dt+"

Load data to database

go-ycsb is a Go port of YCSB. It fully supports all YCSB generators and the Core workload so we can do the basic CRUD benchmarks with Go.

$ ./bin/go-ycsb load postgresql -P workloads/workloadd --threads 768 -p pg.host=$db_host -p pg.port=$db_port -p pg.user=$db_user -p pg.db=$db_name -p pg.sslmode=disable -p dropdata=true
<snippet>
Run finished, takes 29m39.847077518s
INSERT - Takes(s): 1779.8, Count: 97404992, OPS: 54727.5, Avg(us): 11176, Min(us): 179, Max(us): 80767, 99th(us): 72127, 99.9th(us): 79807, 99.99th(us): 80703

Run YCSB benchmark

$ ./bin/go-ycsb run postgresql -P workloads/workloadd --threads 768 -p pg.host=$db_host -p pg.port=$db_port -p pg.user=$db_user -p pg.db=$db_name -p pg.sslmode=disable
<snippet>
Run finished, takes 14m8.828228178s
INSERT - Takes(s): 848.8, Count: 4981537, OPS: 5868.8, Avg(us): 1968, Min(us): 226, Max(us): 19327, 99th(us): 11623, 99.9th(us): 17567, 99.99th(us): 19119
READ   - Takes(s): 848.8, Count: 93786269, OPS: 110492.3, Avg(us): 5899, Min(us): 78, Max(us): 41247, 99th(us): 32831, 99.9th(us): 40063, 99.99th(us): 41119

Reference