The http.tcp.keep_idle
setting in Elasticsearch controls the idle time before TCP starts sending keepalive probes on HTTP connections. It helps maintain long-lived connections and detect disconnected clients.
Description
- Default value: System default (varies by operating system)
- Possible values: Time in seconds
- Recommendation: Adjust based on network environment and connection requirements
This setting determines how long a connection can remain idle before the TCP stack begins sending keepalive probes. It's part of the TCP keepalive mechanism, which helps detect and clean up dead connections.
Version Compatibility
Available in Elasticsearch 6.3.0 and later versions.
Example Usage
To set the http.tcp.keep_idle
value to 300 seconds (5 minutes) using the cluster settings API:
PUT _cluster/settings
{
"persistent": {
"http.tcp.keep_idle": "300s"
}
}
Reasons for changing:
- To detect dead connections more quickly in unstable network environments
- To comply with firewall or proxy timeouts in your infrastructure
Effects of the change:
- Shorter values may increase network traffic but improve connection reliability
- Longer values reduce overhead but may lead to longer detection times for dead connections
Common Issues
- Setting too low values can increase unnecessary network traffic
- Setting too high values may result in maintaining dead connections for too long
Do's and Don'ts
Do's:
- Align this setting with your network infrastructure timeouts
- Monitor the effects after changing this setting
- Consider the trade-off between connection reliability and network overhead
Don'ts:
- Don't set extremely low values (e.g., less than 60 seconds) unless absolutely necessary
- Don't ignore this setting if you have issues with lingering dead connections
Frequently Asked Questions
Q: How does http.tcp.keep_idle differ from http.tcp.keep_alive?
A: While http.tcp.keep_alive
enables or disables the TCP keepalive mechanism, http.tcp.keep_idle
specifically controls the idle time before keepalive probes are sent.
Q: Can changing http.tcp.keep_idle affect Elasticsearch performance?
A: Yes, it can impact network performance and connection management. Lower values may increase network traffic but improve connection reliability, while higher values do the opposite.
Q: Is this setting node-specific or cluster-wide?
A: This setting can be configured at both node and cluster levels. When set via cluster settings API, it applies cluster-wide.
Q: How does this setting interact with firewalls or load balancers?
A: It's important to align this setting with your network infrastructure. Firewalls or load balancers may have their own idle connection timeouts, which should be considered when configuring http.tcp.keep_idle
.
Q: Should I change this setting if I'm not experiencing connection issues?
A: If you're not experiencing connection problems, it's generally best to leave this setting at its default value. Only adjust it if you have specific requirements or are troubleshooting connection-related issues.