Scenario 08.2.1 · KafScale: a lease owner crashes
KafScale 2.1 diskless Kafka: a lease owner crashes
KafScale 2.1 · a hard-killed owner keeps its etcd lease for the 10 s TTL, and since a fetch needs the lease too, its partition takes no writes and no reads until another broker takes over; a graceful stop hands over at once.
Run this scenario in the playgroundTwo partitions, two owners. t+1.100s
orders is a KafScale topic (KafScale 2.1) with two partitions, one replica each, every byte in S3. p1's first two records (keys A and D) made broker-2 take orders-0's lease in etcd and broker-3 take orders-1's (the simulator's hash picks them). Both were acked at 790 ms and consumer c1 of g1 read them at 1000 ms. p1 is set to retries=30 and retry.backoff.ms=500: about 15 s of retries with the simulator's fixed backoff.
Open at this step: step 1, Two partitions, two ownersOwner of orders-0 crashes: lease orphaned. t+1.500s
broker-2 was killed without warning at 1500 ms, with nothing in flight: both records had been acked. Its lease on orders-0 is orphaned: it stays in etcd until KafScale's lease TTL of 10 s runs out, at 11500 ms, and the lease lane counts it down. Until then no other broker may write orders-0, and in KafScale no other broker may serve its reads either. The metadata still names broker-2, the lease holder, as the partition's leader. broker-3 still holds orders-1.
Open at this step: step 2, Owner of orders-0 crashes: lease orphanedorders-0 refuses writes and reads. t+3.100s
p1 sent order-3 (orders-0) and order-4 (orders-1) at 2000 ms. order-4 went to broker-3, its owner, was acked at 2690 ms and read by c1 at 3000 ms. order-3 reached a broker that does not hold the lease and was refused with NOT_LEADER_OR_FOLLOWER, a retriable error, at 2050, 2550 and 3050 ms. c1's fetches of orders-0 at 2000 and 3000 ms got the same error: in KafScale a fetch needs the lease, as a produce does.
Open at this step: step 3, orders-0 refuses writes and readsLease expires, the next request takes over. t+11.600s
From 2000 to 11050 ms orders-0 refused 19 produce attempts and 10 fetches. At 11500 ms, 10 s after the kill, the orphaned lease expired. The first request for orders-0 after that was p1's retry at 11550 ms, before c1's next fetch at 12000 ms. It went to broker-1 (the simulator's hash over the alive brokers), which took the lease and restored orders-0: etcd's end offset is 1 and S3's is 1, so numbering goes on from 1. broker-1 gave order-3 offset 1 and is uploading it.
Open at this step: step 4, Lease expires, the next request takes overThe retried record is acked and read. t+13.100s
The upload ended, broker-1 wrote the end offset 2 to etcd, and order-3 was acked at 12190 ms, about 10.2 s after p1 first sent it. c1 read it at 13000 ms through broker-1, the new owner. Nothing was written twice: broker-2 died with no request in flight.
Open at this step: step 5, The retried record is acked and readA graceful stop releases its lease first. t+17.100s
order-5 (orders-1) was acked by broker-3 at 14690 ms and read by c1 at 15000 ms. broker-3 was stopped gracefully at 15000 ms with nothing in flight, and released orders-1's lease at once: in KafScale a graceful stop releases its leases first. order-6, sent at 15500 ms, went to broker-1, which took the lease at 15550 ms without waiting for any TTL, restored (end offset 3) and was acked at 16190 ms; c1 read it at 17000 ms. All six records are acked and read once; the high watermarks are 2 and 4. 08.2.6 stops an owner while a write is in flight.
Open at this step: step 6, A graceful stop releases its lease firstWhat you start with
In KafScale each partition has one owner broker, which holds a lease for it in etcd with a TTL of 10 s. A fetch needs the lease too, so the broker that serves a read must own the partition, and a graceful stop releases its leases before it lets requests in flight finish. Partition orders-0 is owned by broker-2 and orders-1 by broker-3. broker-2 will be killed without warning, and later broker-3 will be stopped gracefully. Producer p1 is set to retries=30 and retry.backoff.ms=500, about 15 s of retries with the simulator's fixed backoff. Watch the lease lane for etcd, p1's and c1's errors and the partition strips.
Step by step
- Two partitions, two owners t+1.100s orders is a KafScale topic (KafScale 2.1) with two partitions, one replica each, every byte in S3. p1's first two records (keys A and D) made broker-2 take orders-0's lease in etcd and broker-3 take orders-1's (the simulator's hash picks them). Both were acked at 790 ms and consumer c1 of g1 read them at 1000 ms. p1 is set to retries=30 and retry.backoff.ms=500: about 15 s of retries with the simulator's fixed backoff. Open at this step: step 1, Two partitions, two owners
- Owner of orders-0 crashes: lease orphaned t+1.500s broker-2 was killed without warning at 1500 ms, with nothing in flight: both records had been acked. Its lease on orders-0 is orphaned: it stays in etcd until KafScale's lease TTL of 10 s runs out, at 11500 ms, and the lease lane counts it down. Until then no other broker may write orders-0, and in KafScale no other broker may serve its reads either. The metadata still names broker-2, the lease holder, as the partition's leader. broker-3 still holds orders-1. Open at this step: step 2, Owner of orders-0 crashes: lease orphaned
- orders-0 refuses writes and reads t+3.100s p1 sent order-3 (orders-0) and order-4 (orders-1) at 2000 ms. order-4 went to broker-3, its owner, was acked at 2690 ms and read by c1 at 3000 ms. order-3 reached a broker that does not hold the lease and was refused with NOT_LEADER_OR_FOLLOWER, a retriable error, at 2050, 2550 and 3050 ms. c1's fetches of orders-0 at 2000 and 3000 ms got the same error: in KafScale a fetch needs the lease, as a produce does. Open at this step: step 3, orders-0 refuses writes and reads
- Lease expires, the next request takes over t+11.600s From 2000 to 11050 ms orders-0 refused 19 produce attempts and 10 fetches. At 11500 ms, 10 s after the kill, the orphaned lease expired. The first request for orders-0 after that was p1's retry at 11550 ms, before c1's next fetch at 12000 ms. It went to broker-1 (the simulator's hash over the alive brokers), which took the lease and restored orders-0: etcd's end offset is 1 and S3's is 1, so numbering goes on from 1. broker-1 gave order-3 offset 1 and is uploading it. Open at this step: step 4, Lease expires, the next request takes over
- The retried record is acked and read t+13.100s The upload ended, broker-1 wrote the end offset 2 to etcd, and order-3 was acked at 12190 ms, about 10.2 s after p1 first sent it. c1 read it at 13000 ms through broker-1, the new owner. Nothing was written twice: broker-2 died with no request in flight. Open at this step: step 5, The retried record is acked and read
- A graceful stop releases its lease first t+17.100s order-5 (orders-1) was acked by broker-3 at 14690 ms and read by c1 at 15000 ms. broker-3 was stopped gracefully at 15000 ms with nothing in flight, and released orders-1's lease at once: in KafScale a graceful stop releases its leases first. order-6, sent at 15500 ms, went to broker-1, which took the lease at 15550 ms without waiting for any TTL, restored (end offset 3) and was acked at 16190 ms; c1 read it at 17000 ms. All six records are acked and read once; the high watermarks are 2 and 4. 08.2.6 stops an owner while a write is in flight. Open at this step: step 6, A graceful stop releases its lease first
The takeaway
A hard-killed owner kept its partition for the lease TTL. For 10 s orders-0 took no writes and no reads: p1 and c1 were both refused with NOT_LEADER_OR_FOLLOWER, because in KafScale a fetch needs the lease as a produce does. orders-1 kept being acked and read. Once etcd deleted the expired lease, the first request for orders-0, p1's retry, made broker-1 take the lease and restore the partition, and the record was acked and read. The graceful stop released its lease at once, so orders-1 moved without waiting. All six records were acked and read once. Simulator choices: a restore takes no extra time, the broker that takes over comes from the simulator's hash, and p1's retry settings are chosen to outlast the 10 s TTL.
Configs in this scenario
-
retriesHow many times the producer sends a batch again after a transient error (default 2147483647, so in practice delivery.timeout.ms ends the retrying); idempotence needs it above 0. -
retry.How long the producer waits before retrying a failed send, so it does not hammer a broker that is still recovering.backoff. ms
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=08.2.1" title="Kafka Simulator: KafScale: a lease owner crashes" 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/kafscale-2-broker-crash/">KafScale 2.1 diskless Kafka: a lease owner crashes</a></p> Further reading
KafScale v2.1.0 source on GitHub
Troubleshooting
More in Diskless
- Diskless Kafka topics (KIP-1163): the write path
- Diskless vs classic Kafka: cross-AZ replication traffic
- Diskless Kafka produce latency: the price of object storage
- Diskless Kafka (KIP-1163): when object storage goes down
- Aiven Inkless diskless Kafka: the write path
- Aiven Inkless: what a PostgreSQL outage does to Kafka
- Aiven Inkless: what losing a Kafka broker costs
- Aiven Inkless: a slow S3 bucket fails Kafka produce
- KafScale diskless Kafka: etcd lease, S3 segment, ack
- KafScale 2.1 diskless Kafka: when etcd goes down
- KafScale 2.1 diskless Kafka: when S3 goes down
- KafScale 2.1 proxy: etcd down past the 60 s cache TTL
- KafScale 2.1: a Kafka producer timeout that still wrote
- KafScale 2.1 diskless Kafka: lease handover, no overwrite
- KafScale 2.1 diskless Kafka: a paused broker comes back
- AutoMQ diskless Kafka: one S3 WAL per broker, then ack
- AutoMQ diskless Kafka: a broker crash and WAL failover
- AutoMQ diskless Kafka: moving a partition, no copying
- AutoMQ diskless Kafka: zone router, no cross-zone data
- AutoMQ diskless Kafka: when S3 goes down
- WarpStream diskless Kafka: the write path through Agents
- WarpStream Kafka: a leader per client, a cache per zone
- WarpStream Kafka: an Agent dies mid-commit
- WarpStream Kafka: the control plane goes down
- WarpStream Kafka Ripcord: produce without the control plane
- WarpStream Kafka lightning topics: ack before the commit
- WarpStream Kafka transactions in the control plane
- Redpanda Kafka write path: the offset comes after S3
- Redpanda Kafka leader crash: a Raft election, no replay
- Redpanda Kafka S3 outage: uploads time out, Raft holds
- Redpanda Kafka L0 to L1: the LRO and who serves a read
- Redpanda Kafka transactions: exactly-once on Cloud Topics
- Nisshi diskless Kafka: watermark.json, then the batch
- Nisshi diskless Kafka on PostgreSQL: a row lock per write
- Nisshi diskless Kafka: two brokers write one partition
- Nisshi diskless Kafka: reading through another broker
- Nisshi diskless Kafka: a broker dies mid-write
- Nisshi diskless Kafka: when PostgreSQL goes down
- Nisshi diskless Kafka: what 0.8.2 refuses
- Ursa for Kafka write path: Oxia assigns the offset
- Ursa for Kafka zones: the zonal owner and the zone cache
- Ursa for Kafka compaction: from WAL objects to Parquet
- Ursa for Kafka broker failure: a kill and a silent broker
- Ursa for Kafka: diskless and disk topics, side by side