[DRIVERS-961] Support serverSelectionTryOnce in multi-threaded drivers Created: 25/Oct/19 Updated: 29/Jul/20 |
|
| Status: | Blocked |
| Project: | Drivers |
| Component/s: | SDAM |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Tomer Yakir | Assignee: | Rachelle Palmer |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
The current spec indicates that single-threaded drivers must implement serverselectiontryonce but multi-threaded drivers must not. There's benefit in implementing serverselectiontryonce in multi-threaded drivers as well so they can fail fast in case the server isn't running. Current workarounds are a bit cumbersome - for example when working with the Go Driver we were able to workaround this using the following approaches: To highlight the benefit of this (on top of cleaner code) - this is expected to introduce a significant performance boost to the MongoDB agent, especially in large clusters deployments |
| Comments |
| Comment by Esha Bhargava [ 09/Mar/20 ] |
|
rachelle.palmer can you have a look at this one? |
| Comment by Oleg Pudeyev (Inactive) [ 22/Jan/20 ] |
|
This came up before: https://jira.mongodb.org/browse/SPEC-1167 We currently recommend lowering server selection timeout from its default in both development and production environments (for different reasons): https://docs.mongodb.com/ruby-driver/master/tutorials/ruby-driver-create-client/#development-configuration FWIW, Ruby driver implements something similar to serverselectiontryonce for legacy compatibility, to provide the illusion of the driver synchronously scanning each server before returning from constructor (but the scanning time is bound by server selection timeout, and servers are scanned in parallel; the scan also doesn't stop on a primary or a particular server type but tries to contact each server in the seed list). This functionality can be turned off by applications if desired and we'll drop this feature in the next major version. |