Skip to content

Instantly share code, notes, and snippets.

@gautammenghani
Last active March 12, 2024 11:55
Show Gist options
  • Select an option

  • Save gautammenghani/599fd7506dac1870b6dced65a17d06f9 to your computer and use it in GitHub Desktop.

Select an option

Save gautammenghani/599fd7506dac1870b6dced65a17d06f9 to your computer and use it in GitHub Desktop.
steps to run phoronix pgbench

NOTE: Run all below steps as root

  1. Get phoronix test suite
# git clone https://github.com/phoronix-test-suite/phoronix-test-suite.git
  1. Install dependencies
# dnf install -y libicu libicu-devel pkgconf-pkg-config php-cli php-xml php-json unzip
  1. Do a sanity run to install the test
# cd phoronix-test-suite
# FORCE_TIMES_TO_RUN=1 ./phoronix-test-suite benchmark run pgbench

NOTE: When running the benchmark, you will be prompted for params to pgbench. Input in this order - 2,2,1,n (these don't matter as we will edit the script for our purpose below)

  1. Modify the pgbench script located at /var/lib/phoronix-test-suite/installed-tests/pts/pgbench-1.14.0/pgbench
// Original default line to be changed
pg_/bin/pgbench --protocol=prepared -j $NUM_CPU_CORES $@ -n -T 45 -r pgbench >>$LOG_FILE 2>&1

// Edited line we need for our run
pg_/bin/pgbench --protocol=prepared -j $NUM_CPU_CORES -s 100 -c $NUM_CPU_CORES -N -n -T 120 -r pgbench >>$LOG_FILE 2>&1
  1. Paste the wrapper script to run the test easily
# cd phoronix-test-suite
# cat run.sh

#!/bin/bash

if [ $# -ne 1 ];
then
  ./phoronix-test-suite benchmark run pgbench
else
  FORCE_TIMES_TO_RUN=$1 ./phoronix-test-suite benchmark run pgbench
fi
  1. Set the governor to perf
# echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
  1. Run the benchmark
// To benchmark, run the wrapper script without args
# ./run.sh

// To run it only n number of times, invoke it with the number of runs
# ./run.sh 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment