📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

How would you enforce a single rate limit across 10 instances of an ASP.NET Core API?

Intermediate Theory Intermediate

🎯 Key points

  • Built-in limiter state is per process
  • Limit / instance count is approximate and breaks with autoscale
  • API Management rate-limit-by-key or quota-by-key at the edge
  • Redis with atomic scripts for exact limits
  • Shared store makes the limit independent of instance count under autoscale
  • Fail-open with a local fallback limiter vs fail-closed when Redis is down

⏱ 30-second answer

The built-in middleware keeps counters in each process, so 10 instances allow roughly 10x the limit. Options: divide the limit by the instance count (cheap, approximate, and wrong as soon as autoscaling changes the count); enforce at a shared edge such as Azure API Management rate-limit-by-key / quota-by-key; or use a Redis-backed limiter (sliding window or token bucket in an atomic Lua script) for exact limits, at the cost of a network hop per request. Decide up front what happens when Redis is unreachable: fail open with a per-instance local limiter as a fallback, or fail closed for abuse-sensitive endpoints such as login.

🔍 What the interviewer is checking

Checks distributed-state trade-offs: Redis, API Management, approximate per-instance limits

↩ Usually asked after

More in API Reliability

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me