Skip to content

Commit ac69ffd

Browse files
ci: add epoch boundary time to the PR benchmark comment (#11820)
1 parent 0349a86 commit ac69ffd

4 files changed

Lines changed: 23 additions & 3 deletions

File tree

‎.github/workflows/benchmark.yml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,18 @@ on:
1313
type: string
1414
default: testnet-455087014-snapload
1515
description: 'load-only testnet ledger (genesis.bin + full snapshot) for the snapshot row'
16+
epoch-ledger:
17+
type: string
18+
default: mainnet-epoch-boundary-461376000
19+
description: 'minimized mainnet ledger whose first replayed slots cross an epoch boundary, for the epoch row'
1620
workflow_dispatch:
1721
inputs:
1822
snapshot-ledger:
1923
type: string
2024
default: testnet-455087014-snapload
25+
epoch-ledger:
26+
type: string
27+
default: mainnet-epoch-boundary-461376000
2128

2229
permissions:
2330
contents: read
@@ -158,6 +165,7 @@ jobs:
158165
BENCH_DIR: ${{ github.workspace }}/../bench
159166
DUMP_DIR: ${{ github.workspace }}/../dump
160167
BENCH_SNAP_LEDGER: ${{ inputs.snapshot-ledger }}
168+
BENCH_EPOCH_LEDGER: ${{ inputs.epoch-ledger }}
161169

162170
steps:
163171
- uses: actions/checkout@v7
@@ -223,6 +231,9 @@ jobs:
223231
- run: contrib/ci/bench/bench.sh snapshot base
224232
continue-on-error: true # a baseline that cannot run is not the PR's fault; its rows stay pending
225233
- run: contrib/ci/bench/bench.sh snapshot new
234+
- run: contrib/ci/bench/bench.sh epoch base
235+
continue-on-error: true
236+
- run: contrib/ci/bench/bench.sh epoch new
226237
- name: Free RAM disk # brd keeps its pages until rmmod
227238
if: always()
228239
continue-on-error: true

‎.github/workflows/on_pull_request.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
with:
2828
github-token: ${{ github.token }}
2929
snapshot-ledger: testnet-455087014-snapload
30+
epoch-ledger: mainnet-epoch-boundary-461376000
3031
secrets: inherit
3132
build_checks_1:
3233
if: github.event.pull_request.draft == false

‎contrib/ci/bench/bench.sh‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
2-
# PR perf rows. bench.sh build|replay|snapshot|bench base|new
2+
# PR perf rows. bench.sh build|replay|snapshot|epoch|bench base|new
33
# Raw results land in $BENCH_DIR/<side>.<what>.*; benchmark_comment.py turns them into the comment.
44
set -euo pipefail
5-
what=${1:?usage: bench.sh build|replay|snapshot|bench base|new} side=${2:?side}
5+
what=${1:?usage: bench.sh build|replay|snapshot|epoch|bench base|new} side=${2:?side}
66
BENCH_DIR=${BENCH_DIR:-$(realpath ..)/bench}
77
DUMP_DIR=${DUMP_DIR:-$(realpath ..)/dump}
88
SHREDB=/dev/shm/fd-bench-shreds.db # tmpfs: on disk, writeback holds its inode lock and stalls shred/rserve pwrite() for whole slots
@@ -76,6 +76,7 @@ case $what in
7676
ACCOUNTS_DB=$RAMDB/accounts.db out=$out.warmup backtest "${BENCH_SNAP_LEDGER:?}" -m 100000000
7777
fi
7878
ACCOUNTS_DB=$RAMDB/accounts.db backtest "${BENCH_SNAP_LEDGER:?}" -m 100000000 ;;
79+
epoch) backtest "${BENCH_EPOCH_LEDGER:-mainnet-epoch-boundary-461376000}" -m 2000000 ;; # whole ledger: crosses one epoch boundary
7980
bench)
8081
{ cat "$BENCH_DIR/$side/bench.toml"; printf '[paths]\n accounts = "%s"\n shredb = "%s"\n' "$DUMP_DIR/accounts.db" "$SHREDB"; } > "$out.toml"
8182
quiesce

‎contrib/ci/bench/benchmark_comment.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ def snapshot_load(d, s):
2828
log = read(d, s, "snapshot.log")
2929
return (stamp(log, "replay ready at slot") - stamp(log, "reading full snapshot from file")) % 86400 # midnight
3030

31+
def epoch_boundary(d, s): # ms fd_runtime_process_new_epoch() took at the boundary the epoch ledger crosses
32+
log = re.sub(r"\x1b\[[0-9;]*m", "", read(d, s, "epoch.log")) # the runtime styles this line when colorized
33+
took = re.findall(r"starting epoch \d+ at slot \d+ \(took ([0-9.]+) seconds\)", log)
34+
if not took: raise LookupError("epoch.log: no epoch boundary")
35+
return float(took[-1]) * 1e3
36+
3137
def mem(d, s, cluster):
3238
return json.loads(read(d, s, f"build.mem.{cluster}.json"))["summary"]["total_memory_locked_bytes"] / 2**30
3339

@@ -36,12 +42,13 @@ def mem(d, s, cluster):
3642
("replay_tps", "replay tps, mainnet", "replay", lambda d, s: summary(d, s, "replay")["tps"], ",.0f tps", 1.25, 2.5, True),
3743
("bench_tps", "bench tps, localnet", "bench", lambda d, s: summary(d, s, "bench")["tps"], ",.0f tps", 1.75, 3.5, True),
3844
("snapshot_load", "snapshot load, testnet", "snapshot", snapshot_load, ".2f s", 1.5, 3.0, False),
45+
("epoch_boundary","epoch boundary, mainnet", "snapshot", epoch_boundary, ".1f ms", 5.0, 10.0, False),
3946
("mem_mainnet", "mem total, mainnet", "replay", lambda d, s: mem(d, s, "mainnet"), ".2f GiB", 0.0, 1.0, False),
4047
("mem_testnet", "mem total, testnet", "replay", lambda d, s: mem(d, s, "testnet"), ".2f GiB", 0.0, 1.0, False),
4148
("compile", "clean compile, firedancer", "*", lambda d, s: float(read(d, s, "build.time").split()[0]), ".2f s", 1.5, 3.0, False),
4249
("binsize", "binary size, firedancer", "replay", lambda d, s: os.path.getsize(f"{d}/{s}/bin/firedancer") / 1e6, ".2f MB", 0.5, 2.0, False),
4350
)
44-
HIST_HDR = ("TPS", "BENCH", "SNAP", "MEM·M", "MEM·T", "COMPILE", "BINARY")
51+
HIST_HDR = ("TPS", "BENCH", "SNAP", "EPOCH", "MEM·M", "MEM·T", "COMPILE", "BINARY")
4552

4653
def tier(row, d):
4754
_, _, _, _, _, warn, red, up = row

0 commit comments

Comments
 (0)