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

Support for configurable Keep-Alive for both frontend and backend #727

Closed
bgv opened this issue Oct 10, 2016 · 6 comments
Closed

Support for configurable Keep-Alive for both frontend and backend #727

bgv opened this issue Oct 10, 2016 · 6 comments
Milestone

Comments

@bgv
Copy link

bgv commented Oct 10, 2016

Hi,
I want to propose adding new configuration options prompt by #718.

While certainly its nice to have Keep-Allive from end to end sometimes we don't have full control over the applications we deploy.

In some situations it's good to have more granular control over the connection, so for example if we use the application just to print few bits of information we don't need the connection staying open for another 30 seconds.

For example when creating new service with docker swarm we can just add new label for this particular frontend: --label traefik.frontend.rule=Client-KeepAlive:5,Backend-KeepAlive:0 which will tell traefik to keep the connection to client browser open for 5 sec but close connection to backend after the response is finished.

So the full service command becomes:

docker service create --name whoami --replicas 3 --label traefik.port=80 --label traefik.frontend.rule=Client-KeepAlive:5,Backend-KeepAlive:0 --network frontend emilevauge/whoami

I don't think this is urgent feature but certainly good to have.
Cheers.

@jsravn
Copy link

jsravn commented Feb 22, 2017

I think this feature is pretty urgent for production use. Without it, traefik will generate errors for non-idempotent requests - go http client only retries closed idle connections for idempotent requests. Only way to prevent this is to set the forwarder's transport idle timeout to less than our server timeouts. In golang 1.6 this isn't straightforward, while 1.7 has added the idle timeout that can be used for this. I'm not sure how easy it will be to do this, it probably requires a change to the oxy library that traefik uses.

@ldez ldez added the priority/P3 maybe label Jun 2, 2017
@27Bslash6
Copy link

Adding my reasoning for this request: optimal configuration for Akamai <> origin is keepalive of 301 seconds (https://community.akamai.com/customers/s/question/0D50f00005RtqgwCAB/default-pconn-timeout?language=en_US) but we don't want Traefik <> backend service connections persisting this long

@stealthybox
Copy link

stealthybox commented Sep 9, 2018

+1
It may be difficult/impossible to disable keep-alive support on a backend server
(particularly if the servers are part of a third party application).

Common use-case:

(disregard -- the fix is to sleep in a preStop lifecycle hook until traefik can update its backend list)

It's difficult to do zero-downtime rolling deploys of NGINX pods if keep-alive is enabled.
NGINX can't drain keep-alive connections during a graceful shutdown so it drops in-flight requests:

Say we're using Traefik to load-balance some NGINX servers;
It would be convenient to work around this issue by configuring the Traefik to not keep-alive those backend connections.

@pmontepagano
Copy link
Contributor

So... currently there is no way to completely disable keepalives between Traefik and a backend?

@glebsam
Copy link

glebsam commented Jul 23, 2019

So... currently there is no way to completely disable keepalives between Traefik and a backend?

There is: #3237 (comment)

@bgv
Copy link
Author

bgv commented Jul 23, 2019

#4983 is merged, and is in v2.0.0 (still beta):

Closing this issue now, many thanks to everyone involved.

@bgv bgv closed this as completed Jul 23, 2019
@ldez ldez added this to the 2.0 milestone Jul 24, 2019
@traefik traefik locked and limited conversation to collaborators Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants