Repository navigation
perf(client): skip health lock without cooldowns - #624
Conversation
- Reuse the existing atomic cooldown-count gate on the healthy common path. - Preserve recovery-trial locking and health-check metrics.
e00342b to
4965dfa
Compare
Verification for exact head
|
Scope — bounded healthy-peer hot path (verification in progress)
Draft only; not ready or merge-approved. Raw head
e00342bd8b17ffe232950477d1ea5baa7852ec23, tree13cbadc1bb3daf2740047b6e7ddb43726cf76c66, parentdf5002482c45d1e86d99e14aa95f9f4718e54882.Changes only:
src/client/peer_health.h: aHealthy()call may return true immediately when the existing atomic cooldown-count is zero. This is the same result as examining the original empty map, without map access or redundant allocation. Every nonempty/active/expired cooldown still takes the original mutex, including recovery-trial admission; no map entry is removed from the lock.checks_still increments exactly once per call on both paths.test/client/client_metrics_test.cc: verifies that both the fast empty-map check and an active-cooldown check remain counted.No environment parsing, default, API/wire schema, RDMA, STO-36 or unrelated application behavior changed. This is not a change to coding policy, timed-deadline bypass, or global getenv caching.
Correctness audit
An independent concurrency/caller review found zero must-fix findings. It audited all cooldown insertion/erasure/LRU/recovery paths and all 17 production
KVClient::health_.Healthycall sites. It confirmed that checks counts remain atomic exactly once, single-trial admission remains locked, neutralkResourceExhausteddoes not poison a peer, and an initial zero observed during first-incident publication serializes the overlapping check before that incident. Existing active/expired cooldowns retain a positive count and therefore cannot take the unlocked path. No uninitialized or non-atomic state was introduced.Baseline and candidate independently built binaries each passed:
peer_health_test: 22/22peer_health_stall_test: 12/12, including concurrent recovery admission and neutral immediate retryclient_metrics_test: 26/26, including the new both-path health counter assertion and ResourceExhausted attribution checksThe review did not treat timing alone as concurrency proof, and did not run or claim sanitizer, physical RDMA/full-matrix, maintained-full, CI or rollout approval. Those are separate required gates.
Isolated helper microbenchmark
Exact empty-cooldown
PeerHealth::Healthy()calls, same peer string and separately compiled before/after binaries; four alternating pairs per scenario, with process exit 0 and expected admission/metric values.The total benchmark runner took 6.12 seconds. These figures describe this isolated helper only, not RPC latency, distributed throughput, multi-host performance, or production speedup. They do not imply completion of all TRN-15 work.
Remaining gates
Fresh maintained full regression and public CI on this exact raw head, final evidence review, and normal ready/queue checks are still required. Complete-head recovery evidence is preserved before publishing the branch. This draft does not claim merge, rollout, universal ABI change, or completion of TRN-15/M4/M6.