[CDRIVER-438] Implement Server Discovery And Monitoring Spec Created: 06/Oct/14  Updated: 26/Feb/16  Resolved: 13/Jul/15

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: None
Fix Version/s: 1.2-beta0

Type: New Feature Priority: Major - P3
Reporter: Barrie Segal Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on CDRIVER-699 Fail-fast server selection mode Closed
is depended on by PHPC-24 Implement server discovery and monito... Closed
is depended on by DRIVERS-182 Implement Server Discovery And Monito... Closed
Duplicate
is duplicated by CDRIVER-277 perform keepalive with {ping:1} for c... Closed
is duplicated by CDRIVER-416 HA monitoring Closed
is duplicated by CDRIVER-459 Bring mongoc_cluster_node_t up to the... Closed
Related
related to CDRIVER-758 priority=0 (passives) servers ignored Closed
related to CDRIVER-1139 Network err must invalidate server de... Closed
related to CDRIVER-739 minHeartbeatFrequencyMS can be overri... Closed
related to CDRIVER-573 Update "not master" and "node is reco... Closed
is related to CDRIVER-279 be lazier about holding on to connect... Closed
is related to CDRIVER-689 Detect incompatible wire versions Closed
is related to CDRIVER-459 Bring mongoc_cluster_node_t up to the... Closed
is related to CDRIVER-460 Implement SDAM for mongoc_cluster_t Closed

 Comments   
Comment by A. Jesse Jiryu Davis [ 03/Mar/15 ]

The C driver's general approach to Server Discovery And Monitoring is:

A mongoc_client_t that you get from the mongoc_client_pool_t will share one monitor with other clients from the same pool. That monitor runs periodically on a background thread, slowly under normal circumstances, quickly when any client wants to select a server type that's unavailable (e.g., while a client wants to write and the primary is unavailable). The monitor is uses non-blocking sockets to check servers concurrently; the overall effect conforms to SDAM's description of multithreaded and asynchronous clients, even though the C driver uses one thread to accomplish monitoring.

A non-pooled mongoc_client_t has its own monitor which runs on the current thread. It blocks to rescan the topology periodically, or whenever selection fails or the topology description is "stale". It conforms to SDAM's description of a single-threaded client, plus an optimization: during the rescan it fans out to all servers concurrently with non-blocking sockets. So the recheck only takes as long as the slowest server, or the connectTimeoutMS, rather than requiring the sum of all server latencies.

Generated at Wed Feb 07 21:09:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.