Skip to content

Commit a7c8b80

Browse files
author
Yevgeniy Miretskiy
committed
Support separate workload binary.
Add ability to specify workload binary independently of cockroach binary. The `-W` (capital 'W') flag added to each driver script overrides default binary to use.
1 parent 313c802 commit a7c8b80

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

cmd/generate.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ function load_cockroach() {
144144
echo "WARN: staging unknown version of cockroach binary from local path: $cockroach_binary"
145145
roachprod put "$1" "$cockroach_binary" "cockroach"
146146
fi
147+
148+
if [ -n "$workload_binary" ]
149+
then
150+
echo "Staging $workload_binary as cockroach workload command"
151+
roachprod put "$1" "$workload_binary" "cockroach_workload"
152+
fi
147153
}
148154
149155
# Start cockroach cluster on nodes [1-NODES-1].
@@ -457,7 +463,7 @@ function destroy_cluster() {
457463
458464
function usage() {
459465
echo "$1
460-
Usage: $0 [-b <bootstrap>]... [-w <workload>]... [-d] [-c cockroach_binary]
466+
Usage: $0 [-b <bootstrap>]... [-w <workload>]... [-d] [-c cockroach_binary] [-W workload_binary]
461467
-b: One or more bootstrap steps.
462468
-b create: creates cluster
463469
-b upload: uploads required scripts
@@ -472,6 +478,7 @@ Usage: $0 [-b <bootstrap>]... [-w <workload>]... [-d] [-c cockroach_binary]
472478
-w tpcc: Benchmark TPCC
473479
-w all : All of the above
474480
-c: Override cockroach binary to stage (local path to binary or release version)
481+
-W: Override workload binary to stage (local path only).
475482
-r: Do not start benchmarks specified by -w. Instead, resume waiting for their completion.
476483
-I: additional IO benchmark arguments
477484
-F: additional IO Fsync benchmark arguments
@@ -498,6 +505,7 @@ tpcc_extra_args='{{with $arg := .BenchArgs.tpcc}}{{$arg}}{{end}}'
498505
intra_az_net_extra_args='{{with $arg := .BenchArgs.net}}{{$arg}}{{end}}'
499506
cross_region_net_extra_args='{{with $arg := .BenchArgs.cross_region_net}}{{$arg}}{{end}}'
500507
cockroach_binary=''
508+
workload_binary=''
501509
502510
while getopts 'c:b:w:dn:I:F:N:C:T:R:r' flag; do
503511
case "${flag}" in
@@ -515,6 +523,7 @@ while getopts 'c:b:w:dn:I:F:N:C:T:R:r' flag; do
515523
esac
516524
;;
517525
c) cockroach_binary="${OPTARG}" ;;
526+
W) workload_binary="${OPTARG}" ;;
518527
w) case "${OPTARG}" in
519528
cpu) benchmarks+=("bench_cpu") ;;
520529
io) benchmarks+=("bench_io") ;;

scripts/gen/tpcc.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ exec &> >(tee -a "$logdir/script.log")
7878

7979
cd "$HOME"
8080

81+
workload_binary="./cockroach"
82+
if [ -f "./cockroach_workload" ]; then
83+
echo "Using cockroach_workload binary for workload generation"
84+
workload_binary="./cockroach_workload"
85+
fi
86+
8187
if [ -z "$f_skip_load" ]
8288
then
8389
#./cockroach sql --insecure --url "${pgurls[0]}" -e "
@@ -88,7 +94,7 @@ then
8894
# SET CLUSTER SETTING admission.sql_sql_response.enabled=false;
8995
#";
9096
echo "Loading TPCC fixture for $f_warehouses warehouses ..."
91-
./cockroach workload fixtures load tpcc --checks=false --warehouses="$f_warehouses" $f_load_args "${pgurls[0]}"
97+
$workload_binary workload fixtures load tpcc --checks=false --warehouses="$f_warehouses" $f_load_args "${pgurls[0]}"
9298
echo "done loading"
9399
fi
94100

@@ -115,6 +121,6 @@ echo "num_servers:$num_nodes, num_vcpu_per_node:$num_vcpu_per_node, conns=$((num
115121
# See also: https://www.cockroachlabs.com/docs/stable/recommended-production-settings.html#connection-pooling
116122

117123
report="${logdir}/tpcc-results-$f_active.txt"
118-
./cockroach workload run tpcc \
124+
$workload_binary workload run tpcc \
119125
--warehouses="$f_warehouses" --active-warehouses="$f_active" --conns=$((num_vcpu_per_node * num_servers * 4)) --ramp=5m --duration="$f_duration" --tolerate-errors --wait=0 \
120126
"${pgurls[@]}" > "$report"

0 commit comments

Comments
 (0)