Quick revision
The short answer
A shared gateway is a shared blast radius: any change to it is a change to every API, so it must be released like core platform software. Split it into separate deployments per domain or criticality tier, or into cells that each serve a share of traffic, roll out configuration and plugins progressively with CI validation, canaries and automatic rollback, constrain custom code with reviews, safe regular expression engines and per-request CPU limits, and keep a fast rollback path, per-route kill switches and saturation alerts on the gateway itself.
What to remember
In this answer, we saw that a shared gateway turns any change into a change for every API, and that a backtracking regular expression on few shared workers can stall all of them. The fixes are to treat gateway changes as platform releases, split the gateway by domain, tier or cell, roll out progressively with CI performance tests, canaries and automatic rollback, constrain custom code with reviews, linear-time regex engines and per-request limits, and keep fast rollback, kill switches and gateway saturation alerts.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
A shared gateway is a shared blast radius: any change to it is a change to every API, so it must be released like core platform software. Split it into separate deployments per domain or criticality tier, or into cells that each serve a share of traffic, roll out configuration and plugins progressively with CI validation, canaries and automatic rollback, constrain custom code with reviews, safe regular expression engines and per-request CPU limits, and keep a fast rollback path, per-route kill switches and saturation alerts on the gateway itself.
Why this question is asked
When 200 services share one gateway, the gateway is the most important piece of software in the company, whether anyone treats it that way or not. One team's regular expression proved it. Interviewers ask this to see whether we can design for blast radius, the share of the system a single failure can affect, both in architecture and in the change process. In this answer, we will see what happened, split the gateway so failures stay small, make rollouts progressive, constrain custom code, and add rollback and alerts.
1What Happened: One Plugin, Every API
Gateways run on a small number of event-loop or worker threads, which is how they serve huge traffic with little hardware. That design has a weakness: anything that burns CPU inside the request path blocks the threads that every other request needs. The team's plugin used a regular expression with catastrophic backtracking, a pattern where the engine tries an exponential number of ways to match certain inputs before failing. On some request paths, one match took hundreds of milliseconds of CPU.
Because the gateway cluster is shared, every instance ran the plugin, every instance's CPU hit its limit, and every API in the company, whatever its path, waited behind those requests. A change meant for one team's routes became a company-wide outage for 35 minutes.
The Java snippet shows the same class of problem in the JDK's backtracking engine, which is why it is easy to miss in testing: typical inputs match instantly, and only an unusual input explodes.
2Treat the Gateway as Core Platform Software
The first change is a mindset. A route edit or a plugin for one API is, in practice, a release of software that every API runs on. So it gets the same care as a core platform release: code review by the gateway owners, automated tests including performance tests, and progressive rollout. This is not bureaucracy for its own sake; it follows directly from the blast radius.
3Split the Gateway So Failures Stay Small
The structural fix is to stop having one gateway for everything. There are two common ways to split. By domain or criticality: a separate gateway deployment for payments and checkout, another for internal tools, another for partner APIs, so a change for internal tools cannot touch checkout. By cells: several identical gateway deployments, each serving a fixed share of customers or traffic, so a bad change rolled to cell 1 hurts at most a tenth of traffic.
The two combine well, with tiers for criticality and cells within the busy tiers. The cost is more deployments to operate, which is manageable when they are defined from the same code and configuration pipeline.
| Design | Blast radius of a bad change | Cost |
|---|---|---|
| One shared cluster | every API | lowest operating cost |
| Per domain or tier | the APIs of one domain or tier | more deployments, routing by host |
| Cells | the share of traffic in one cell | identical copies, a thin router in front |
| Tiers plus cells | one cell of one tier | most to run, smallest failures |
4Roll Out Configuration and Plugins Progressively
Every gateway change, configuration or code, goes through the same pipeline. CI validates it: syntax, policy checks, and a performance test that runs the new plugin against a corpus of real request paths, including long and odd ones, with a CPU budget per request. Then the change goes to a canary, one instance or one small cell taking a few percent of traffic. Automated analysis compares the canary's error rate, latency and CPU with the rest for a few minutes; if they hold, the change expands in steps, and if they degrade, it rolls back automatically, without waiting for a human.
- Change submittedroute, plugin or config
- CI: syntax, policy, perf test on real pathsCPU budget per request
- Canary: 1 instance or cell, 2 percentwatch errors, latency, CPU
- Canary worse than baseline?YesRoll back automaticallyNoExpand to 25, 50, 100 percent
- Done, with kill switch keptper route
5 steps in order. Play them, or step through them one at a time.
Each step limits how much traffic a bad change can reach.
In this incident, a canary with a CPU comparison would have caught the problem within minutes on a few percent of traffic, and automatic rollback would have ended it before most people noticed.
5Constrain Custom Code and Keep a Fast Way Back
Custom plugins are where most of the risk lives, so we narrow what they can do. Prefer declarative configuration, routes, header rules and limits, over code. Review plugins with the gateway team. Use regular expression engines that guarantee linear time, such as RE2, which Envoy uses for its safe_regex matcher, so catastrophic backtracking is impossible by construction. Set CPU and time limits per request where the gateway supports them, so one slow plugin execution is cut off instead of starving the worker.
Finally, the way back must be fast. A one-command rollback to the previous configuration, tested regularly, and per-route kill switches that disable a plugin or a route without a full release. Alerts must watch the gateway's own saturation, CPU, event loop lag and queueing, separately from service errors, so the on-call engineer sees immediately that the gateway, not 200 services, is the problem.
6Follow-up questions
How would you decide which APIs share a gateway deployment?
Group APIs by criticality and by who changes them. APIs with the same availability target and similar traffic, such as checkout and payments, can share a high-tier deployment with strict change control; internal tools and experimental APIs, which change often, share a lower tier with faster rollouts. Partner APIs with their own authentication and limits often get their own. Within a busy tier, cells by customer or traffic share bound the blast radius further. The goal is that the APIs which change most often are not in the same failure domain as the APIs that matter most.
Why did a CPU problem in one path affect all paths?
Because gateways process many requests on a few shared worker threads. A request stuck in an expensive regular expression occupies a worker, and other requests queued on that worker wait, whatever their path. With enough slow requests, every worker is busy and everything waits.
7Conclusion
In this answer, we saw that a shared gateway turns any change into a change for every API, and that a backtracking regular expression on few shared workers can stall all of them. The fixes are to treat gateway changes as platform releases, split the gateway by domain, tier or cell, roll out progressively with CI performance tests, canaries and automatic rollback, constrain custom code with reviews, linear-time regex engines and per-request limits, and keep fast rollback, kill switches and gateway saturation alerts.
Open with
The underlying problem is that one shared gateway is a shared blast radius: a plugin change for one team is really a release for all 200 services. Gateways run requests on a few worker threads, so a regular expression with catastrophic backtracking burned the CPU on every instance and every API waited behind it.
Then, if they want more
I would change the design first. I would split the gateway into separate deployments per domain or criticality tier, for example checkout and payments apart from internal tools, and use cells inside the busy tiers, so a bad change reaches only a fraction of traffic.
Then the change process: every route or plugin change goes through CI with policy checks and a performance test on real request paths, then a canary on a few percent of traffic with automatic comparison of errors, latency and CPU, and automatic rollback if it degrades.
For custom code, I would prefer declarative configuration, review plugins with the gateway team, require a linear-time regex engine like RE2, which Envoy uses for safe_regex, and set per-request CPU or time limits.
Finally, I would keep a tested one-command rollback, per-route kill switches, and alerts on gateway CPU and event loop lag separate from service errors, so we see in seconds that the gateway itself is the problem.
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 official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
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 "How would you change the gateway's design and change process so one team's change cannot...": https://scrivio-interview-library.netlify.app/architecture/load-balancing-networking/caa4519578/