All jobs / Backend developer / Performance
Backend developer interview question · 3–5 years
The interviewer asks: “Where do you enforce rate limits?” Strongest answer?
The strongest answer
At the edge (gateway / mesh) by identity — user, API key, IP as a last resort — with a budget the app can also enforce on expensive routes. Limits are a product and a safety control, not a random 429.
Why it works
Exactly. Edge limits protect everyone; app limits protect a heavy endpoint (export, search). Key by principal or you punish a NAT.
What a good answer covers
- Limit at the edge by identity.
- Extra caps on expensive routes.
- Don't use one shared counter for all tenants.
- Don't confuse scale-out with a security control.
Answers that fall short
- Close, but not the strongest: Only in each handler with a static counter.
In-process counters don't share across instances and reset on deploy. Use a shared store or the gateway. - Weak: One global limit for the whole cluster so it's fair.
A single cluster-wide number lets one noisy neighbour exhaust everyone. Isolate by tenant/user. - Red flag: No limits; autoscaling will absorb abuse.
Autoscaling an expensive endpoint is how you turn abuse into a cloud bill. Limits first.
Who gets asked this
More Performance questions
- The interviewer asks: “This query is slow in production but fine on your laptop. What do you do first?”…
- An endpoint takes 1.5 seconds at p95. The container’s CPU sits at 8% and the CPU profiler shows almost…
- The interviewer asks: “The cache expires and 2,000 requests hit the database at once. How do you prevent…
- Under load, someone raises the connection pool from 20 to 200 per instance. Throughput drops and p95 gets…
- The interviewer asks: “How do you know we can take 3× traffic on Monday?” Strongest answer?
- The interviewer asks: “The bill doubled but QPS didn't. Where do you look?” Strongest answer?
- A teammate opens a pull request that rewrites a service “for performance”. What do you ask for before you…
- The interviewer asks: “The API is idle but requests hang on 'opening a connection.' What's going on?”…