High-Level Design of Sharded Counters

Let's understand and design sharded counters.

High-level solution sketch

Managing millions of tweet likes requires many counters operating on many nodes. To manage these counters, we need an efficient system that could give high performance and scalability as the number of users grows. What will happen when a single tweet on Twitter gets a million likes, and the application server receives a write request against each like to increment the relevant counter? These millions of requests are eventually serialized in a queue for data consistency. Such serialization is one way to deal with concurrent activity, though at the expense of added delay. Real-time applications want to keep the quality of experience high by providing minimum possible latency for the end-user.

Let’s see the illustration below to understand the discussed problem.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy