-
Notifications
You must be signed in to change notification settings - Fork 62
Add GHA coordinator for performance evaluation task scatter/gather #791
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
Changes from all commits
Commits
Show all changes
120 commits
Select commit
Hold shift + click to select a range
3392f09
pull initial work from branch load-testing
cjonas9 ffe27bc
add ledger generation test adapted for RPC
cjonas9 65da3b5
add apply load config
cjonas9 34f086d
add generated ledger output to infrastructure/testdata/
cjonas9 80c982d
add basic ingestion of synthetic ledgers phase
cjonas9 94c69b7
disable debug logs for load test for timeout reasons
cjonas9 f4a16f9
add functions for snapshotting + restoring test DB
cjonas9 1d53b96
improve ad restructure db restoration helpers/API
cjonas9 baf2255
finish DB restoration logic flow and wiring
cjonas9 1647464
skip migrations/fee-stats in load test mode
cjonas9 2f14765
ingest test: refactor, minor semantic fixes
cjonas9 d7c90a9
test.go: add retention window to config, fix fake history archive for…
cjonas9 0390757
minor db restore/trim helper fixes
cjonas9 e0a86e7
rename restore backed-up ledgers function for accuracy
cjonas9 f151a35
refactor, add env vars, change DB helpers to take sequences
cjonas9 bffb101
remove db restoration functionality
cjonas9 e04d51d
add performance metrics json emission functionality
cjonas9 bd8c784
migrate to polling getHealth, change ingest test limits to 1000 ledgers
cjonas9 c7bc001
remove ledger fixtures
cjonas9 786423d
add workflow and script
cjonas9 1606829
fix yaml referencing wrong path for script
cjonas9 7d41b1a
fix yml parsing indentation bug
cjonas9 b701108
use head-object for metadata rather than tags
cjonas9 b1cec1d
refine workflow + instance script
cjonas9 b9ef27e
add apply load cfg
cjonas9 73df1e7
testing: on-push runs
cjonas9 241bdf8
minor yml syntax fixes
cjonas9 1161e3f
set test e2e.yml + add debugging info from instance to ssm
cjonas9 47437f4
skip e2e.yml for testing, add retry loop for root volume lookup
cjonas9 008f327
build-libs over build-stellar-rpc to cut time back
cjonas9 9441749
further slim build phase with no-install-recommends
cjonas9 36c0a82
make instance script best-effort if head-object or stellar-core versi…
cjonas9 4535977
temporarily modify script to work on scratch dev box; increase timeout
cjonas9 54f0b41
fix cfg path error and run ID regression
cjonas9 44e093c
improve error logging
cjonas9 1ce515e
fix error logging wrapper
cjonas9 22a8e6e
patch premature exit due to err trap bug
cjonas9 e925d3c
fix empty GOPATH/GOMODCACHE
cjonas9 ffb3299
updated apply-load config for specific core on runner
cjonas9 bae2fdc
fix version check if warning prints
cjonas9 70eb9dc
bump all timeouts to >= 2 hours
cjonas9 705edec
increase ingest phase timeout
cjonas9 c697510
extend aws role lifetime
cjonas9 caec3f4
undo session time limit increase, use pre-generated synthetic ledgers
cjonas9 b32181d
require confirmed gp3 throttling, extend GHA AWS session to 4 hours
cjonas9 3a0571f
patch logic for throttling behavior
cjonas9 2c4a004
slim needless instance bootstrapping work
cjonas9 d620450
refactor ephemeral load test runner
cjonas9 41529f4
fix minor refactor false sha-verify failure
cjonas9 2a21c73
add support for multiple ledger profiles/files
cjonas9 04f0fe1
change log level to warn, decrease each soroban scenario meta to 1000…
cjonas9 02556cc
refactored duplicate/messy code
cjonas9 807ca42
stop grepping to determine success status, make GHA->ec2 parameter pa…
cjonas9 af9f7b9
split offline ledger generation out of the ingest benchmark
cjonas9 e4180dd
refactor and remove old apply load cfg
cjonas9 4c3394c
Merge remote-tracking branch 'origin/main' into apply-load
cjonas9 bc2e490
Merge branch 'main' into apply-load
cjonas9 555483e
Merge branch 'apply-load' of https://github.com/stellar/stellar-rpc i…
cjonas9 a620cdc
fix linter errors
cjonas9 2dabdf3
add json file providing configurability for eval thresholds
cjonas9 3f873f7
add basic coordinator for epic's tasks
cjonas9 8f4f1d1
make ec2 ingest load test callable
cjonas9 c1c437f
propogate apply load ingest test metrics to coordinator
cjonas9 b031d9d
add releaseeval package for subtest tooling and execution
cjonas9 61d4877
make ingest load test share perf schema w/ coordinator
cjonas9 65cb6ff
update go version
cjonas9 4aca1ef
update default ledger bundle/config to existent ones for test
cjonas9 3d61ceb
decompose ec2 script into go programs
cjonas9 9bef115
reduce comment verbosity, minor clean up
cjonas9 8b39ed5
install jq on load-test box for build-libs; surface build-libs errors
cjonas9 714b1fa
throttle load-test benchmark via cgroup io.max instead of EBS ModifyV…
cjonas9 d9987f6
drop accidentally-committed refresh tooling and orphaned apply-load.cfg
cjonas9 5058ad3
fix linter errors in load-test runner
cjonas9 8cf9f6b
make load-test ingest frequency and ledger count configurable via env
cjonas9 3b33626
EXPERIMENT: run load-test benchmark un-throttled at volume-provisione…
cjonas9 7e60661
use SDK's maxLedgersPerFile ceiling and multiple-bundle functionality
cjonas9 fdb1926
simplify verification walk
cjonas9 1f974a4
simplify and refactor, add ledger ingest stall timeout
cjonas9 19a3115
simplify correctness check, delegate apply-load config work to SDK
cjonas9 103b648
remove ingest phase dependence on unnecessary supplied apply load con…
cjonas9 7e13bf3
bump go sdk to v0.6.x
cjonas9 8333974
bump go sdk again, merge SDK main into loadtest-patch
cjonas9 f3f3d58
Merge remote-tracking branch 'origin/main' into apply-load
cjonas9 a6241f6
update comments in light of changes
cjonas9 855527c
merge apply-load recent work into coordinator
cjonas9 8d5f523
rework handshake into instance->s3 results push, fix minor leaks + OO…
cjonas9 21b8045
replace polling-based ledger timing computation with daemon hook
cjonas9 a8931fe
remove trigger-on-push behavior
cjonas9 97af867
Merge branch 'apply-load' into gha-coordinator
cjonas9 b15e2e3
simplify significantly, refactor into on-release-push job launcher + …
cjonas9 fbd8b2b
moved ingest load test go programs into separate folder
cjonas9 237578c
refactored coordinator logic into go
cjonas9 4651084
Merge remote-tracking branch 'origin/main' into gha-coordinator
cjonas9 f1b4473
add temporary trigger and log->s3 for testing
cjonas9 c601be5
bring main verbosity cleanups into coordinator
cjonas9 d846b52
decompose shared ec2/gha programming into reusable modular components
cjonas9 f83c4d8
move run-load-test.sh scripting into run_leg helper in common shell s…
cjonas9 c91c61f
refactor into callable workflow, factor out common main Run() func
cjonas9 4ced1a8
Merge branch 'main' into gha-coordinator
cjonas9 4193e6e
gate comment posting on GHA bot user, add guard for blank comments, s…
cjonas9 6e760db
remove local files from gitignore
cjonas9 5877dc2
derive all timeout buffers from e2e deadline
cjonas9 6ea0d82
move leg concurrency label from workflow level to job level
cjonas9 c701ab2
pin renderer to workflow version, pass ec2 launch params through env
cjonas9 fef348f
make renderer failures abort before posting
cjonas9 e542699
make run-load-test.sh 644
cjonas9 6e0ad79
make gather its own command in its own package main
cjonas9 0d93c00
Merge branch 'gha-coordinator' of https://github.com/stellar/stellar-…
cjonas9 2bdcc22
return error in BailInstance
cjonas9 9e1aa87
inline running of apply-load test rather than abstracting through cal…
cjonas9 ac92932
drastically simplify AMI resolution
cjonas9 c2be14f
simplify s3 to be the sole reporting channel
cjonas9 38081f5
inline + simplify result fetching in gather from s3
cjonas9 9ddaaed
make renderer robust to comments by passing comment md as base64 JSON…
cjonas9 8076b9e
add gather/main.go
cjonas9 6c98267
pin hardcoded AMI
cjonas9 dce2afd
guard against stale attempts
cjonas9 18df31c
Merge branch 'main' into gha-coordinator
cjonas9 62719e2
remove temporary scaffolding in-place for debugging on this branch
cjonas9 ee300ed
Merge branch 'gha-coordinator' of https://github.com/stellar/stellar-…
cjonas9 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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,264 @@ | ||
| name: Perf-eval EC2 leg (ephemeral) | ||
| # Generic callable leg: launches an ephemeral EC2 box, renders its user-data from | ||
| # bootstrap-common.sh + the leg's own run script, polls S3 for the result object | ||
| # the box publishes, and reports through that object (job result = leg verdict). | ||
| # Does not post to the PR -- the coordinator owns human-facing output. | ||
| # Box bootstrap: perf-eval/bootstrap-common.sh + the leg script (inputs.leg_script); | ||
| # runner-side polling: perf-eval/gather. | ||
|
|
||
| on: | ||
| # workflow_call is the only trigger: a leg runs through the coordinator. | ||
| workflow_call: | ||
| inputs: | ||
| target_ref: | ||
| description: 'Ref or SHA to benchmark (resolved to a SHA on checkout)' | ||
| required: true | ||
| type: string | ||
| run_label: | ||
| description: 'Leg label; folded into the S3 result key and instance name' | ||
| required: true | ||
| type: string | ||
| leg_script: | ||
| description: 'Path to the leg run script, concatenated after bootstrap-common.sh into the box user-data' | ||
| required: true | ||
| type: string | ||
| instance_type: | ||
| description: 'EC2 instance type' | ||
| required: false | ||
| type: string | ||
| default: c5.2xlarge | ||
| root_volume_gb: | ||
| description: 'Root gp3 volume size (GB)' | ||
| required: false | ||
| type: number | ||
| default: 500 | ||
| volume_iops: | ||
| description: 'Root gp3 IOPS (3000 is the gp3 floor)' | ||
| required: false | ||
| type: number | ||
| default: 3000 | ||
| volume_throughput: | ||
| description: 'Root gp3 throughput (MiB/s)' | ||
| required: false | ||
| type: number | ||
| default: 125 | ||
| ssm_registration_timeout: | ||
| description: 'Seconds to wait for the SSM agent to register' | ||
| required: false | ||
| type: number | ||
| default: 240 | ||
| budget_minutes: | ||
| description: 'End-to-end leg ceiling (= job timeout); S3 poll deadline, box self-terminate, and OIDC session derive from it (-15m/+15m/+15m). Derived session must fit the IAM role max.' | ||
| required: false | ||
| type: number | ||
| default: 225 | ||
| poll_interval: | ||
| description: 'Seconds between S3 result polls' | ||
| required: false | ||
| type: number | ||
| default: 30 | ||
| extra_env: | ||
| description: 'Extra `export FOO=bar` lines injected into the box user-data preamble' | ||
| required: false | ||
| type: string | ||
| default: '' | ||
| secrets: | ||
| AWS_GHA_ROLE_ARN: | ||
| description: 'OIDC role ARN to assume for EC2 + S3 access' | ||
| required: true | ||
|
|
||
| # Only the intrinsic infra permissions necessary | ||
| permissions: | ||
| id-token: write # OIDC AssumeRole into the GHA role | ||
| contents: read # checkout | ||
|
|
||
| jobs: | ||
| ec2-leg: | ||
| name: Launch + await ephemeral perf-eval box | ||
| # Non-cancelling group keyed on the test commit SHA + leg. An instance can run | ||
| # until the box’s self-terminate ceiling, so new runs queue. | ||
| concurrency: | ||
| group: ec2-leg-${{ inputs.target_ref }}-${{ inputs.run_label }} | ||
| cancel-in-progress: false | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: ${{ inputs.budget_minutes }} | ||
| env: | ||
| AWS_REGION: us-east-1 | ||
| INSTANCE_TYPE: ${{ inputs.instance_type }} | ||
| ROOT_VOLUME_GB: ${{ inputs.root_volume_gb }} | ||
| BOOTSTRAP_VOLUME_IOPS: ${{ inputs.volume_iops }} | ||
| BOOTSTRAP_VOLUME_THROUGHPUT: ${{ inputs.volume_throughput }} | ||
| INSTANCE_PROFILE: stellar-rpc-ci-load-test | ||
| TEST_TAG_KEY: test | ||
| TEST_TAG_VAL: stellar-rpc-ci-load-test | ||
| SSM_REGISTRATION_TIMEOUT: ${{ inputs.ssm_registration_timeout }} | ||
| POLL_INTERVAL: ${{ inputs.poll_interval }} | ||
| DEBUG_LOG_LINES: 40 | ||
| DEBUG_LOG_EVERY_POLLS: 5 | ||
| PERF_EVAL_DIR: cmd/stellar-rpc/internal/integrationtest/infrastructure/perf-eval | ||
| LEG_SCRIPT: ${{ inputs.leg_script }} | ||
| BUCKET: stellar-rpc-ci-load-test | ||
| RESULT_KEY: runs/${{ github.run_id }}/${{ inputs.run_label }}/result.json # deterministic per run + leg | ||
|
|
||
| steps: | ||
| # budget_minutes is the job timeout and the other deadlines derive from it so | ||
| # the ordering (poll < job < self-terminate <= role session) holds by | ||
| # construction. | ||
| - name: Derive deadlines | ||
| id: deadlines | ||
| run: | | ||
| B=${{ inputs.budget_minutes }} | ||
| [ "$B" -gt 30 ] || { echo "::error::budget_minutes must exceed the 15m infra buffers"; exit 1; } | ||
| { | ||
| echo "RESULTS_TIMEOUT=$(( (B - 15) * 60 ))" | ||
| echo "SELF_TERMINATE_MINUTES=$(( B + 15 ))" | ||
| } >> "$GITHUB_ENV" | ||
| echo "role_seconds=$(( (B + 15) * 60 ))" >> "$GITHUB_OUTPUT" | ||
|
|
||
| # Harness (gather, bootstrap-common.sh, leg script) and the benchmarked | ||
| # code come from one SHA: target_ref is checked out here and the box rebuilds | ||
| # it. Tradeoff: an ad-hoc dispatch against an old ref also runs that ref's | ||
| # harness. | ||
| - name: Checkout target ref | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ inputs.target_ref }} | ||
|
|
||
| - name: Resolve target SHA | ||
| id: resolve | ||
| run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | ||
|
|
||
| # The runner-side half is `go run <perf-eval>/gather`. | ||
| - uses: ./.github/actions/setup-go | ||
|
|
||
| - name: Configure AWS via OIDC | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| role-to-assume: ${{ secrets.AWS_GHA_ROLE_ARN }} | ||
| aws-region: ${{ env.AWS_REGION }} | ||
| role-duration-seconds: ${{ steps.deadlines.outputs.role_seconds }} | ||
|
|
||
| - name: Render user-data | ||
| # The scripts ship verbatim; parameters travel in a preamble so the bytes | ||
| # that run on the box match the bytes in git. Order is: | ||
| # preamble exports -> bootstrap-common.sh -> the leg run script. | ||
| env: | ||
| EXTRA_ENV: ${{ inputs.extra_env }} | ||
| run: | | ||
| { | ||
| echo '#!/usr/bin/env bash' | ||
| echo "export TARGET_SHA=${{ steps.resolve.outputs.sha }} RUN_ID=${{ github.run_id }}-${{ github.run_attempt }}" | ||
| echo "export BUCKET=$BUCKET RESULT_KEY=$RESULT_KEY" | ||
| echo "export SELF_TERMINATE_MINUTES=$SELF_TERMINATE_MINUTES" | ||
| if [ -n "$EXTRA_ENV" ]; then printf '%s\n' "$EXTRA_ENV"; fi | ||
| cat "$PERF_EVAL_DIR/bootstrap-common.sh" | ||
| cat "$LEG_SCRIPT" | ||
| } > /tmp/user-data.sh | ||
|
|
||
| - name: Launch EC2 instance | ||
| id: launch | ||
| env: | ||
| TARGET_REF: ${{ inputs.target_ref }} | ||
| RUN_LABEL: ${{ inputs.run_label }} | ||
| run: | | ||
| COMMON_TAGS="{Key=$TEST_TAG_KEY,Value=$TEST_TAG_VAL}, | ||
| {Key=ref,Value=$TARGET_REF}, | ||
| {Key=sha,Value=${{ steps.resolve.outputs.sha }}}, | ||
| {Key=run-id,Value=${{ github.run_id }}}" | ||
| # AMI: Ubuntu 22.04 amd64 in us-east-1 as of 2026-07-08 | ||
| RUN_INSTANCES_JSON=$(aws ec2 run-instances \ | ||
| --image-id ami-0d28727121d5d4a3c \ | ||
| --instance-type "$INSTANCE_TYPE" \ | ||
| --iam-instance-profile "Name=$INSTANCE_PROFILE" \ | ||
| --user-data file:///tmp/user-data.sh \ | ||
| --instance-initiated-shutdown-behavior terminate \ | ||
| --block-device-mappings "[{ | ||
| \"DeviceName\":\"/dev/sda1\", | ||
| \"Ebs\":{\"VolumeSize\":$ROOT_VOLUME_GB,\"VolumeType\":\"gp3\",\"Iops\":$BOOTSTRAP_VOLUME_IOPS,\"Throughput\":$BOOTSTRAP_VOLUME_THROUGHPUT,\"DeleteOnTermination\":true} | ||
| }]" \ | ||
| --tag-specifications \ | ||
| "ResourceType=instance,Tags=[ | ||
| {Key=Name,Value=perf-eval-$RUN_LABEL}, | ||
| $COMMON_TAGS | ||
| ]" \ | ||
| "ResourceType=volume,Tags=[ | ||
| {Key=Name,Value=perf-eval-${RUN_LABEL}-root}, | ||
| $COMMON_TAGS | ||
| ]" \ | ||
| --count 1 \ | ||
| --output json) | ||
|
|
||
| INSTANCE_ID=$(printf '%s' "$RUN_INSTANCES_JSON" | jq -r '.Instances[0].InstanceId') | ||
| echo "instance_id=$INSTANCE_ID" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Wait for SSM agent to register | ||
| env: | ||
| INSTANCE_ID: ${{ steps.launch.outputs.instance_id }} | ||
| run: | | ||
| DEADLINE=$(( $(date +%s) + SSM_REGISTRATION_TIMEOUT )) | ||
| while [ "$(date +%s)" -lt "$DEADLINE" ]; do | ||
| PING=$(aws ssm describe-instance-information \ | ||
| --filters "Key=InstanceIds,Values=$INSTANCE_ID" \ | ||
| --query 'InstanceInformationList[0].PingStatus' \ | ||
| --output text 2>/dev/null || echo "") | ||
| echo "[$(date -u +%FT%TZ)] ssm ping=$PING" | ||
| if [ "$PING" = "Online" ]; then | ||
| exit 0 | ||
| fi | ||
| sleep 10 | ||
| done | ||
| echo "::error::SSM agent never registered for $INSTANCE_ID — verify AmazonSSMManagedInstanceCore is attached to the stellar-rpc-ci-load-test role" | ||
| exit 1 | ||
|
|
||
| # Polls S3 for the result object and relays verdict/passed + the result | ||
| # location (bucket/key) as step outputs the coordinator reads. | ||
| # RUN_ID must match the box preamble's: gather skips result objects from | ||
| # other attempts (a re-run shares RESULT_KEY with its predecessors). | ||
| - name: Poll for results | ||
| id: results | ||
| env: | ||
| INSTANCE_ID: ${{ steps.launch.outputs.instance_id }} | ||
| RUN_ID: ${{ github.run_id }}-${{ github.run_attempt }} | ||
| run: go run "./$PERF_EVAL_DIR/gather" | ||
|
cjonas9 marked this conversation as resolved.
|
||
|
|
||
| - name: Write results summary | ||
| if: always() | ||
| run: | | ||
| if [ -f /tmp/results.md ]; then | ||
| cat /tmp/results.md >> "$GITHUB_STEP_SUMMARY" | ||
| elif [ -f /tmp/timeout-comment.md ]; then | ||
| cat /tmp/timeout-comment.md >> "$GITHUB_STEP_SUMMARY" | ||
| fi | ||
|
|
||
| # Standalone-debugging convenience: the result object also lives in S3, which | ||
| # is what the coordinator reads. | ||
| - name: Upload leg results artifact | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: perf-eval-results-${{ inputs.run_label }} | ||
| path: | | ||
| /tmp/results.md | ||
| /tmp/timeout-comment.md | ||
| /tmp/bench-results.json | ||
| if-no-files-found: warn | ||
|
|
||
| - name: Fail leg on timeout or leg failure | ||
| if: always() | ||
| run: | | ||
| if [ "${{ steps.results.outputs.found }}" != "true" ]; then | ||
| echo "Leg timed out before producing instance results" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ "${{ steps.results.outputs.passed }}" != "true" ]; then | ||
| echo "Instance reported a failing verdict" | ||
| cat /tmp/results.md 2>/dev/null || true | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Terminate instance | ||
| if: always() && steps.launch.outputs.instance_id != '' | ||
| run: | | ||
| aws ec2 terminate-instances \ | ||
| --instance-ids ${{ steps.launch.outputs.instance_id }} || true | ||
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.
Uh oh!
There was an error while loading. Please reload this page.