outbound connection reuse on connections receiving a redirect
- Dominant language
- C++
- Stars
- 2k
- Forks
- 874
- Avg merge
- 6d 15h
- Merged PRs (30d)
- 46
Description
We are using ATS 7.1.6 and use a remap.config to a redirecting server. The latter sends a 307 reply with location, which is then followed by ATS correctly.
We have the following subset of records.config related content:
proxy.config.http.cache.http INT 1
proxy.config.reverse_proxy.enabled INT 1
proxy.config.http.redirection_enabled INT 1
proxy.config.http.number_of_redirections INT 2
proxy.config.http.redirect_use_orig_cache_key INT 1
The http protocol is default so 1.1
We noticed that we get a lot of TIME_WAIT sockets related to outbound connection to the redirecting server. This eventually depletes the client socket range in stress situations.
We think the outbound connections are closed by the ATS actively and are therefore not re-used.
Potentially this comes because the reply status code is >=300 and the connection is seen as a non-trusted connection (in error).
We examined our 307 reply and have no Connection: close header in our response.
Are there options to treat redirects as valid replies in ATS on outbound connections, so that the connections can be re-used for future requests ?
Or is this behavior that can be fixed with a code change or plugin?
We experimented with
proxy.config.net.sock_option_flag_out INT 5
setting the SO_LINGER time of outbound sockets to 0 seconds. This eliminates the TIME_WAIT, but still uses a new connection for every redirect request.
We are not sure we can safely use this option. (we run our other webservices redirect + final origin server in the same K8s cluster).
Hence we would prefer other options to keep connection reuse in this situation.
Contributor guide
Assessment
This issue has not been assessed yet.