Database Test 5 (DBT-5) Documentation

Introduction

This document provides instructions on how to set up and use the Open Source Development Lab's Database Test 5 (DBT-5) kit. This kit is an open source fair-use implementation of the TPC Benchmark(TM) E (TPC-E) specification, which is an on-line transaction processing benchmark.

An introduction and complete details on the TPC-E can be found at: https://tpc.org/tpce/

Design

DBT-5 implements the workload with three binaries: BrokerageHouse, MarketExchange, and Driver.

BrokerageHouse

BrokerageHouse is responsible for executing all of the database transactions. It implements the EGenTxnHarness and EGenDriverDM.

MarketExchange

MarketExchange emulates stock exchanges and sends messages to the BrokerageHouse for initial Trade Request and Mark Feed transactions. It implements the EGenDriverMEE.

Driver

Driver emulates customers and drives the workload. It implements EGenDriverCE.

Installing DBT-5

The latest stable and development version of the kit can be found on GitHub: https://github.com/osdldbt/dbt5

The TPC's TPC-E Tools cannot be redistributed with DBT-5 and must be downloaded separately from: https://www.tpc.org/tpc_documents_current_versions/current_specifications5.asp

Required Software

In addition to the database management system software, the following is also required:

Optional software:

User's Guide

Building TPC-E Tools

Download the TPC-E Tools directly from the TPC: https://www.tpc.org/tpc_documents_current_versions/current_specifications5.asp

The kit requires the TPC-E Tools to be built for the specific database management system to be tested. The TPC-E Tools is developed in such a way that it needs to rebuilt or another copy needs to be built if a different database management system is to be tested.

DBT-5 provides a script to apply patches and code to compile the TPC-E Tools. The patches that are applied are minor code changes and code is supplied to build sponsor supplied code.

For example, to build the TPC-E Tools for PostgreSQL (pgsql), unzip the TPC-E Tools zip file into an empty directory and run dbt5-build-egen against the resulting directory:

mkdir /tmp/egen
cd /tmp/egen
unzip /path/to/*-tpc-e-tool.zip
dbt5-build-egen /tmp/egen

Database Management System Notes

PostgreSQL

Building the Kit

Developed against PostgreSQL 8.4 and newer. May work with older versions but not quite tested.

By default, the kit will use PL/pgsql stored functions, but you may use C stored functions instead or have the transaction logic be executed on the client-size. The C stored functions need to be separately built and installed on the database system before they can be used by the database:

cd storedproc/pgsql/c
make
make install
dbt5 pgsql-load-stored-procs -t c

Configuration

The transaction code expects PostgreSQL to use its default datestyle of 'iso, dmy'.

Build the Database

To build the minimum sized database in a database dbt5:

dbt5 build --tpcetools=/tmp/egen pgsql

Run a Test

Run a quick 120 second (2 minute) test with 1 user:

dbt5 run -d 120 pgsql /tmp/results

Performance Testing

There are many additional performance testing scenarios beyond using this workload as defined by the TPC specification. This sections describes some of them.

Database Connection Scaling

This test is performed by the test-user-scaling script.

The purpose of this test is determine how many users, or database connections, are needed to get as much throughput as possible out of the system.

This script is run a series of tests starting with 1 user up to the number of detected processors of the driver system, adding 1 user per step in the series. The script is primarily intended to be run in a 1-tier system configuration, but may be run in a 2-tier configuration and may needs some additional intelligence or options for that.

Each step in the series will spend 1 minute to warm up and establish all connections to the database, then run for an additional 5 minutes and stop before starting the next test in the series. The warm up time and test duration can be varied.

At the end of the test, the script will create a bar plot of the reported metric of each test vs. the number of users. The sar data from all the tests will be aggregated and plotted.

Here are some examples plots from a system with 4 logical processors where it spend 1 minute warming up before running another 5 minutes.

test-user-scaling/trpu.png

Connection Scaling Transaction Rates per user

test-user-scaling/t9-transaction-rate.png

Connection Scaling Transaction Rates

test-user-scaling/sar-cpu-agg-busy.png

Connection Scaling Processor Utilization

Database Parameter Effects

This test is performed by the test-db-param script.

The purpose of this test is to evaluate the effects of a changing a single database parameter.

This script must be used with a configuration file and cannot currently be controlled with just command line arguments.

The configure file must contain the following details in addition to any other required configuration parameter (see configuration instructions in User Guide section of the documentation):

  1. database start command

  2. database stop command

  3. database parameter name

  4. database parameter values to test

Here is an example for PostgreSQL that is testing 3 difference values for shared_buffers:

db_start_command = "pg_ctl -D /tmp/pgdata start"
db_stop_command = "pg_ctl -D /tmp/pgdata stop -m fast"
db_param_name = "shared_buffers"
db_param_values = ["1GB", "2GB", "3GB"]

At the end of the test, the script will create a bar plot of the reported metric of each test vs. the value of database parameter being evaluated. The sar data from all the tests will be aggregated and plotted, as shown in the Database Parameter Effects section.

Here is an example plot of the above example.

test-db-param/trpp.png

Evaluating PostgreSQL shared_buffers

Developer Guide

This document is for detailing anything related to the development of this test kit.

Building the Kit

CMake is build system used for this kit. A Makefile.cmake is provided to automate some of the tasks.

Building for debugging:

make -f Makefile.cmake debug

Building for release:

make -f Makefile.cmake release

Building source packages:

make -f Makefile.cmake package

See the AppImage section for details on building an AppImage. There are additional requirements for the appimage target in the Makefile.cmake. Alternatively, the kit provides scripts in the tools diretory to create a container that can create an AppImage.

AppImage

AppImages are only for Linux based systems: https://appimage.org/

The AppImageKit AppImage can be downloaded from: https://github.com/AppImage/AppImageKit/releases

It is recommended to build AppImages on older distributions: https://docs.appimage.org/introduction/concepts.html#build-on-old-systems-run-on-newer-systems

The logo used is the number "5" from the Freeware Metal On Metal Font.

See the README.rst in the tools/ directory for an example of creating an AppImage with a Podman container.

Building the AppImage

The AppImages builds a custom minimally configured PostgreSQL build to reduce library dependency requirements. Part of this reason is to make it easier to include libraries with compatible licences. At least version PostgreSQL 11 should be used for the pg_type_d.h header file.

At the time of this document, PostgreSQL 11 was configured with the following options:

./configure --without-ldap --without-readline --without-zlib \
      --without-gssapi --with-openssl

Don't forget that both PATH and LD_LIBRARY_PATH may need to be set appropriately depending on where the custom build of PostgreSQL is installed.

Including TPC-E Tools in the AppImage

Review the TPC EULA for redistribution of TPC provided code and binaries before redistributing any AppImages that include any TPC provided code or binaries: https://www.tpc.org/tpc_documents_current_versions/current_specifications5.asp

In the source directory, create the subdirectory egen and unzip the TPC-E tools into it:

mkdir egen
cd egen
unzip /tmp/*-tpc-e-tool.zip

Two scripts are provided, one to create a container for building the AppImage and one to building the AppImage:

EGEN=tpc-e-tool.zip tools/build-appimage-container
EGEN=tpc-e-tool.zip tools/build-appimage

The environment variable EGEN must be set to location and name of the TPC-E Tools zip file otherwise the AppImage will be created without the TPC-E tools included.

When the TPC-E Tools are included in the AppImage, the build and run commands do not need the use of the --tpcetools flag and will automatically use the included TPC-E Tools binaries.