Configure TCP Keepalive

Registered by Pranesh

In this blueprint we aim to add configuration options to tune TCP keepalive. These will be used to enable/disable, and tune, TCP keepalive. To avoid socket leaks because of connections being left idle for any reason,the nova code has tcp keepalive automatically turned on in places like nova/wsgi.py and cinder/wsgi.py. However, there is no way to configure keepalive parameters.
nova.conf already has a tcp_keepidle setting. This is meant to be the the interval between the last data packet sent (excluding just ACKs) and the first keepalive probe; after the connection is marked to need keepalive, this counter is not used any further. In order to implement this blueprint I propose we specify the following configuration options:

 * tcp_keepalive_interval, which is the interval between subsequential keepalive
   probes
 * tcp_keepalive_count, which is the number of unacknowledged probes to send before the
   connection is considered dead
 * tcp_keepalive_configure, which is the switch to turn on configuration of
   tcp_keepalive. If this is False, default TCP values would be used.

This change will allow cluster owners to set tcp_keepidle, etc to values suitable for their setup, if they choose to do so. At present, this value defaults to 10 minutes (600 seconds), which is not necessarily good everywhere.

This was proposed in Nova, and it was suggested that its a better fit in Oslo.
https://review.openstack.org/#/c/87427/

Code changes will involve using socket.setsockopt() to set values specified in the conf.
There must be some documentation change to explain these settings as well.

References:
1. TCP Keepalive HOWTO http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/index.html

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
Pranesh
Direction:
Needs approval
Assignee:
Pranesh
Definition:
Approved
Series goal:
Proposed for juno
Implementation:
Implemented
Milestone target:
None
Started by
Pranesh
Completed by
Pranesh

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/configure-tcp-keepalive,n,z

Addressed by: https://review.openstack.org/90870
    Enable configuring tcp keepalive

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.