[JAVA-1139] Allow configuration of heartbeat background threads to be set via API Created: 07/Mar/14  Updated: 31/May/16  Resolved: 07/Nov/14

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

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

Issue Links:
Duplicate
is duplicated by JAVA-763 Allow configuration of heartbeat back... Closed
Related
is related to JAVA-381 Support redundant mongos connections Closed
is related to JAVA-693 Document system properties for contro... Closed

 Description   

The Java driver, as of version 2.9.0, supports automatic failover of mongos instances (JAVA-381). The parameters that determine the wait time when the active mongos becomes unavailable, until choosing a new mongos, are only available as system properties. They cannot be set directly via the driver API. This ticket is to add API support for directly specifying the failover timeout value.

For the record, the relevant system properties, and their default values, are:

updaterIntervalMS = Integer.parseInt(System.getProperty("com.mongodb.updaterIntervalMS", "5000"));
updaterIntervalNoMasterMS = Integer.parseInt(System.getProperty("com.mongodb.updaterIntervalNoMasterMS", "10"));
mongoOptionsDefaults.connectTimeout = Integer.parseInt(System.getProperty("com.mongodb.updaterConnectTimeoutMS", "20000"));
mongoOptionsDefaults.socketTimeout = Integer.parseInt(System.getProperty("com.mongodb.updaterSocketTimeoutMS", "20000"));

The maximum time to failover to a new mongos is:

Sum of: <com.mongodb.updaterIntervalMS> + max(com.mongodb.updaterSocketTimeoutMS, com.mongodb.updaterConnectTimeoutMS, ping time) for each mongos

The new options are:

  • MongoClientOptions#getHeartbeatFrequency
  • MongoClientOptions#getHeartbeatConnectRetryFrequency
  • MongoClientOptions#getHeartbeatConnectTimeout
  • MongoClientOptions#getHeartbeatSocketTimeout
  • MongoClientOptions#getHeartbeatThreadCount

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