IntermediateTECHNICAL
How would you design and implement rate limiting for an external-facing API that must protect downstream services from abuse while still allowing legitimate high-volume clients? Be specific about algorithms, data storage, and where you’d enforce the limits.
Backend Developer
General

Sample Answer

I’d implement a multi-layer rate limiting strategy. At the edge (API gateway like NGINX, Kong, or AWS API Gateway), I’d use a token bucket or leaky bucket algorithm to enforce per-IP and per-API-key limits (e.g., 1,000 req/min default, custom tiers up to 20,000 req/min). State would be stored in a distributed in-memory store like Redis using atomic INCR/EXPIRE or Lua scripts for accuracy. For fairness, I’d also add sliding window counters for p95 accuracy during bursts. Limits are evaluated at the gateway to protect downstream services, with service-level circuit breakers in the backend. I’d return 429s with retry-after headers, provide analytics dashboards, and allow whitelisting and burst credits for paying clients.

Keywords

Use token bucket or leaky bucket plus sliding window for accurate, burst-tolerant limitsStore counters in Redis or similar distributed cache with atomic operationsEnforce limits at API gateway to shield downstream services and add service-level circuit breakersSupport per-tenant tiers, 429 with retry-after, and observability for tuning
Related Questions

Based on your hydrology and irrigation engineering background, explain how you would estimate the irrigation water requirement for a kharif crop in a semi-arid region of Gujarat. Walk me through each step: from reference evapotranspiration estimation, crop coefficient selection, effective rainfall calculation, to arriving at canal discharge for a given command area.

IntermediateTECHNICAL

In your civil engineering studies, what specific design coursework or project work did you complete related to irrigation channels or canals (e.g., design of lined/unlined canals, distributaries, minors)? Describe one such design in detail, including how you determined discharge, permissible velocity, section dimensions, and lining choice for Gujarat-type soil and climate conditions.

IntermediateTECHNICAL

Walk me through a recent multi-channel digital marketing campaign you managed end-to-end. How did you set objectives, choose channels, allocate budget, and measure success?

IntermediateBEHAVIORAL

In your resume you note improving or optimizing [a process, KPI, or metric]. What specific baseline metrics did you start from, what steps did you personally take, and how did you verify that the improvement was due to your changes rather than external factors?

IntermediatePROBLEM_SOLVING

On your resume you mention working on a cross-functional project (e.g., involving multiple teams or stakeholders). Describe a situation from that project where priorities conflicted—how did you navigate the trade-offs and what was the final outcome?

IntermediateSITUATIONAL