Repository navigation
feat: Add cloud storage integration with S3 upload/download and snapshot management #107
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 17 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b7a3663
feat: Add upload to aws and retrieving results from aws
tobidae-cb 715d03f
feat: update how report backend works
tobidae-cb 77038a7
Setup initial snapshot from remote source and copy per tests
tobidae-cb 6dfc2b1
Add frontend build
tobidae-cb 836ecd1
Merge remote-tracking branch 'origin' into tobi/add-aws
tobidae-cb 17c4a1d
Add machine info
tobidae-cb c758c68
More frontend changes
tobidae-cb 2d7ec86
Use debug setHead for quick snapshot rollbacks, add client version pe…
tobidae-cb 9cbf7c2
Remove redundant client version
tobidae-cb 67b4cd7
Add additional snapshot method
tobidae-cb d0f2321
Fix warnings
tobidae-cb 6b94a74
Fix lint issues
tobidae-cb 6a0d4aa
Update frontend
tobidae-cb 9457e53
Update output dir
tobidae-cb 2d7ae0c
Merge remote-tracking branch 'origin' into tobi/add-aws
tobidae-cb a6db049
Remove backend and ref to s3, fix lint
tobidae-cb 86dafdd
Remove all refs to s3
tobidae-cb da990e5
revert main.go, rename and delete some files
tobidae-cb addb893
More changes
tobidae-cb 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 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
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
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
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,97 @@ | ||
| # Two-Tier Snapshot System | ||
|
|
||
| ## Overview | ||
|
|
||
| The benchmarking framework now supports an optimized two-tier snapshot system that significantly improves performance and reduces network overhead when running multiple tests with snapshots. | ||
|
|
||
| ## Architecture | ||
|
|
||
| ### Tier 1: Initial Snapshots | ||
| - **Purpose**: Downloaded once at benchmark startup and stored persistently | ||
| - **Location**: Typically `/data/snapshots/initial_<nodeType>_<hash>` | ||
| - **Lifecycle**: Created at benchmark startup, persisted across all tests | ||
| - **Usage**: Serves as the source for per-test copies | ||
|
|
||
| ### Tier 2: Per-Test Snapshots | ||
| - **Purpose**: Test-specific copies created from initial snapshots | ||
| - **Location**: Test-specific temporary directories | ||
| - **Lifecycle**: Created before each test, cleaned up after test completion | ||
| - **Usage**: Isolated environment for each test run | ||
|
|
||
| ## Configuration Format | ||
|
|
||
| ### New YAML Structure | ||
|
|
||
| ```yaml | ||
| benchmarks: | ||
| - initial_snapshots: | ||
| - node_type: reth | ||
| command: ./scripts/setup-initial-snapshot.sh --network=sepolia --node-type=reth | ||
| superchain_chain_id: 84532 | ||
| - node_type: geth | ||
| command: ./scripts/setup-initial-snapshot.sh --network=sepolia --node-type=geth | ||
| superchain_chain_id: 84532 | ||
| variables: | ||
| - type: node_type | ||
| values: [reth, geth] | ||
| # ... other variables | ||
| ``` | ||
|
|
||
| ## Implementation Details | ||
|
|
||
| ### Key Components | ||
|
|
||
| 1. **SnapshotManager Interface** (`benchmark/snapshots.go`) | ||
| - `EnsureInitialSnapshot()`: Creates initial snapshots | ||
| - `GetInitialSnapshotPath()`: Retrieves initial snapshot paths | ||
| - `CopyFromInitialSnapshot()`: Copies using rsync for efficiency | ||
|
|
||
| 2. **TestDefinition** (`benchmark/definition.go`) | ||
| - `InitialSnapshots []SnapshotDefinition`: Tier 1 snapshots | ||
|
|
||
| 3. **Service** (`runner/service.go`) | ||
| - `setupInitialSnapshots()`: Runs at benchmark startup | ||
| - `setupInternalDirectories()`: Uses rsync for per-test copies | ||
|
|
||
| ### Execution Flow | ||
|
|
||
| 1. **Benchmark Startup** | ||
| ``` | ||
| Service.Run() → setupInitialSnapshots() → EnsureInitialSnapshot() | ||
| ``` | ||
|
|
||
| 2. **Per Test Execution** | ||
| ``` | ||
| runTest() → setupInternalDirectories() → CopyFromInitialSnapshot() | ||
| ``` | ||
|
|
||
| 3. **Test Cleanup** | ||
| ``` | ||
| defer cleanup → os.RemoveAll(testDir) // Removes per-test copies only | ||
| ``` | ||
|
|
||
| ## Usage Examples | ||
|
|
||
| ### Multi-Node Type Testing | ||
| ```yaml | ||
| initial_snapshots: | ||
| - node_type: reth | ||
| command: ./download-reth-snapshot.sh | ||
| - node_type: geth | ||
| command: ./download-geth-snapshot.sh | ||
| variables: | ||
| - type: node_type | ||
| values: [reth, geth] | ||
| ``` | ||
|
|
||
| ### Fallback Support | ||
| If no initial snapshot exists for a node type, the system automatically falls back to the original single-tier behavior, ensuring backward compatibility. | ||
|
|
||
| ### Mixed Scenarios | ||
| ```yaml | ||
| # Test plan 1: Uses two-tier system | ||
| - initial_snapshots: [...] | ||
|
|
||
| # Test plan 2: Uses single-tier system | ||
| - initial_snapshots: [...] # No initial_snapshots | ||
| ``` | ||
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 |
|---|---|---|
|
|
@@ -42,8 +42,8 @@ func main() { | |
| Name: "import-runs", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. small nit: I think this file can be reverted |
||
| Flags: cliapp.ProtectFlags(flags.ImportRunsFlags), | ||
| Action: ImportMain(Version), | ||
| Usage: "import runs from metadata file or URL", | ||
| Description: "Import benchmark runs from local metadata.json or remote URL into existing output metadata.json. Use --src-tag and --dest-tag to apply tags to runs, or use interactive mode.", | ||
| Usage: "import runs from metadata file, URL", | ||
| Description: "Import benchmark runs from local metadata.json, remote URL into existing output metadata.json. Use --src-tag and --dest-tag to apply tags to runs, or use interactive mode.", | ||
| ArgsUsage: "[metadata-file-or-url]", | ||
| }, | ||
| } | ||
|
|
@@ -86,7 +86,7 @@ func ImportMain(version string) cli.ActionFunc { | |
|
|
||
| service := importer.NewService(cfg, l) | ||
|
|
||
| // Load source metadata | ||
| // Load source metadata from file/URL | ||
| srcMetadata, err := service.LoadSourceMetadata(cfg.SourceFile()) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to load source metadata: %w", err) | ||
|
|
||
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
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
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
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
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 |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ benchmarks: | |
| value: 10 | ||
| - type: gas_limit | ||
| values: | ||
| - 15000000 | ||
| - 20000000 | ||
| - 30000000 | ||
| - 60000000 | ||
| - 90000000 | ||
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
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 think we can remove this file. Maybe move some of this explanation into
configs/examples/snapshot.yml