Specify minimum response time for slave selection

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.3
    • None
    • None
    • Minor Change
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            Unassigned
            Reporter:
            Mike Copley
            None
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: