-
Notifications
You must be signed in to change notification settings - Fork 33
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
ci(l2): automate flamegraph tests #1366
Open
dsocolobsky
wants to merge
63
commits into
main
Choose a base branch
from
automate-perf-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
52da6ca
script that watches balance of account
dsocolobsky 441fc6a
Run flamegraph reporting in Github CI
dsocolobsky 1ce321d
feat(cli/ethrex_l2): allow --default parameter in "ethrex_l2 config c…
dsocolobsky f9cb7bc
fix: create ethrex_l2 config in flamegraph_reporter.yaml
dsocolobsky d3679ec
Make load test retry if connection failed
dsocolobsky 37fcfd1
Use addr2line for faster perf usage
dsocolobsky 122a4a8
Use addr2line for faster perf usage 2
dsocolobsky 830159f
Run perf with --no-inline to make it faster
dsocolobsky 967e79e
Run perf with --no-inline to make it faster (2)
dsocolobsky fbb456f
Run inferno-collapse-perf with --tid parameter
dsocolobsky 803a72f
Run inferno-collapse-perf without --tid parameter
dsocolobsky 0b783ea
Run flamegraph for reth as well
dsocolobsky 6349a7a
Run flamegraph for reth in parallel in a separate job
dsocolobsky 89799a3
Add balance to account in genesis-load-test.json
dsocolobsky 5d3429c
Run cargo flamegraph with perf options
dsocolobsky 0dd0e05
Adjust paths in workflow
dsocolobsky 71b2c5d
Adjust paths in workflow 2
dsocolobsky 73c5edf
Deploy page workflow
dsocolobsky b128f48
Update deployed page with generated flamegraphs
dsocolobsky 9a7c430
Update deployed page with generated flamegraphs 2
dsocolobsky 29d50a4
Fix .svg paths
dsocolobsky 2d2160b
Add elapsed time for each test to static page
dsocolobsky 320acec
Use Github Action Outputs for test times
dsocolobsky bc4b4f1
Merge branch 'main' into automate-perf-tests
dsocolobsky 11c6696
Merge branch 'main' into automate-perf-tests
dsocolobsky 5f6d547
Run a 1000 iterations for the load tests.
dsocolobsky 201ab7a
Minor adjustments and cleanup for flamegraph_reporter.yaml
dsocolobsky 6b0c5e2
Simplify flamegraph script into a single one.
dsocolobsky 5db6105
Metadata for Slack link previews
dsocolobsky 43689a8
Send daily flamegraph report via Slack
dsocolobsky 3ff3063
Measure load test time more accurately
dsocolobsky 19e8b78
Fix local script
dsocolobsky 91e0b87
Send direct links to .svg files in Slack
dsocolobsky dbec9c7
Fix local script "make flamegraph"
dsocolobsky a28971f
refactor: small improvements
fborello-lambda dab2121
Merge branch 'main' into automate-perf-tests
fborello-lambda f55c741
rm: unneeded step in ci
fborello-lambda 9e54c2e
fix: bash scripts duration time
fborello-lambda 3cbb899
Merge branch 'main' into automate-perf-tests
fborello-lambda 9392999
chore: lower the amount of txs
fborello-lambda d8410ca
Merge branch 'automate-perf-tests' of github.com:lambdaclass/ethrex i…
fborello-lambda 968d951
chore: suppress output
fborello-lambda 15567c9
fix: test pgrep -f
fborello-lambda 0ba0191
fix: test pgrep -l shorter
fborello-lambda 1b8a3a4
fix: test if full_path works
fborello-lambda 8bb0077
fix: test lowering the iterations and wait for perf
fborello-lambda 274c7e4
chore: spinner
fborello-lambda 18e96a5
chore: rm spinner for ci
fborello-lambda 3cca963
fix: calculate time to process the balance
fborello-lambda a82cb9c
Merge branch 'main' into automate-perf-tests
dsocolobsky 3c39c68
chore: add .idea/ to .gitignore
dsocolobsky b73b2d4
chore: Bump workflow's CI Rust version to 1.84.0
dsocolobsky 28344d5
chore: Attempt to cache cargo binaries in CI
dsocolobsky d93c90b
chore: ci: try running reth without profile=profiling
dsocolobsky 9e65249
chore: ci: Use gimli's addr2line for faster perf
dsocolobsky e1f9063
chore: ci: Cache reth repo
dsocolobsky dcf001e
chore: ci: Read kernel symbols in perf
dsocolobsky 4552225
chore: ci: Cache ethrex_l2 in "flamegraph-reth" as well
dsocolobsky 56b57b9
chore: ci: Add CARGO_PROFILE_RELEASE_DEBUG=true to reth call
dsocolobsky a7392f2
chore: ci: Modify slightly how we measure load test time
dsocolobsky 4b47cb6
chore: ci: Try compiling reth with maxperf
dsocolobsky 47c4b8a
chore: ci: fix ethrex_l2 for flamegraph-reth
dsocolobsky f93037c
chore: ci: Test sleeping 20min before running the perf tests on reth
dsocolobsky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
# This script sends 171 * <iterations> transactions to a test account, per defined private key | ||
# then polls the account balance until the expected balance has been reached | ||
# and then kills the process. It also measures the elapsed time of the test and | ||
# outputs it to Github Action's outputs. | ||
iterations=50 | ||
value=1 | ||
account=0x33c6b73432B3aeA0C1725E415CC40D04908B85fd | ||
end_val=$((171 * $iterations * $value)) | ||
|
||
ethrex_l2 test load --path /home/runner/work/ethrex/ethrex/test_data/private_keys.txt -i $iterations -v --value $value --to $account >/dev/null | ||
|
||
start_time=$(date +%s) | ||
output=$(ethrex_l2 info -b -a $account --wei 2>&1) | ||
while [[ $output -lt $end_val ]]; do | ||
sleep 5 | ||
output=$(ethrex_l2 info -b -a $account --wei 2>&1) | ||
done | ||
end_time=$(date +%s) | ||
elapsed=$((end_time - start_time)) | ||
|
||
minutes=$((elapsed / 60)) | ||
seconds=$((elapsed % 60)) | ||
output=$(ethrex_l2 info -b -a $account --wei 2>&1) | ||
echo "Balance of $output reached in $minutes min $seconds s, killing process" | ||
|
||
sudo pkill "$PROGRAM" | ||
|
||
while pgrep -l "perf" >/dev/null; do | ||
sleep 10 | ||
done | ||
|
||
# We need this for the following job, to add to the static page | ||
echo "time=$minutes minutes $seconds seconds" >>"$GITHUB_OUTPUT" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
curl -XPOST -H "Content-type: application/json" -d '{ | ||
"blocks": [ | ||
{ | ||
"type": "header", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "Daily Flamegraph Report" | ||
} | ||
}, | ||
{ | ||
"type": "divider" | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "🔥 Flamegraphs are available at *<https://lambdaclass.github.io/ethrex/|lambdaclass.github.io/ethrex/>*\n | ||
• *<https://lambdaclass.github.io/ethrex/flamegraph_ethrex.svg/flamegraph_ethrex.svg|Ethrex Flamegraph>*\n | ||
• *<https://lambdaclass.github.io/ethrex/flamegraph_reth.svg/flamegraph_reth.svg|Reth Flamegraph>*\n" | ||
} | ||
} | ||
] | ||
}' "$url" |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,258 @@ | ||
name: Daily Flamegraph Reporter | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "**" ] | ||
workflow_dispatch: | ||
|
||
env: | ||
RUST_VERSION: 1.84.0 | ||
RUST_RETH_VERSION: 1.84.0 | ||
|
||
jobs: | ||
flamegraph-ethrex: | ||
name: Generate Flamegraph for Ethrex | ||
runs-on: ubuntu-latest | ||
env: | ||
PROGRAM: ethrex | ||
outputs: | ||
time: ${{steps.generate-flamegraph-ethrex.outputs.time}} | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Rustup toolchain install | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: ${{ env.RUST_VERSION }} | ||
|
||
- name: Caching | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Cache Cargo binaries | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cargo/bin | ||
key: ${{ runner.os }}-cargo-install-${{ hashFiles('cmd/ethrex_l2/Cargo.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo-install- | ||
|
||
- name: Change perf settings | ||
run: | | ||
sudo sysctl kernel.perf_event_paranoid=-1 | ||
sudo sysctl -w kernel.kptr_restrict=0 | ||
sudo chmod +r /proc/kallsyms | ||
sudo perf list hw | ||
|
||
- name: Checkout gimli addr2line | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: gimli-rs/addr2line | ||
path: "addr2line" | ||
|
||
- name: Build gimli addr2line | ||
working-directory: ./addr2line | ||
run: | | ||
# Little hack we need else it throws error building | ||
echo "[workspace]" >> ./Cargo.toml | ||
cargo install --features="bin" addr2line | ||
|
||
- name: Install flamegraph | ||
run: | | ||
cargo install flamegraph | ||
cargo install inferno | ||
|
||
- name: Install ethrex_l2 cli | ||
run: | | ||
cargo install --path cmd/ethrex_l2 | ||
ethrex_l2 config create default --default | ||
ethrex_l2 config set default | ||
|
||
- name: Build ethrex | ||
run: CARGO_PROFILE_RELEASE_DEBUG=true cargo build --release --bin ethrex --features dev | ||
|
||
- id: generate-flamegraph-ethrex | ||
name: Generate Flamegraph data for Ethrex | ||
shell: bash | ||
run: | | ||
CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph -c "record -o perf.data -F997 --call-graph dwarf,16384 -g" \ | ||
--bin ethrex --features dev -- --network /home/runner/work/ethrex/ethrex/test_data/genesis-l2.json --http.port 1729 >/dev/null & | ||
echo "waiting to execute load test..." | ||
sleep 30 && | ||
echo "executing load test..." | ||
bash /home/runner/work/ethrex/ethrex/.github/scripts/flamegraph_watcher.sh && | ||
echo "Load test finished" | ||
|
||
- name: Generate SVG | ||
shell: bash | ||
run: | | ||
PATH=$HOME/.cargo/bin:$PATH which addr2line | ||
PATH=$HOME/.cargo/bin:$PATH perf script -v -i /home/runner/work/ethrex/ethrex/perf.data --no-inline > stack.data | ||
inferno-collapse-perf -q < stack.data > collapsed.data | ||
inferno-flamegraph --title "Ethrex Flamegraph" < collapsed.data > flamegraph_ethrex.svg | ||
|
||
- name: Upload artifacts - flamegraph_ethrex.svg | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: flamegraph_ethrex.svg | ||
path: ./flamegraph_ethrex.svg | ||
|
||
flamegraph-reth: | ||
name: Generate Flamegraph for Reth | ||
runs-on: ubuntu-latest | ||
env: | ||
PROGRAM: reth | ||
outputs: | ||
time: ${{steps.generate-flamegraph-reth.outputs.time}} | ||
steps: | ||
- name: Cache Cargo binaries | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cargo/bin | ||
key: ${{ runner.os }}-cargo-install-${{ hashFiles('cmd/ethrex_l2/Cargo.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo-install- | ||
|
||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Rustup toolchain install | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: ${{ env.RUST_RETH_VERSION }} | ||
|
||
- name: Cache reth repository | ||
uses: actions/cache@v4 | ||
id: cache-reth-repo | ||
with: | ||
path: reth | ||
key: reth-repo-main-${{ hashFiles('reth/Cargo.lock') }} | ||
restore-keys: | | ||
reth-repo-${{ env.RETH_REF }}- | ||
reth-repo- | ||
|
||
- name: Checkout reth | ||
if: steps.cache-reth-repo.outputs.cache-hit != 'true' | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: paradigmxyz/reth | ||
path: "reth" | ||
ref: main | ||
|
||
- name: Caching | ||
uses: Swatinem/rust-cache@v2 | ||
with: | ||
workspaces: "reth -> target" | ||
key: reth-build-main | ||
|
||
- name: Change perf settings | ||
run: | | ||
sudo sysctl kernel.perf_event_paranoid=-1 | ||
sudo sysctl -w kernel.kptr_restrict=0 | ||
sudo chmod +r /proc/kallsyms | ||
sudo perf list hw | ||
|
||
- name: Checkout gimli addr2line | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: gimli-rs/addr2line | ||
path: "addr2line" | ||
|
||
- name: Build gimli addr2line | ||
working-directory: ./addr2line | ||
run: | | ||
# Little hack we need else it throws error building | ||
echo "[workspace]" >> ./Cargo.toml | ||
cargo install --features="bin" addr2line | ||
|
||
- name: Install flamegraph | ||
run: | | ||
cargo install flamegraph | ||
cargo install inferno | ||
|
||
- name: Install ethrex_l2 cli | ||
run: | | ||
cargo install --path cmd/ethrex_l2 | ||
ethrex_l2 config create default --default | ||
ethrex_l2 config set default | ||
|
||
- id: generate-flamegraph-reth | ||
name: Build and test reth | ||
shell: bash | ||
# --dev.block-time 1000ms set to 1000ms to match ethrex block generation time | ||
run: | | ||
cd ./reth | ||
CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph -c "record -o perf.data -F997 --call-graph dwarf,16384 -g" --bin reth --profile profiling \ | ||
-- node --chain /home/runner/work/ethrex/ethrex/test_data/genesis-load-test.json --dev \ | ||
--dev.block-time 1000ms --http.port 1729 --txpool.max-pending-txns 100000000 --txpool.max-new-txns 1000000000 \ | ||
--txpool.pending-max-count 100000000 --txpool.pending-max-size 10000000000 --txpool.basefee-max-count 100000000000 \ | ||
--txpool.basefee-max-size 1000000000000 --txpool.queued-max-count 1000000000 >/dev/null & | ||
echo "waiting to execute load test..." | ||
sleep 1200 && | ||
bash /home/runner/work/ethrex/ethrex/.github/scripts/flamegraph_watcher.sh && | ||
echo "Load test finished" | ||
|
||
- name: Generate SVG | ||
shell: bash | ||
run: | | ||
PATH=$HOME/.cargo/bin:$PATH which addr2line | ||
PATH=$HOME/.cargo/bin:$PATH perf script -v -i /home/runner/work/ethrex/ethrex/reth/perf.data --no-inline > stack.data | ||
inferno-collapse-perf -q < stack.data > collapsed.data | ||
inferno-flamegraph --title "Reth Flamegraph" < collapsed.data > flamegraph_reth.svg | ||
|
||
- name: Upload artifacts - flamegraph_reth.svg | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: flamegraph_reth.svg | ||
path: ./flamegraph_reth.svg | ||
|
||
upload-static-page: | ||
name: Upload artifacts for static page | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
needs: [ flamegraph-ethrex, flamegraph-reth ] | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download ethrex flamegraph artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: flamegraph_ethrex.svg | ||
path: flamegraph_ethrex.svg | ||
|
||
- name: Download reth flamegraph artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: flamegraph_reth.svg | ||
path: flamegraph_reth.svg | ||
|
||
- name: Update static page locally with new data | ||
shell: bash | ||
run: | | ||
cp -r flamegraph_ethrex.svg pages/ | ||
cp -r flamegraph_reth.svg pages/ | ||
sed -i "s/{{LAST_UPDATE}}/$(TZ='Etc/GMT+3' date +'%Y-%m-%dT%H:%M:%S')/g" pages/index.html | ||
sed -i "s/{{ETHREX_TIME}}/${{ needs.flamegraph-ethrex.outputs.time }}/g" pages/index.html | ||
sed -i "s/{{RETH_TIME}}/${{ needs.flamegraph-reth.outputs.time }}/g" pages/index.html | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: "pages/" | ||
|
||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ ethereum-package/ | |
|
||
**/.DS_Store | ||
**/.vscode | ||
**/.idea | ||
|
||
|
||
# EVM Mlir stuff | ||
|
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I collapsed all daily reports into https://github.com/lambdaclass/ethrex/blob/main/.github/workflows/daily_reports.yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Not sure if it's daily though, I forgot I had named it like that but I think it's supposed to run in each merge to master; I will ask Javi/Ivan.