Per-Base API Rate Limiter With Retry-After Hints

Last updated: November 29, 2026

Quick Overview

Implement a rate limiter for a public REST API that allows a fixed number of requests per second per base, with short bursts, and tells rejected callers how long to wait. It must be deterministic to test and must not leak memory for bases that stop calling.

Airtable
Software Engineering Fundamentals
Software Engineer
Airtable
November 29, 2026
Software Engineer
Technical Screen
Software Engineering Fundamentals
Medium

0

0

0 solved


Implement a rate limiter for a public REST API that allows a fixed number of requests per second per base, with short bursts, and tells rejected callers how long to wait. It must be deterministic to test and must not leak memory for bases that stop calling.

Airtable's public API and integrations are rate limited per base, and the thin web tier in front of the base workers is where this logic lives. The interviewer looks for a correct token bucket, injectable time for tests, and practical concerns like eviction and running across many servers.

What the Interviewer Expects
  • Pick an algorithm (token bucket, sliding window) and justify it
  • Refill lazily on each call rather than with a timer
  • Return a precise retry-after value
  • Inject the clock for deterministic tests
  • Evict idle buckets and discuss a distributed version
Key Topics to Cover
Token bucket
Rate limiting
Testability
Memory management
Distributed counters
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • How would you enforce the limit across 50 web servers behind a load balancer?
  • Should a burst of 429s from one integration affect other users of the same base?
  • How do you rate limit by both base and API token without double counting?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Sustained rate of 5 requests per second per base, burst capacity 5. allow(base, now) returns whether to serve and, if not, seconds until a token is available (sent as Retry-After with HTTP 429). T...

High-Level Design

Token bucket per base: store tokens and the last refill time. On each call add elapsed * rate tokens capped at capacity, then spend one if available. Lazy refill means no background timers. Fixed wi...


Submit Your Answer
Markdown supported

Related Questions