ScalarDB Benchmarking Tools
This tutorial describes how to run benchmarking tools for ScalarDB. Database benchmarking is helpful for evaluating how databases perform against a set of standards.
Benchmark workloads
- TPC-C
- YCSB (Workloads A, C, and F)
- Multi-storage YCSB (Workloads C and F)
- This YCSB variant is for a multi-storage environment that uses ScalarDB.
- Workers in a multi-storage YCSB execute the same number of read and write operations in two namespaces:
ycsb_primary
andycsb_secondary
.
Prerequisites
- One of the following Java Development Kits (JDKs):
- Oracle JDK LTS version 8
- OpenJDK LTS version 8
- Gradle
- Kelpie
- Kelpie is a framework for performing end-to-end testing, such as system benchmarking and verification. Get the latest version from Kelpie Releases, and unzip the archive file.
- A client to run the benchmarking tools
- A target database
- For a list of databases that ScalarDB supports, see Databases.
Currently, only JDK 8 can be used when running the benchmarking tools.
Set up the benchmarking tools
The following sections describe how to set up the benchmarking tools.
Clone the ScalarDB benchmarks repository
Open Terminal, then clone the ScalarDB benchmarks repository by running the following command:
git clone https://github.com/scalar-labs/scalardb-benchmarks
Then, go to the directory that contains the benchmarking files by running the following command:
cd scalardb-benchmarks
Build the tools
To build the benchmarking tools, run the following command:
./gradlew shadowJar
Load the schema
Before loading the initial data, the tables must be defined by using the ScalarDB Schema Loader. You can download the ScalarDB Schema Loader on the ScalarDB Releases page. Select the Schema Loader based on how you access ScalarDB:
- Using the ScalarDB Core library (Community edition)?: Choose
scalardb-schema-loader-<VERSION>.jar
for the version of ScalarDB that you're using. Then, save the.jar
file in thescalardb-benchmarks
root directory. - Using ScalarDB Cluster (Enterprise edition)?: Choose
scalardb-cluster-schema-loader-<VERSION>-all.jar
for the version of ScalarDB Cluster that you're using. Then, save the.jar
file in thescalardb-benchmarks
root directory.
In addition, you need a properties file for accessing ScalarDB via the Java CRUD interface. For details about configuring the ScalarDB properties file, see ScalarDB Configurations or ScalarDB Cluster Client Configurations.
After applying the schema and configuring the properties file, select a benchmark and follow the instructions to create the tables.
- TPC-C
- YCSB
- Multi-storage YCSB
To create tables for TPC-C benchmarking (tpcc-schema.json
), run the following command, replacing the contents in the angle brackets as described:
java -jar scalardb-schema-loader-<VERSION>.jar --config <PATH_TO_SCALARDB_PROPERTIES_FILE> -f tpcc-schema.json --coordinator
If you are using ScalarDB Cluster, run the following command instead:
java -jar scalardb-cluster-schema-loader-<VERSION>-all.jar --config <PATH_TO_SCALARDB_PROPERTIES_FILE> -f tpcc-schema.json --coordinator
To create tables for YCSB benchmarking (ycsb-schema.json
), run the following command, replacing the contents in the angle brackets as described:
java -jar scalardb-schema-loader-<VERSION>.jar --config <PATH_TO_SCALARDB_PROPERTIES_FILE> -f ycsb-schema.json --coordinator
If you are using ScalarDB Cluster, run the following command instead:
java -jar scalardb-cluster-schema-loader-<VERSION>-all.jar --config <PATH_TO_SCALARDB_PROPERTIES_FILE> -f ycsb-schema.json --coordinator
To create tables for multi-storage YCSB benchmarking (ycsb-multi-storage-schema.json
), run the following command, replacing the contents in the angle brackets as described:
java -jar scalardb-schema-loader-<VERSION>.jar --config <PATH_TO_SCALARDB_PROPERTIES_FILE> -f ycsb-multi-storage-schema.json --coordinator
If you are using ScalarDB Cluster, run the following command instead:
java -jar scalardb-cluster-schema-loader-<VERSION>-all.jar --config <PATH_TO_SCALARDB_PROPERTIES_FILE> -f ycsb-multi-storage-schema.json --coordinator
Prepare a benchmarking configuration file
To run a benchmark, you must first prepare a benchmarking configuration file. The configuration file requires at least the locations of the workload modules to run and the database configuration.
The following is an example configuration for running the TPC-C benchmark. The ScalarDB properties file specified for config_file
should be the properties file that you created as one of the steps in Load the schema.
Alternatively, instead of using the ScalarDB properties file, you can specify each database configuration item in the .toml
file. If config_file
is specified, all other configurations under [database_config]
will be ignored even if they are uncommented.
[modules]
[modules.preprocessor]
name = "com.scalar.db.benchmarks.tpcc.TpccLoader"
path = "./build/libs/scalardb-benchmarks-all.jar"
[modules.processor]
name = "com.scalar.db.benchmarks.tpcc.TpccBench"
path = "./build/libs/scalardb-benchmarks-all.jar"
[modules.postprocessor]
name = "com.scalar.db.benchmarks.tpcc.TpccReporter"
path = "./build/libs/scalardb-benchmarks-all.jar"
[database_config]
config_file = "<PATH_TO_SCALARDB_PROPERTIES_FILE>"
#contact_points = "localhost"
#contact_port = 9042
#username = "cassandra"
#password = "cassandra"
#storage = "cassandra"
You can define parameters to pass to modules in the configuration file. For details, see the sample configuration files below and available parameters in Common parameters:
- TPC-C:
tpcc-benchmark-config.toml
- YCSB:
ycsb-benchmark-config.toml
- Multi-storage YCSB:
ycsb-multi-storage-benchmark-config.toml
Run a benchmark
Select a benchmark, and follow the instructions to run the benchmark.
- TPC-C
- YCSB
- Multi-storage YCSB
To run the TPC-C benchmark, run the following command, replacing <PATH_TO_KELPIE>
with the path to the Kelpie directory:
/<PATH_TO_KELPIE>/bin/kelpie --config tpcc-benchmark-config.toml