Monedula

Scenario 25.1.5 · Schema Registry down: a restart stops the client

Kafka Schema Registry down: a restarted client stops

Schema registry · Intermediate · about 4 min · Apache Kafka 4.4 · Confluent Platform feature

With SR down a restarted producer cannot serialize and a restarted consumer cannot deserialize. A warm producer next to them keeps writing.

Run this scenario in the playground

c1 restarted: stuck at P1. t+2.900s

c1 restarted too. p2, still warm, keeps writing P1 and P2, but c1 cannot look up the id of P1: it stops at that record. It stays in the group (no rebalance) while its lag grows.

Open at this step: step 5, c1 restarted: stuck at P1

What you start with

Two producers write orders with schema id 1; one consumer reads them. Then the only Schema Registry instance dies and, as in a deploy, p1 and the consumer restart. A restarted process starts with an empty schema cache.

Step by step

  1. two warm producers, one consumer t+0.000s p1 and p2 write orders with schema id 1 (p2 runs with auto.register.schemas=false); c1 reads them. All three have the id cached. Open at this step: step 1, two warm producers, one consumer
  2. O1 written and read t+1.000s Steady state: no client talks to Schema Registry. Open at this step: step 2, O1 written and read
  3. sr-1 down t+1.300s The only SR instance dies. Kafka is healthy. Open at this step: step 3, sr-1 down
  4. p1 restarted: its send fails t+1.900s p1 restarted with an empty schema cache. Its next send must ask SR for the id of orders-value v1, no instance answers, and the serializer throws before the record reaches the batch. Nothing is appended. Open at this step: step 4, p1 restarted: its send fails
  5. c1 restarted: stuck at P1 t+2.900s c1 restarted too. p2, still warm, keeps writing P1 and P2, but c1 cannot look up the id of P1: it stops at that record. It stays in the group (no rebalance) while its lag grows. Open at this step: step 5, c1 restarted: stuck at P1
  6. SR back: both recover t+4.000s sr-1 is back. c1 looks up id 1, reads P1 and P2 and catches up; p1 resolves the id and its O2 goes through. Both caches are warm again. Open at this step: step 6, SR back: both recover
  7. p2 deploys v2: not registered t+4.700s p2 runs with auto.register.schemas=false and is redeployed with schema v2, which nobody registered. SR is up, but its serializer only looks the schema up, finds no such version and throws: schema not found. Register the version first, from CI. Open at this step: step 7, p2 deploys v2: not registered

The takeaway

A restart turns an SR outage into an application outage: the serializer throws before the record reaches Kafka, the deserializer stops the consumer at the record it cannot decode. Run more than one SR instance, and do not roll clients while SR is down. With auto.register.schemas=false a new version must be registered before the deploy, or the producer stops even with SR up.

Embed this scenario

Paste this into a blog post, a course page or your team's docs. The scenario plays inside your page, and the link under it points readers to this walkthrough.

<iframe src="https://monedula.dev/kafka-simulator/embed/?scenario=25.1.5" title="Kafka Simulator: Schema Registry down: a restart stops the client" width="100%" height="520" style="border:1px solid #d0d0d0;border-radius:8px" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
<p><a href="https://monedula.dev/kafka-simulator/scenarios/sr-down-cold-clients/">Kafka Schema Registry down: a restarted client stops</a></p>

Further reading

Confluent documentation

Troubleshooting

More in Schema registry

All scenarios