-
Notifications
You must be signed in to change notification settings - Fork 7
Add EOA executor benchmark tool with metrics tracking #59
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
joaquim-verges
merged 1 commit into
main
from
Add_EOA_executor_benchmark_tool_with_metrics_tracking
Oct 2, 2025
Merged
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Benchmark Configuration | ||
BASE_URL=http://localhost:3005 | ||
TYPE=eoa | ||
FROM=0x... | ||
CHAIN_ID=1337 | ||
SECRET_KEY=your-secret-key | ||
VAULT_ACCESS_TOKEN=your-vault-access-token | ||
|
||
# Optional: Benchmark Parameters | ||
CONCURRENT_REQUESTS=10 | ||
TOTAL_REQUESTS=100 |
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 |
---|---|---|
|
@@ -32,3 +32,4 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json | |
|
||
# Finder (MacOS) folder config | ||
.DS_Store | ||
benchmarks/runs |
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,154 @@ | ||
# EOA Executor Benchmark | ||
|
||
A comprehensive benchmark tool for stress testing the `/v1/write/transaction` endpoint with detailed performance metrics and webhook event tracking. | ||
|
||
## Features | ||
|
||
- ✅ Concurrent request execution with configurable concurrency | ||
- 📊 Detailed metrics tracking (HTTP response time, submission time, confirmation time) | ||
- 🎣 Built-in webhook server to capture transaction lifecycle events | ||
- 📈 Statistical analysis (p50, p90, p95, p99, min, max, mean) | ||
- 📄 CSV export of individual transaction metrics | ||
- 📊 JSON export of aggregate results | ||
- 🎯 Real-time progress and status updates | ||
|
||
## Setup | ||
|
||
1. Copy the `.env.example` to `.env` in the `/scripts` directory: | ||
```bash | ||
cp .env.example .env | ||
``` | ||
|
||
2. Configure your environment variables in `.env`: | ||
``` | ||
BASE_URL=http://localhost:3005 | ||
TYPE=eoa | ||
FROM=0x1234567890123456789012345678901234567890 | ||
CHAIN_ID=1337 | ||
SECRET_KEY=your-secret-key | ||
VAULT_ACCESS_TOKEN=your-vault-access-token | ||
CONCURRENT_REQUESTS=10 | ||
TOTAL_REQUESTS=100 | ||
``` | ||
|
||
## Usage | ||
|
||
Run the benchmark from the `/scripts` directory: | ||
|
||
```bash | ||
cd scripts | ||
bun ./benchmarks/eoa.ts | ||
``` | ||
|
||
## Output | ||
|
||
The benchmark creates a timestamped directory `run-<timestamp>/` containing: | ||
|
||
- `transactions-<timestamp>.csv` - Individual transaction metrics | ||
- `result-<timestamp>.json` - Aggregate statistics | ||
|
||
### CSV Format | ||
|
||
Each row contains: | ||
- `transaction_id` - Unique transaction identifier | ||
- `http_response_time_ms` - HTTP request/response time | ||
- `sent_to_submitted_ms` - Time from send to submitted webhook | ||
- `submitted_to_confirmed_ms` - Time from submitted to confirmed webhook | ||
- `total_time_ms` - Total time from send to confirmed | ||
- `status` - Final status (confirmed/failed/pending) | ||
- `error` - Error message if failed | ||
|
||
### JSON Format | ||
|
||
Aggregate results include: | ||
- Total/successful/failed request counts | ||
- Error rate percentage | ||
- Duration and throughput (req/s) | ||
- Statistical breakdown for all timing metrics (min, max, mean, p50, p90, p95, p99) | ||
|
||
## Configuration Options | ||
|
||
| Variable | Default | Description | | ||
|----------|---------|-------------| | ||
| `BASE_URL` | `http://localhost:3005` | API endpoint base URL | | ||
| `TYPE` | `eoa` | Execution type | | ||
| `FROM` | *required* | Sender address | | ||
| `CHAIN_ID` | `1337` | Blockchain network ID | | ||
| `SECRET_KEY` | *required* | API secret key | | ||
| `VAULT_ACCESS_TOKEN` | *required* | Vault access token | | ||
| `CONCURRENT_REQUESTS` | `10` | Number of concurrent requests | | ||
| `TOTAL_REQUESTS` | `100` | Total number of requests to send | | ||
|
||
## How It Works | ||
|
||
1. **Webhook Server**: Starts a local server on port 3070 to receive transaction lifecycle webhooks | ||
2. **Request Sending**: Sends HTTP requests to `/v1/write/transaction` with controlled concurrency | ||
3. **Event Tracking**: Tracks webhook events for each transaction: | ||
- `send` stage with `Success` event = transaction submitted | ||
- `confirm` stage with `Success` event = transaction confirmed | ||
- `Failure` or `Nack` events = transaction failed | ||
4. **Metrics Calculation**: Computes timing metrics and statistics | ||
5. **Output Generation**: Writes CSV and JSON files with results | ||
|
||
## Webhook Event Structure | ||
|
||
Based on `executors/src/eoa/events.rs`, the webhook payload contains: | ||
```json | ||
{ | ||
"transaction_id": "...", | ||
"executor_name": "eoa", | ||
"stage_name": "send" | "confirm", | ||
"event_type": "Success" | "Nack" | "Failure", | ||
"payload": { ... } | ||
} | ||
``` | ||
|
||
## Example Output | ||
|
||
``` | ||
🚀 Starting benchmark... | ||
📊 Configuration: | ||
Base URL: http://localhost:3005 | ||
Type: eoa | ||
From: 0x1234... | ||
Chain ID: 1337 | ||
Total Requests: 100 | ||
Concurrent Requests: 10 | ||
|
||
📤 Sent 10/100 requests... | ||
... | ||
✅ All HTTP requests completed | ||
⏳ Waiting for webhooks to complete... | ||
🎉 All transactions completed! | ||
|
||
📊 BENCHMARK RESULTS | ||
============================================================ | ||
📈 Overview: | ||
Total Requests: 100 | ||
Successful: 98 | ||
Failed: 2 | ||
Error Rate: 2.00% | ||
Duration: 45.23s | ||
Throughput: 2.21 req/s | ||
|
||
⏱️ HTTP Response Times (ms): | ||
Min: 45.23 | ||
Mean: 123.45 | ||
P50: 110.00 | ||
P90: 180.00 | ||
P95: 210.00 | ||
P99: 250.00 | ||
Max: 320.00 | ||
... | ||
``` | ||
|
||
## Tips | ||
|
||
- Start with a small `TOTAL_REQUESTS` value to test your setup | ||
- Adjust `CONCURRENT_REQUESTS` based on your server capacity | ||
- Monitor your server logs alongside the benchmark | ||
- The script waits up to 2 minutes for pending webhooks before timing out | ||
- Use the CSV output for detailed per-transaction analysis | ||
- Use the JSON output for automated performance regression testing | ||
|
||
|
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.
Sort required keys to satisfy dotenv-linter.
.env.example
currently trips theUnorderedKey
rule (BASE_URL
➝TYPE
➝FROM
…). This will keep failing lint runs until the keys are alphabetized. Please reorder the required block (e.g.BASE_URL
,CHAIN_ID
,FROM
,SECRET_KEY
,TYPE
,VAULT_ACCESS_TOKEN
) so the example passes the check.(evrone.com)
🧰 Tools
🪛 dotenv-linter (3.3.0)
[warning] 4-4: [UnorderedKey] The FROM key should go before the TYPE key
(UnorderedKey)
[warning] 5-5: [UnorderedKey] The CHAIN_ID key should go before the FROM key
(UnorderedKey)
[warning] 6-6: [UnorderedKey] The SECRET_KEY key should go before the TYPE key
(UnorderedKey)
🤖 Prompt for AI Agents