Benchmarking is one of the best ways to ensure the ongoing performance of your Postgres database, providing vital insights that can prove incredibly useful when growing and scaling. Luckily there are a range of tools that can help with effective and efficient benchmarking.
This blog post explores whether a complex benchmark like the TPC Benchmark (TM) C (TPC-C) can be easier to run like the much simpler TPC Benchmark (TM) B (TPC-B) with the help of AppImage packaging.
pgbench, a PostgreSQL specific fair-use implementation of the retired TPC-B, is a tool provided with Postgres that people use because it's easy to get, set up and run. Allow me to reproduce some existing information about how to easily use pgbench in 3 short and simple steps when PostgreSQL is already up and running:
- Create a database pgbench:
- Initialize (or load) the database with default sizing parameters:
- Run a test with default parameters:
There are a number of fair-use TPC-C implementations out there such as HammerDB, BenchBase, and DBT-2 to name just a few. Can any of these be just as simple to use?
I think so! An experiment with creating an AppImage might help us take a step in that direction if you have a Linux based system to run the AppImage on, but the database can be on another system, like with pgbench.
Let's see how that works with this DBT-2 AppImage proof-of-concept.
- Build a database called dbt2:
- Run a 120 second (2 minute) test using easy mode:
- Generate a summary of the results (careful, there may be other mix-*.log files in the current directory depending on how many times dbt2 has been run and depending on how many processors are on the system):
Three steps seem to be on par with pgbench, but there is still some room for improvement around how many command line parameters are really needed.