Skip to content

Commit

Permalink
Add slo change expt.
Browse files Browse the repository at this point in the history
  • Loading branch information
amlatyrngom committed Apr 26, 2024
1 parent 9d68ec6 commit 4ca9d6e
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 4 deletions.
22 changes: 22 additions & 0 deletions experiments/15-e2e-scenarios-v2-baselines/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,28 @@ function start_txn_runner() {
runner_pid=$!
}

function start_txn_runner_serial() {
t_clients=$1

>&2 echo "[Serial Transactions] Running with $t_clients..."
results_dir=$EXPT_OUT/t_${t_clients}
mkdir -p $results_dir

local args=(
--num-clients $t_clients
--output-dir $results_dir
--baseline $TRANSACTION_ENGINE
)

log_workload_point "txn_${t_clients}"
python3 workloads/IMDB_extended/run_transactions_serial.py \
"${args[@]}" &

# This is a special return value variable that we use.
runner_pid=$!
}


function extract_named_arguments() {
# Evaluates any environment variables in this script's arguments. This script
# should only be run on trusted input.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#! /bin/bash

EXPT_OUT="expt_out"
ANALYTICS_ENGINE="tidb"
TRANSACTION_ENGINE="tidb"
script_loc=$(cd $(dirname $0) && pwd -P)
# total_first_phase_time_s=$(( 10 * 60 ))
total_first_phase_time_s=$(( 30 ))
# total_second_phase_time_s=$(( 60 * 60 ))
total_second_phase_time_s=$(( 60 ))
source $script_loc/../common.sh

# Arguments:
# --system-config-file
# --physical-config-file
# --query-indexes
extract_named_arguments $@

# Just fo testing.
echo "Query indexes"
echo $ra_query_indexes
echo "rana Query Bank"
# Check file and exit if not exists
ls $ra_query_bank_file || exit 1
echo "Seq Query Bank"
ls $seq_query_bank_file || exit 1


log_workload_point "clients_starting"
# 12 clients, offset 20 (for the transactional clients)
start_repeating_olap_runner 12 5 2 $ra_query_indexes "ra_8" 20
rana_pid=$runner_pid

start_txn_runner_serial 20 # Implicit: --dataset-type
txn_pid=$runner_pid

log_workload_point "clients_started"

function inner_cancel_experiment() {
cancel_experiment $rana_pid $txn_pid
}

trap "inner_cancel_experiment" INT
trap "inner_cancel_experiment" TERM

# Sleep for 10 minutes and then change the SLOs.
sleep $total_first_phase_time_s

# No SLO Change on Baselines.
log_workload_point "second_phase_no_slo_change"

# Wait another hour before stopping.
sleep $total_second_phase_time_s

# Shut down everything now.
log_workload_point "experiment_workload_done"
>&2 echo "Experiment done. Shutting down runners..."
graceful_shutdown $rana_pid $txn_pid
log_workload_point "shutdown_complete"
6 changes: 6 additions & 0 deletions experiments/15-e2e-scenarios-v2-baselines/slo_change/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
script_loc=$(cd $(dirname $0) && pwd -P)
export seq_query_bank_file="workloads/IMDB_100GB/adhoc_test/queries.sql"
export ra_query_bank_file="workloads/IMDB_100GB/regular_test/queries.sql"
bash $script_loc/run_workload.sh \
--ra-query-indexes="99,56,32,92,91,49,30,83,94,38,87,86,76,37,31,46,58,61,62,64,69,73,74,51,57,60" \
--ra-query-bank-file=$ra_query_bank_file
21 changes: 17 additions & 4 deletions workloads/IMDB_extended/run_transactions_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ def noop_handler(_signal, _frame):
db = connect_to_db(
args, worker_idx, direct_engine=Engine.Aurora, directory=directory
)
db.execute_sync(
f"SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL {args.isolation_level}"
)
if args.baseline != "tidb":
db.execute_sync(
f"SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL {args.isolation_level}"
)
except BradClientError as ex:
logger.error("[T %d] Failed to connect to BRAD: %s", worker_idx, str(ex))
start_queue.put_nowait(STARTUP_FAILED)
Expand All @@ -90,7 +91,7 @@ def noop_handler(_signal, _frame):

out_dir = cond.get_output_path()
else:
out_dir = pathlib.Path(".")
out_dir = pathlib.Path(f"./{args.output_dir}").resolve()

verbose_log_dir = out_dir / "verbose_logs"
verbose_log_dir.mkdir(exist_ok=True)
Expand Down Expand Up @@ -330,6 +331,18 @@ def main():
parser.add_argument("--brad-port", type=int, default=6583)
parser.add_argument("--num-front-ends", type=int, default=1)
parser.add_argument("--serverless-aurora", action="store_true")
parser.add_argument(
"--baseline",
default="",
type=str,
help="Whether to use tidb, aurora or redshift",
)
parser.add_argument(
"--output-dir",
type=str,
default=".",
help="Environment variable that stores the output directory of the results",
)
args = parser.parse_args()

set_up_logging()
Expand Down

0 comments on commit 4ca9d6e

Please sign in to comment.