From 8337aca4d31ffa8120704057675aacbbaa280975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 20 May 2020 11:08:58 +0200 Subject: Increase the default max_keepalive HTTP option to 1000 100 is very low for current deployments. 1000 is more appropriate as a default value. --- doc/src/manual/cowboy_http.asciidoc | 2 +- src/cowboy_http.erl | 2 +- test/rfc7230_SUITE.erl | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/src/manual/cowboy_http.asciidoc b/doc/src/manual/cowboy_http.asciidoc index b088797..33d2888 100644 --- a/doc/src/manual/cowboy_http.asciidoc +++ b/doc/src/manual/cowboy_http.asciidoc @@ -121,7 +121,7 @@ max_headers (100):: Maximum number of headers allowed per request. -max_keepalive (100):: +max_keepalive (1000):: Maximum number of requests allowed per connection. diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl index e7a28da..2833e79 100644 --- a/src/cowboy_http.erl +++ b/src/cowboy_http.erl @@ -176,7 +176,7 @@ init(Parent, Ref, Socket, Transport, ProxyHeader, Opts) -> parent=Parent, ref=Ref, socket=Socket, transport=Transport, proxy_header=ProxyHeader, opts=Opts, peer=Peer, sock=Sock, cert=Cert, - last_streamid=maps:get(max_keepalive, Opts, 100)}, + last_streamid=maps:get(max_keepalive, Opts, 1000)}, setopts_active(State), loop(set_timeout(State, request_timeout)); {{error, Reason}, _, _} -> diff --git a/test/rfc7230_SUITE.erl b/test/rfc7230_SUITE.erl index 19b97bc..e110441 100644 --- a/test/rfc7230_SUITE.erl +++ b/test/rfc7230_SUITE.erl @@ -33,7 +33,8 @@ groups() -> [{http, [parallel], ct_helper:all(?MODULE)}]. init_per_group(Name = http, Config) -> cowboy_test:init_http(Name = http, #{ - env => #{dispatch => cowboy_router:compile(init_routes(Config))} + env => #{dispatch => cowboy_router:compile(init_routes(Config))}, + max_keepalive => 100 }, Config). end_per_group(Name, _) -> -- cgit v1.2.3