educative.io

Rate limiter design: Throttle rule retriever

Does the throttle rule retriever poll the db for updates? If not, does it learn about rule updates via some sort of pub-sub, and do we need that building block here? If it does poll, what do you think of having whatever process updates the rule also update the cache, with a write-through or write-back approach? Benefits:

  1. We have one fewer component in our system (the poller) for which we must build and track metrics and alarms
  2. Since rule updates are infrequent, a push model will result in many fewer operations than a pull model
  3. If the pull model offset this by pulling infrequently, we’d get data inconsistencies between db and cache, which a write-through or write-around approach would resolve

Course: Grokking Modern System Design Interview for Engineers & Managers - Learn Interactively
Lesson: Design of a Rate Limiter - Grokking Modern System Design Interview for Engineers & Managers

Hi Isaac,

The rate limiter system currently employs a polling mechanism to refresh the throttle rules with write-back approach for cache updates.

Given that rule updates are infrequent, this method could streamline system components and operations, thereby enhancing the consistency between the cache and the database.

In addition, adopting a push model could further improve the maintenance of consistency between the database and the cache. We will certainly explore these suggestions in depth and make necessary updates.

Thank you.

1 Like