Skip to content

Running load\performance test

Kevin Wooten edited this page Oct 3, 2019 · 2 revisions

Overview

Jesper Pedersen created some cool PostgreSQL tools, a couple of them (SQLLoadGenerator & Replay) have been co-opted & modified for easy performance testing and comparison of drivers.

A temporary branch, load_test, has been created that has the tools in the build along with a standard testing profile (i.e. data).

Replay

Replay is the tool for replaying data generated by SQLLoadGenerator at the end of its run it prints timing information. The Replay in the load_test branch has been modified to create a database from a source template, analyze it, and then replay the generated profile. The source template database is always named as the original with the _src suffix (e.g. <target-db>_src).

Replay's "replaying" when targeting a database named "mytest" and superuser "myuser":

  • Drops target database (e.g. DROP DATABASE mytest IF EXISTS)
  • Creates target database from template (CREATE DATABASE mytest WITH TEMPLATE mytest_src OWNER myuser)
  • Replays profile data

Configuration

Replay stores its configuration in a replay.properties that needs to be in the current working directory. The url, user & password must be present.

Credentials

Replay drops and creates databases so it essentially requires a superuser account to run correctly. The checked-in properties use pgjdbc/test but these can be changed in replay.properties.

Initialization

The source template database needs to be created and filled with initial data using. All of this is contained in the load_test branch's directory.

cd tools
psql -c "CREATE DATABASE loadtest_src"
psql -f std/ddl.sql loadtest_src
psql -f std/data.sql loadtest_src

Load Test Execution

After building the project (e.g. ./gradlew build -x test) an application distribution will be in the tools/build/distribution directory.

To execute the load test using the standard profile data:

cd tools # if you're not already there
unzip build/distributions/tools-<version>.zip
tools-<version>/bin/tools std

Driver Selection

replay.properties contains the url, and the url selects which driver is used.

The JDBC URL prefix selects the driver:

  • jdbc:pgsql - targets this (ng) driver
  • jdbc:postgresql - targets the mainline (og) driver