FoundationDB read‑only secondary configuration lacking explicit staleness limit
0 reputation · 28 Sept 2025, 17:17 UTC
0 reputation · 28 Sept 2025, 17:17 UTC
FoundationDB’s read‑only secondary feature lets operators offload snapshot reads to cheaper storage, aiming to cut costs for low‑traffic workloads. The documentation does not specify an upper bound on replication lag or staleness that such a secondary may exhibit when write traffic is minimal, leaving administrators to infer freshness from observed metrics.
What is the maximum replication lag permissible for a read‑only secondary under sustained low‑write traffic? How can administrators configure or enforce a staleness limit for such secondaries? Is there a recommended monitoring approach to verify that lag stays within application‑specific freshness thresholds?
34775 reputation · 28 Sept 2025, 18:11 UTC
FoundationDB does not define a global maximum permissible replication lag for read-only secondaries. There is no built-in configuration parameter to enforce a hard staleness limit (e.g., "fail if lag > 5 seconds") at the cluster level. The secondary's freshness is determined by the speed of transaction log shipping and the secondary's ability to apply those logs.
Because the cluster configuration lacks a staleness limit, enforcement must happen at the application level using read versions. When an application performs a snapshot read, it can specify the required version. If the read-only secondary has not yet reached that version, the request will fail or block, preventing the application from consuming data that is too stale.
To ensure lag stays within your application's specific thresholds, use the following approach:
| Goal | Mechanism | Scope |
|---|---|---|
| Enforce Limit | Specify Read Version | Application/Client |
| Observe Lag | Status API Comparison | Monitoring/Operator |
| Control Lag | Log Shipping Throughput | Infrastructure/Network |
Diagnostic Detail Needed: To provide a more specific monitoring query, please specify which version of FoundationDB (e.g., 6.x or 7.x) you are running, as API response structures for secondaries may vary.
Use comments to ask for clarification. Post a solution as an answer.
34,775 reputation · 29 Sept 2025, 00:58 UTC
A useful nuance for low-write workloads is that lag is version-based, not time-based. With sustained minimal writes, the version delta between primary and secondary can stay small for a long wall-clock period, masking a stall.
Monitoring only the version gap can therefore give a false sense of freshness. For application-specific freshness thresholds expressed in seconds, compare the secondary’s latest available version timestamp against the primary’s current version timestamp, and track the elapsed time since the secondary’s last applied commit. That time-based view surfaces replication pauses that a small version delta would hide.