sysdesign-top-k-count-min-sketch

Design real-time top-K dashboards with count-min sketch under memory constraints.

Updated Apr 23, 2026
One-click install
npx skills add https://github.com/danilods/matilha-sysdesign-pack --skill sysdesign-top-k-count-min-sketch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sysdesign-top-k-count-min-sketch
Source: https://github.com/danilods/matilha-sysdesign-pack/tree/main/skills/sysdesign-top-k-count-min-sketch
Command: npx skills add https://github.com/danilods/matilha-sysdesign-pack --skill sysdesign-top-k-count-min-sketch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Efficiently design real-time top-K dashboards over high-cardinality event streams using a count-min sketch to bound memory while maintaining acceptable accuracy.

Core Features & Use Cases

  • Count-min sketch sizing and evaluation for high-cardinality streams.
  • Kappa vs Lambda architecture choices with checkpointing.
  • Serving from sealed windows with late-event handling and a clear recovery path.

Quick Start

Configure a real-time top-K pipeline using a count-min sketch with a Kappa architecture and enable periodic checkpointing.

Frequently Asked Questions about sysdesign-top-k-count-min-sketch

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I track top-K items in a high-cardinality streaming pipeline without running out of memory?

You can track top-K items in a high-cardinality stream using a count-min sketch to bound memory while maintaining acceptable approximate results. This approach enforces explicit error and probability parameters to size the data structure correctly.

How does a count-min sketch work for real-time dashboards?

A count-min sketch works for real-time dashboards by using multiple hash functions to estimate event frequencies in constant memory. It prescribes window sealing and checkpointing to serve approximate top-K results from completed time windows.

What is the difference between Kappa and Lambda architectures for streaming top-K workloads?

For streaming top-K workloads, a Kappa architecture uses a single stream processing path with periodic checkpointing, while Lambda combines batch and speed layers. The design evaluates both to choose the appropriate checkpointing strategy.

Can I use approximate top-K results for high-throughput streaming workloads with many unique keys?

Yes, you can use approximate top-K results for high-throughput workloads with many unique keys. This approach is specifically designed for contexts where approximate results are acceptable and clear checkpointing is required.

How do I handle late events and recovery when serving top-K dashboards from sealed windows?

Serving from sealed windows handles late events and recovery by closing windows before serving results. The design prescribes a clear recovery path using periodic checkpointing to ensure streaming-to-serving consistency.