Scrivio Interview library
LeadershipPrincipal5 min read · updated 13 November 2026

Your platform standard says all services must be stateless. Teams building a multiplayer game server, a chat connection hub and an in-memory matching engine argue that the rule forces slow and costly designs on them.

As the senior technical leader, when would you allow stateful services, and what would the platform need to provide for them?

Statelessness should be the default, not an absolute rule. I would allow stateful services when a team shows a measured benefit and explains how state is recovered, rebalanced and kept through deploys, and I would back them with platform support: stable identities and storage, key-based routing, connection draining and state hand-off. State that cannot be rebuilt must be durable or replicated with tested recovery, and stateful services stay few, owned by skilled teams and reviewed as their own class.

Why this question is asked

A platform rule like 'all services must be stateless' exists for good reasons, and most of the time it is right. But some workloads, such as a game server holding a match, a chat hub holding open connections, or a matching engine holding an order book, are stateful by nature. Forcing their state into a remote store adds a network hop to every operation and can make the product worse. Interviewers ask this to see whether a leader can keep a useful default without turning it into dogma. In this answer, we will recap why statelessness is the default, look at what forcing it costs these three workloads, define when stateful designs are allowed, and describe what the platform and the review process must provide.

1Why Statelessness Is the Default

A stateless service keeps nothing in memory that it cannot lose. Any instance can handle any request, so scaling out means adding instances, and a crashed instance is simply replaced. Deploys are rolling restarts, and load balancing needs no knowledge of the application. That simplicity is why it is the right default for the large majority of services.

The state does not disappear; it moves to databases, caches and queues that are built to keep it safe. For a typical CRUD service, the extra network hop to those stores costs a millisecond or two, which nobody notices.

2What the Rule Costs These Three Workloads

A multiplayer game server updates the positions of every player 30 or 60 times a second. A round trip to Redis for each tick adds latency and multiplies network traffic by the tick rate. A chat connection hub is stateful because a WebSocket is a connection to one specific process; the platform cannot pretend otherwise. A matching engine compares every new order with the order book, and needs microsecond access to it and a single order of processing; putting the book in a remote store makes each match many times slower and makes ordering harder, not easier.

In each case the state close to the computation is the product's performance. The question is not whether to allow it, but how to make it safe.

Where state lives for each workload
WorkloadWhy state is localWhat must survive a node loss
Game server60 updates per second per matchmatch result, maybe nothing in flight
Chat huba socket belongs to one processmessages (already in a durable store)
Matching engineorder book in memory, strict orderevery accepted order and trade

3When to Allow a Stateful Design

I would allow it when the team brings evidence and a plan. The evidence is a measured benefit: latency or cost numbers from a prototype comparing local state with an external store. The plan answers three questions: how is state recovered when a node dies, how is load rebalanced when nodes are added or removed, and how does a deploy happen without losing users or orders.

The answers differ by workload, and that is fine. A game server may accept that a crash ends the current match, as long as results are saved. A chat hub needs clients that reconnect and resume from the last message id stored in the database. A matching engine needs every order written to a durable log before it is acknowledged, so the book can be rebuilt by replaying the log on a standby.

Step throughApproving a stateful service
  1. Is there a measured benefit over external state?
    YesContinue to the planNoUse the stateless default
  2. Can lost state be rebuilt or is it replicated durably?
    YesContinueNoAdd a durable log or replication first
  3. Is recovery time tested and within the target?
    YesContinueNoTest it before launch
  4. Approve as a stateful service with its own review

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

4What the Platform Must Provide

Teams should not each invent the plumbing for stateful services. The platform can offer stable identities and storage, such as Kubernetes StatefulSets with persistent volumes, so a node keeps its name and disk across restarts. It can offer routing by key at the gateway, using consistent hashing on match id, user id or instrument, so requests reach the node that holds their state and few keys move when nodes change.

Deploys need connection draining, so a node stops accepting new sessions and lets existing ones finish or move, and hooks for state hand-off, where an old node transfers its state, or the new node rebuilds it, before taking traffic. Clear guidance and libraries for snapshots to object storage and replay from a log complete the toolkit.

5Durability Rules and Ownership

The non-negotiable rule is about state that cannot be rebuilt. Any such state must be written to durable storage or replicated before it is acknowledged, and the recovery time after losing a node must be tested regularly, not assumed. The matching engine must never acknowledge an order that exists only in memory.

Stateful services should also stay few. Each one should belong to a team with the skills to run it, carry its own reliability targets and runbooks, and be reviewed as a separate class, with game days that kill nodes and deploys under load. That keeps the platform simple for everyone else while the services that need state get proper support.

6Follow-up questions

How would you deploy a new version of the matching engine without dropping orders?

Run a primary and a standby that both consume the same durable, ordered log of orders. Deploy the new version to the standby first, let it rebuild the book by replaying the log and verify it matches the primary's state, for example by comparing a hash of the book at the same log offset. Then pause intake for a moment, promote the standby at a known offset, and resume; clients see a brief pause, not lost orders. The old primary is upgraded and becomes the new standby.

Does allowing stateful services weaken the standard?

Not if the exception is explicit and costly to claim. The default stays stateless, an exception requires evidence and a reviewed plan, and the services that get it carry stricter reliability duties. In practice that keeps the exceptions few and well run, which is better than teams quietly building stateful systems that ignore the rule.

What about using a stateful database inside the service, like an embedded RocksDB?

That is still a stateful service, and the same rules apply: the data must be replicated or rebuilt from a durable log, and recovery must be tested. Embedded stores are a good choice when combined with a changelog, as Kafka Streams does with its state stores and changelog topics.

7Conclusion

In this answer, we saw that statelessness is the right default because it makes scaling and recovery simple, but workloads like game servers, chat hubs and matching engines need state close to compute. We allow them when the benefit is measured and the team can show recovery, rebalancing and deploys; the platform provides stable identities, key-based routing, draining and hand-off; and durability rules, tested recovery and dedicated ownership keep these services safe.

What to say in the interviewAbout 80 seconds aloud

Open with

I would treat statelessness as a default, not a goal in itself. It is the right choice for most services because it makes scaling and failure handling simple, but some workloads need state next to the computation: a game server ticking 60 times a second, a chat hub that owns live sockets, a matching engine that must process orders in strict order with microsecond access to the book.

Then, if they want more

Forcing their state into a remote store adds latency and cost and often makes them harder to get right. So I would allow stateful designs when the team measures the benefit and shows how state is recovered after a node loss, how load is rebalanced, and how they deploy without losing users or orders.

The platform would provide StatefulSets with stable storage, routing by key with consistent hashing at the gateway, connection draining and state hand-off on deploys. The firm rule is that state which cannot be rebuilt is written to a durable log or replicated before it is acknowledged, and recovery time is tested.

And I would keep these services few, owned by teams with the skills, and reviewed as a separate class with their own reliability targets.

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, when would you allow stateful services, and what would...": https://scrivio-interview-library.netlify.app/architecture/sd-fundamentals/968f753109/