Practitioners face challenges during load testing of Tantor Postgres databases using pgbench, primarily due to insufficient documentation of the testing environment, leading to non-representative results and the need for repeated tests. The pg_perfbench tool has been developed to address these issues by ensuring repeatability, safeguarding data, and simplifying result comparisons through a cohesive template. It automates pgbench execution, collects metadata about the testing environment, and generates structured reports.
pgbench operates on a TPC-B model, providing performance metrics such as transactions per second (tps), average latency, and the number of processed and failed transactions. A Bash script can be used to automate pgbench tests with varying client numbers, logging results into separate files.
The pg_perfbench tool captures extensive data regarding the database environment and generates reports that include system properties, common database information, benchmark details, and test results. It facilitates the comparison of multiple load test results and ensures that environments being compared are consistent in terms of PostgreSQL versions and system parameters.
The tool also allows for the evaluation of performance impacts from changes to PostgreSQL settings by generating separate reports for different configurations. It verifies compliance of specified parameters before joining reports, ensuring accurate comparisons. The final reports are structured in JSON and HTML formats, enhancing analysis and collaboration efforts.