[JAVA-235] Specify minimum response time for slave selection Created: 14/Dec/10  Updated: 12/Aug/12  Resolved: 27/Apr/12

Status: Closed
Project: Java Driver
Component/s: Cluster Management, Performance
Affects Version/s: 2.3
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Mike Copley Assignee: Unassigned
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File pingCeiling.patch    
Backwards Compatibility: Minor Change

 Description   

The API should have a way to configure a minimum response time a slave must have before it can be used for queries (using slaveOK).

I have 5 mongod instances, 2 capable of being primary. 3 as read only slaves (priority 0). One of the 3 read only slaves is performing poorly (a switch is dying, latency is spiking > 900ms). Because the current algorithm has an element of randomness in it, some of the requests are being served by this poorly performing server. This is due to ReplicaSetStatus.getASecondary() calling "if ( diff > 15 || ( ( badBeforeBest - mybad ) / ( _all.size() - 1 ) ) > _random.nextDouble() )".

The driver should support a minimum cut off. getASecondary() should enforce a latency ceiling in choosing random slaves. I've submitted a patch that does this, using a default of 200ms as a cut off, configurable in MongoOptions.



 Comments   
Comment by Jeffrey Yemin [ 27/Apr/12 ]

This bug should have been closed a while back, asi it's now already configurable via com.mongodb.slaveAcceptableLatencyMS system property

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