Bench #88
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Bench | |
on: | |
workflow_call: | |
workflow_dispatch: | |
env: | |
CARGO_PROFILE_BENCH_BUILD_OVERRIDE_DEBUG: true | |
CARGO_PROFILE_RELEASE_DEBUG: true | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
TOOLCHAIN: nightly | |
RUSTFLAGS: -C link-arg=-fuse-ld=lld -C link-arg=-Wl,--no-rosegment | |
PERF_CMD: record -o perf.data -F997 --call-graph lbr -g | |
jobs: | |
bench: | |
name: Benchmark | |
runs-on: self-hosted | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set PATH | |
run: echo "/home/bench/.cargo/bin" >> "${GITHUB_PATH}" | |
- name: Install Rust | |
uses: ./.github/actions/rust | |
with: | |
version: $TOOLCHAIN | |
components: rustfmt | |
- name: Fetch and build NSS and NSPR | |
uses: ./.github/actions/nss | |
- name: Build | |
run: | | |
cargo +$TOOLCHAIN bench --features bench --no-run | |
cargo +$TOOLCHAIN build --release --bin neqo-client --bin neqo-server | |
- name: Download criterion results | |
id: criterion-cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ./target/criterion | |
key: criterion-${{ runner.os }}-${{ hashFiles('./target/criterion/**.json') }} | |
restore-keys: criterion-${{ runner.os }}- | |
# - name: Download github-action-benchmark results | |
# id: benchmark-cache | |
# uses: actions/cache/restore@v4 | |
# with: | |
# path: ./cache | |
# key: action-benchmark-${{ runner.os}}-${{ hashFiles('./cache/**.TODO') }} | |
# restore-keys: action-benchmark-${{ runner.os }}- | |
# Disable turboboost, hyperthreading and use performance governor. | |
- name: Prepare machine | |
run: sudo /root/bin/prep.sh | |
# Pin the benchmark run to core 0 and run all benchmarks at elevated priority. | |
- name: Run cargo bench | |
run: | | |
taskset -c 0 nice -n -20 \ | |
cargo +$TOOLCHAIN bench --features bench | tee output.txt | |
# Pin the transfer benchmark to core 0 and run it at elevated priority inside perf. | |
# Work around https://github.com/flamegraph-rs/flamegraph/issues/248 by passing explicit perf arguments. | |
- name: Profile cargo bench transfer | |
run: | | |
taskset -c 0 nice -n -20 \ | |
cargo +$TOOLCHAIN flamegraph -v -c "$PERF_CMD" --features bench --bench transfer -- \ | |
--bench --exact "Run multiple transfers with varying seeds" | |
- name: Profile client/server transfer | |
run: | | |
{ mkdir server; \ | |
cd server; \ | |
taskset -c 0 nice -n -20 \ | |
cargo +$TOOLCHAIN flamegraph -v -c "$PERF_CMD" \ | |
--bin neqo-server -- --db ../test-fixture/db $HOST:4433 || true; } & | |
mkdir client; \ | |
cd client; \ | |
time taskset -c 1 nice -n -20 \ | |
cargo +$TOOLCHAIN flamegraph -v -c "$PERF_CMD" \ | |
--bin neqo-client -- --output-dir . https://$HOST:4433/$SIZE | |
killall -INT neqo-server | |
cd ${{ github.workspace }} | |
[ "$(wc -c < client/"$SIZE")" -eq "$SIZE" ] || exit 1 | |
env: | |
HOST: localhost | |
SIZE: 1073741824 # 1 GB | |
# Re-enable turboboost, hyperthreading and use powersave governor. | |
- name: Restore machine | |
run: sudo /root/bin/unprep.sh | |
if: success() || failure() || cancelled() | |
# TODO: Wait for this action to be allowlisted. And then figure out how to only upload | |
# benchmark data when the main branch is being updated (e.g., if: ${{ github.ref == "refs/heads/main" }}) | |
# - name: Store current benchmark results | |
# uses: benchmark-action/github-action-benchmark@v1 | |
# with: | |
# tool: 'cargo' | |
# output-file-path: output.txt | |
# external-data-json-path: ./cache/benchmark-data.json | |
# fail-on-alert: true | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# comment-on-alert: true | |
# summary-always: true | |
- name: Convert for profiler.firefox.com | |
run: | | |
perf script -i perf.data -F +pid > transfer.perf & | |
perf script -i client/perf.data -F +pid > client.perf & | |
perf script -i server/perf.data -F +pid > server.perf & | |
wait | |
mv flamegraph.svg transfer.svg | |
mv client/flamegraph.svg client.svg | |
mv server/flamegraph.svg server.svg | |
rm neqo.svg | |
- name: Upload criterion results | |
if: github.ref == 'refs/heads/main' | |
uses: actions/cache/save@v4 | |
with: | |
path: ./target/criterion | |
key: ${{ steps.criterion-cache.outputs.cache-primary-key }} | |
# - name: Upload github-action-benchmark results | |
# if: github.ref == 'refs/heads/main' | |
# uses: actions/cache/save@v4 | |
# with: | |
# path: ./cache | |
# key: ${{ steps.benchmark-cache.outputs.cache-primary-key }} | |
- name: Archive perf data | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }}-${{ github.sha }} | |
path: | | |
*.svg | |
*.perf | |
output.txt | |
target/criterion | |
compression-level: 9 |