udp load test: tweak defaults and peer distribution algorithm

This commit is contained in:
Joakim Frostegård 2024-02-06 17:05:09 +01:00
parent 6eb3195d62
commit 5cad19c12e
2 changed files with 9 additions and 5 deletions

View file

@ -114,8 +114,8 @@ pub struct RequestConfig {
impl Default for RequestConfig { impl Default for RequestConfig {
fn default() -> Self { fn default() -> Self {
Self { Self {
number_of_torrents: 10_000, number_of_torrents: 1_000_000,
number_of_peers: 100_000, number_of_peers: 2_000_000,
scrape_max_torrents: 10, scrape_max_torrents: 10,
announce_peers_wanted: 30, announce_peers_wanted: 30,
weight_connect: 0, weight_connect: 0,

View file

@ -41,7 +41,7 @@ pub fn run(config: Config) -> ::anyhow::Result<()> {
panic!("Error: report_last_seconds can't be larger than duration"); panic!("Error: report_last_seconds can't be larger than duration");
} }
println!("Starting client with config: {:#?}", config); println!("Starting client with config: {:#?}\n", config);
let info_hash_dist = InfoHashDist::new(&config)?; let info_hash_dist = InfoHashDist::new(&config)?;
let peers_by_worker = create_peers(&config, &info_hash_dist); let peers_by_worker = create_peers(&config, &info_hash_dist);
@ -235,6 +235,8 @@ fn create_peers(config: &Config, info_hash_dist: &InfoHashDist) -> Vec<Box<[Peer
.collect::<Vec<_>>(); .collect::<Vec<_>>();
if let Some(peers_per_info_hash) = opt_peers_per_info_hash { if let Some(peers_per_info_hash) = opt_peers_per_info_hash {
println!("Number of info hashes: {}", peers_per_info_hash.len());
let mut histogram = Histogram::<u64>::new(2).unwrap(); let mut histogram = Histogram::<u64>::new(2).unwrap();
for num_peers in peers_per_info_hash.values() { for num_peers in peers_per_info_hash.values() {
@ -245,10 +247,12 @@ fn create_peers(config: &Config, info_hash_dist: &InfoHashDist) -> Vec<Box<[Peer
1.0, 10.0, 25.0, 50.0, 75.0, 85.0, 90.0, 95.0, 98.0, 99.9, 100.0, 1.0, 10.0, 25.0, 50.0, 75.0, 85.0, 90.0, 95.0, 98.0, 99.9, 100.0,
]; ];
println!("Peers per info hash:");
for p in percentiles { for p in percentiles {
let value = histogram.value_at_percentile(p); let value = histogram.value_at_percentile(p);
println!("Peers at info hash percentile {}: {}", p, value); println!(" - p{}: {}", p, value);
} }
} }
@ -297,7 +301,7 @@ impl InfoHashDist {
.map(|i| { .map(|i| {
let floor = num_torrents as f64 / config.requests.number_of_peers as f64; let floor = num_torrents as f64 / config.requests.number_of_peers as f64;
floor + (7.0f64 - ((300.0 * f64::from(i)) / f64::from(num_torrents))).exp() floor + (6.5f64 - ((500.0 * f64::from(i)) / f64::from(num_torrents))).exp()
}) })
.collect(); .collect();