[DRIVERS-723] Driver support for server Hedged Reads Created: 19/Aug/19  Updated: 22/Feb/23  Resolved: 22/Feb/23

Status: Closed
Project: Drivers
Component/s: None
Fix Version/s: None

Type: Epic Priority: Major - P3
Reporter: Esha Bhargava Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on CSHARP-3019 Driver support for server Hedged Reads Closed
depends on CXX-1966 Driver support for server Hedged Reads Closed
depends on GODRIVER-1538 Driver support for server Hedged Reads Closed
depends on JAVA-3666 Driver support for server Hedged Reads Closed
depends on PHPC-1571 Driver support for server Hedged Reads Closed
depends on CDRIVER-3583 Driver support for server Hedged Reads Closed
depends on MOTOR-516 Driver support for server Hedged Reads Closed
depends on PYTHON-2170 Driver support for server Hedged Reads Closed
depends on RUBY-2184 Driver support for server Hedged Reads Closed
depends on RUST-325 Driver support for server Hedged Reads Closed
depends on NODE-2510 Driver support for server Hedged Reads Closed
Related
related to DOCS-13369 Investigate changes in SERVER-45440: ... Closed
related to DOCS-13586 remove uri connection string blurb fo... Closed
Driver Changes: Not Needed
Server Compat: 4.4
Quarter: FY21Q1
Upstream Changes Summary:

There will be a new mongos setParameter "readHedgingMode" that allows eligible "nearest" reads to be "hedged" by sending a request to a second member after waiting on the first member for a period. This parameter will be "on" by default.

There will also be a new readPreference field "hedge" that allows explicitly opting into hedging behavior as above.

Downstream Changes Summary:

Hedged Reads

Cost Threshold %: 100
Driver Compliance:
Key Status/Resolution FixVersion
PYTHON-2170 Fixed 3.11
MOTOR-516 Gone away
GODRIVER-1538 Fixed 1.4.0
NODE-2510 Fixed 3.6.0
RUBY-2184 Fixed 2.13.0.beta1
JAVA-3666 Fixed 4.1.0
CDRIVER-3583 Fixed 1.17.0-beta2, 1.17.0
CXX-1966 Fixed 3.6.0-rc0, 3.6.0
CSHARP-3019 Fixed 2.11.0
RUST-325 Fixed 1.2.0
SWIFT-741 Won't Do
PHPC-1571 Fixed 1.8.0-beta2, 1.8.0

 Description   
Epic Summary

 

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

spec change.
 



 Comments   
Comment by Divjot Arora (Inactive) [ 10/Apr/20 ]

If anyone is looking for a link on the MongoDB docs site to reference in their driver's documentation, https://docs.mongodb.com/master/release-notes/4.4/#hedged-reads and https://docs.mongodb.com/master/core/sharded-cluster-query-router/#hedged-reads-and-read-preference are good links to use.

Generated at Thu Feb 08 08:22:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.