[SERVER-29341] Set TCP_KEEPIDLE and TCP_KEEPINTVL (or OS equivalent) whenever available Created: 23/May/17 Updated: 30/Oct/23 Resolved: 01/Sep/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Networking |
| Affects Version/s: | None |
| Fix Version/s: | 3.5.13 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Bernie Hackett | Assignee: | Sara Golemon |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Minor Change | ||||||||||||
| Sprint: | Platforms 2017-09-11 | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
The server currently enables SO_KEEPALIVE on sockets whenever it is defined. On Linux it goes the extra mile and attempts to set a reasonable value for TCP_KEEPIDLE and TCP_KEEPINTVL (the default TCP_KEEPIDLE value on Linux - and keep-alive timeout on Windows - is a completely useless 7200 seconds). The server should attempt to set a reasonable value for TCP_KEEPIDLE and TCP_KEEPINTVL whenever they are defined, not just on Linux. It should also attempt to set the equivalent values on Windows using WSAIoctl. References: |
| Comments |
| Comment by Githook User [ 28/Jun/18 ] |
|
Author: {'username': 'sgolemon', 'name': 'Sara Golemon', 'email': 'sara.golemon@mongodb.com'}Message: (cherry picked from commit bd153cba11ab82ffbf8d2bc0b801eb808369eb9e) |
| Comment by Sara Golemon [ 01/Sep/17 ] |
|
KeepAlive parameters are now updated on Windows and Mac according to the same rules as Linux. That is, if the current keepidle/keepintvl values are greater than 300 seconds, they are reduced to 300 seconds. If they are shorter than 300s they are not modified. Note that while windows and linux have two distinct settings, mac uses a single setting. |
| Comment by Githook User [ 01/Sep/17 ] |
|
Author: {'username': 'sgolemon', 'name': 'Sara Golemon', 'email': 'sara.golemon@mongodb.com'}Message: |
| Comment by Shane Harvey [ 24/Jul/17 ] |
|
The server's current behavior on Linux is to only set keep-alive times if the default value is greater than a threshold. On Windows, it may be more complicated to have the same behavior. It's simple to set the keep-alive times using WSAIoctl with SIO_KEEPALIVE_VALS but it does not seem possible to read the current SIO_KEEPALIVE_VALS on a socket; the WSAIoctl output buffer is not used according to the documentation and confirmed by testing locally. So I believe the only way to get the default keep-alive times are by reading the KeepAliveTime and KeepAliveInterval registry entries. |
| Comment by Bernie Hackett [ 26/May/17 ] |
|
The argument here isn't to configure more tcp options, but to apply the values we already configure on a wider array of operating systems. |
| Comment by Mira Carey [ 26/May/17 ] |
|
It's not clear to me if we want to do this. We've made a conscious choice in the past to do application level heartbeating wherever feasible, partially because relying more strongly on tcp keep alives may make alternate transports more difficult to reason about. acm, what are your thoughts? |