ARCHOS 525 BLUEPRINT · /d/dgm_code-cardinality-and-sampling-streams
Cardinality Estimation & Stream Sampling (HyperLogLog & Reservoir)
6 COMPONENTS · 6 FLOWS · UPDATED 2026-11-24
GITHUB README / PR PREVIEW CARD
[](https://archos.sageideas.dev/d/dgm_code-cardinality-and-sampling-streams) *Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_code-cardinality-and-sampling-streams)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_code-cardinality-and-sampling-streams" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Cardinality Estimation & Stream Sampling (HyperLogLog & Reservoir) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
client_0["Click / Telemetry Stream"]
n1_1["64-Bit Uniform Hash"]
n2a_2[("HyperLogLog Registers")]
n2b_3[("Reservoir Sampler")]
n3_4[("Mergeable Rollups")]
downstream_5["Downstream & OTel"]
client_0 -->|"1. Hash item · xxHash"| n1_1
n1_1 -->|"2a. Max rho · HLL"| n2a_2
n1_1 -->|"2b. Keep K/i · Reservoi"| n2b_3
n2a_2 -->|"3a. Merge max · OLAP"| n3_4
n2b_3 -->|"3b. Merge · RAM"| n3_4
n3_4 -.->|"4. Emit / · OTLP/API"| downstream_5COMPONENT STACK (6)
- Click / Telemetry StreamSTATELESSBillions of user_ids
- 64-Bit Uniform HashSTATELESSLeading-zero geometric run
- HyperLogLog RegistersSTATEFUL16,384 6-bit regs
- Reservoir SamplerSTATEFULUniform K-sample in O RAM
- Mergeable RollupsSTATEFULUnion HLL across time/shards
- Downstream & OTelSTATELESSConsumers, metrics & SLOs
REQUEST & DATA FLOW (6)
- Click / Telemetry Stream → 64-Bit Uniform Hash (Hash item)[xxHash]
- 64-Bit Uniform Hash → HyperLogLog Registers (Max rho)[HLL]
- 64-Bit Uniform Hash → Reservoir Sampler (Keep K/i)[Reservoi]
- HyperLogLog Registers → Mergeable Rollups (Merge max)[OLAP]
- Reservoir Sampler → Mergeable Rollups (Merge)[RAM]
- Mergeable Rollups → Downstream & OTel (Emit /)[OTLP/API]