udp load test: improve config defaults, add announce_peers_wanted field

This commit is contained in:
Joakim Frostegård 2024-01-03 19:49:28 +01:00
parent 1df1014798
commit bbe09bd0df
2 changed files with 12 additions and 9 deletions

View file

@ -68,11 +68,11 @@ pub struct NetworkConfig {
/// values for different operating systems: /// values for different operating systems:
/// ///
/// macOS: /// macOS:
/// $ sudo sysctl net.inet.udp.recvspace=6000000 /// $ sudo sysctl net.inet.udp.recvspace=8000000
/// ///
/// Linux: /// Linux:
/// $ sudo sysctl -w net.core.rmem_max=104857600 /// $ sudo sysctl -w net.core.rmem_max=8000000
/// $ sudo sysctl -w net.core.rmem_default=104857600 /// $ sudo sysctl -w net.core.rmem_default=8000000
pub recv_buffer: usize, pub recv_buffer: usize,
} }
@ -81,8 +81,8 @@ impl Default for NetworkConfig {
Self { Self {
multiple_client_ipv4s: true, multiple_client_ipv4s: true,
first_port: 45_000, first_port: 45_000,
poll_timeout: 276, poll_timeout: 1,
recv_buffer: 6_000_000, recv_buffer: 8_000_000,
} }
} }
} }
@ -94,6 +94,8 @@ pub struct RequestConfig {
pub number_of_torrents: usize, pub number_of_torrents: usize,
/// Maximum number of torrents to ask about in scrape requests /// Maximum number of torrents to ask about in scrape requests
pub scrape_max_torrents: usize, pub scrape_max_torrents: usize,
/// Ask for this number of peers in announce requests
pub announce_peers_wanted: i32,
/// Probability that a generated request is a connect request as part /// Probability that a generated request is a connect request as part
/// of sum of the various weight arguments. /// of sum of the various weight arguments.
pub weight_connect: usize, pub weight_connect: usize,
@ -118,13 +120,14 @@ impl Default for RequestConfig {
fn default() -> Self { fn default() -> Self {
Self { Self {
number_of_torrents: 10_000, number_of_torrents: 10_000,
scrape_max_torrents: 50, scrape_max_torrents: 10,
announce_peers_wanted: 30,
weight_connect: 0, weight_connect: 0,
weight_announce: 100, weight_announce: 100,
weight_scrape: 1, weight_scrape: 1,
torrent_gamma_shape: 0.2, torrent_gamma_shape: 0.2,
torrent_gamma_scale: 100.0, torrent_gamma_scale: 100.0,
peer_seeder_probability: 0.25, peer_seeder_probability: 0.75,
additional_request_probability: 0.5, additional_request_probability: 0.5,
} }
} }

View file

@ -160,8 +160,8 @@ fn create_announce_request(
bytes_left, bytes_left,
event: event.into(), event: event.into(),
ip_address: Ipv4AddrBytes([0; 4]), ip_address: Ipv4AddrBytes([0; 4]),
key: PeerKey::new(12345), key: PeerKey::new(0),
peers_wanted: NumberOfPeers::new(100), peers_wanted: NumberOfPeers::new(config.requests.announce_peers_wanted),
port: torrent_peer.port, port: torrent_peer.port,
}) })
.into() .into()