Skip to content
About
Main content

Registry and subject strategies

What happens when the schema registry is down?

Why a registry exists

A schema registry exists for a coordination reason. Without a central authority, every producer must negotiate with every : that is . With a central reference, each producer registers once and each consumer checks once: N + M agreements.

Subject strategy: the unit of the contract

The is the granularity of the : which set of messages must be compatible with each other. (In a registry, a subject is the name under which a series of schema versions is stored.) Three common choices:

StrategyThe interface isGoodCost
Per the streamsimplea topic cannot carry mixed types
Per record typethe record typeone type can travel across several topics, one topic can carry several typesconsumers must handle a union; ordering across types now matters
Per topic and per typeboththe benefits of bothmore bookkeeping

The derivation is not a matter of taste: match the contract granularity to the unit a consumer subscribes to. When the subscription unit and the contract unit differ, you get the situation "I cannot evolve this without breaking an unrelated consumer".

Availability: the neglected part

Two common registry behaviours put it in the data path:

  • validate on register: the producer asks the registry before it publishes a new schema,
  • decode by ID on read: a consumer reads a schema ID in each message and fetches the schema from the registry.

If the registry fails, one of two things happens:

  • Fail closed: the producer stops. A metadata service now limits the availability of ingestion. (This was Sara's 40-minute outage.)
  • Fail open with a cache: the producer continues with the last known schema. That admits unvalidated schemas and defers the discovery of any problem.

Every workable deployment caches decode aggressively and makes registration rare. This is the general move of putting the authority on the change path and keeping it off the data path. It is the same structural choice as using manifest instead of directory listing in a (the manifest says which files belong, and nobody lists the folder on every query).

A registry turns N×M agreements into N+M at the price of a metadata service in the data path.