Scrivio Interview library
LeadershipPrincipal6 min read · updated 13 November 2026

Over the years four rate-limiting implementations appeared: a Redis Lua limiter in the gateway, Resilience4j limits inside services, a homegrown Redis library used by a dozen teams, and the cloud API gateway's own quotas.

As the senior technical leader, how do you decide what the company standardises on, and whether to build or buy?

Start by separating the three purposes the four implementations serve: protecting services from overload, which should be local, fast and approximate; enforcing customer plans and quotas, which should be global, accurate and tied to billing; and fairness between internal callers. For customer limits, compare the managed gateway's quotas with a shared Redis-based service on accuracy, latency, multi-region behaviour, observability, cost per million checks and how plans change, and build only what bought products cannot do, with an owning team, a client library, standard headers and documented failure behaviour. Then migrate deliberately, riskiest homegrown limiters first, with product and support involved.

Why this question is asked

Four rate limiters is a sign that each team solved its own problem well enough and nobody owned the whole. A senior leader's job here is not to pick the best tool on paper but to work out which problems the company actually has and give each one a clear owner. Interviewers ask this to see how we make build-or-buy decisions with evidence and bring teams along. In this answer, we will separate the purposes, compare the options for customer-facing limits, decide what to keep in-house, and plan the migration, with an example of how the decision plays out.

1Separate the Purposes First

The four implementations look like duplicates, but they mostly answer different questions. Resilience4j limits inside services protect a service from being overwhelmed; they need to be local, fast and can be approximate, because their job is to shed load in milliseconds. The cloud gateway's quotas and the gateway's Redis Lua limiter enforce what customers paid for; that needs to be global across instances, accurate enough to bill on, and connected to the plan catalogue. The homegrown library is probably being used for both, plus fairness between internal callers, such as one batch job not starving the others.

One tool rarely fits all three well. Trying to standardise on one usually produces either a slow global check inside every service or an inaccurate local count used for billing. So the standard we set has a part per purpose.

Three purposes, three shapes
PurposeNeedsNatural home
Overload protectionLocal, sub-ms, approximateIn-process (Resilience4j or similar)
Customer plans and quotasGlobal, accurate, billableGateway quotas or a shared service
Internal fairnessGlobal, per caller, tolerantShared service or mesh policy

2Comparing Buy and Build for Customer Limits

For customer-facing limits, the real choice is between the managed gateway's quotas and a shared in-house service on Redis. We compare them on criteria that matter to the business, using numbers from a short proof of concept rather than opinions. Accuracy: can it enforce the plan's wording, such as 1,000 per minute and 100,000 per month? Latency: what does a check add at p99? Multi-region behaviour: are limits global or per region, and what happens when regions disconnect? Observability: can support see why a customer was limited? Cost per million checks at our volume, including people to run it. And how plans change: can product launch a new tier without a deployment?

A typical outcome is that the managed gateway handles simple per-key rate and monthly quotas well and cheaply, while a few needs, such as limits by tenant and endpoint group, cost-weighted requests or burst rules tied to contract terms, are beyond it.

3Keep In-House Only What Bought Products Cannot Do

Whatever we keep in-house becomes a product with an owner. That means one owning team, a client library for Java services so nobody calls Redis scripts directly, standard response headers for limit, remaining and retry-after so clients behave consistently, documented failure behaviour (fail open with a local fallback for most limits, fail closed for a named few), and dashboards and alerts.

The homegrown library used by a dozen teams is the usual casualty. It probably works, but nobody owns it, its failure behaviour differs by version, and each team configured it differently. It either becomes the basis of the owned service or is retired in favour of it.

Step throughDeciding where a limit lives
  1. Is it overload protection inside a service?
    YesLocal limiter in the serviceNoContinue
  2. Can gateway quotas express it?Accuracy, regions, plan changes
    YesUse the gatewayNoUse the shared service
  3. Documented failure mode and headers?
    YesShip itNoAdd before launch

3 steps in order. Play them, or step through them one at a time.

4Migrating Deliberately

We start with an inventory: every limiter, where it runs, what it protects, its values, who owns it and how it fails. That inventory alone usually finds surprises, such as a limit that fails closed by accident or one that nobody remembers setting.

Then we migrate the riskiest first, which are typically the homegrown ones with undefined failure behaviour on critical paths. Each move runs in shadow mode first: the new limiter decides, the old one enforces, and we compare decisions for a week. Throughout, services keep their local overload protection regardless of the global choice, because a global limiter cannot protect a service from a traffic spike that arrives faster than it can react.

5Bring Product and Support Along

Limit values and error responses are part of the customer contract. Product decides what each tier includes, support explains 429 responses to customers, and sales negotiates exceptions. So they are part of the decision: product owns the plan catalogue that drives limits, support gets a tool to see a customer's current usage and recent rejections, and changes to limits or error formats go through the same review as any other API change.

6Follow-up questions

How would you tell whether limits are set at the right values?

Look at the data. For each tier, plot the distribution of customers' peak usage against their limit: if most customers never use a fifth of it, the limit protects nothing; if many sit at the limit and support tickets about 429 responses are rising, it is too tight or the plan is wrong. Compare limits with the actual capacity of the services behind them, so the sum of plausible concurrent usage does not exceed what the system can serve. And watch who gets limited: a few abusive keys is healthy, many good customers is a product problem.

What if the managed gateway is good enough for everything today?

Then buy it and keep nothing global in-house, while keeping local overload protection in services. Building a shared limiter is justified only by needs the product cannot meet, and revisiting that each year is cheaper than running one prematurely.

How do you handle teams attached to their own implementation?

Start from the problems their limiter solves and show that the standard solves them too, run their traffic in shadow mode so they see the comparison, and give them a migration path with support from the owning team. Mandates without that tend to produce a fifth implementation.

7Conclusion

In this answer, we saw that standardising rate limiting starts with separating overload protection, customer plans and internal fairness, because one tool rarely fits all three. For customer limits we compare gateway quotas with a shared Redis service on accuracy, latency, multi-region behaviour, observability, cost and plan changes, and keep in-house only what cannot be bought, as an owned product with a library, standard headers and documented failure behaviour. We migrate from an inventory, riskiest first and in shadow mode, keep local overload protection everywhere, and involve product and support because limits are part of the customer contract.

What to say in the interviewAbout 80 seconds aloud

Open with

I would start by separating what the four implementations are for, because they are not really duplicates. Protecting a service from overload has to be local, fast and can be approximate, so Resilience4j-style limits inside services stay.

Then, if they want more

Enforcing customer plans and quotas has to be global, accurate and tied to billing. And fairness between internal callers is a third need. One tool rarely fits all three.

For customer limits, I would compare the managed gateway's quotas with a shared in-house service on Redis, using a short proof of concept: accuracy against how plans are worded, added latency, behaviour across regions, observability for support, cost per million checks including people, and how easily product can change plans.

I would keep in-house only what the bought product cannot do, and if we keep something, it gets an owning team, a client library, standard limit, remaining and retry-after headers, and documented failure behaviour.

Then I would migrate deliberately: inventory all limiters, move the riskiest homegrown ones first, run new limiters in shadow mode before enforcing, and keep local overload protection in every service. And I would involve product and support from the start, because limit values and error responses are part of the customer contract.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Redis documentation
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "As the senior technical leader, how do you decide what the company standardises on, and...": https://scrivio-interview-library.netlify.app/databases/redis-patterns/3c37a4bdad/