Scrivio Interview library
DesignAdvanced6 min read · updated 12 November 2026

Your URL shortener is now used by marketing teams worldwide, and the business wants five-nines availability for redirects in all regions. How would you design multi-region operation?

Because redirects dominate, every region serves them from its own replicated copy of the link data and its own caches, with a CDN in front for the hottest links. Writes either go to one home region or, better, each region creates codes with its own region prefix so no two regions can produce the same code. Replication between regions is asynchronous, so a new link may take a few seconds to appear elsewhere, which we document and soften by forwarding local misses to the code's home region. Five nines then depends on regular, tested regional failover with runbooks.

Why this question is asked

Five nines, 99.999 percent availability, is a demanding target: it allows about 5 minutes and 15 seconds of downtime per year. No single region, however well run, reliably meets it, because whole regions occasionally have incidents that last longer than that. Interviewers ask this question to see whether we can decide which parts of the system really need that target, and how to get there without making every request depend on several regions at once. In this answer, we will translate the target into design rules, serve redirects from every region, choose how writes avoid conflicts, live with replication lag, add edge caching, and make failover a routine we practice rather than a hope.

1What Five Nines Means for a Redirect Service

Start with the arithmetic. A year has about 525,600 minutes, and 0.001 percent of that is about 5.3 minutes. A single bad deployment that takes ten minutes to roll back uses two years of budget. So the design must keep working when a region, a database or a deployment fails, without a human in the loop.

The second rule is to apply the target only where it is needed. The business wants redirects to work everywhere, because a broken link in a campaign email is lost revenue. Creating links can have a lower target, such as 99.9 percent, because a marketer who cannot create a link for a minute can retry. Separating the two lets us make redirects depend on as little as possible.

2Serving Redirects From Every Region

Each region runs the full redirect path: redirect service instances, a local cache layer, and a read replica of the link data. A global entry point, either latency-based DNS or an anycast load balancer, sends each user to the nearest healthy region. When a region fails its health checks, the entry point stops sending traffic there, and users are served by the next closest region.

Because every region holds all the link data, any region can serve any code. Data is small enough for that: even billions of links fit in a replicated key-value store in each region. Every region must also have spare capacity to absorb a failed neighbour's traffic, so we plan each region at peak load plus the largest share it could inherit.

Step throughRedirect path in each region
  1. Global entry pointlatency-based DNS or anycast, health-checked
  2. CDN edgecaches the hottest redirects for a short time
  3. Regional redirect serviceSpring Boot instances with a local Caffeine cache
  4. Regional Redisshared cache for the region
  5. Regional replica of link datafull copy, replicated asynchronously

5 layers, from the top down. Step through them one at a time.

Nothing on this path calls another region in normal operation.

3Where Writes Go: Home Region or Region-Prefixed Codes

Writes need care because two regions must never assign the same code to different URLs. There are two common approaches.

With a home region, all writes go to one region, which owns the primary copy and replicates to the others. It is simple and conflict-free, but link creation fails when the home region is down, and users far away pay extra latency. With region-prefixed codes, each region generates codes in its own part of the code space, for example a first character that names the region, or a disjoint id range per region. Every region can then create links independently, with no coordination and no possible collision. The prefix costs one character of code length and gives us something useful: from any code, we know which region created it.

Choosing a write strategy
ApproachConflictsWhen a region fails
Single home regionnone, one writercreation stops until failover
Region-prefixed codesnone, disjoint code spacesother regions keep creating
Custom aliasespossible, so coordinatedslower path, rare traffic

Custom aliases are the exception. An alias is chosen by the user, so it has no region prefix, and two regions could accept the same alias at the same moment. We route alias creation to a single region, or use a store with a globally consistent conditional write for the alias table only. Aliases are rare, so their slightly slower, coordinated path does not matter.

4Living With Asynchronous Replication

Replication between regions is asynchronous: a region commits a new link locally and ships it to other regions afterwards, usually within a second or two. Synchronous replication would make every write wait for the slowest region and fail when any region is unreachable, which is the opposite of what we want.

The cost is a short visibility gap. A marketer in Frankfurt creates a link and a colleague in Singapore clicks it two hundred milliseconds later; Singapore may not have it yet. We handle this in two ways. First, we document it: new links are globally visible within seconds. Second, a region that does not find a code checks the code's prefix, and if the code was created elsewhere and is very recent or simply unknown, it asks the creating region directly before returning 404. That fallback rarely runs and closes most of the gap.

Java
Link link = localStore.find(code);
if (link == null && !regionOf(code).equals(myRegion)) {
link = remoteRegion(regionOf(code)).find(code); // rare: only for very new links
}
return link; // null: a real 404

5Edge Caching for the Hottest Links

A campaign link can get millions of clicks in minutes, all for the same code. Serving those from a CDN edge takes the load off our regions completely and also keeps working if a region is degraded. We return the redirect with Cache-Control: public, max-age=60, so edges cache it for a minute and then ask again. A short time keeps analytics reasonably accurate, since the CDN's logs can supply counts for cached hits, and lets us disable abusive links quickly, with an explicit purge for urgent cases.

6Practicing Failover and Keeping Runbooks

Failover that has never been tested usually fails when it is needed. We run regular exercises, for example monthly, where we drain one region in production during normal hours and watch the others take over: health checks flip, the entry point moves traffic, caches warm up and latency stays within target. Each exercise produces findings, and those findings are fixed.

Runbooks describe the manual steps for the cases automation does not cover: promoting a new primary for alias writes, pausing replication when a region has bad data, or rolling back a release region by region. Releases themselves go one region at a time with automatic rollback, because deployments are the most common cause of outages.

7Follow-up questions

Why not use synchronous replication so every region always has every link?

Because a write would then wait for the farthest region and fail whenever any region is unreachable. That costs latency and availability on writes to remove a gap of a second or two, which the fallback lookup already mostly hides.

Does five nines apply to link creation too?

Usually not. Creation is lower volume and retryable, so a target like 99.9 percent is reasonable and much cheaper. Making that explicit lets the redirect path avoid any dependency on the write path.

How do you measure availability across regions?

From the user's point of view: synthetic probes in many locations that click real test links through the global entry point, plus the success rate of real redirects. Regional server metrics alone miss failures in DNS or the CDN.

8Conclusion

In this answer, we turned five nines into about five minutes a year, applied it to redirects rather than creation, served redirects in every region from replicated data and local caches, avoided write conflicts with region-prefixed codes and a coordinated path for aliases, accepted and documented a few seconds of replication lag with a fallback to the creating region, put a CDN in front of the hottest links, and made regional failover something we exercise regularly.

What to say in the interviewAbout 80 seconds aloud

Open with

Five nines is about five minutes of downtime a year, so redirects must survive the loss of a whole region without humans. I would apply that target to redirects only, and give link creation a lower one.

Then, if they want more

Every region runs the full redirect path: service instances with a local cache, a regional Redis and a full replica of the link data, behind latency-based DNS or anycast that moves traffic away from unhealthy regions. Each region keeps headroom to absorb a neighbour's traffic.

For writes, I would use region-prefixed codes, so each region generates codes in its own code space and can create links independently with no collisions; custom aliases, which have no prefix, go through one coordinated path because they are rare.

Replication between regions is asynchronous, so a new link may take a second or two to appear elsewhere; I would document that, and when a region misses a code created elsewhere it asks the creating region before returning 404. The hottest links get cached at the CDN for about a minute.

And I would test failover regularly by draining a region in production, keep runbooks for the manual cases, and roll out releases region by region.

About this answer

Last updated
12 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 "Your URL shortener is now used by marketing teams worldwide, and the business wants...": https://scrivio-interview-library.netlify.app/architecture/backend-system-design/799eedc228/