Data Center

System Design Interview - Chapter 4 - Design a Rate Limiter

System Design Interview - Chapter 4 - Design a Rate Limiter

Translations: RU

Every popular software should have a Rate Limiter. It prevents DDOS attack, reduces cost and prevents servers from being overloaded.

There are some tricky questions to be considered during implementation of Rate Limiter:

  • Where to put Rate Limiter: client-side, server-side, gateway?
  • Algorithms for rate limiting. There are many algorithms with pros and cons: Token bucket, Leaking bucket, Fixed window counter, Sliding window log, Sliding window counter. Your business needs will define the right algorithm.
  • How are rate limiting rules created?
  • Where are the rules stored?
  • How to handle requests that are rate limited?

These questions are disclosed in a very interesting Chapter 4 of the book:

System Design Interview - Chapter 1 - Scale from zero to millions of users

System Design Interview - Chapter 1 - Scale from zero to millions of users

Translations: RU

A great generic plan for scaling any app from zero to millions of users.

  • Single server setup
  • Selection and usage of database
  • Vertical scaling vs horizontal scaling approaches. And why you should prefer horizontal
  • Adding load balancer for horizontal scaling
  • Adding database replication for horizontal scaling
  • Adding cache
  • Adding CDN
  • Stateless vs Stateful architecture and using external state storage
  • Adding extra Data Centers
  • Adding Message queue
  • Adding Logging, Metrics, and Automation
  • Scaling database (sharding)
  • and futher steps…

All of these is carefully but briefly disclosed in the Chapter 1 of the book: