Scrivio Interview library
LeadershipPrincipal6 min read · updated 13 November 2026

The Redis cluster used for distributed locks by 30 services was unavailable for 50 minutes. Some services stopped processing entirely, while others ignored the failure, ran their jobs on every pod and sent duplicate invoices.

As the senior technical leader, what policy do you set for how services behave when their lock or coordination backend is down, and how do you roll it out?

I would require every lock to declare its purpose: an efficiency lock may fail open only if the work it protects is idempotent, and a correctness lock must fail closed (stop or queue) unless fencing or idempotency protects the data. Every externally visible side effect needs an idempotency key regardless of locking, services that fail closed treat the lock backend as a tier-1 dependency or move their locks into the database they already depend on, and a shared lock library enforces the choice, which we roll out by inventory and risk, prove in game days and keep in the design review checklist.

Why this question is asked

When a shared dependency fails, the interesting question is not why it failed but why 30 services behaved in 30 different ways. This incident had both extremes: some services stopped completely, and others ignored the failure and sent duplicate invoices. Interviewers ask senior leaders this to see whether they can turn an incident into a clear policy that teams can follow without a meeting every time. In this answer, we will look at what each behaviour cost, define the policy around the purpose of each lock, decide how to treat the backend, and then plan the shared library and the rollout.

1What the Two Failure Behaviours Cost

When Redis disappeared, every service had to make a choice it had never written down. Failing closed means that without the lock, the service does not do the work: it stops or queues it. Failing open means it carries on without the lock. The services that failed closed lost 50 minutes of processing; that hurt, but nothing was wrong afterwards, and backlogs drained. The services that failed open ran their jobs on every pod at once. Where the job was harmless to repeat, that cost some CPU. Where it was invoicing, customers received duplicate invoices, which costs money, support time and trust.

So neither behaviour is right in general. The right behaviour depends on what the lock protects, and the incident exposed that nobody had decided.

2The Core Rule: Classify Every Lock

The policy starts by making each lock's purpose explicit. An efficiency lock only avoids duplicate work, and a correctness lock protects data from damage. That classification then dictates the failure behaviour.

Step throughChoosing behaviour when the lock backend is down
  1. Would two holders damage data?
    YesCorrectness lockNoEfficiency lock
  2. Efficiency: is the work idempotent?
    YesMay fail open (run without the lock)NoFail closed until made idempotent
  3. Correctness: fencing or idempotency in place?
    YesMay continue, protected by the resourceNoFail closed: stop or queue
  4. Record the choice in configurationreviewed with the service design

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

Failing open is allowed only when repeating the work cannot hurt anyone.

Notice that the invoice incident breaks the rule twice: invoicing is a correctness concern, and the work was not idempotent, so failing open was never acceptable. That leads to the second rule, which applies whatever the locking: every externally visible side effect, such as an invoice, an email, a payment or a partner API call, must carry an idempotency key derived from the business event, for example invoice:customer-123:2026-10. If two pods try to send the same invoice, the second attempt is recognised and dropped by a unique constraint or by the provider. Locks then become an optimisation, not the only thing standing between us and duplicates.

3Treating the Lock Backend as a Real Dependency

Services that fail closed now depend on the lock backend for their availability. That makes the backend a tier-1 dependency for them, and it must be run like one: replicated across zones, monitored, with an availability target the dependent services can design around, and on-call ownership by a platform team. A Redis cluster that 30 services rely on and nobody owns is how a 50-minute outage happens.

There is often a better option. Many of these services already depend on a strongly consistent database for their own data. A lock or lease stored in that database (a row with a token, or PostgreSQL advisory locks) fails exactly when the service's data is unavailable anyway, so it adds no new failure mode. For correctness locks in particular, moving the lock next to the data also makes fencing natural. Redis remains a good choice for efficiency locks, where a lost lock is harmless.

4A Shared Library That Forces the Choice

Policies that live only in a wiki are forgotten. The platform team provides a small lock library that every service uses, and its API makes the decision impossible to skip.

YAML
# application.yaml of the invoicing service
platform:
locks:
monthly-invoices:
purpose: correctness # efficiency | correctness (required, no default)
on-backend-failure: fail-closed
backend: postgres # the service's own database
lease: 5m
refresh-exchange-rates:
purpose: efficiency
on-backend-failure: fail-open # allowed: the job overwrites the same rates
backend: redis
lease: 2m

The library refuses to start if a lock has no declared purpose, and it refuses fail-open on a correctness lock. It also emits metrics for acquisitions, contention and backend failures, labelled by lock name, so during the next incident we can see at a glance which services are blocked and which are proceeding. And we exercise it: in regular game days we remove the lock backend in a staging environment and check that every service does what its configuration says.

5Rolling the Policy Out

We roll out in the order of risk. First an inventory: search code and configuration for every lock, classify each one, and record what it does when the backend is down today. Services that fail open on non-idempotent work, like invoicing, are fixed first, usually by adding idempotency keys, which also protects them against retries and replays. Next come correctness locks without fencing. Efficiency locks that already behave sensibly are migrated to the library over time.

Finally, lock behaviour becomes a standard item in the design review checklist: which locks does this service take, what purpose does each serve, and what happens when the backend fails. Within a quarter or two, the next Redis outage should produce predictable behaviour: efficiency jobs carrying on or pausing harmlessly, and correctness work stopping or queueing without a single duplicate.

Rollout plan
PhaseScopeDone when
1. Inventoryall 30 servicesevery lock classified with owner
2. Highest riskfail-open on non-idempotent workidempotency keys in place
3. Correctness lockslocks without fencingfencing, idempotency or fail-closed
4. Library adoptionremaining locksall locks declared in config
5. Prove itgame day without lock backendbehaviour matches config

6Follow-up questions

Isn't failing closed just trading duplicates for downtime?

For correctness work, yes, and that is usually the right trade: a delayed invoice run can catch up, while duplicate invoices need cleanup and apologies. The goal is to make fail-closed rare by keeping the backend highly available or moving the lock next to the service's own data, and to make correctness work idempotent so that it can safely continue.

How do you get 30 teams to adopt the library?

We make it the easiest path: a small dependency with good defaults, examples for the common cases, and a migration guide. We start with the teams affected by the incident, who are motivated, publish the inventory so every team sees its own risk, and add the check to design review so new code starts on the library.

Should efficiency locks ever fail closed?

Yes, when running the work everywhere would itself cause harm, for example a heavy batch job that would overload the database if 40 pods ran it at once. Then the efficiency lock fails closed for capacity reasons, and the job simply waits.

7Conclusion

In this answer, we turned a lock outage into a policy. Each lock declares its purpose: efficiency locks may fail open only for idempotent work, and correctness locks fail closed unless fencing or idempotency protects the data. Every external side effect carries an idempotency key regardless of locking, the backend is either run as a tier-1 dependency or replaced by the service's own database, and a shared library enforces the choice, reports metrics and is tested in game days. We roll it out by inventory and risk and keep it alive through design review.

What to say in the interviewAbout 100 seconds aloud

Open with

The incident shows that nobody had decided what a service should do when its lock backend fails, so some failed closed and some failed open. My policy starts with classifying every lock.

Then, if they want more

An efficiency lock only avoids duplicate work; it may fail open, meaning run without the lock, but only if the protected work is idempotent. A correctness lock protects data; it must fail closed, stop or queue, unless the data is protected by fencing or idempotency anyway.

The duplicate invoices show that failing open on non-idempotent work is never acceptable, so a second rule applies regardless of locking: every externally visible side effect needs an idempotency key derived from the business event, enforced by a unique constraint or the provider.

For services that fail closed, the lock backend becomes a tier-1 dependency, replicated, monitored, with an availability target and an owner, or better, we move those locks into the strongly consistent database the service already uses, so the lock adds no new failure mode.

To make this stick, the platform team provides a shared lock library that requires each lock to declare its purpose and failure behaviour in configuration, refuses fail-open for correctness locks, emits metrics, and is exercised in game days where we remove the backend.

I would roll it out by inventorying every lock, fixing the fail-open non-idempotent cases like invoicing first, then correctness locks without fencing, and adding lock behaviour to the design review checklist.

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, what policy do you set for how services behave when...": https://scrivio-interview-library.netlify.app/architecture/distributed-systems/593c772127/