Katkat

Implement Real-Time Rate Limiting for Web Service Requests

AtlassianData Scientist · Technical Screen

Last updated

This question evaluates understanding of real-time rate limiting, time-windowed traffic control, and efficient per-client state management under algorithmic constraints.

Scenario

A web service must throttle traffic from clients; you need to decide in real-time whether each incoming request should be served or rejected according to rate-limiting rules.

Question

Design and implement getRequestStatus(addresses) where addresses[i] is the URL hit at second i. Return "200" or "429" so that no address receives more than 5 requests in any 30-second window or more than 2 in any 5-second window.

Hints

Think sliding windows, per-address queues or deques, and O(

  1. updates.