One owner per session: scaling a document AI workspace without a database We stopped a server in the middle of a conversation. The next question was answered by the other one, and nothing was lost.
- Users never share data, so each session can live on one server at a time: requests are routed by session, its files sit in object storage, and every write checks the file has not changed since the server read it. No coordinator.
- Stopped mid-conversation, the server's sessions moved to the other one: the follow-up came back 8.8 s after it was asked, the answer included. Every earlier turn was there.
- The vector store runs on three nodes with two copies. With one node stopped, searches and new sessions worked at the first try.
- No database for any of it. What broke first was not storage: a firewall that drops instead of refusing, a folder nginx could not write, and an allowlist on another server.
Live runs on 21 November 2026, one session each, against the production API: two API servers and a three-node Qdrant on four small Hetzner machines.
Users never share data. That makes most of the hard parts disappear.
A document AI workspace holds one person's documents, their chats and the answers checked against those documents. Nothing in it is shared with another account. So instead of a database every server reads and writes, each session lives on one server at a time, which keeps a working copy in memory, while the truth sits in object storage under the session's own prefix: its documents, one small file for its state, one file per chat.
- Routing by session. The load balancer hashes the session id taken from the address, so all of a session's requests reach the same server. With consistent hashing, adding or removing a server moves only about one session in N.
- Writes before replies. An answer is written to its chat's file before it is sent; a new session is saved before its id is returned. A server that stops loses no answer, and a save stays small however long the history.
- A version check instead of a lock. Each file has a version number in the Postgres database we already run. A server remembers the version it read; before using its copy it compares it (another server saved since: it reads the session back), and every write first moves the version on with one atomic compare-and-set, which two servers cannot both win. The loser writes nothing, and the person sees “Your question crossed with another one: please ask it again.”
Grouped this way, a set of accounts with its servers, its vector store and its storage is a self-contained cell. Cells share nothing, so growth means adding cells, and a cell can be a country: the data of a French fund need never leave France.
Why not a lock service?
Our first version held each session in Redis: a 15-second hold, extended while the server lived, handed over on request. It worked, and the same test answered the follow-up after 21.9 s, because the new server waited for the stopped one's hold to expire. It also made one Redis a single point of failure for every save. A consensus store (etcd, on three nodes) would remove that, at the price of three more moving parts. Our object storage cannot refuse a stale write itself (it ignores conditional-write headers), but one compare-and-set on a row of the existing Postgres does exactly that. If Postgres does not answer, the servers fall back to checking the file's tag in object storage just before writing: saves never stop, and only two writes within the same few milliseconds could then both land.
An API server stopped in the middle of a conversation.
One session, a short document, four questions. After the first answer we stopped the API on the server that gave it and asked a follow-up at once; then started it again and asked two more.
| Step | Result |
|---|---|
| Follow-up, its server stopped | answered by the other server at the first try, 8.8 s after it was asked, with the first turn in the conversation |
| Server started again; third question | answered, the session read back from storage |
| Fourth question, 25 s later | answered; all four turns in the chat |
A stopped server comes back with an empty memory. The harder case is a server that was only unreachable for a moment and still holds an old copy. We ran it on the storage directly, two processes playing two servers on one session: the second saved an answer; the first, with its older copy, tried to save another and was refused, wrote nothing, and its next read had both turns. Then the hardest timing: the two processes writing the same chat at the same agreed instant, five times. Each time exactly one answer landed and the other was refused; the chat held exactly the five winners.
Logs and scripts: vectogrid/scaling_runs/.
A vector store node stopped.
The vectors live in Qdrant on three nodes, each collection in two copies on different nodes. We stopped the first node for 27 seconds, then asked a follow-up and opened a brand-new session.
| With one of three nodes down | Result |
|---|---|
| Follow-up (a search on the surviving copy) | answered at the first try, 13.7 s with the answer |
| New session (a new collection) | made at the first try, 11.3 s |
| The cluster | yellow while down (every collection one live copy), green with three nodes once back |
Not storage. Four small things, each found by stopping something on purpose.
- A firewall that drops instead of refusing. When a server is gone, its port is silently dropped, so the load balancer waited its default 60 seconds before trying the other one. A 3-second connect timeout on the private network fixed it.
- One-copy collections on a dead node. New collections started with one copy, and the cluster can place it on the node that is down: new sessions failed twice and worked at the third try, 28.6 seconds in. They are now created with two copies.
- A cleanup that raced creation. The hourly sweep of orphaned collections ran on a fresh server just as a session was being made, and deleted its collection. A session is now marked as being made before its collection exists, and every server's sweep keeps it.
- Configuration that was right on one server only. One machine's web server could not write its temp folder, so every larger request failed there; the models server let in only the first API server. Both invisible with one server, both found in the first hour with two.
What this does not show
- A server lost for good: the runs stop containers, and the platform restarted the stopped API within seconds. Failover is shown; recovery from a dead machine is not.
- A server stopped in the middle of an upload: documents being read are queued again by the new owner. Built, not yet run.
- Load: two runs of one session each. The ceiling at high load is the model providers' limits, measured in Where to run an open model, long before storage.
For how the index itself grows, see From one report to millions; for ingestion at volume, How we ingest thousands of documents in minutes.
Need document AI that stays up, in your own country?
Published 21 November 2026 · Philippe Vergnet, VectoGrid