StickySampling: Streaming Frequency Estimation
- StickySampling is a streaming algorithm that approximates item frequency counts in high-speed data streams with provable one-sided additive error guarantees.
- It employs a decreasing Bernoulli sampling probability combined with periodic counter decay to achieve logarithmic space complexity relative to the failure probability.
- The algorithm is applied in security-critical contexts such as DRAM RowHammer mitigation, ensuring efficient detection of hammer rows without false positives.
StickySampling is a streaming algorithm designed to maintain approximate frequency counts for items in a high-speed data stream, providing one-sided additive error guarantees using space that is logarithmic in the failure probability. Originally formulated for data streams by Manku and Motwani, StickySampling achieves strong probabilistic security and performance trade-offs, making it particularly suitable for security-critical systems such as DRAM RowHammer mitigation, where it enables the detection of “hammer” rows with provable guarantees.
1. Problem Statement and Formal Definition
The StickySampling algorithm addresses the problem of tracking item (e.g., memory row) frequencies over a potentially unbounded data stream of length . For each unique element , let denote the true frequency and the estimate reported by the algorithm. The algorithm maintains a data structure with the following property:
where is the permissible additive error fraction and is the failure probability on the upper bound. In practice, parameters are tuned so that is a small fraction of a relevant system threshold (such as RowHammer, RH), and 0 is the tolerable false-negative rate.
Key parameters:
- 1: additive error fraction (e.g., set so 2 in DRAM applications)
- 3: failure probability
- 4: support-width constant, controlling counter compression frequency
- 5: updates before each compression and halving of sampling probability
StickySampling combines a geometrically decreasing Bernoulli sampling probability with periodical counter decay (“Compress”) to bound the number of stored counters.
2. Algorithm: Annotated Pseudocode
A hardware-friendly version of the StickySampling algorithm maintains accuracy and memory efficiency:
0 This structure admits new items with a decreasing probability, ensuring rare items are dropped over time. The Compress step uses geometric decay to cap state and avoids linear growth over the stream.
3. Accuracy and Space Complexity Guarantees
Let 6 be the total number of processed items. Under the specified parameters:
- The counter table maintains at most 7 entries.
- For any row address 8:
- Deterministic lower bound: 9.
- Probabilistic upper bound:
0
Space usage is thus
1
with each entry recording a row address and its partial count.
4. Security Guarantees for RowHammer Mitigation
For DRAM RowHammer detection, “critical” rows (potential aggressors) are defined as 2 within a refresh window. To guarantee detection,
- Set 3 so that 4.
- Any row with 5 will have 6 with probability at least 7, triggering mitigation.
- No row with 8 will be falsely reported: no false positives. With this, all rows exceeding the hammer threshold are detected and mitigated with high confidence before causing victim bitflips.
5. Comparison with Reservoir Sampling and Lossy Counting
| Algorithm | Space Complexity | Error Profile |
|---|---|---|
| Reservoir Sampling | 9 (0) | Probabilistic (detection by sampling) |
| Lossy Counting | 1 | One-sided, deterministic lower bound |
| StickySampling | 2 | One-sided additive 3 error with failure 4 |
Reservoir Sampling provides uniform sampling but does not yield frequency counts, and is relatively inefficient for high security as 5 scales steeply. Lossy Counting provides one-sided error but its counter state grows with 6. StickySampling achieves similar error guarantees to Lossy Counting, with superior scaling—its state does not depend on the total stream length 7, only on 8 and 9.
6. Parameter Selection and Practical Deployment in DRAM Controllers
In practical DRAM systems with 0 ms, 1 ns, and worst-case 2 activations per window, set 3 (RowHammer threshold). To ensure 4, select 5. With 6, this yields:
- 7
- 8 activations
The resulting counter table holds 9 entries. After every 0 activations, the Compress step is triggered, halving 1 and doubling the next window. Such resource demands are moderate relative to DRAM controller capabilities and allow designer-controlled trade-offs by tuning 2 and 3; lowering 4 increases tracking fidelity but raises memory usage, while decreasing 5 reduces false negatives with only logarithmic space cost.
7. Significance and Applicability
StickySampling introduces a novel combination of provable one-sided additive error (6) and logarithmic-in-7 space, enabled by the geometric decay and window-doubling mechanism. It is the first streaming method to provide these guarantees within the domain of architectural RowHammer defenses, ensuring the detection of all rows surpassing the hammer threshold with tunable confidence while avoiding false positives. The algorithm’s balanced security-performance trade-off surpasses both pure sampling and deterministic bucket-based schemes for this class of memory security problems. Practitioners should select 8 and 9 to match system-level false-negative requirements, thereby right-sizing counter table, update window, and sampling probability to ensure resilient mitigation against aggressive RowHammer attacks.