sharded-counters

Distribute high-frequency counter writes across storage shards with HyperLogLog.

42|2|Updated Jun 1, 2026
One-click install
npx skills add https://github.com/proyecto26/system-design-skills --skill sharded-counters-proyecto26
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sharded-counters
Source: https://github.com/proyecto26/system-design-skills/tree/main/skills/sharded-counters
Command: npx skills add https://github.com/proyecto26/system-design-skills --skill sharded-counters-proyecto26

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill solves the performance bottleneck of hot keys in distributed systems where a single counter cannot handle the write volume, preventing lock contention and throughput plateaus.

Core Features & Use Cases

  • Write-Sharding: Distributes increments across multiple physical shards to bypass single-row serialization limits.
  • Probabilistic Counting: Implements HyperLogLog for memory-efficient, large-scale unique item counting.
  • Time-Windowing: Manages bucketed counters for rolling rate-limiting or recent-activity tracking.
  • Use Case: Use this when a viral post's like count or a global rate tally causes write contention, allowing you to absorb massive traffic by spreading the load.

Quick Start

Use the sharded-counters skill to design a distributed counter strategy for a high-traffic service that needs to handle millions of concurrent increments per second.

Frequently Asked Questions about sharded-counters

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

FAQPage Schema
How do I prevent database hot spots from write contention on high-traffic counters?

Sharded counters solve write contention by distributing high-frequency increments across multiple physical storage shards, bypassing single-row serialization limits to absorb massive traffic without throughput plateaus.

How does HyperLogLog work for large-scale unique visitor tracking?

HyperLogLog provides probabilistic counting for large-scale unique visitor tracking by estimating cardinality with high memory efficiency, allowing distributed systems to track millions of unique items without storing individual identifiers.

What's the best way to handle millions of concurrent counter increments per second?

The best way to handle millions of concurrent increments per second is distributing write operations across multiple shards, which absorbs massive traffic by spreading the load and preventing single-counter throughput bottlenecks.

When do I need sharding for distributed counters instead of a single row?

You need sharding for distributed counters when a single counter cannot handle the write volume, causing lock contention and throughput plateaus during viral events or global rate tallies that require eventual consistency.

Can I use time-windowed bucketed counters for rolling rate limiting?

Yes, sharded counters manage time-windowed bucketed counters for rolling rate-limiting and recent-activity tracking, distributing increments across shards while maintaining bucketed time windows for rate calculations.

What are the limitations of using probabilistic cardinality estimation for unique counts?

Probabilistic cardinality estimation using HyperLogLog trades exact precision for memory efficiency, providing approximate unique counts that satisfy eventual consistency requirements rather than exact real-time tallies.