Repository navigation
docs(adr): add DHT bandwidth analysis to ADR 022, cold-start re-publish jitter MUST - #631
Conversation
…o ADR 022 ADR 001 has a detailed gossip bandwidth analysis (§ Gossip Bandwidth Analysis); ADR 022 had no equivalent for DHT. The DHT rate-limit numbers in § DHT Rate Limiting were defensible defaults but not derived from a throughput model. § Bootstrap — adds a MUST for cold-start per-record jitter: uniform(0, 50 min) for each blob's first re-publish after startup, independently per record. Naive single-tick bulk re-publish is non-conforming and would saturate the per-peer rate limit at every receiver. New § DHT Bandwidth Analysis — symmetric to ADR 001 § Gossip Bandwidth Analysis. Covers: - Per-RPC wire sizing (FindValue ~600B, Store ~170B, FindNode ~800B) - Steady-state scaling table over cached-blob count C, showing STORE bandwidth dominates and scales with C (not N) — ~130 Kbps at C=10k, comparable order to gossip at N=1000 - Bootstrap surge analysis showing per-record cold-start jitter makes bootstrap rate match steady state - Headroom table validating the § DHT Rate Limiting numbers against modeled steady-state load (10× per-peer burst, 50× per-IP, 7-10× global headroom at the analyzed parameters) - Bottleneck regime discussion identifying the moderate-C zone where QUIC stream-setup overhead dominates and motivating batched STORE as a follow-up Acceptance criterion 16 added for the cold-start jitter MUST. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request updates ADR 022 to include specifications for cold-start re-publish scheduling and a detailed DHT bandwidth analysis. The changes mandate a per-record jitter for initial re-publishes to prevent network saturation during node startup. Feedback was provided regarding mathematical inconsistencies in the bootstrap rate calculation and the estimated bandwidth savings for batched STORE operations.
|
|
||
| #### Bootstrap surge | ||
|
|
||
| A restarting publisher with C cached blobs needs `C × (K+3)` STOREs to fully populate DHT records. At C=10,000: 230,000 STOREs. The natural spread mechanism is per-record jitter on cold start ([§ Bootstrap](#bootstrap)): with `uniform(0, 50 min)` draws, bootstrap rate matches steady state at ~96 STOREs/sec averaged across all receivers, fitting comfortably within the rate-limit budget. Without per-record jitter at cold start, the same 230,000 STOREs deliver in a single scheduler interval, saturating the per-peer rate limit at every receiver. The cold-start jitter requirement is what makes bootstrap the publisher's problem to schedule rather than the receiver's problem to absorb. |
There was a problem hiding this comment.
The bootstrap rate calculation appears inconsistent with the stated jitter window. If 10,000 blobs (uniform(0, 50 min) window (3,000 seconds) with ~96 STOREs/sec, which corresponds to a 40-minute window (the steady-state mean). To align the math, the jitter should either be uniform(0, 40 min) or the rate figure should be updated to ~77 STOREs/sec.
References
- When documenting related numerical estimates (like gas costs) across multiple documents (ADRs), derive them from a single, explicit base rate to ensure consistency and maintain a single source of truth.
There was a problem hiding this comment.
Fixed in 9b32c82. Changed the cold-start jitter window to uniform(0, 40 min) everywhere (in § Bootstrap, § DHT Bandwidth Analysis bootstrap surge, and acceptance criterion 16). 40 min matches the steady-state mean cycle (mean of uniform(30, 50)), so the math reconciles cleanly: 230,000 / (40 × 60) = 95.8 STOREs/sec, matching steady state by construction. Picked option A from your two choices because it makes the derivation cleaner ("bootstrap rate equals steady-state rate") rather than just adjusting a number.
| Three asymptotic regimes inform protocol-level optimizations: | ||
|
|
||
| - **Low C (≤1,000).** Bandwidth is gossip-dominated; DHT is a rounding error. No DHT-specific optimization warranted. | ||
| - **Moderate C (10,000–50,000).** DHT and gossip are comparable. The bottleneck is QUIC stream-setup overhead, not bytes-on-wire — 230,000 STOREs at bootstrap costs ~11.5 MB of pure framing on top of ~28 MB of payload. Batched STORE collapses concentration into one RPC per publisher-receiver pair per scheduler tick, reducing stream count by two-to-three orders of magnitude and saving ~40% of bootstrap bytes-on-wire to framing. Specified in a follow-up. |
There was a problem hiding this comment.
The claimed bandwidth savings from batched STORE do not align with the provided breakdown. The text states that 230,000 STOREs cost ~11.5 MB of framing and ~28 MB of payload (Total ~39.5 MB). Eliminating the framing overhead would result in a saving of ~40% reduction in total bootstrap bytes-on-wire. Please verify if the framing estimate or the total savings percentage needs adjustment.
References
- When documenting related numerical estimates (like gas costs) across multiple documents (ADRs), derive them from a single, explicit base rate to ensure consistency and maintain a single source of truth.
There was a problem hiding this comment.
Fixed in 9b32c82. You're right that the 40% number didn't reconcile with the framing-only breakdown. Recomputed: per-RPC unbatched ≈170B × 230k = ~39 MB; batched at 256/batch ≈898 batches × ~16.7 KB = ~15 MB. Actual savings is ~60%, not 40%. The shortfall in my decomposition was that I treated framing as the sole source of savings (which would give ~30%, as you noted) — but batched STOREs also de-duplicate the holder field (one per batch instead of one per RPC), worth another ~7 MB / ~20 percentage points. Updated text now shows both contributors: ~30pp from framing, ~20pp from holder de-duplication, totaling ~60%.
Two corrections caught in code review on the bandwidth analysis. § Bootstrap, § DHT Bandwidth Analysis bootstrap surge, and acceptance criterion 16 — cold-start jitter window changed from uniform(0, 50 min) to uniform(0, 40 min). The 40-minute window matches the steady-state mean re-publish cycle (mean of uniform(30, 50)), so bootstrap rate matches steady-state rate by construction: 230,000 / (40 × 60) = 96 STOREs/sec. The previous uniform(0, 50 min) was inconsistent with the stated ~96/sec figure (50-minute window would give 76.7/sec). § DHT Bandwidth Analysis bottleneck regimes — batched STORE savings figure corrected from ~40% to ~60%, with the decomposition that makes the math reconcile. Framing elimination alone accounts for ~30 percentage points; holder-field de-duplication (one holder per batch instead of per-RPC) accounts for another ~20. The previous 40% figure treated framing as the sole source of savings, which underestimated the actual reduction. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Summary
Two related additions to ADR 022 closing the bandwidth-modeling gap relative to ADR 001 § Gossip Bandwidth Analysis.
§ Bootstrap — cold-start re-publish jitter MUST. Each cached blob's first re-publish after startup is drawn from
uniform(0, 50 min)independently per record. Subsequent re-publishes use the standarduniform(30, 50)interval. Closes a spec gap where naive "re-publish everything on the next scheduler tick" would saturate the per-peer rate limit at every receiver during bootstrap.New § DHT Bandwidth Analysis. Symmetric to ADR 001 § Gossip Bandwidth Analysis. Five subsections:
Acceptance criterion 16 added for the cold-start jitter MUST.
Closes #629.
Why this shape
The numbers belong in the protocol they govern — same as gossip lives in ADR 001 — rather than scattered across implementation notes. Rate-limit defaults referenced from the analysis are more defensible than the free-floating values landed in #628; the headroom table makes the limits' role as adversarial ceilings (not steady-state targets) explicit.
The bottleneck-regime discussion identifies QUIC stream-setup overhead as the dominant bootstrap cost at moderate C and motivates the batched STORE follow-up in #630 with concrete numbers (~256× reduction in framing-only cost, ~40% reduction in total bootstrap bytes-on-wire). Batched STORE isn't proposed here — it's documented as the protocol-level optimization the moderate-C regime warrants, with implementation specified separately.
Test plan
make check-refs— ADR reference hygiene (bare refs, anchors, section spacing)markdownlintvia pre-commitRelated