Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle idle connections #137

Closed
vasiliy-t opened this issue May 21, 2021 · 4 comments · Fixed by #141
Closed

Handle idle connections #137

vasiliy-t opened this issue May 21, 2021 · 4 comments · Fixed by #141
Assignees
Labels

Comments

@vasiliy-t
Copy link

Problem statement

We have http server exposing metrics to telegraf. Telegraf scrapes metrics in 60 second intervals via http: it opens keep-alive connections but under certain conditions (have no repro, only in prod) it does not reuses established connections and opens new connection each time it scrapes metrics. This results in increasing number of open connections, every connection if a fiber which lives forever.

Possible solution

Introduce new http.server config options:

  • maximum number of idle connections, after reaching this limit http.server could start closing idle conns
  • idle timeout is the maximum amount of time an idle (keep-alive) connection will remain idle before closing
@kyukhin
Copy link

kyukhin commented Jun 11, 2021

This is supposed to be fixed in httpng.

@kyukhin kyukhin added this to the wishlist milestone Jun 11, 2021
@vasiliy-t
Copy link
Author

vasiliy-t commented Oct 13, 2021

@kyukhin I did not agree with "wishlist". Lack of idle connections timeout has been exploding every cluster our customer have for a week and that's a lot of clusters. And the only solution we have is to configure Telegraf and have no way to protect from within tarantool. If it will be fixed in httpng then it must be ported to http - we have no resources to migrate every application we have to new http module.

@vasiliy-t vasiliy-t removed this from the wishlist milestone Oct 13, 2021
@Totktonada
Copy link
Member

It is in our backlog now. Further prioritization may be done via the product team.

@ligurio
Copy link
Member

ligurio commented Oct 15, 2021

It is possible to set a timeout in a keep-alive header.
https://tools.ietf.org/id/draft-thomson-hybi-http-timeout-01.html#rfc.section.2
Now http module set keep-alive header without timeout, see https://github.com/tarantool/http/blob/master/http/server/init.lua#L238-L260

ligurio added a commit that referenced this issue Oct 20, 2021
By default http module set keep-alive option in connections to make it
persistent:

$ tarantool examples/middleware.lua
started
entering the event loop
HEAD /

...

$ curl -I  http://127.0.0.1:8080
HTTP/1.1 404 Not found
Content-length: 0
Server: Tarantool http (tarantool v1.10.6-0-g5372cd2fa)
Connection: keep-alive
$

However sometimes we need persistent connection and close it instead. It
is possible with option keepalive_disable. Option accepts a map where key
is a user agent name with assigned non-nil value.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    log_requests = true,
    log_errors = true,
    keepalive_disable = {
        ['curl/7.68.0'] = true
    },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable

Fixes #137
ligurio added a commit that referenced this issue Oct 20, 2021
By default http module set keep-alive option in connections to make it
persistent:

$ tarantool examples/middleware.lua
started
entering the event loop
HEAD /

...

$ curl -I  http://127.0.0.1:8080
HTTP/1.1 404 Not found
Content-length: 0
Server: Tarantool http (tarantool v1.10.6-0-g5372cd2fa)
Connection: keep-alive
$

However sometimes we need persistent connection and close it instead. It
is possible with option keepalive_disable. Option accepts a map where key
is a user agent name with assigned non-nil value.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    log_requests = true,
    log_errors = true,
    keepalive_disable = {
        ['curl/7.68.0'] = true
    },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable

Fixes #137
ligurio added a commit that referenced this issue Oct 20, 2021
By default http module set keep-alive option in connections to make it
persistent:

$ tarantool examples/middleware.lua
started
entering the event loop
HEAD /

...

$ curl -I  http://127.0.0.1:8080
HTTP/1.1 404 Not found
Content-length: 0
Server: Tarantool http (tarantool v1.10.6-0-g5372cd2fa)
Connection: keep-alive
$

However sometimes we need persistent connection and close it instead. It
is possible with option keepalive_disable. Option accepts a map where
key is a user agent name with assigned non-nil value. Note: nginx
web-server has a similar option, see [1].

Unfortunately http client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is untested.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    log_requests = true,
    log_errors = true,
    keepalive_disable = {
        ['curl/7.68.0'] = true
    },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Fixes #137
ligurio added a commit that referenced this issue Oct 29, 2021
ligurio added a commit that referenced this issue Oct 29, 2021
By default http module set keep-alive option in connections to make it
persistent. However sometimes we need persistent connection and close it
instead. It is possible with option keepalive_disable. Option accepts a
map where key is a user agent name with assigned non-nil value.
Note: nginx web-server has a similar option, see [1].

Unfortunately http client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is untested.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    log_requests = true,
    log_errors = true,
    keepalive_disable = {
        ['curl/7.68.0'] = true
    },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Fixes #137
ligurio added a commit that referenced this issue Oct 29, 2021
ligurio added a commit that referenced this issue Oct 29, 2021
By default http module set keep-alive option in connections to make it
persistent. However sometimes we need persistent connection and close it
instead. It is possible with option keepalive_disable. Option accepts a
map where key is a user agent name with assigned non-nil value.
Note: nginx web-server has a similar option, see [1].

Unfortunately http client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is untested.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    log_requests = true,
    log_errors = true,
    keepalive_disable = {
        ['curl/7.68.0'] = true
    },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Fixes #137
ligurio added a commit that referenced this issue Oct 29, 2021
ligurio added a commit that referenced this issue Oct 29, 2021
By default http module set keep-alive option in connections to make it
persistent. However sometimes we need persistent connection and close it
instead. It is possible with option keepalive_disable. Option accepts a
map where key is a user agent name with assigned non-nil value.
Note: nginx web-server has a similar option, see [1].

Unfortunately http client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is untested.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    log_requests = true,
    log_errors = true,
    keepalive_disable = {
        ['curl/7.68.0'] = true
    },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Fixes #137
ligurio added a commit that referenced this issue Nov 2, 2021
By default http module set keep-alive option in connections to make it
persistent. However sometimes we need persistent connection and close it
instead. It is possible with option keepalive_disable. Option accepts a
map where key is a user agent name with assigned non-nil value.
Note: nginx web-server has a similar option, see [1].

Unfortunately http client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is untested.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    log_requests = true,
    log_errors = true,
    keepalive_disable = {
        ['curl/7.68.0'] = true
    },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Fixes #137
ligurio added a commit that referenced this issue Nov 2, 2021
By default http module set keep-alive option in connections to make it
persistent. However sometimes we need persistent connection and close it
instead. It is possible with option keepalive_disable. Option accepts a
map where key is a user agent name with assigned non-nil value.
Note: nginx web-server has a similar option, see [1].

Unfortunately http client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is untested.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    log_requests = true,
    log_errors = true,
    keepalive_disable = {
        ['curl/7.68.0'] = true
    },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Fixes #137
ligurio added a commit that referenced this issue Nov 2, 2021
By default http module set keep-alive option in connections to make it
persistent. However sometimes we need persistent connection and close it
instead. It is possible with option keepalive_disable. Option accepts a
map where key is a user agent name with assigned non-nil value.
Note: nginx web-server has a similar option, see [1].

Unfortunately http client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is untested.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    log_requests = true,
    log_errors = true,
    keepalive_disable = {
        ['curl/7.68.0'] = true
    },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Fixes #137
ligurio added a commit that referenced this issue Nov 2, 2021
By default http module set keep-alive option in connections to make it
persistent. However sometimes we need persistent connection and close it
instead. It is possible with option keepalive_disable. Option accepts a
map where key is a user agent name with assigned non-nil value.
Note: nginx web-server has a similar option, see [1].

Unfortunately http client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is untested.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    log_requests = true,
    log_errors = true,
    keepalive_disable = {
        ['curl/7.68.0'] = true
    },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Fixes #137
ligurio added a commit that referenced this issue Nov 9, 2021
By default http module set keep-alive option in connections to make it
persistent. However sometimes we need persistent connection and close it
instead. It is possible with option keepalive_disable. Option accepts a
map where key is a user agent name with assigned non-nil value.
Note: nginx web-server has a similar option, see [1].

Unfortunately http client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is untested.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    log_requests = true,
    log_errors = true,
    keepalive_disable = {
        ['curl/7.68.0'] = true
    },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Fixes #137
ligurio added a commit that referenced this issue Nov 11, 2021
By default http module set keep-alive option in connections to make it
persistent. However sometimes we need persistent connection and close it
instead. It is possible with option keepalive_disable. Option accepts a
map where key is a user agent name with assigned non-nil value.
Note: nginx web-server has a similar option, see [1].

Unfortunately http client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is untested.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    log_requests = true,
    log_errors = true,
    keepalive_disable = {
        ['curl/7.68.0'] = true
    },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Fixes #137
ligurio added a commit that referenced this issue Jan 27, 2022
By default http module set keep-alive option in connections to make it
persistent. However sometimes we need persistent connection and close it
instead. It is possible with option keepalive_disable. Option accepts a
map where key is a user agent name with assigned non-nil value.
Note: nginx web-server has a similar option, see [1].

Unfortunately http client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is untested.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    log_requests = true,
    log_errors = true,
    keepalive_disable = {
        ['curl/7.68.0'] = true
    },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Part of #137
ligurio added a commit that referenced this issue Jan 27, 2022
The main problem with current implementation of HTTP server is it's
cooperative scheduling. To control connections we need invent something
that will periodically checks open connections and close idles with
exceeded timeout. Before start processing a new connection we close idle
connections with exceeded idle_timeout. In comparison to other solutions
(like running checking function in a separate fiber) closing connections
synchronously is much easier to implement and don't make module complex.

Fixes #137
ligurio added a commit that referenced this issue Jan 27, 2022
The main problem with current implementation of HTTP server is it's
cooperative scheduling. To control connections we need invent something
that will periodically checks open connections and close idles with
exceeded timeout. In proposed implementation we close idle connections
with exceeded idle_timeout in synchronous manner - before start
processing a new connection. In comparison to other solutions (like
running checking function in a separate fiber) closing connections
synchronously is much easier to implement and don't make module complex.

Fixes #137
ligurio added a commit that referenced this issue Jan 27, 2022
The main problem with current implementation of HTTP server is it's
cooperative scheduling. To control connections we need invent something
that will periodically checks open connections and close idles with
exceeded timeout. In proposed implementation we close idle connections
with exceeded idle_timeout in synchronous manner - before start
processing a new connection. In comparison to other solutions (like
running checking function in a separate fiber) closing connections
synchronously is much easier to implement and don't make module complex.

Fixes #137
ligurio added a commit that referenced this issue Jul 8, 2022
Option idle_timeout allows to set a maximum amount of time an idle
(keep-alive) connection will remain idle before closing. When the idle
timeout is exceeded, HTTP server closes the keepalive connection.

Fixes #137
ligurio added a commit that referenced this issue Jul 8, 2022
By default HTTP server sets a keep-alive option in connections to make
it persistent. However sometimes keeping connections alive is not
required and user may want to disable it for a certain connections.

Patch adds a new option 'disable_keepalive' that accepts a table with
user agent names. HTTP server will disable keep-alive for connections
established by user agents listed in a table.

Note: nginx web-server has a similar option, see [1].

Unfortunately HTTP client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is not covered in regression tests.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    log_requests = true,
    log_errors = true,
    keepalive_disable = { 'curl/7.68.0' },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Part of #137
ligurio added a commit that referenced this issue Jul 8, 2022
Option idle_timeout allows to set a maximum amount of time an idle
(keep-alive) connection will remain idle before closing. When the idle
timeout is exceeded, HTTP server closes the keepalive connection.

Fixes #137
ligurio added a commit that referenced this issue Jul 8, 2022
By default HTTP server sets a keep-alive option in connections to make
it persistent. However sometimes keeping connections alive is not
required and user may want to disable it for a certain connections.

Patch adds a new option 'disable_keepalive' that accepts a table with
user agent names. HTTP server will disable keep-alive for connections
established by user agents listed in a table.

Note: nginx web-server has a similar option, see [1].

Unfortunately HTTP client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is not covered in regression tests.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    keepalive_disable = { 'curl/7.68.0' },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Part of #137
ligurio added a commit that referenced this issue Jul 8, 2022
Option idle_timeout allows to set a maximum amount of time an idle
(keep-alive) connection will remain idle before closing. When the idle
timeout is exceeded, HTTP server closes the keepalive connection.

Fixes #137
ligurio added a commit that referenced this issue Jul 8, 2022
ligurio added a commit that referenced this issue Jul 8, 2022
By default HTTP server sets a keep-alive option in connections to make
it persistent. However sometimes keeping connections alive is not
required and user may want to disable it for a certain connections.

Patch adds a new option 'disable_keepalive' that accepts a table with
user agent names. HTTP server will disable keep-alive for connections
established by user agents listed in a table.

Note: nginx web-server has a similar option, see [1].

Unfortunately HTTP client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is not covered in regression tests.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    keepalive_disable = { 'curl/7.68.0' },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Part of #137
ligurio added a commit that referenced this issue Jul 8, 2022
Option idle_timeout allows to set a maximum amount of time an idle
(keep-alive) connection will remain idle before closing. When the idle
timeout is exceeded, HTTP server closes the keepalive connection.

Fixes #137
ligurio added a commit that referenced this issue Jul 8, 2022
Option idle_timeout allows to set a maximum amount of time an idle
(keep-alive) connection will remain idle before closing. When the idle
timeout is exceeded, HTTP server closes the keepalive connection.

Fixes #137
ligurio added a commit that referenced this issue Jul 8, 2022
ligurio added a commit that referenced this issue Jul 8, 2022
By default HTTP server sets a keep-alive option in connections to make
it persistent. However sometimes keeping connections alive is not
required and user may want to disable it for a certain connections.

Patch adds a new option 'disable_keepalive' that accepts a table with
user agent names. HTTP server will disable keep-alive for connections
established by user agents listed in a table.

Note: nginx web-server has a similar option, see [1].

Unfortunately HTTP client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is not covered in regression tests.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    keepalive_disable = { 'curl/7.68.0' },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Part of #137
ligurio added a commit that referenced this issue Jul 8, 2022
Option idle_timeout allows to set a maximum amount of time an idle
(keep-alive) connection will remain idle before closing. When the idle
timeout is exceeded, HTTP server closes the keepalive connection.

Fixes #137
ligurio added a commit that referenced this issue Jul 8, 2022
ligurio added a commit that referenced this issue Jul 8, 2022
By default HTTP server sets a keep-alive option in connections to make
it persistent. However sometimes keeping connections alive is not
required and user may want to disable it for a certain connections.

Patch adds a new option 'disable_keepalive' that accepts a table with
user agent names. HTTP server will disable keep-alive for connections
established by user agents listed in a table.

Note: nginx web-server has a similar option, see [1].

Unfortunately HTTP client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is not covered in regression tests.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    keepalive_disable = { 'curl/7.68.0' },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Part of #137
ligurio added a commit that referenced this issue Jul 8, 2022
Option idle_timeout allows to set a maximum amount of time an idle
(keep-alive) connection will remain idle before closing. When the idle
timeout is exceeded, HTTP server closes the keepalive connection.

Fixes #137
ligurio added a commit that referenced this issue Jul 8, 2022
ligurio added a commit that referenced this issue Jul 8, 2022
By default HTTP server sets a keep-alive option in connections to make
it persistent. However sometimes keeping connections alive is not
required and user may want to disable it for a certain connections.

Patch adds a new option 'disable_keepalive' that accepts a table with
user agent names. HTTP server will disable keep-alive for connections
established by user agents listed in a table.

Note: nginx web-server has a similar option, see [1].

Unfortunately HTTP client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is not covered in regression tests.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    keepalive_disable = { 'curl/7.68.0' },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Part of #137
ligurio added a commit that referenced this issue Jul 8, 2022
Option idle_timeout allows to set a maximum amount of time an idle
(keep-alive) connection will remain idle before closing. When the idle
timeout is exceeded, HTTP server closes the keepalive connection.

Fixes #137
ligurio added a commit that referenced this issue Jul 8, 2022
ligurio added a commit that referenced this issue Jul 8, 2022
By default HTTP server sets a keep-alive option in connections to make
it persistent. However sometimes keeping connections alive is not
required and user may want to disable it for a certain connections.

Patch adds a new option 'disable_keepalive' that accepts a table with
user agent names. HTTP server will disable keep-alive for connections
established by user agents listed in a table.

Note: nginx web-server has a similar option, see [1].

Unfortunately HTTP client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is not covered in regression tests.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    keepalive_disable = { 'curl/7.68.0' },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Part of #137
ligurio added a commit that referenced this issue Jul 8, 2022
Option idle_timeout allows to set a maximum amount of time an idle
(keep-alive) connection will remain idle before closing. When the idle
timeout is exceeded, HTTP server closes the keepalive connection.

Fixes #137
ligurio added a commit that referenced this issue Jul 8, 2022
By default HTTP server sets a keep-alive option in connections to make
it persistent. However sometimes keeping connections alive is not
required and user may want to disable it for a certain connections.

Patch adds a new option 'disable_keepalive' that accepts a table with
user agent names. HTTP server will disable keep-alive for connections
established by user agents listed in a table.

Note: nginx web-server has a similar option, see [1].

Unfortunately HTTP client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is not covered in regression tests.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    disable_keepalive = { 'curl/7.68.0' },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Part of #137
ligurio added a commit that referenced this issue Jul 8, 2022
Option idle_timeout allows to set a maximum amount of time an idle
(keep-alive) connection will remain idle before closing. When the idle
timeout is exceeded, HTTP server closes the keepalive connection.

Fixes #137
ligurio added a commit that referenced this issue Jul 9, 2022
Needed for #137

Reviewed-by: Alexander Turenko <alexander.turenko@tarantool.org>
ligurio added a commit that referenced this issue Jul 9, 2022
By default HTTP server sets a keep-alive option in connections to make
it persistent. However sometimes keeping connections alive is not
required and user may want to disable it for a certain connections.

Patch adds a new option 'disable_keepalive' that accepts a table with
user agent names. HTTP server will disable keep-alive for connections
established by user agents listed in a table.

Note: nginx web-server has a similar option, see [1].

Unfortunately HTTP client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is not covered in regression tests.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    disable_keepalive = { 'curl/7.68.0' },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Part of #137

Reviewed-by: Alexander Turenko <alexander.turenko@tarantool.org>
ligurio added a commit that referenced this issue Jul 9, 2022
Option idle_timeout allows to set a maximum amount of time an idle
(keep-alive) connection will remain idle before closing. When the idle
timeout is exceeded, HTTP server closes the keepalive connection.

Fixes #137

Reviewed-by: Alexander Turenko <alexander.turenko@tarantool.org>
Totktonada pushed a commit that referenced this issue Jul 9, 2022
Needed for #137

Reviewed-by: Alexander Turenko <alexander.turenko@tarantool.org>
Totktonada pushed a commit that referenced this issue Jul 9, 2022
By default HTTP server sets a keep-alive option in connections to make
it persistent. However sometimes keeping connections alive is not
required and user may want to disable it for a certain connections.

Patch adds a new option 'disable_keepalive' that accepts a table with
user agent names. HTTP server will disable keep-alive for connections
established by user agents listed in a table.

Note: nginx web-server has a similar option, see [1].

Unfortunately HTTP client [1] builtin into Tarantool supports only HTTP
protocol version 1.1, so version 1.0 is not covered in regression tests.

Example:

local httpd = http_server.new('127.0.0.1', 8080, {
    disable_keepalive = { 'curl/7.68.0' },
})

1. https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_disable
2. https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/

Part of #137

Reviewed-by: Alexander Turenko <alexander.turenko@tarantool.org>
Totktonada pushed a commit that referenced this issue Jul 9, 2022
Option idle_timeout allows to set a maximum amount of time an idle
(keep-alive) connection will remain idle before closing. When the idle
timeout is exceeded, HTTP server closes the keepalive connection.

Fixes #137

Reviewed-by: Alexander Turenko <alexander.turenko@tarantool.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants