Skip to content

Commit

Permalink
Try to measure servers in steady state
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterthanlime committed Aug 31, 2024
1 parent 5cc1018 commit 2563ffb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
3 changes: 2 additions & 1 deletion crates/loona/src/h2/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ where

let hpack_enc = loona_hpack::Encoder::new();

let (ev_tx, ev_rx) = tokio::sync::mpsc::channel::<H2Event>(32);
let h2_server_chan_size: usize = std::env::var("H2_SERVER_CHAN_SIZE").unwrap_or("32".to_string()).parse().unwrap();
let (ev_tx, ev_rx) = tokio::sync::mpsc::channel::<H2Event>(h2_server_chan_size);

Ok(Self {
driver,
Expand Down
22 changes: 15 additions & 7 deletions scripts/perfstat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ ENDPOINT="${ENDPOINT:-/repeat-4k-blocks/128}"
RPS="${RPS:-2}"
CONNS="${CONNS:-40}"
STREAMS="${STREAMS:-8}"
NUM_REQUESTS="${NUM_REQUESTS:-100}"
WARM_UP_TIME="${WARM_UP_TIME:-5}"
DURATION="${DURATION:-20}"
TIMES="${TIMES:-1}"

# Set MODE to 'stat' if not specified
Expand All @@ -110,13 +111,13 @@ else
exit 1
fi

echo -e "\033[1;34mπŸ“Š Benchmark parameters: RPS=$RPS, CONNS=$CONNS, STREAMS=$STREAMS, NUM_REQUESTS=$NUM_REQUESTS, ENDPOINT=$ENDPOINT\033[0m"
echo -e "\033[1;34mπŸ“Š Benchmark parameters: RPS=$RPS, CONNS=$CONNS, STREAMS=$STREAMS, WARM_UP_TIME=$WARM_UP_TIME, DURATION=$DURATION, TIMES=$TIMES\033[0m"

for server in "${!servers[@]}"; do
read -r PID ADDR <<< "${servers[$server]}"
echo -e "\033[1;36mLoona Git SHA: $(cd ~/bearcove/loona && git rev-parse --short HEAD)\033[0m"
echo -e "\033[1;33mπŸš€ Benchmarking \033[1;32m$(cat /proc/$PID/cmdline | tr '\0' ' ')\033[0m"
remote_command=("$H2LOAD" "${H2LOAD_ARGS[@]}" --rps "$RPS" -c "$CONNS" -m "$STREAMS" -n "$NUM_REQUESTS" "${ADDR}${ENDPOINT}")
remote_command=("$H2LOAD" "${H2LOAD_ARGS[@]}" --rps "$RPS" -c "$CONNS" -m "$STREAMS" --duration "$DURATION" "${ADDR}${ENDPOINT}")

if [[ "$MODE" == "record" ]]; then
samply record -p "$PID" &
Expand All @@ -127,10 +128,17 @@ for server in "${!servers[@]}"; do
wait $SAMPLY_PID
else
for ((i=1; i<=$TIMES; i++)); do
echo "===================="
echo -e "\033[1;35mπŸƒ Run $i of $TIMES πŸƒ\033[0m"
echo "===================="
perf stat -e "$PERF_EVENTS" -p "$PID" -- ssh brat "${remote_command[@]}"
echo "==================================================="
echo -e "\033[1;35mπŸƒ Run $i of $TIMES for $server server πŸƒ\033[0m"
echo "==================================================="
ssh brat "${remote_command[@]}" &
SSH_PID=$!
sleep "$WARM_UP_TIME"
ACTUAL_DURATION=$((DURATION - WARM_UP_TIME - 1))
echo "Starting perf for $ACTUAL_DURATION seconds..."
perf stat -e "$PERF_EVENTS" -p "$PID" -- sleep "$ACTUAL_DURATION"
echo "Starting perf... done!"
wait $SSH_PID
done
fi
done

0 comments on commit 2563ffb

Please sign in to comment.