aboutsummaryrefslogtreecommitdiffstats
path: root/test/rfc7540_SUITE.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-09-13 10:52:10 +0200
committerLoïc Hoguin <[email protected]>2019-09-13 10:52:10 +0200
commit4194682d4edaee3da34783c46a513698eb1e8d05 (patch)
tree6e43ee4ed6a52e9b1f44c0eede4673b42f6ca21e /test/rfc7540_SUITE.erl
parent585c1dcd001c2cb41cc77216aed2cf729fad6cc7 (diff)
downloadgun-4194682d4edaee3da34783c46a513698eb1e8d05.tar.gz
gun-4194682d4edaee3da34783c46a513698eb1e8d05.tar.bz2
gun-4194682d4edaee3da34783c46a513698eb1e8d05.zip
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.
Diffstat (limited to 'test/rfc7540_SUITE.erl')
-rw-r--r--test/rfc7540_SUITE.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/rfc7540_SUITE.erl b/test/rfc7540_SUITE.erl
index 0db9dd0..14e9c0c 100644
--- a/test/rfc7540_SUITE.erl
+++ b/test/rfc7540_SUITE.erl
@@ -98,9 +98,17 @@ lingering_data_counts_toward_connection_window(_) ->
%% Skip RST_STREAM.
{ok, << 4:24, 3:8, 1:40, _:32 >>} = gen_tcp:recv(Socket, 13, 1000),
%% Received a WINDOW_UPDATE frame after we got RST_STREAM.
- {ok, << 4:24, 8:8, 0:40, 1000:32 >>} = gen_tcp:recv(Socket, 13, 1000)
+ {ok, << 4:24, 8:8, 0:40, Increment:32 >>} = gen_tcp:recv(Socket, 13, 1000),
+ true = Increment > 0
end),
- {ok, ConnPid} = gun:open("localhost", Port, #{protocols => [http2]}),
+ {ok, ConnPid} = gun:open("localhost", Port, #{
+ protocols => [http2],
+ http2_opts => #{
+ %% We don't set 65535 because we still want to have an initial WINDOW_UPDATE.
+ initial_connection_window_size => 65536,
+ initial_stream_window_size => 65535
+ }
+ }),
{ok, http2} = gun:await_up(ConnPid),
timer:sleep(100), %% Give enough time for the handshake to fully complete.
%% Step 1.