[JAVA-961] Add independent setting for timeout when selecting a server to operate against Created: 26/Sep/13  Updated: 04/Nov/16  Resolved: 25/Nov/14

Status: Closed
Project: Java Driver
Component/s: Cluster Management
Affects Version/s: None
Fix Version/s: 3.0.0

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

In 2.x, we use connectTimeout, which overloads the meaning (since we also use it for Socket connect timeout),

In 3.x, it's not configurable yet, but there's an easy place to hook a value in, in BaseCluster.getServer().

Possible name: serverSelectionTimeout



 Comments   
Comment by Jeffrey Yemin [ 25/Nov/14 ]

Fixed in:
https://github.com/mongodb/mongo-java-driver/commit/c58856b0189d09d0d7f4156610f82802afdd4337

Comment by Jeffrey Yemin [ 27/Sep/13 ]

I'm not sure it's necessary to have a setting specifically for waiting for the primary. Is it necessary for that to be different than the setting for waiting for a secondary (for secondary reads) or for waiting for a primary to read from?

Comment by Jeffrey Yemin [ 27/Sep/13 ]

There are a number of places where waiting can occur:

  1. selecting a server to operate against (Not just for writes, but for reads too)
  2. checking out a socket from the pool
  3. connecting the socket
  4. writing to the socket
  5. reading from the socket

All of them can have independent and configurable timeouts, but only the first two can be set to zero.

Comment by Antoine Girbal [ 27/Sep/13 ]

To reinforce the importance of this: the current behavior of waiting for connect timeout is kind of arbitrary and not ideal for env with harsh SLA.
It makes more sense to have a setting 'wait time til master' during which driver would loop through and check for primary every 1s or so.
In many high performance case the wait would be set to 0.

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