Skip to main content
HammerDB is the open-source database benchmark hosted by the TPC-Council on GitHub. It supports VillageSQL as its own database, with two workloads: TPROC-C, an OLTP workload derived from the TPC-C specification, and TPROC-H, an analytic workload derived from TPC-H. This guide uses Docker to run TPROC-C against a VillageSQL server.

Prerequisites

  • Docker. Both the VillageSQL server and HammerDB run in containers, so you don’t install either one on the host.
  • About 5 GB of free disk space: about 2 GB for the two images, and about 3 GB for the data that the test below writes. Most of that data is the server’s binary log, which grows with the length of the run.

Start a VillageSQL server

Create a Docker network so that the HammerDB container can reach the server by name, then start the server on it:
The server takes a few seconds to initialize. It’s ready when this command prints a version:
To benchmark a server you already run, skip this step. Set vsql_host, vsql_user, and vsql_pass in the scripts below to that server’s address and credentials, and drop --network hammerdb-net from the HammerDB commands.

Write the HammerDB scripts

HammerDB runs from its command-line interface, hammerdbcli, which reads a script of settings and commands. Create a folder for the scripts:
Save this as build.tcl. It builds the TPROC-C schema in a database named tpcc:
Save this as run.tcl. It runs a timed test: one minute of ramp-up, then two minutes of measurement, with four virtual users:
dbset db vsql selects VillageSQL. The five ssl lines turn on TLS without certificate files. The root account authenticates with caching_sha2_password, which needs an encrypted connection over TCP, and HammerDB’s default certificate folder, /etc/mysql/certs, doesn’t exist in the image.

Build the schema

Run build.tcl from the HammerDB VillageSQL image, with the scripts folder mounted:
Each virtual user loads warehouses, then HammerDB creates the stored procedures and gathers statistics. The build ends with these lines:
HammerDB prints ALL VIRTUAL USERS COMPLETE even when the build fails, so look for FINISHED FAILED in the output. If it’s there, see Troubleshooting.

Run the test

After the ramp-up and the timed run, HammerDB prints the result:
NOPM (new orders per minute) is HammerDB’s recommended primary metric. HammerDB measures it from the test schema itself, so it doesn’t depend on how a particular database counts transactions. HammerDB results are not TPC-C results. Don’t compare them with published TPC-C results or report them as tpmC.

Scale the test

The test above checks that the setup works. To measure a server, raise these settings: The HammerDB documentation covers every TPROC-C setting, the TPROC-H workload, and the HammerDB GUI.

Troubleshooting

Clean up

Remove the server container with its data volume, and the network:

See also