Summary
Send N reads in parallel, to the two “best” hosts. After one result comes back, cancel other outstanding operations, drain their sockets on background threads and send that first result back to the user.
By default, do this for nearest with a hedging of 2. With some kind of fanciness to determine if this is useful / effective
Motivation
Users want fast reads, but sometimes they send a read to a host which is slow (when another eligible host would have been faster). It’s also sometimes not possible to know this ahead of time.
Driver implementation
Initially we intend to support hedged reads for sharded clusters, so the drivers work is simply to pass hedging-related client application configuration through to mongos servers. Here's an example of a readPreference document with explicit hedging parameters:
{ mode: “nearest” hedge: { enabled: true, // optional, defaults to true } }
Documentation
- depends on
-
CSHARP-3019 Driver support for server Hedged Reads
- Closed
-
CXX-1966 Driver support for server Hedged Reads
- Closed
-
GODRIVER-1538 Driver support for server Hedged Reads
- Closed
-
JAVA-3666 Driver support for server Hedged Reads
- Closed
-
PHPC-1571 Driver support for server Hedged Reads
- Closed
-
CDRIVER-3583 Driver support for server Hedged Reads
- Closed
-
MOTOR-516 Driver support for server Hedged Reads
- Closed
-
PYTHON-2170 Driver support for server Hedged Reads
- Closed
-
RUBY-2184 Driver support for server Hedged Reads
- Closed
-
RUST-325 Driver support for server Hedged Reads
- Closed
-
NODE-2510 Driver support for server Hedged Reads
- Closed
- is related to
-
DRIVERS-783 Hedged reads with Replica sets in Drivers
- Backlog
-
DRIVERS-2929 Deprecate Hedged Reads option
- Backlog