PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/OpenAI

Implement a Distributed Rate Limiter

Last updated: Jun 5, 2026

Implement a Distributed Rate Limiter

Company: OpenAI

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Implement a simple rate limiter library that can run across multiple application servers. The rate limiter should support a sliding time window policy: - Each client is identified by a `clientId` string. - A client may make at most `limit` requests within any `windowMs` millisecond window. - `allowRequest(clientId, timestampMs)` returns `true` if the request is allowed and records it; otherwise it returns `false`. - `reset(clientId)` clears the recorded request history for that client. Your implementation should consider: 1. Multiple application servers checking the same client's limit concurrently. 2. Persistence of rate-limit state so that state is not lost immediately after a process restart. 3. Clock skew between servers. 4. A degraded mode where the shared remote store is unavailable and the system must temporarily fall back to local storage. 5. Recovery after the remote store becomes available again, including how locally recorded state is reconciled.

Related Interview Questions

  • Compute Plant Infection Time - OpenAI (medium)
  • Implement IP Address Arithmetic - OpenAI (hard)
  • Simulate Infection Spread on a Grid - OpenAI (hard)
  • Implement Social Follow Recommendations - OpenAI (medium)
  • Build a Compose Rating Card - OpenAI (medium)
OpenAI logo
OpenAI
May 25, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
0
0

Implement a simple rate limiter library that can run across multiple application servers.

The rate limiter should support a sliding time window policy:

  • Each client is identified by a clientId string.
  • A client may make at most limit requests within any windowMs millisecond window.
  • allowRequest(clientId, timestampMs) returns true if the request is allowed and records it; otherwise it returns false .
  • reset(clientId) clears the recorded request history for that client.

Your implementation should consider:

  1. Multiple application servers checking the same client's limit concurrently.
  2. Persistence of rate-limit state so that state is not lost immediately after a process restart.
  3. Clock skew between servers.
  4. A degraded mode where the shared remote store is unavailable and the system must temporarily fall back to local storage.
  5. Recovery after the remote store becomes available again, including how locally recorded state is reconciled.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More OpenAI•More Software Engineer•OpenAI Software Engineer•OpenAI Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.