Design of a Rate Limiter

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

Design of a Rate Limiter

High-level design

This design places a rate-limiting decision service behind the web tier. The web server supplies a policy descriptor, receives an allow or deny decision, and forwards allowed work to an API server. The Envoy rate-limit service, originally developed at Lyft, provides this configuration example:

domain: messaging
descriptors:
  - key: message_type
    value: marketing
    rate_limit:
      unit: day
      requests_per_unit: 5

The configuration applies to a descriptor bucket in the messaging domain.

Here, unit is day, requests_per_unit is 5, and the descriptor selects marketing messages. The snippet does not include a user or client descriptor, so it does not establish a separate five-message allowance for each client. Per-client enforcement needs identity in the configured descriptor and the request sent to the limiter.

The rest of this lesson is for Premium members

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