aquatic http load test: improve connection creation, default config

This commit is contained in:
Joakim Frostegård 2020-08-02 19:11:14 +02:00
parent 8a3f3fa330
commit a02035d659
2 changed files with 8 additions and 6 deletions

View file

@ -61,9 +61,9 @@ impl Default for NetworkConfig {
fn default() -> Self {
Self {
close_connection_after_response: false,
connection_creation_interval: 40,
poll_timeout_microseconds: 47,
poll_event_capacity: 1024,
connection_creation_interval: 10,
poll_timeout_microseconds: 197,
poll_event_capacity: 64,
}
}
}

View file

@ -187,7 +187,7 @@ pub fn run_socket_thread(
let timeout = Duration::from_micros(config.network.poll_timeout_microseconds);
let create_conn_interval = 2 ^ config.network.connection_creation_interval;
let mut connections: ConnectionMap = HashMap::new();
let mut connections: ConnectionMap = HashMap::with_capacity(config.num_connections);
let mut poll = Poll::new().expect("create poll");
let mut events = Events::with_capacity(config.network.poll_event_capacity);
let mut rng = SmallRng::from_entropy();
@ -254,11 +254,13 @@ pub fn run_socket_thread(
let max_new = config.num_connections - connections.len();
if max_new != 0 && iter_counter % create_conn_interval == 0 {
if iter_counter % create_conn_interval == 0 {
num_to_create += 1;
}
for _ in 0..num_to_create.min(max_new){
num_to_create = num_to_create.min(max_new);
for _ in 0..num_to_create {
let ok = Connection::create_and_register(
config,
&mut connections,