System Design: The Sharded Counters

Lesson 101 of 25610 min readPremium lesson preview
In this lesson1 sections

System Design: The Sharded Counters

A popular post can concentrate updates on one counter even when the rest of a service is quiet. This chapter spreads that write load across partial counters, then examines the extra work needed to read and preserve their total.

Problem statement

Views, likes, and comments can create a skewed update workload: a few items receive a large fraction of events. These frequent items are heavy hitters. Their counters become hot keys when the required update rate exceeds one key’s serving capacity. The bottleneck depends on per-item traffic, not merely the total number of counters.

The following historical media examples illustrate concentrated attention. Use their counts to understand skew, not as current traffic measurements or a capacity benchmark:

YouTube videos’ views in 24 hours
YouTube videos’ views in 24 hours

The rest of this lesson is for Premium members

Premium opens every lesson in this course, along with all questions and solutions on PracHub.