TPC-C

Follow the steps below to run the open-source oltpbench TPC-C workload against YugabyteDB YSQL. TPC-C is a popular online transaction processing benchmark that provides metrics you can use to evaluate the performance of YugabyteDB for concurrent transactions of different types and complexity that are either either executed online or queued for deferred execution.

Step 1. Download the TPC-C binaries

To download the TPC-C binaries, run the following commands.

  1. $ cd $HOME
  2. $ wget https://github.com/yugabyte/tpcc/releases/download/1.0/tpcc.tar.gz
  3. $ tar -zxvf tpcc.tar.gz
  4. $ cd tpcc

Step 2. Start your database

Start the database using the steps mentioned here.

Step 3. Configure connection properties

Set the following connection configurations in the workload configuration file (config/workload_1.xml).

  1. <!-- Connection details -->
  2. <dbtype>postgres</dbtype>
  3. <driver>org.postgresql.Driver</driver>
  4. <DBUrl>jdbc:postgresql://<ip>:5433/yugabyte</DBUrl>
  5. <username>yugabyte</username>
  6. <password></password>
  7. <isolation>TRANSACTION_REPEATABLE_READ</isolation>

The details of the workloads have already been populated in the sample configuration files located in the /config directory.The workload descriptor works the same way as it does in the upstream branch and details can be found in the online documentation.

Step 4. Running the TPC-C benchmark

Use the provided utility script (./tpccbenchmark) to run the TPC-C benchmark. Available options are:

  1. -c,--config &lt;arg&gt; [required] Workload configuration file
  2. --clear &lt;arg&gt; Clear all records in the database for this benchmark
  3. --create &lt;arg&gt; Initialize the database for this benchmark
  4. --dialects-export &lt;arg&gt; Export benchmark SQL to a dialects file
  5. --execute &lt;arg&gt; Execute the benchmark workload
  6. -h,--help Print this help
  7. --histograms Print txn histograms
  8. --load &lt;arg&gt; Load data using the benchmark's data loader
  9. -o,--output &lt;arg&gt; Output file (default System.out)
  10. --runscript &lt;arg&gt; Run an SQL script
  11. -s,--sample &lt;arg&gt; Sampling window
  12. -v,--verbose Display Messages

Before starting the workload, you will need to load the data first.

  1. $ ./tpccbenchmark -c config/workload_1.xml --create=true --load=true

Then, you can run the workload.

  1. $ ./tpccbenchmark -c config/workload_1.xml --execute=true -s 5 -o outputfile

You can also load and run the benchmark in a single step:

  1. $ ./tpccbenchmark -c config/workload_1.xml --create=true --load=true --execute=true -s 5 -o outputfile

The config directory has different configurations for various workloads. You can run any of those workloads by changing the configuration file.

  1. $ ./tpccbenchmark -c config/workload_2.xml --create=true --load=true --execute=true -s 5 -o outputfile

Output

The raw output is a listing of start time (in Java microseconds) and duration (microseconds) for each transaction type.

  1. transaction type (index in config file), start time (microseconds),latency (microseconds)
  2. 3,1323686190.045091,8677
  3. 4,1323686190.050116,6800
  4. 4,1323686190.055146,3221
  5. 3,1323686190.060193,1459
  6. 4,1323686190.065246,2476
  7. 4,1323686190.070348,1834
  8. 4,1323686190.075342,1904

To obtain transactions per second (TPS), you can aggregate the results into windows using the -s 1 option. The throughput and different latency measures in milliseconds are reported.

  1. time (seconds),throughput (requests/s),average,min,25th,median,75th,90th,95th,99th,max
  2. 0,200.200,1.183,0.585,0.945,1.090,1.266,1.516,1.715,2.316,12.656
  3. 5,199.800,0.994,0.575,0.831,0.964,1.071,1.209,1.424,2.223,2.657
  4. 10,200.000,0.984,0.550,0.796,0.909,1.029,1.191,1.357,2.024,35.835