Quick revision
The short answer
First recover: make both client versions compute the same ring, by pinning the old placement algorithm through configuration (for example a ketama-compatible mode) or by rolling back, and then flush or version the keys written to the wrong servers so stale prices disappear. The root cause is organisational: placement was an implicit contract copied into 300 services through a library, with no owner and no compatibility test. The standard I would set is either a routing tier that owns placement or a single supported client whose ring definition is versioned configuration checked against fixed test vectors on every release, with placement changes treated as migrations.
What to remember
In this answer, we saw that a library upgrade changed the hash and virtual node naming, so half the fleet placed keys on different servers, which cut the hit ratio and served stale prices. Recovery pins both versions to the same ring through a compatibility mode or a rollback, then removes stale entries by versioning or flushing keys. The root cause is an unowned, untested placement contract. The standard is either a routing tier that owns placement or one supported client whose ring is versioned configuration verified by test vectors, with placement changes run as migrations, a clear owning team and per-service hit ratio dashboards.
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.
First recover: make both client versions compute the same ring, by pinning the old placement algorithm through configuration (for example a ketama-compatible mode) or by rolling back, and then flush or version the keys written to the wrong servers so stale prices disappear. The root cause is organisational: placement was an implicit contract copied into 300 services through a library, with no owner and no compatibility test. The standard I would set is either a routing tier that owns placement or a single supported client whose ring definition is versioned configuration checked against fixed test vectors on every release, with placement changes treated as migrations.
Why this question is asked
Client-side sharding is fast and simple: every service computes which cache node holds a key and talks to it directly. The hidden cost is that every service must compute exactly the same answer, forever. This incident shows what happens when a library upgrade quietly changes that answer for half the fleet. Interviewers ask this leadership scenario because it starts as an outage and ends as a question about contracts and ownership. In this answer, we will understand the failure, recover in the right order, name the real root cause, compare the two standards we could set, and describe how future changes should be rolled out.
1What Actually Broke
A client-side sharded cache works like this: the client library builds a ring of cache servers, hashes each key onto it, and sends the request to the owning server. The ring depends on details: the hash function, how virtual node names are formed (for example "10.0.0.5:11211-0" versus "cache-a#0"), how many points each server gets and the server list order.
The new library version changed some of those details, so for many keys it picks a different server than the old version. Now half the services write a key to server A while the other half read it from server B. Each half misses on keys the other half wrote, which is why the hit ratio fell from 94 to 60 percent, and the database behind the cache took the extra load. Worse, a price updated by an old-version service is written to A and invalidated on A, while a new-version service keeps reading an older copy it cached on B. That is how stale prices appeared.
| Step | Old client (150 services) | New client (150 services) |
|---|---|---|
| Hash and ring for price:123 | server A | server B |
| Price updated, cache invalidated | deletes price:123 on A | nothing deleted on B |
| Next read of price:123 | miss, loads the new price | hit on B: the old price |
| Effect | extra database load | stale data served |
2Recovering in the Right Order
Recovery has two goals in a fixed order: stop the divergence, then remove the damage. To stop the divergence, all services must compute the same ring again. Many client libraries offer a compatibility setting, such as ketama-compatible hashing or an explicit choice of hash function and node naming. If the new version can be configured to reproduce the old ring exactly, we push that configuration to the upgraded services, which avoids a mass rollback. If it cannot, we roll back the upgraded services to the old version. We confirm with a quick test: for a sample of keys, both versions must name the same server.
Then we remove the stale entries. Keys written while the rings diverged may sit on the wrong server with old values. The safest tool is a key namespace version: if keys are built as v7:price:123, bumping to v8 makes every service ignore everything written before, at the cost of a cold cache for a while, so we warm up gradually or do it per key family. Flushing the cache servers also works but sends a burst of load to the database at once. For prices specifically, we could also reduce the TTL temporarily so stale values expire quickly.
3The Root Cause Is Not the Library
It is tempting to blame the library maintainers, but changing a hash function is a legitimate improvement in isolation. The real cause is that the placement algorithm was an implicit contract shared by 300 services, and nobody treated it as one. It lived inside a library that each team upgraded on its own schedule, there was no test that checked placement compatibility between versions, and no team owned the cache platform end to end. A senior leader's job here is to fix that structure, so the next change, which will come, is safe.
4Option One: A Routing Tier Owns Placement
In the first option, services stop computing placement. They talk to a routing tier, a proxy such as twemproxy-style proxies, mcrouter or Envoy's Redis proxy, run either as a shared fleet or as a sidecar beside each service. The proxy holds the ring, and changing placement happens in one place, rolled out once, by the owning team. Clients become simple and language-independent.
The cost is an extra network hop on every cache call, unless the proxy is a local sidecar, a component that must be run with high availability because every cache call depends on it, and some features of the native client that the proxy may not support. For a cache whose point is microsecond-level latency, that hop matters, so we measure it.
5Option Two: One Supported Client With a Versioned Ring
In the second option, services keep talking to cache servers directly, but there is exactly one supported client per language, and the ring definition is no longer code inside it. The algorithm name, hash function, node naming scheme, node list and weights become versioned configuration, served centrally, so every service uses ring version 7 until the platform team publishes version 8. A conformance test runs in every client release: a fixed file of test vectors, thousands of keys with their expected server under ring version 7, must match exactly in every language. A library change that moves even one key fails the build.
| Routing tier | One client + versioned ring | |
|---|---|---|
| Where placement lives | the proxy, one place | versioned config read by clients |
| Latency | extra hop (small if sidecar) | direct |
| Failure modes | proxy outage affects all calls | a non-conforming client |
| Multi-language support | free | one client per language, same vectors |
| Changing the ring | proxy rollout | publish new version, migrate |
This keeps the direct path's latency and spreads no extra infrastructure, but it relies on discipline: every language's client must pass the same vectors, and services must not pin old library versions forever. Whichever option we choose, any change to placement is treated as a migration: run the old and new rings side by side with dual reads or a warm-up period, compare hit ratios, then switch.
6Making It Stick
Finally, the organisation needs an owner and feedback. The cache platform gets a clear owning team, responsible for the client or the proxy, the ring configuration and its migrations. Hit ratio per service and per key family is published on a shared dashboard, with an alert on sudden drops, which would have caught this incident within minutes of the first upgraded deploy. And library upgrades that touch placement go through the platform team's change process rather than each team's routine dependency bumps.
7Follow-up questions
How do the latency and failure modes of a proxy tier compare with a smart client?
A shared proxy fleet adds a network hop, typically a fraction of a millisecond within a data centre, and becomes a shared dependency whose outage or overload affects every service, so it needs its own capacity planning and redundancy. A sidecar proxy cuts the hop to localhost but adds a process per pod. A smart client has the lowest latency and no shared component, but its failure mode is subtle: a misbehaving or outdated client silently places keys wrongly, as in this incident, rather than failing loudly.
Why not just require every team to upgrade together?
Because 300 services cannot deploy atomically; there will always be a window with both versions, and some services deploy rarely. The ring must be compatible across that window, which is why it has to be versioned and tested rather than coordinated by calendar.
How would you have detected this before production?
A placement conformance test with fixed vectors in the library's own CI would have failed on the change, and a canary rollout of the library to a few services with hit ratio monitoring would have shown the drop within minutes.
8Conclusion
In this answer, we saw that a library upgrade changed the hash and virtual node naming, so half the fleet placed keys on different servers, which cut the hit ratio and served stale prices. Recovery pins both versions to the same ring through a compatibility mode or a rollback, then removes stale entries by versioning or flushing keys. The root cause is an unowned, untested placement contract. The standard is either a routing tier that owns placement or one supported client whose ring is versioned configuration verified by test vectors, with placement changes run as migrations, a clear owning team and per-service hit ratio dashboards.
Open with
First I would stop the bleeding. Both halves of the fleet must compute the same ring again, so either I push configuration that makes the new client reproduce the old placement, most libraries have a ketama-compatible or explicit hash setting, or I roll the upgraded services back, and I verify with a sample of keys that both name the same server.
Then, if they want more
Then I clean up: keys written while the rings diverged can be stale, so I bump the key namespace version or flush gradually, warming up to protect the database. But the real root cause is organisational.
Placement was an implicit contract copied into 300 services through a library, with no owner and no compatibility test, so a legitimate library change broke it. For the future I would choose between two standards.
One is a routing tier, a proxy or sidecar that owns placement, so changes happen in one place, at the cost of a hop and a highly available component.
The other is a single supported client per language, where the ring, algorithm, hash, node list and weights, is versioned configuration, and every release must pass a conformance test of fixed key-to-node vectors.
Either way, a placement change is a migration with dual reads or warm-up, hit ratio per service is on a dashboard with alerts, and one team owns the cache platform.
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, how do you recover, and what standard do you set for how...": https://scrivio-interview-library.netlify.app/architecture/partitioning-and-replication/1bb737cb01/