[CSHARP-3960] Consider changing the default of MaxConnectionLifeTime to infinite Created: 09/Nov/21 Updated: 31/Mar/22 |
|
| Status: | Backlog |
| Project: | C# Driver |
| Component/s: | Connectivity |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Unknown |
| Reporter: | Boris Dogadov | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
| Comments |
| Comment by Robert Stam [ 10/Nov/21 ] |
|
Fair point that MaxConnectionLifeTime should be added to the CMAP spec. |
| Comment by Robert Stam [ 10/Nov/21 ] |
|
I doesn't seem like DRIVERS-1198 will help at all with the load balancing issue. I disagree that we should remove MaxConnectionLifeTime. But given what we have learned about how long lived connections interact badly with load balancing we should reduce the default value to something a lot shorter than 30 minutes. |
| Comment by Boris Dogadov [ 10/Nov/21 ] |
|
It would be great to have any evidence of the original problem, and maybe gather some data from other drivers as well. While ConnectionSettings.MaxLifeTime might mitigate the problem of possible network instability to some extent, it might not be the ideal approach. I think that connection management in this case should align as much as possible with CMAP spec. |
| Comment by Robert Stam [ 10/Nov/21 ] |
|
While MaxConnectionLifeTime was originally introduced to deal with network environments that don't deal reliably with long lived connections, now that we support mongos behind a load balancer there is an additional reason to keep MaxConnectionLifeTime: load balancers don't balance well when connections are long lived. Here's an interesting article on how long lived connections interfere with load balancing: https://www.ateam-oracle.com/post/long-lived-tcp-connections-and-load-balancers So perhaps we should actually move in the opposite direction, and reduce the default value of MaxConnectionLifeTime from 30 minutes to something like 5 minutes. Figuring out the best new smaller value is tricky. |