From 4194682d4edaee3da34783c46a513698eb1e8d05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 13 Sep 2019 10:52:10 +0200 Subject: Use cow_http2_machine:ensure_window Gun was very inefficient at receiving HTTP/2 bodies. Switching to ensure_window and increasing the default window sizes brings the response body reading performance at least on par with the one for HTTP/1.1. This has a small negative impact on message flow control because we stop updating the window later than we did before, increasing the number of extra messages we may send. The exact amount depends on configuration and the exact moment flow control kicks in. --- test/gun_test.erl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/gun_test.erl') diff --git a/test/gun_test.erl b/test/gun_test.erl index e74fcd0..a2cbf6d 100644 --- a/test/gun_test.erl +++ b/test/gun_test.erl @@ -79,6 +79,8 @@ http2_handshake(Socket, Transport) -> %% Receive the SETTINGS from the preface. {ok, <>} = Transport:recv(Socket, 3, 5000), {ok, <<4:8, 0:40, _:Len/binary>>} = Transport:recv(Socket, 6 + Len, 5000), + %% Receive the WINDOW_UPDATE sent with the preface. + {ok, <<4:24, 8:8, 0:40, _:32>>} = Transport:recv(Socket, 13, 5000), %% Send the SETTINGS ack. ok = Transport:send(Socket, cow_http2:settings_ack()), %% Receive the SETTINGS ack. -- cgit v1.2.3