Skip to content

Commit

Permalink
Add a --shard-count argument to build-and-run.sh
Browse files Browse the repository at this point in the history
The README suggests using a shard count that is divisible by the number
of nodes in your cluster. This is good advice, but we did not allow
changing the shardcount that we set by default.
  • Loading branch information
JelteF committed Dec 20, 2021
1 parent ccdc7d4 commit d7ec696
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mkdir -p results/
psql -v "ON_ERROR_STOP=1" -f sql/drop-tables.sql

# set Citus configurations
psql -c "ALTER ROLE current_user SET citus.shard_count TO 40" 2>/dev/null || true
psql -c "ALTER ROLE current_user SET citus.shard_count TO $SHARD_COUNT" 2>/dev/null || true
psql -c "ALTER ROLE current_user SET citus.enable_repartition_joins to on" 2>/dev/null || true

# build hammerdb related tables
Expand Down
52 changes: 44 additions & 8 deletions parse-arguments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,41 @@ set -e
# fail if a command that is piped fails
set -o pipefail

helpstring="usage: [--hammerdb-version[=]<version>] [--ch|--ch-queries-only] [--no-citus] [--name[=]name]"
helpstring="Usage: [--hammerdb-version[=]<version>] [--ch|--ch-queries-only] [--no-citus] [--name[=]name] --shard-count=<shard_count>
--hammerdb-version What version of HammerDB to use to run the benchmark.
To be able to run Citus benchmarks it is required to
use '4.3-custom' here. All other versions only work for
standard postgres benchmarks.
default: 4.3-custom
--ch Run both HammerDB TPROC-C and CH-benCHmark queries at
the same time.
--ch-queries-only Run only CH-benCHmark queries (so don't run HammerDB
TPROC-C queries
--no-citus Build the dataset and run the benchmark for standard
Postgres instead of for Citus. This also requires
setting pg_cituscompat to false in run.tcl
--name The name you want to give to the benchmark run. This
determines the filenames in the results directory.
default: timestamp of start of benchmark
--shard-count The amount of shards each distributed table should
have. It's important to make sure that this is
divisible by the number of worker nodes that you have,
otherwise the load will not be evenly spread across
nodes.
default: 48
"

IS_CH_ONLY=${IS_CH_ONLY:-false}
IS_CH_AND_TPCC=${IS_CH_AND_TPCC:-false}
IS_TPCC=${IS_TPCC:-true}
IS_CH=${IS_CH:-false}
IS_CITUS=${IS_CITUS:-true}
SHARD_COUNT=${SHARD_COUNT:-48}
isodate=$(date +"%Y-%m-%dT%H:%M:%S")
BENCHNAME=${BENCHNAME:-${isodate}}
HAMMERDB_VERSION=${HAMMERDB_VERSION:-4.3-custom}
SHARD_COUNT=${SHARD_COUNT:-48}

# inspired by: https://stackoverflow.com/a/7680682/2570866
optspec=":h-:"
Expand All @@ -25,8 +53,8 @@ while getopts "$optspec" optchar; do
echo "error: --hamerdb-version requires argument" >&2
exit 2
fi
HAMMERDB_VERSION="${!OPTIND}"; OPTIND=$(( OPTIND + 1 ))
BENCHNAME="$OPTARG"
HAMMERDB_VERSION="${!OPTIND}"
OPTIND=$(( OPTIND + 1 ))
;;
hammerdb-version=*)
HAMMERDB_VERSION=${OPTARG#*=}
Expand All @@ -36,7 +64,19 @@ while getopts "$optspec" optchar; do
echo "error: --name requires argument" >&2
exit 2
fi
BENCHNAME="${!OPTIND}"; OPTIND=$(( OPTIND + 1 ))
BENCHNAME="${!OPTIND}"
OPTIND=$(( OPTIND + 1 ))
;;
name=*)
BENCHNAME=${OPTARG#*=}
;;
name)
if [ -z ${!OPTIND+x} ]; then
echo "error: --shard-count requires argument" >&2
exit 2
fi
SHARD_COUNT="${!OPTIND}"
OPTIND=$(( OPTIND + 1 ))
;;
name=*)
BENCHNAME=${OPTARG#*=}
Expand Down Expand Up @@ -88,10 +128,6 @@ if [ -z "${PGPASSWORD+x}" ]; then
fi
export PGPASSWORD=${PGPASSWORD}

isodate=$(date +"%Y-%m-%dT%H:%M:%S")
BENCHNAME=${BENCHNAME:-${isodate}}
HAMMERDB_VERSION=${HAMMERDB_VERSION:-4.3-custom}

# Only parse the variables once and then export them to any nested scripts,
# this way the BENCHNAME is the same for both the build and the run when
# sourcing parse-arguments.sh from build-and-run.sh.
Expand Down

0 comments on commit d7ec696

Please sign in to comment.