-
Notifications
You must be signed in to change notification settings - Fork 43
Metrics and load testing #121
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
36 commits
Select commit
Hold shift + click to select a range
c90177c
skeleton test setup
kmchicoine 9ac2960
add basic tests and rpc client
kmchicoine 59e7931
add client
kmchicoine 3ba620d
full e2e tests, with local node
kmchicoine a262b34
Ignore test that requires node running
kmchicoine cdad812
Mark full node tests with env flag
kmchicoine 9f65698
Merge remote-tracking branch 'origin/master' into kaley/e2e-testing
kmchicoine 1f9fe4d
Finish merge
kmchicoine ae9641f
readme + fmt
kmchicoine 8272ed9
Merge remote-tracking branch 'origin/master' into kaley/e2e-testing
kmchicoine e78c225
yarn update
kmchicoine 56ef9a0
Update tests for clean fail
kmchicoine d254ec2
fmt
kmchicoine b5b4502
Add mock provider to avoid need to run node for e2e tests
kmchicoine 15cada8
Cargo
kmchicoine f0cc6a9
Merge remote-tracking branch 'origin/master' into kaley/e2e-testing
kmchicoine 4d74529
lint + clippy
kmchicoine d7b82a2
Update env var flag and readme
kmchicoine 6541a73
Merge remote-tracking branch 'origin/master' into kaley/e2e-testing
kmchicoine 8ec09b6
Merge remote-tracking branch 'origin/master' into kaley/e2e-testing
kmchicoine d34f5b5
run tests with full services
kmchicoine 126e4e5
update integration tests filename
kmchicoine 3a9cf7b
Merge remote-tracking branch 'origin/master' into kaley/e2e-testing
kmchicoine b87f88d
Merge remote-tracking branch 'origin/master' into kaley/e2e-testing
kmchicoine 1a23736
create runnable bin for load testing
kmchicoine c2bc241
Restructure for runnable binary
kmchicoine 55da6cf
Merge remote-tracking branch 'origin/master' into kaley/e2e-testing
kmchicoine 4d58ead
Separate load testing from integration testing
kmchicoine 20a3d9b
refine load testing
kmchicoine 03618d6
Merge remote-tracking branch 'origin' into kaley/load-tests
kmchicoine 59485ab
Fix toml
kmchicoine 14cdfe0
Merge branch 'master' into kaley/load-tests
kmchicoine f5a389d
Cargo.toml update
kmchicoine 35e13f1
Load test cleanup
kmchicoine 79bc854
fix readme
kmchicoine 069a696
METRICS.md fix + fmt
kmchicoine 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,133 @@ | ||
| # TIPS Load Testing | ||
|
|
||
| Multi-wallet concurrent load testing tool for measuring TIPS performance. | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ```bash | ||
| # 1. Build | ||
| cargo build --release --bin load-test | ||
|
|
||
| # 2. Setup wallets | ||
| ./target/release/load-test setup \ | ||
| --master-key 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d \ | ||
| --output wallets.json | ||
|
|
||
| # 3. Run load test | ||
| ./target/release/load-test load --wallets wallets.json | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Configuration Options | ||
|
|
||
| ### Setup Command | ||
|
|
||
| Create and fund test wallets from a master wallet. Test wallets are saved to allow test reproducibility and avoid the need to create new wallets for every test run. | ||
|
|
||
| **Usage:** | ||
| ```bash | ||
| ./target/release/load-test setup --master-key <KEY> --output <FILE> [OPTIONS] | ||
| ``` | ||
|
|
||
| **Options:** | ||
|
|
||
| | Flag | Description | Default | Example | | ||
| |------|-------------|---------|---------| | ||
| | `--master-key` | Private key of funded wallet (required) | - | `0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d` | | ||
| | `--output` | Save wallets to JSON file (required) | - | `wallets.json` | | ||
| | `--sequencer` | L2 sequencer RPC URL | `http://localhost:8547` | `http://localhost:8547` | | ||
| | `--num-wallets` | Number of wallets to create | `10` | `100` | | ||
| | `--fund-amount` | ETH to fund each wallet | `0.1` | `0.5` | | ||
|
|
||
| **Environment Variables:** | ||
| - `MASTER_KEY` - Alternative to `--master-key` flag | ||
| - `SEQUENCER_URL` - Alternative to `--sequencer` flag | ||
|
|
||
| ### Load Command | ||
|
|
||
| Run load test with funded wallets. Use the `--seed` flag to set the RNG seed for test reproducibility. | ||
|
|
||
| **Usage:** | ||
| ```bash | ||
| ./target/release/load-test load --wallets <FILE> [OPTIONS] | ||
| ``` | ||
|
|
||
| **Options:** | ||
|
|
||
| | Flag | Description | Default | Example | | ||
| |------|-------------|---------|---------| | ||
| | `--wallets` | Path to wallets JSON file (required) | - | `wallets.json` | | ||
| | `--target` | TIPS ingress RPC URL | `http://localhost:8080` | `http://localhost:8080` | | ||
| | `--sequencer` | L2 sequencer RPC URL | `http://localhost:8547` | `http://localhost:8547` | | ||
| | `--rate` | Target transaction rate (tx/s) | `100` | `500` | | ||
| | `--duration` | Test duration in seconds | `60` | `100` | | ||
| | `--tx-timeout` | Timeout for tx inclusion (seconds) | `60` | `120` | | ||
| | `--seed` | Random seed for reproducibility | (none) | `42` | | ||
| | `--output` | Save metrics to JSON file | (none) | `metrics.json` | | ||
|
|
||
| **Environment Variables:** | ||
| - `INGRESS_URL` - Alternative to `--target` flag | ||
| - `SEQUENCER_URL` - Alternative to `--sequencer` flag | ||
|
|
||
| --- | ||
| --- | ||
|
|
||
| ## Metrics Explained | ||
|
|
||
| ### Output Example | ||
|
|
||
| ``` | ||
| Load Test Results | ||
| ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
| Configuration: | ||
| Target: http://localhost:8080 | ||
| Sequencer: http://localhost:8547 | ||
| Wallets: 100 | ||
| Target Rate: 100 tx/s | ||
| Duration: 60s | ||
| TX Timeout: 60s | ||
|
|
||
| Throughput: | ||
| Sent: 100.0 tx/s (6000 total) | ||
| Included: 98.5 tx/s (5910 total) | ||
| Success Rate: 98.5% | ||
|
|
||
| Transaction Results: | ||
| Included: 5910 (98.5%) | ||
| Reverted: 10 (0.2%) | ||
| Timed Out: 70 (1.2%) | ||
| Send Errors: 10 (0.1%) | ||
| ``` | ||
|
|
||
| ### Metrics Definitions | ||
|
|
||
| **Throughput:** | ||
| - `Sent Rate` - Transactions sent to TIPS per second | ||
| - `Included Rate` - Transactions included in blocks per second | ||
| - `Success Rate` - Percentage of sent transactions that were included | ||
|
|
||
| **Transaction Results:** | ||
| - `Included` - Successfully included in a block with status == true | ||
| - `Reverted` - Included in a block but transaction reverted (status == false) | ||
| - `Timed Out` - Not included within timeout period | ||
| - `Send Errors` - Failed to send to TIPS RPC | ||
|
|
||
| --- | ||
|
|
||
| ## Architecture | ||
|
|
||
| ``` | ||
| Sender Tasks (1 per wallet) Receipt Poller | ||
| │ │ | ||
| ▼ ▼ | ||
| Send to TIPS ──► Tracker ◄── Poll sequencer every 2s | ||
| (retry 3x) (pending) │ | ||
| │ │ ├─ status=true → included | ||
| │ │ ├─ status=false → reverted | ||
| │ │ └─ timeout → timed_out | ||
| ▼ ▼ | ||
| rate/N tx/s Calculate Results → Print Summary | ||
| ``` | ||
|
|
||
| --- | ||
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,13 @@ | ||
| use anyhow::Result; | ||
| use clap::Parser; | ||
| use tips_system_tests::load_test::{config, load, setup}; | ||
|
|
||
| #[tokio::main] | ||
| async fn main() -> Result<()> { | ||
| let cli = config::Cli::parse(); | ||
|
|
||
| match cli.command { | ||
| config::Commands::Setup(args) => setup::run(args).await, | ||
| config::Commands::Load(args) => load::run(args).await, | ||
| } | ||
| } |
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 |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| pub mod client; | ||
| pub mod fixtures; | ||
| pub mod load_test; |
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,76 @@ | ||
| use clap::{Parser, Subcommand}; | ||
| use std::path::PathBuf; | ||
|
|
||
| #[derive(Parser)] | ||
| #[command(name = "load-test")] | ||
| #[command(about = "Load testing tool for TIPS ingress service", long_about = None)] | ||
| pub struct Cli { | ||
| #[command(subcommand)] | ||
| pub command: Commands, | ||
| } | ||
|
|
||
| #[derive(Subcommand)] | ||
| pub enum Commands { | ||
| /// Setup: Fund N wallets from a master wallet | ||
| Setup(SetupArgs), | ||
| /// Load: Run load test with funded wallets | ||
| Load(LoadArgs), | ||
| } | ||
|
|
||
| #[derive(Parser)] | ||
| pub struct SetupArgs { | ||
| /// Master wallet private key (must have funds) | ||
| #[arg(long, env = "MASTER_KEY")] | ||
| pub master_key: String, | ||
|
|
||
| /// Sequencer RPC URL | ||
| #[arg(long, env = "SEQUENCER_URL", default_value = "http://localhost:8547")] | ||
| pub sequencer: String, | ||
|
|
||
| /// Number of wallets to create and fund | ||
| #[arg(long, default_value = "10")] | ||
| pub num_wallets: usize, | ||
|
|
||
| /// Amount of ETH to fund each wallet | ||
| #[arg(long, default_value = "0.1")] | ||
| pub fund_amount: f64, | ||
|
|
||
| /// Output file for wallet data (required) | ||
| #[arg(long)] | ||
| pub output: PathBuf, | ||
| } | ||
|
|
||
| #[derive(Parser)] | ||
| pub struct LoadArgs { | ||
| /// TIPS ingress RPC URL | ||
| #[arg(long, env = "INGRESS_URL", default_value = "http://localhost:8080")] | ||
| pub target: String, | ||
|
|
||
| /// Sequencer RPC URL (for nonce fetching and receipt polling) | ||
| #[arg(long, env = "SEQUENCER_URL", default_value = "http://localhost:8547")] | ||
| pub sequencer: String, | ||
|
|
||
| /// Path to wallets JSON file (required) | ||
| #[arg(long)] | ||
| pub wallets: PathBuf, | ||
|
|
||
| /// Target transaction rate (transactions per second) | ||
| #[arg(long, default_value = "100")] | ||
| pub rate: u64, | ||
|
|
||
| /// Test duration in seconds | ||
| #[arg(long, default_value = "60")] | ||
| pub duration: u64, | ||
|
|
||
| /// Timeout for transaction inclusion (seconds) | ||
| #[arg(long, default_value = "60")] | ||
| pub tx_timeout: u64, | ||
|
|
||
| /// Random seed for reproducibility | ||
| #[arg(long)] | ||
| pub seed: Option<u64>, | ||
|
|
||
| /// Output file for metrics (JSON) | ||
| #[arg(long)] | ||
| pub output: Option<PathBuf>, | ||
| } |
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.
qq: is it correct to assume that the target TPS is evenly distributed across the number of wallets?
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.
Exactly. Could make this configurable as well if needed