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

MINOR: connection: add TCP keep-alive parameters #252

Closed
wants to merge 1 commit into from

Conversation

sveniu
Copy link

@sveniu sveniu commented Sep 3, 2019

Add configuration parameters to control TCP keep-alives:

  • tcp-keepalive-time: Idle time before keep-alive probes are sent
  • tcp-keepalive-interval: Interval between keep-alive probes
  • tcp-keepalive-count: Number of keep-alive probes to send before giving up

Tested with TCP and HTTP, and with different settings in the default, listen, frontend and backend sections.

Potential issues:

  • Only tested on Linux.
  • Darwin #ifdef TCP_KEEPALIVE implemented but untested.
  • No Windows support.

Rationale:

  • HAProxy only allows enabling/disabling TCP keep-alives; not controlling parameters.
  • System default parameters controllable using sysctl.
  • System defaults apply to all connections. Default idle time: 7200 seconds, as required by RFC 1122.
  • The sysctl command does not work on Docker containers due to read-only procfs.
  • The Docker privileged flag could have worked, but is unsupported on AWS Fargate.
  • The Docker sysctl flag could have worked, but is unsupported on AWS Fargate.
  • The Docker Linux capability flags could have worked, but are unsupported on AWS Fargate.
  • I'm behind a Cisco Meraki NAT gateway that has a fixed TCP NAT timeout of 300 seconds, meaning connections are dropped before the TCP keep-alive idle time kicks in (default 7200 seconds on Linux). Meraki support confirms the fixed 300 second timeout.
  • Instead of requiring all clients to increase the TCP keep-alive probe frequency, fix it centrally by enabling parameters in HAProxy.

This commit adds three TCP keep-alive parameters to control the idle time,
probe interval and probe count.
@lukastribus
Copy link
Member

This is an automated message.

The haproxy project does not review or merge pull requests on GitHub (please see CONTRIBUTING).

Your patch or patchseries will be forwarded to the haproxy mailing list where it can be reviewed (you will be CC'ed).

This PR will be closed automatically.

@lukastribus lukastribus closed this Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants