-
Notifications
You must be signed in to change notification settings - Fork 14
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
Open
tobidae-cb
wants to merge
18
commits into
main
Choose a base branch
from
tobi/add-aws
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
18 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 26447f3
Update script
tobidae-cb e4e1093
Update config
tobidae-cb 80ae674
Disable explicit check
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
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,45 @@ | ||
package config | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/base/base-bench/benchmark/flags" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
// ExportCmdConfig represents the configuration for the export-to-cloud command | ||
type ExportCmdConfig struct { | ||
outputDir string | ||
s3Bucket string | ||
} | ||
|
||
// NewExportCmdConfig creates a new export command config from CLI context | ||
func NewExportCmdConfig(cliCtx *cli.Context) *ExportCmdConfig { | ||
return &ExportCmdConfig{ | ||
outputDir: cliCtx.String(flags.OutputDirFlagName), | ||
s3Bucket: cliCtx.String(flags.S3BucketFlagName), | ||
} | ||
} | ||
|
||
// OutputDir returns the output directory path | ||
func (c *ExportCmdConfig) OutputDir() string { | ||
return c.outputDir | ||
} | ||
|
||
// S3Bucket returns the S3 bucket name | ||
func (c *ExportCmdConfig) S3Bucket() string { | ||
return c.s3Bucket | ||
} | ||
|
||
// Check validates the export command configuration | ||
func (c *ExportCmdConfig) Check() error { | ||
if c.outputDir == "" { | ||
return fmt.Errorf("output directory is required") | ||
} | ||
|
||
if c.s3Bucket == "" { | ||
return fmt.Errorf("S3 bucket is required for export command") | ||
} | ||
|
||
return nil | ||
} |
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 still feel like this command could be handled outside of the benchmark program. It's basically the same as
aws s3 cp
.