When an application lives in one program, shared truth is easy. Every part reads the same records, and where a fact lives never has to be asked out loud. Split that program into separate services, each with its own store, and the question arrives at once: where does shared truth live now, and how out of date may each service's view of it be allowed to get?
Every fact has one owner
The starting discipline is ownership. A fact has exactly one owning service, and that service's store is the fact's home. Every other service that needs the fact holds a copy, and a copy is not a second source of truth.
Consider a rental business — call it Tideboard — split into services. Reservations own availability truth, held in a relational database and guarded by transactions, because the last kayak being promised once is a guarantee, not a preference. The storefront may keep a cached copy of the day's rental counts so its pages render quickly. Both arrangements are correct, because each was chosen for the fact it covers, and the choice is written down.
Consistency is chosen per fact, not per system
The word for that choice is consistency, and it is made fact by fact. Strong consistency belongs where money, safety, or a scarce thing is allocated: seat counts, payment states, holds on a limited item. Eventual consistency belongs where a brief lag costs nothing but a slightly old display: review counts, "recently booked" ribbons, catalog highlights.
The practical tool is a state table: one row per shared fact, naming its owner, the consistency chosen for it, and its staleness bound — how old a copy may be before it is no longer acceptable. The table looks like paperwork. Its value is that it converts a thousand future arguments into a lookup. When someone asks whether a page may cache a number, the answer is already recorded, attached to the fact rather than to whoever argued loudest in a meeting.
Sessions are state with a person attached
One kind of state deserves separate handling: the session. A session holds who is signed in, what sits in the cart, and which rental dates a customer was considering. It belongs to a person, it changes often, and it must survive the way modern platforms actually run.
That rules out the simplest home. A session cannot live in the memory of a single running instance, because that instance may be replaced between two requests from the same customer, taking the session with it. Session state belongs in a shared, fast store every instance can reach. A document-shaped store suits it well, because a session is naturally one bundle of facts fetched together, short-lived, and tolerant of simple reads and writes. A very hot working set shared by many instances at once — a flash-sale cart counter, for example — is the cache-shaped case that calls for a dedicated in-memory store instead.
A cache is a performance tool with an honesty rule
Caching in front of a database is legitimate and often valuable, but it operates under one rule: a cache may serve a stale answer only where the state table has already declared that fact eventual, with its bound stated. Cache the catalog's category pages, where a minute stale is invisible. Cache trip descriptions. Never cache the answer to "is this kayak still free" in a way that could sell it twice — that read goes to the owner, transactionally, every time.
Every cached item also needs a time-to-live and an invalidation story: what event shortens the wait when a fact changes. A booking that changes counts can publish that fact, and listeners can drop the affected entries rather than waiting for them to expire. And the cache must justify itself in the open, through its hit rate and the database load it actually removed. A cache with a low hit rate whose staleness generates support calls is not an optimization. It is a second system to debug, and the honest move is to remove it and let a properly indexed, properly pooled database do its job.
The arithmetic, worked plainly
Tideboard's catalog pages draw 8,000 reads on a busy day. A cache with a one-minute life absorbing 90 percent of them leaves the database about 800 catalog reads — 8,000 × 0.10 = 800. Availability checks, exempt from caching under the state table, still arrive in full: say 1,200 transactional reads and writes. Total database work falls from 9,200 operations to about 2,000. Every operation removed was a display read. Not one was a guarantee. That distribution, not the raw saving, is the point.
The customer sees the lag, so the wording must match it
State has a human surface builders forget until support teaches them. Eventual consistency is a design property inside the system; in the customer's hands it becomes sentences on a screen. A booking can honestly read "confirmed" the instant the owning service has it, while an internal board catches up within its declared bound of seconds, because the wording promises nothing tighter than the design delivers. A page showing a just-canceled rental as still held needs wording that admits the lag — "your release is being processed" — rather than a confident statement the design knows may be stale.
This is where the common shortcut fails. "Add a cache in front of everything — databases are slow and stale data is a small price for speed" treats stale as one price. It is a different price per fact. A stale review count costs nothing. A stale availability count costs a double-booked kayak and a family's Saturday. Cache by the state table's declared consistency, never by blanket habit, and let guarantee-shaped reads reach their owner.
Experience it, don’t just read about it
Consistency chosen per fact, with one owner for every fact and a cache that never serves a guarantee is Concept 12 of Building and Deploying Apps on Google Cloud: From Code to Live Service (Course No. 341), from Cognosco Learning, a learning company powered by AI. The course builds the wider craft of running services on Google Cloud beyond this distinction — Choose the Right Home, Data for an Application, and Coordinate Work with Pub/Sub and Tasks — each worked through with an Agentic Socratic AI coach, one learner at a time. Try a Free Preview at cognoscolearning.com.
Navigate your own course.
© 2026 Cognosco Learning. All rights reserved.