Skip to content

Commit 25f678b

Browse files
author
Can Gokmen
committed
Created a script that tests all tree types with varying N
1 parent 84c3fdd commit 25f678b

1 file changed

Lines changed: 82 additions & 0 deletions

File tree

tpcc/run_tpcc_experiments.sh

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/bin/bash
2+
# Run insertion/query experiments on the TPC-C workload across tree types and dataset sizes.
3+
# Results are written as CSV to results/tpcc_results_<timestamp>.csv
4+
# Run from the repo root: bash tpcc/run_tpcc_experiments.sh
5+
6+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7+
REPO_ROOT="$(dirname "$SCRIPT_DIR")"
8+
9+
SUFFIX=$(date +"%Y%m%d_%H%M%S")
10+
RESULTSDIR="$SCRIPT_DIR/results"
11+
RESULTS="${RESULTSDIR}/tpcc_results_${SUFFIX}.csv"
12+
LOGDIR="${RESULTSDIR}/tpcc_logs_${SUFFIX}"
13+
14+
mkdir -p "$LOGDIR"
15+
16+
echo "N,tree_type,insertion_time_ns,query_time_ns" > "$RESULTS"
17+
18+
# Path to the generated TPC-C workload file
19+
INPUT_FILE="$SCRIPT_DIR/benchmarksql_workdir/workload.txt"
20+
21+
if [ ! -f "$INPUT_FILE" ]; then
22+
echo "ERROR: workload file not found at $INPUT_FILE"
23+
echo "Run tpcc/gen_tpcc.py first to generate it."
24+
exit 1
25+
fi
26+
27+
# Dataset sizes to test (must be <= number of rows in INPUT_FILE)
28+
TEST_SIZES=(1000000 5000000 10000000 50000000 100000000)
29+
30+
# Tree types to benchmark
31+
TREES=(ART QuART_tail QuART_lil QuART_stail QuART_lil_can QuART_stail_reset QuART_stail_reset_bidir)
32+
33+
# Number of repetitions per configuration
34+
REPEAT=10
35+
36+
echo "Starting TPC-C experiments..."
37+
echo "Results -> $RESULTS"
38+
echo "Logs -> $LOGDIR"
39+
echo ""
40+
41+
for N in "${TEST_SIZES[@]}"; do
42+
for TREE in "${TREES[@]}"; do
43+
LOGFILE="${LOGDIR}/log_N${N}_${TREE}.txt"
44+
echo "=== N=$N tree=$TREE ===" > "$LOGFILE"
45+
46+
INSERT_SUM=0
47+
QUERY_SUM=0
48+
FAILED=0
49+
50+
for ((i=1; i<=REPEAT; i++)); do
51+
echo "--- Run $i/$REPEAT ---" >> "$LOGFILE"
52+
OUTPUT=$(${REPO_ROOT}/build/run -f "$INPUT_FILE" -N "$N" -t "$TREE" 2>>"$LOGFILE")
53+
STATUS=$?
54+
echo "$OUTPUT" >> "$LOGFILE"
55+
56+
if [ $STATUS -ne 0 ] || [ -z "$OUTPUT" ]; then
57+
echo " [WARN] run failed for N=$N tree=$TREE run=$i" | tee -a "$LOGFILE"
58+
FAILED=1
59+
break
60+
fi
61+
62+
CSV_LINE=$(echo "$OUTPUT" | tail -1)
63+
INSERT_TIME=$(echo "$CSV_LINE" | cut -d',' -f1 | xargs)
64+
QUERY_TIME=$(echo "$CSV_LINE" | cut -d',' -f2 | xargs)
65+
INSERT_SUM=$((INSERT_SUM + INSERT_TIME))
66+
QUERY_SUM=$((QUERY_SUM + QUERY_TIME))
67+
echo " run $i: insert=${INSERT_TIME}ns query=${QUERY_TIME}ns"
68+
done
69+
70+
if [ $FAILED -eq 0 ]; then
71+
AVG_INSERT=$((INSERT_SUM / REPEAT))
72+
AVG_QUERY=$((QUERY_SUM / REPEAT))
73+
echo "$N,$TREE,$AVG_INSERT,$AVG_QUERY" >> "$RESULTS"
74+
echo " avg: insert=${AVG_INSERT}ns query=${AVG_QUERY}ns"
75+
else
76+
echo "$N,$TREE,ERROR,ERROR" >> "$RESULTS"
77+
fi
78+
done
79+
done
80+
81+
echo ""
82+
echo "Done. Results saved to $RESULTS"

0 commit comments

Comments
 (0)