Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
135549: drtprod: drt-test example yaml changes r=vidit-bhat a=nameisbhaskar

I have made some changes to  the drt-test script to make it better for demo purpose. Also, I have made some minor tweaks in the scripts to make it more robust

Epic: none
Release note: None

Co-authored-by: Bhaskarjyoti Bora <[email protected]>
  • Loading branch information
craig[bot] and nameisbhaskar committed Nov 18, 2024
2 parents 3397bc5 + f07e9d5 commit 3d083fe
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 30 deletions.
132 changes: 105 additions & 27 deletions pkg/cmd/drtprod/configs/drt_test.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,95 @@
# Yaml to create a test-cluster. Please make sure that you change the cluster names to avoid conflicts.
environment:
ROACHPROD_GCE_DEFAULT_PROJECT: cockroach-ephemeral
ROACHPROD_GCE_DEFAULT_SERVICE_ACCOUNT: [email protected]
ROACHPROD_DNS: drt.crdb.io
ROACHPROD_GCE_DNS_DOMAIN: drt.crdb.io
ROACHPROD_GCE_DNS_ZONE: drt
ROACHPROD_GCE_DEFAULT_PROJECT: cockroach-drt
CLUSTER: drt-test
WORKLOAD_CLUSTER: workload-test
CLUSTER_NODES: 3
WORKLOAD_NODES: 1

targets:
# crdb cluster specs
- target_name: $CLUSTER
steps:
- command: create
args:
- $CLUSTER
flags:
clouds: gce
nodes: 1
username: drt
gce-machine-type: n2-standard-2
gce-use-spot: true
on_rollback:
- command: destroy
- command: create
args:
- $CLUSTER
- command: stage
args:
- $CLUSTER
- cockroach
- command: start
args:
- $CLUSTER
flags:
clouds: gce
gce-managed: true
gce-enable-multiple-stores: true
gce-zones: "us-central1-a"
nodes: $CLUSTER_NODES
gce-machine-type: n2-standard-2
username: drt
on_rollback:
- command: destroy
args:
- $CLUSTER
- command: sync
flags:
clouds: gce
- command: stage
args:
- $CLUSTER
- cockroach
- script: "pkg/cmd/drtprod/scripts/setup_datadog_cluster"
- command: start
args:
- $CLUSTER
- "--binary"
- "./cockroach"
flags:
# add flag to set provisioned throughput on each store according to their cloud provider limits
enable-fluent-sink: true
restart: false
sql-port: 26257
- command: run
args:
- $CLUSTER
- --
- "sudo systemctl unmask cron.service ; sudo systemctl enable cron.service ; echo \"crontab -l ; echo '@reboot sleep 100 && ~/cockroach.sh' | crontab -\" > t.sh ; sh t.sh ; rm t.sh"
# workload cluster specs
- target_name: $WORKLOAD_CLUSTER
steps:
- command: create
args:
- $WORKLOAD_CLUSTER
flags:
nodes: 1
username: workload
on_rollback:
- command: destroy
- command: create
args:
- $WORKLOAD_CLUSTER
flags:
clouds: gce
gce-zones: "us-central1-a"
nodes: $WORKLOAD_NODES
gce-machine-type: n2-standard-2
os-volume-size: 100
username: workload
on_rollback:
- command: destroy
args:
- $WORKLOAD_CLUSTER
- command: sync
flags:
clouds: gce
- command: stage
args:
- $WORKLOAD_CLUSTER
- cockroach
- command: stage
args:
- $WORKLOAD_CLUSTER
- workload
- script: "pkg/cmd/drtprod/scripts/setup_datadog_workload"
- target_name: post_tasks
dependent_targets:
- $CLUSTER
- $WORKLOAD_CLUSTER
steps:
- script: rm
args:
- -rf
- certs-$CLUSTER
- command: get
args:
- $CLUSTER:1
Expand All @@ -59,3 +107,33 @@ targets:
- chmod
- 600
- './certs/*'
- command: put
args:
- $WORKLOAD_CLUSTER
- artifacts/roachprod
- roachprod
- command: put
args:
- $WORKLOAD_CLUSTER
- artifacts/roachtest
- roachtest-operations
- script: "pkg/cmd/drtprod/scripts/tpcc_init.sh"
args:
- cct_tpcc_1k # suffix added to script name tpcc_init_cct_tpcc_400k.sh
- true # determines whether to execute the script immediately on workload node
flags:
warehouses: 1000
db: cct_tpcc
- script: "pkg/cmd/drtprod/scripts/generate_tpcc_run.sh"
args:
- cct_tpcc_1k # suffix added to script name tpcc_run_400k.sh
- false # determines whether to execute the script immediately on workload node
flags:
db: cct_tpcc
warehouses: 1000
max-rate: 100
workers: 50
conns: 100
duration: 12h
ramp: 10m
wait: 0
4 changes: 4 additions & 0 deletions pkg/cmd/drtprod/scripts/generate_tpcc_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ if [ -z "${WORKLOAD_NODES}" ]; then
exit 1
fi

absolute_path=$(roachprod run "${WORKLOAD_CLUSTER}":1 -- "realpath ./cockroach")
pwd=$(roachprod run "${WORKLOAD_CLUSTER}":1 -- "dirname ${absolute_path}")
# Prepare PGURLS
PGURLS=$(roachprod pgurl $CLUSTER | sed s/\'//g)

Expand Down Expand Up @@ -72,5 +74,7 @@ EOF
roachprod ssh $WORKLOAD_CLUSTER:$NODE -- "chmod +x tpcc_run_${suffix}.sh"
if [ "$execute_script" = "true" ]; then
roachprod run "${WORKLOAD_CLUSTER}":1 -- "sudo systemd-run --unit tpcc_run_${suffix} --same-dir --uid \$(id -u) --gid \$(id -g) bash ${pwd}/tpcc_run_${suffix}.sh"
else
echo "Run --> roachprod run "${WORKLOAD_CLUSTER}":1 -- \"sudo systemd-run --unit tpcc_run_${suffix} --same-dir --uid \\\$(id -u) --gid \\\$(id -g) bash ${pwd}/tpcc_run_${suffix}.sh\""
fi
done
2 changes: 1 addition & 1 deletion pkg/cmd/drtprod/scripts/generate_tpch_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if [ -z "${WORKLOAD_CLUSTER}" ]; then
exit 1
fi

absolute_path=$(roachprod run "${WORKLOAD_CLUSTER}":1 -- "realpath ./tpch_run_${suffix}.sh")
absolute_path=$(roachprod run "${WORKLOAD_CLUSTER}":1 -- "realpath ./cockroach")
pwd=$(roachprod run "${WORKLOAD_CLUSTER}":1 -- "dirname ${absolute_path}")
PGURLS=$(roachprod pgurl "${CLUSTER}":1)

Expand Down
4 changes: 3 additions & 1 deletion pkg/cmd/drtprod/scripts/tpcc_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if [ -z "${WORKLOAD_CLUSTER}" ]; then
exit 1
fi

absolute_path=$(roachprod run "${WORKLOAD_CLUSTER}":1 -- "realpath ./tpcc_init_${suffix}.sh")
absolute_path=$(roachprod run "${WORKLOAD_CLUSTER}":1 -- "realpath ./cockroach")
pwd=$(roachprod run "${WORKLOAD_CLUSTER}":1 -- "dirname ${absolute_path}")
PGURLS=$(roachprod pgurl "${CLUSTER}":1)

Expand All @@ -50,4 +50,6 @@ roachprod ssh "${WORKLOAD_CLUSTER}":1 -- "chmod +x tpcc_init_${suffix}.sh"

if [ "$execute_script" = "true" ]; then
roachprod run "${WORKLOAD_CLUSTER}":1 -- "sudo systemd-run --unit tpcc_init_${suffix} --same-dir --uid \$(id -u) --gid \$(id -g) bash ${pwd}/tpcc_init_${suffix}.sh"
else
echo "Run --> roachprod run "${WORKLOAD_CLUSTER}":1 -- \"sudo systemd-run --unit tpcc_init_${suffix} --same-dir --uid \\\$(id -u) --gid \\\$(id -g) bash ${pwd}/tpch_init_${suffix}.sh\""
fi
2 changes: 1 addition & 1 deletion pkg/cmd/drtprod/scripts/tpch_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if [ -z "${WORKLOAD_CLUSTER}" ]; then
exit 1
fi

absolute_path=$(roachprod run "${WORKLOAD_CLUSTER}":1 -- "realpath ./tpch_init_${suffix}.sh")
absolute_path=$(roachprod run "${WORKLOAD_CLUSTER}":1 -- "realpath ./cockroach")
pwd=$(roachprod run "${WORKLOAD_CLUSTER}":1 -- "dirname ${absolute_path}")
PGURLS=$(roachprod pgurl "${CLUSTER}":1)

Expand Down

0 comments on commit 3d083fe

Please sign in to comment.