Skip to content

ci: add performance benchmarks #4998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ef89eb0
ci: add performance benchmarks
agostbiro Mar 14, 2024
4b6841d
Add snapshot for all scenarios
agostbiro Mar 15, 2024
a4eae0f
Don't try to run snapshot as scenario
agostbiro Mar 15, 2024
50eb9b0
Fix check for trusted collaborators
agostbiro Mar 15, 2024
5d863d3
Allow running in main
agostbiro Mar 15, 2024
0146afd
Update results repository
agostbiro Mar 15, 2024
42e7080
Spawn subprocess for each scenario
agostbiro Mar 15, 2024
20212c8
Fix output being truncated
agostbiro Mar 15, 2024
fa75948
Flush stdout explicitly
agostbiro Mar 15, 2024
fc7126a
Add benchmark variance analysis
agostbiro Mar 17, 2024
76b748c
Flash stdout for report
agostbiro Mar 17, 2024
b2c6907
Rename out to benchmark-variance
agostbiro Mar 17, 2024
84110df
Rename openzeppelin
agostbiro Mar 18, 2024
eccb51c
Temporarily disable get block by number
agostbiro Mar 18, 2024
fcb29a8
Add rust benchmark variance
agostbiro Mar 18, 2024
ca32351
Revert "Temporarily disable get block by number"
agostbiro Mar 18, 2024
206deb1
Add nodejs flags to reduce variance
agostbiro Mar 18, 2024
65165fe
Add nodejs flags to reduce variance to subprocesses
agostbiro Mar 19, 2024
f1be692
Increase --max-old-space-size=28000
agostbiro Mar 19, 2024
acad1ee
Hold on to RPC results to avoid GC
agostbiro Mar 19, 2024
eb61f90
Increase alert threshold to 110%
agostbiro Mar 19, 2024
03eb2b0
Temp
agostbiro Mar 19, 2024
32f7769
Debug
agostbiro Mar 19, 2024
46c0445
Debug
agostbiro Mar 19, 2024
68f60dd
Debug
agostbiro Mar 19, 2024
082edb9
Remove debug
agostbiro Mar 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/edr-benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: EDR Benchmark

on:
push:
branches:
- main
paths:
- ".github/workflows/edr-benchmark.yml"
- "rust-toolchain"
- "Cargo.lock"
- "Cargo.toml"
- "crates/**"
pull_request:
branches:
- "**"
paths:
- ".github/workflows/edr-benchmark.yml"
- "rust-toolchain"
- "Cargo.lock"
- "Cargo.toml"
- "crates/**"
Comment on lines +7 to +21
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only running for changes to EDR since it's very slow and there is only one runner + we'll do this anyway once EDR is a separate repo

workflow_dispatch:

defaults:
run:
working-directory: crates/tools/js/benchmark

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

jobs:
js-benchmark:
name: Run JS scenario runner benchmark
environment: github-action-benchmark
runs-on: self-hosted
# Only run for trusted collaborators since third-parties could run malicious code on the self-hosted benchmark runner.
if: github.ref == 'refs/heads/main' || (github.event.pull_request.author_association == 'OWNER' || github.event.pull_request.author_association == 'MEMBER' || github.event.pull_request.author_association == 'COLLABORATOR')
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: 20
cache: pnpm

- name: Install Rust (stable)
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true

- name: Install package
run: pnpm install --frozen-lockfile --prefer-offline

- name: Run benchmark
run: pnpm run -s benchmark

- name: Validate regressions
run: pnpm run -s verify

- name: Generate report for github-action-benchmark
run: pnpm run -s report | tee report.json

- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: customSmallerIsBetter
output-file-path: crates/tools/js/benchmark/report.json
gh-repository: github.com/nomic-foundation-automation/edr-benchmark-results
gh-pages-branch: main
benchmark-data-dir-path: bench
github-token: ${{ secrets.BENCHMARK_GITHUB_TOKEN }}
# Only save the data for main branch pushes. For PRs we only compare
auto-push: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
alert-threshold: "110%"
# Only fail on pull requests, don't break CI in main
fail-on-alert: ${{ github.event_name == 'pull_request' }}
# Enable Job Summary for PRs
summary-always: true
max-items-in-chart: 1000
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,6 @@ Brewfile.lock.json

# Ipython Notebook
.ipynb_checkpoints

# Benchmark
benchmark-output.json
10 changes: 2 additions & 8 deletions crates/tools/js/benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ pnpm install
pnpm run benchmark
```

The measurements will be printed to stdout as machine-readable json and to stderr as human-readable output.
The measurements will be printed to stdout as machine-readable json and to stderr and saved to `./benchmark-output.json` disk as json.

## Grep

It's possible to grep the output to run a specific scenario:

```shell
npm run benchmark -- --grep seaport
```
Please see `pnpm run help` for more.
Loading
Loading