[#146] Update default values for HTTP_GW_READ/WRITE_TIMEOUT

10 minute upload and 5 minute download timeouts are long enough
to handle average size objects in the real networks. For big
data streams these timeouts should be disabled.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2022-04-21 18:53:17 +03:00 committed by Kira
parent 4f2b21a14b
commit d906732ef4
4 changed files with 11 additions and 6 deletions

View file

@ -125,6 +125,11 @@ You can tune HTTP read and write buffer sizes as well as timeouts with
`HTTP_GW_WEB_WRITE_BUFFER_SIZE` and `HTTP_GW_WEB_WRITE_TIMEOUT` environment `HTTP_GW_WEB_WRITE_BUFFER_SIZE` and `HTTP_GW_WEB_WRITE_TIMEOUT` environment
variables. variables.
**Note:** to allow upload and download of big data streams, disable read
and write timeouts correspondingly. To do that, set `HTTP_GW_WEB_READ_TIMEOUT=0`
and `HTTP_GW_WEB_WRITE_TIMEOUT=0`. Otherwise, HTTP Gateway will terminate
request with data stream after timeout.
`HTTP_GW_WEB_STREAM_REQUEST_BODY` environment variable can be used to disable `HTTP_GW_WEB_STREAM_REQUEST_BODY` environment variable can be used to disable
request body streaming (effectively it'll make gateway accept file completely request body streaming (effectively it'll make gateway accept file completely
first and only then try sending it to NeoFS). first and only then try sending it to NeoFS).

View file

@ -53,11 +53,11 @@ HTTP_GW_WRITE_BUFFER_SIZE=4096
# the full request including body. The connection's read # the full request including body. The connection's read
# deadline is reset when the connection opens, or for # deadline is reset when the connection opens, or for
# keep-alive connections after the first byte has been read. # keep-alive connections after the first byte has been read.
HTTP_GW_READ_TIMEOUT=15s HTTP_GW_READ_TIMEOUT=10m
# WriteTimeout is the maximum duration before timing out # WriteTimeout is the maximum duration before timing out
# writes of the response. It is reset after the request handler # writes of the response. It is reset after the request handler
# has returned. # has returned.
HTTP_GW_WRITE_TIMEOUT=1m HTTP_GW_WRITE_TIMEOUT=5m
# StreamRequestBody enables request body streaming, # StreamRequestBody enables request body streaming,
# and calls the handler sooner when given body is # and calls the handler sooner when given body is
# larger then the current limit. # larger then the current limit.

View file

@ -50,12 +50,12 @@ web:
# the full request including body. The connection's read # the full request including body. The connection's read
# deadline is reset when the connection opens, or for # deadline is reset when the connection opens, or for
# keep-alive connections after the first byte has been read. # keep-alive connections after the first byte has been read.
read_timeout: 15s read_timeout: 10m
# WriteTimeout is the maximum duration before timing out # WriteTimeout is the maximum duration before timing out
# writes of the response. It is reset after the request handler # writes of the response. It is reset after the request handler
# has returned. # has returned.
write_timeout: 1m write_timeout: 5m
# StreamRequestBody enables request body streaming, # StreamRequestBody enables request body streaming,
# and calls the handler sooner when given body is # and calls the handler sooner when given body is

View file

@ -107,8 +107,8 @@ func settings() *viper.Viper {
// web-server: // web-server:
v.SetDefault(cfgWebReadBufferSize, 4096) v.SetDefault(cfgWebReadBufferSize, 4096)
v.SetDefault(cfgWebWriteBufferSize, 4096) v.SetDefault(cfgWebWriteBufferSize, 4096)
v.SetDefault(cfgWebReadTimeout, time.Second*15) v.SetDefault(cfgWebReadTimeout, time.Minute*10)
v.SetDefault(cfgWebWriteTimeout, time.Minute) v.SetDefault(cfgWebWriteTimeout, time.Minute*5)
v.SetDefault(cfgWebStreamRequestBody, true) v.SetDefault(cfgWebStreamRequestBody, true)
v.SetDefault(cfgWebMaxRequestBodySize, fasthttp.DefaultMaxRequestBodySize) v.SetDefault(cfgWebMaxRequestBodySize, fasthttp.DefaultMaxRequestBodySize)