aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorViktor Söderqvist <[email protected]>2020-10-08 17:53:25 +0200
committerLoïc Hoguin <[email protected]>2020-11-27 15:38:21 +0100
commit059d58d39fb12765fa6e42c8d95c861ac85c23e2 (patch)
tree00d297cba48eb63af7bf38f20e7d5207d4139834 /doc
parentfa9c8ad832f72f44b70924c1aa3a2ab4fd04c8da (diff)
downloadcowboy-059d58d39fb12765fa6e42c8d95c861ac85c23e2.tar.gz
cowboy-059d58d39fb12765fa6e42c8d95c861ac85c23e2.tar.bz2
cowboy-059d58d39fb12765fa6e42c8d95c861ac85c23e2.zip
Graceful shutdown
Note: This commit makes cowboy depend on cowlib master. Graceful shutdown for HTTP/2: 1. A GOAWAY frame with the last stream id set to 2^31-1 is sent and a timer is started (goaway_initial_timeout, default 1000ms), to wait for any in-flight requests sent by the client, and the status is set to 'closing_initiated'. If the client responds with GOAWAY and closes the connection, we're done. 2. A second GOAWAY frame is sent with the actual last stream id and the status is set to 'closing'. If no streams exist, the connection terminates. Otherwise a second timer (goaway_complete_timeout, default 3000ms) is started, to wait for the streams to complete. New streams are not accepted when status is 'closing'. 3. If all streams haven't completed after the second timeout, the connection is forcefully terminated. Graceful shutdown for HTTP/1.x: 1. If a request is currently being handled, it is waited for and the response is sent back to the client with the header "Connection: close". Then, the connection is closed. 2. If the current request handler is not finished within the time configured in transport option 'shutdown' (default 5000ms), the connection process is killed by its supervisor (ranch). Implemented for HTTP/1.x and HTTP/2 in the following scenarios: * When receiving exit signal 'shutdown' from the supervisor (e.g. when cowboy:stop_listener/3 is called). * When a connection process is requested to terminate using sys:terminate/2,3. LH: Edited tests a bit and added todos for useful tests to add.
Diffstat (limited to 'doc')
-rw-r--r--doc/src/manual/cowboy_http2.asciidoc12
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/src/manual/cowboy_http2.asciidoc b/doc/src/manual/cowboy_http2.asciidoc
index c61bfe6..de632be 100644
--- a/doc/src/manual/cowboy_http2.asciidoc
+++ b/doc/src/manual/cowboy_http2.asciidoc
@@ -22,6 +22,8 @@ opts() :: #{
connection_window_margin_size => 0..16#7fffffff,
connection_window_update_threshold => 0..16#7fffffff,
enable_connect_protocol => boolean(),
+ goaway_initial_timeout => timeout(),
+ goaway_complete_timeout => timeout(),
idle_timeout => timeout(),
inactivity_timeout => timeout(),
initial_connection_window_size => 65535..16#7fffffff,
@@ -92,6 +94,16 @@ Whether to enable the extended CONNECT method to allow
protocols like Websocket to be used over an HTTP/2 stream.
This option is experimental and disabled by default.
+goaway_initial_timeout (1000)::
+
+Time in ms to wait for any in-flight stream creations before stopping to accept
+new streams on an existing connection during a graceful shutdown.
+
+goaway_complete_timeout (3000)::
+
+Time in ms to wait for ongoing streams to complete before closing the connection
+during a graceful shutdown.
+
idle_timeout (60000)::
Time in ms with no data received before Cowboy closes the connection.