-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Performance, Tests
-
None
Various specs suggest lowering heartbeatFrequencyMS to improve test suite performance. There is intentionally no public API in libmongoc for doing so, but libmongoc's own test suite uses the private API to alter the minimum value directly on the topology object:
/* tests can override this */ topology->min_heartbeat_frequency_msec = MONGOC_TOPOLOGY_MIN_HEARTBEAT_FREQUENCY_MS;
While PHPC could theoretically patch mongoc-topology-private.h when building its bundled copy of libmongoc, there is not really any way to do that when PHPLIB installs the driver through pecl. Some other ideas that crossed my mind:
- libmongoc skips defining its default minimum of 500 if the constant is already defined via CFLAGS, similar to how BSON_COMPILATION and MONGOC_COMPILATION are handled. That said, pecl install also abstracts CFLAGS.
- Exposing configure flags to the PHP driver build process to control this is theoretically possible, but introducing that would likely break existing driver installations by making our pecl install block on user input (see:
PHPC-1017).
Perhaps the best option is the have PHPLIB not use pecl install and instead manually compile the driver from source so that we can patch the private header.
This issue was previously discussed in CDRIVER-3130. If that issue is resolved, perhaps libmongoc will introduce an API specifically for wrapping drivers.
On a related note, older versions of libmongoc did not actually enforce a minimum of heartbeatFrequencyMS, but that was fixed in CDRIVER-2058.
- is related to
-
CDRIVER-3130 Allow specification of minHeartbeatFrequencyMS for wrapping drivers
- Backlog