Skip to content

Commit ed9ee64

Browse files
feat: config (#6)
* 50k conns? * rm: json parsing on testserver * huge backlog * allow get * log concurrent * limit to 1 worker * 50 workers * feat: hyper * fix? * actix -> axum * Update main.rs * rm batch factor * 3 second measurement interval * Update main.rs * worker id * request durr * fix: workers * Update network.rs * fix ids * feat: implied total rps * Update network.rs * Update network.rs * Create genesis.json * genalloc * 25k * start reth * 50k again? * wip: try one of 10k addrs * even workers * 20k conns * Update main.rs * back to 20 acc * 100 accounts * 100 acc * 2500 accounts * oops fix tx queue reporting * feat: rand addr * 500 accounts * use existing people, log * allow dead code * Update tx_gen.rs * lawging * hrmf * 1k accs * 10k accounts * wip: startup delay * Update tx_queue.rs * Update tx_queue.rs * log * moar thresholds * Update tx_queue.rs * feat: rayonify * Update tx_gen.rs * 50k connections? * Revert "50k connections?" This reverts commit 34ec48c. * log rayon thread pool size * Update tx_gen.rs * Initialize Rayon with explicit thread count. * Update tx_gen.rs * Update tx_gen.rs * feat: alternate ratelimit system * Update tx_queue.rs * Update tx_queue.rs * Update tx_queue.rs * Update tx_queue.rs * Update tx_queue.rs * hm * thresholds * Update tx_queue.rs * Update tx_queue.rs * Update tx_queue.rs * thresholds * Update tx_queue.rs * fewer socket conns * 10k connections * 50k RPS? * feat: longer ramp * 35k rps? * Update tx_queue.rs * 25k * Update start-reth.sh * Update genesis.json * Update start-reth.sh * batch factor of 5 * fix: implied rps * disable batching * feat: even slower ramp up * slightly faster * feat: 50k genesis * feat: better ramp * oops * worker ratio * feat: pareto distribute recipients * Update tx_gen.rs * Empty the rate limiter. * feat: empty rate limiter before AND after * wip: can we remove first set avail? * 15k tps * 20k? * 15k again * feat: ramp up faster * even faster * faster! * feat: erc20 precompile testing * fix: bytes * Update tx_gen.rs * lower limit * erc20 regular spam * 15k> * HIGH * Update tx_queue.rs * precompile * Update tx_queue.rs * feat: config * fix config headers * u64 gas price * Update default.toml
1 parent ceeaa7b commit ed9ee64

12 files changed

Lines changed: 371 additions & 87 deletions

File tree

Cargo.lock

Lines changed: 149 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configs/default.toml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[network_worker]
2+
target_url = "http://127.0.0.1:8545"
3+
total_connections = 10_000 # Limited by # of ephemeral ports.
4+
5+
batch_factor = 1
6+
7+
error_sleep_ms = 100
8+
tx_queue_empty_sleep_ms = 25
9+
10+
[tx_gen_worker]
11+
chain_id = 1337
12+
num_accounts = 25_000 # Limited by the number in the genesis (see generate_genesis_alloc.rs)
13+
14+
token_contract_address = "0x2000000000000000000000000000000000000001"
15+
16+
gas_price = 100000000000 # 100 gwei
17+
gas_limit = 100_000
18+
19+
mnemonic = "test test test test test test test test test test test junk"
20+
21+
recipient_distribution_factor = 20 # 1/20 of accounts receive transfers.
22+
max_transfer_amount = 10
23+
24+
[rate_limiting]
25+
initial_ratelimit = 100 # txs/s
26+
27+
# Rate limit thresholds: [(threshold, rate_limit)]
28+
# threshold = number of transactions sent
29+
# rate_limit = new transactions per second limit
30+
ratelimit_thresholds = [
31+
[1_562, 250], # NUM_ACCOUNTS / 16
32+
[3_125, 500], # NUM_ACCOUNTS / 8
33+
[25_000, 1_000], # NUM_ACCOUNTS
34+
[50_000, 2_500], # NUM_ACCOUNTS * 2
35+
[100_000, 5_000], # NUM_ACCOUNTS * 4
36+
[200_000, 7_500], # NUM_ACCOUNTS * 8
37+
[250_000, 12_500], # NUM_ACCOUNTS * 10
38+
[300_000, 15_000], # NUM_ACCOUNTS * 12
39+
]
40+
41+
[workers]
42+
thread_pinning = true
43+
44+
tx_gen_worker_percentage = 0.1
45+
network_worker_percentage = 0.9
46+
47+
[reporters]
48+
tx_queue_report_interval_secs = 3
49+
network_stats_report_interval_secs = 3

crescendo/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ serde_json = "1.0"
2626
hex = "0.4"
2727
simple-tqdm = { version = "0.2.0", features = ["rayon"] }
2828
rand = "0.9.1"
29-
ratelimit = "0.10"
29+
ratelimit = "0.10"
30+
clap = { version = "4.5", features = ["derive", "env"] }
31+
toml = "0.8"

crescendo/src/config.rs

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
use std::path::PathBuf;
2+
use std::sync::OnceLock;
3+
4+
use serde::{Deserialize, Serialize};
5+
6+
/// Global configuration instance for the application.
7+
static CONFIG_INSTANCE: OnceLock<Config> = OnceLock::new();
8+
9+
/// Initialize the global configuration instance.
10+
pub fn init(config: Config) {
11+
CONFIG_INSTANCE.set(config).unwrap();
12+
}
13+
14+
/// Gets the global configuration instance's value,
15+
/// blocking until initialized if necessary.
16+
pub fn get() -> &'static Config {
17+
CONFIG_INSTANCE.wait()
18+
}
19+
20+
#[derive(Debug, Clone, Serialize, Deserialize)]
21+
pub struct Config {
22+
pub tx_gen_worker: TxGenWorkerConfig,
23+
pub network_worker: NetworkWorkerConfig,
24+
pub rate_limiting: RateLimitingConfig,
25+
26+
pub workers: WorkersConfig,
27+
pub reporters: ReportersConfig,
28+
}
29+
30+
impl Config {
31+
pub fn from_file(path: &PathBuf) -> Result<Self, Box<dyn std::error::Error>> {
32+
let config_str = std::fs::read_to_string(path)?;
33+
let config: Config = toml::from_str(&config_str)?;
34+
Ok(config)
35+
}
36+
}
37+
38+
#[derive(Debug, Clone, Serialize, Deserialize)]
39+
pub struct NetworkWorkerConfig {
40+
pub target_url: String,
41+
pub total_connections: u64,
42+
43+
pub batch_factor: usize,
44+
45+
pub error_sleep_ms: u64,
46+
pub tx_queue_empty_sleep_ms: u64,
47+
}
48+
49+
#[derive(Debug, Clone, Serialize, Deserialize)]
50+
pub struct TxGenWorkerConfig {
51+
pub chain_id: u64,
52+
53+
pub mnemonic: String,
54+
pub num_accounts: u32,
55+
56+
pub gas_price: u64,
57+
pub gas_limit: u64,
58+
59+
pub token_contract_address: String,
60+
pub recipient_distribution_factor: u32,
61+
pub max_transfer_amount: u64,
62+
}
63+
64+
#[derive(Debug, Clone, Serialize, Deserialize)]
65+
pub struct RateLimitingConfig {
66+
pub initial_ratelimit: u64,
67+
pub ratelimit_thresholds: Vec<(u32, u64)>,
68+
}
69+
70+
#[derive(Debug, Clone, Serialize, Deserialize)]
71+
pub struct WorkersConfig {
72+
pub thread_pinning: bool,
73+
pub tx_gen_worker_percentage: f64,
74+
pub network_worker_percentage: f64,
75+
}
76+
77+
#[derive(Debug, Clone, Serialize, Deserialize)]
78+
pub struct ReportersConfig {
79+
pub tx_queue_report_interval_secs: u64,
80+
pub network_stats_report_interval_secs: u64,
81+
}

0 commit comments

Comments
 (0)