[DRIVERS-864] Round-robin loadbalancing for evenly distributing secondary reads Created: 02/May/19  Updated: 06/Jul/23  Resolved: 06/Jul/23

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

Type: Task Priority: Major - P3
Reporter: Bernie Hackett Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-40970 Intelligent "load-aware" loadbalancin... Investigating
Related

 Description   

MongoDB drivers use a Server Selection Algorithm to choose which replica set member to use (or, when connected to multiple mongos instances, which mongos instance to use). For a secondary read preference, the server selection process is as follows:

  1. The driver assembles a list of eligible secondary members. maxStalenessSeconds and tag sets can further restrict the eligibility of the members, as documented here.
  2. If the list of eligible members is not empty, the driver determines which eligible member is the “closest” (i.e. the member with the lowest average network round-trip-time) and calculates a latency window by adding the average round-trip-time of this “closest” server and the localThresholdMS. The driver uses this latency window to pare down the list of eligible members to those members that fall within this window.
  3. From this list of eligible members that fall within the latency window, the driver randomly chooses an eligible member.

The above process is documented here. As can be seen here, this process does not use even-load-balancing as a criteria for selection of a secondary. In other words, the secondary selection process does not evenly distribute the incoming queries equally among available secondaries.

 

This is an enhancement request to add a round-robin loadbalancing mechanism in the Server Selection Algorithm, which will evenly distribute secondary reads among secondaries in a round-robin fashion.



 Comments   
Comment by Patrick Freed [ 05/Jan/21 ]

As part of DRIVERS-781, the server selection algorithm was updated to take the active "operation count" of a given server into account instead of just selecting randomly. See the changes in SPEC-1555 for details. This obviates the need for round-robin load balancing and achieves the goals set forth in this ticket, so I think we can just close this out.

 

cc oleg.pudeyev

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