src/bin/h2client.rs: tune h2 client parameters to get reasonable speed

We now get about 2.5GB/s (not really good, but better)
This commit is contained in:
Dietmar Maurer 2019-06-29 10:41:24 +02:00
parent 38294bcc56
commit 872debdefa

View File

@ -68,7 +68,11 @@ pub fn main() -> Result<(), Error> {
let tcp = tcp_stream
.map_err(Error::from)
.and_then(|c| {
h2::client::handshake(c)
h2::client::Builder::new()
.initial_connection_window_size(1024*1024*1024)
.initial_window_size(1024*1024*1024)
.max_frame_size(4*1024*1024)
.handshake(c)
.map_err(Error::from)
})
.and_then(|(client, h2)| {
@ -77,7 +81,7 @@ pub fn main() -> Result<(), Error> {
tokio::spawn(h2.map_err(|e| println!("GOT ERR={:?}", e)));
futures::stream::repeat(())
.take(10)
.take(2000)
.and_then(move |_| send_request(client.clone()))
.fold(0, move |mut acc, size| {
acc += size;