Scrivio Interview library
LeadershipPrincipal6 min read · updated 13 November 2026

Your public API is moving reads to replicas in five regions to cut latency. Partners integrate by writing a resource and immediately reading it back, and some already report stale reads in the pilot.

As the senior technical leader, would you expose consistency to API clients, for example through consistency tokens, or hide it inside the platform? What do you commit to, and why?

I would do both, in layers: a safe default that hides consistency for the common case, read-your-writes per API key for a short window after each write, plus an optional consistency token or request option for clients that need precise or stronger reads. Hiding it entirely costs latency and primary capacity on every write-then-read; exposing it alone pushes a permanent, easy-to-misuse contract onto every partner. I would commit to a small, documented guarantee per endpoint, test it with injected lag, monitor stale reads, and implement it in one shared component so it survives future regions, caches and storage changes.

Why this question is asked

Moving reads to regional replicas is one of the most effective ways to cut API latency, and it quietly changes the contract partners have relied on for years: write, then read back. Once partners see stale reads, the platform must decide whether consistency is the platform's problem or the client's. Interviewers ask this leadership question because the answer is a long-lived public commitment, and it shows whether we can weigh partner experience, cost and future change. In this answer, we will look at what hiding and exposing each mean in practice, the mixed approach most large APIs settle on, what exactly to promise, and how to keep the promise as the platform evolves.

1What Partners Are Really Relying On

Partners write a resource and immediately read it back, often to confirm it or to get server-generated fields. With one database, the read always saw the write. With replicas in five regions, the read may go to a replica that has not yet received the write, typically tens to hundreds of milliseconds behind, and the partner sees an old version or a 404. That is a violation of read-your-writes, the guarantee that a client sees its own writes.

Notice that partners did not ask for strong consistency in general; most do not care whether they see other partners' changes a second late. They care about their own writes. That narrows the problem considerably.

2Option 1: Hide It Inside the Platform

Hiding consistency means the platform guarantees read-your-writes without any help from clients. After a client writes, the platform remembers that, keyed by API key, and for a window, say ten seconds, routes that client's reads either to the primary region or to a replica known to have caught up past the write.

For partners, this is ideal: nothing changes, and the pilot's complaints disappear. The costs land on the platform. Reads during the window lose the latency benefit of the local replica, which for a partner that writes constantly may be most of its reads. The primary or the routing layer must absorb that traffic. And the platform must track recent writes per API key across regions, which is itself a small distributed system. The window is also a guess: if replicas lag more than ten seconds, the guarantee breaks quietly.

3Option 2: Expose It With Consistency Tokens

Exposing consistency means each write response returns a token, an opaque value encoding the write's version or log position, and reads accept it. The server then serves the read from a replica that has reached that position, waits briefly for one, or falls back to the primary.

Java
POST /v2/shipments -> 201 Created
Consistency-Token: eyJyIjoidXMtZWFzdCIsImxzbiI6IjVDLzFBMkIzQzQwIn0
GET /v2/shipments/sh_881
Consistency-Token: eyJyIjoidXMtZWFzdCIsImxzbiI6IjVDLzFBMkIzQzQwIn0
-> 200 OK, from a replica at or past the token's position
GET /v2/shipments/sh_881 -> 200 OK, from the nearest replica, possibly stale

This is precise and cheap: only reads that need freshness pay for it, and only as much as needed. But it is a permanent part of the public contract. Every partner must store and pass tokens correctly, across their own retries, queues and services, and partners who ignore them get stale reads and file bugs. Once published, the token format and semantics must keep working for as long as the API version lives.

4The Mixed Approach and What I Would Commit To

Most mature APIs combine both. The default is hidden: read-your-writes per API key for a short window after its writes, which covers the common write-then-read pattern without partners changing anything. On top, an optional token, or a simple request option such as consistency=strong, lets partners that need precise or stronger reads ask for them, and pay for them in latency.

Then I would write down the guarantee per endpoint, in numbers: strongly consistent for a few critical reads such as payment status, read-your-writes for resources the client created, and bounded staleness, for example at most five seconds, for list and search endpoints. A promise with a number can be tested and monitored; a vague promise becomes an argument in every support ticket.

Step throughChoosing what to promise per endpoint
  1. Must every read see every write?
    YesStrong: read from primary or with tokenNoNext question
  2. Do clients read back their own writes?
    YesRead-your-writes by default, token optionalNoNext question
  3. Bounded stalenessstate the number, e.g. at most 5 s
  4. Document the guarantee per endpointin the API reference and changelog
  5. Test with injected lagreplicas delayed by 2 s in a test environment
  6. Monitor stale-read reports and lagalert before the promise breaks

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

5Keeping the Promise for Years

Whatever we promise must survive changes we cannot foresee: a sixth and seventh region, a cache in front of the replicas, a move to a different database. That argues for keeping the promise small, read-your-writes and stated staleness bounds rather than broad strong consistency, and for implementing it in one shared component, a read-routing layer that every endpoint uses, rather than in each service. Then adding a cache means teaching one component how to respect tokens and recent writes, not auditing fifty endpoints.

Finally, I would make the guarantee testable for partners as well: a sandbox where replica lag can be injected, so partners can see what bounded staleness looks like before it happens in production, and a status signal that tells them when the platform is degraded, for example when it has fallen back to the primary.

6Follow-up questions

Why not just route every read to the primary region?

That removes the problem and the benefit: the whole point of regional replicas is lower latency for partners far from the primary. Routing only reads that need freshness keeps most of the gain.

How long should the read-your-writes window be?

Longer than the replicas' lag in bad conditions, say the 99.9th percentile under load, plus a margin, and monitored: if lag exceeds the window, the guarantee breaks, so an alert should fire before that happens.

What do you tell partners in the pilot today?

Acknowledge the regression, give them the option to request strongly consistent reads immediately, and ship the default read-your-writes window before expanding the rollout, so no partner has to change code to get the behaviour they had.

7Conclusion

In this answer, we saw that partners mainly rely on read-your-writes. Hiding consistency gives them that without changes but costs latency, primary capacity and a fragile window; exposing tokens is precise and cheap but becomes a permanent contract partners must use correctly. The mix most platforms choose is a safe default plus optional tokens or strong-read options, with the guarantee documented per endpoint in numbers, tested with injected lag, monitored, and implemented in one shared routing component so it survives new regions, caches and storage.

What to say in the interviewAbout 90 seconds aloud

Open with

I would not pick one extreme. What partners rely on is read-your-writes: they write and immediately read their own resource. If I hide consistency entirely, the platform has to route a client's reads to the primary or to a caught-up replica for a window after each write.

Then, if they want more

That is easy for partners, but it costs latency and primary capacity and depends on a window that breaks if lag grows.

If I only expose it, every write returns a consistency token and reads accept it, which is precise and cheap, but it is a permanent contract every partner has to implement correctly, and those who do not will keep seeing stale data. So I would commit to a layered design.

The default is read-your-writes per API key for a short window, so nobody has to change code. On top, an optional token or a consistency=strong option for partners that need precise or stronger reads, who accept the latency.

Then I would document the guarantee per endpoint with numbers: strong for a few critical reads, read-your-writes for created resources, and bounded staleness, say five seconds, for lists and search. We test it by injecting replica lag, monitor lag and stale-read reports, and alert before the window is exceeded.

Most important, I keep the promise small and implement it in one shared read-routing component, because it has to survive more regions, caches and storage changes over many years.

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 "As the senior technical leader, would you expose consistency to API clients, for example...": https://scrivio-interview-library.netlify.app/architecture/partitioning-and-replication/430ed623f6/