Monedula

Scenario 11.1.1 · Redpanda: the write path

Redpanda Kafka write path: the offset comes after S3

Diskless · Advanced · about 3 min · Apache Kafka 4.4 · Redpanda

Redpanda v26.2.2 Cloud Topics · the leader uploads the batch to S3 in a per-broker L0 object, a placeholder in the partition's Raft log gives it its offset, and every acks value waits for a majority.

Run this scenario in the playground

The placeholders replicate to the followers; at a majority, acks=all and acks=1 are acked together. t+1.550s

300 ms later the two placeholders of each partition reach broker-1 (az-a) and broker-3 (az-c): about 100 bytes each, pointing into l0-0001, not the records. The simulator draws this as the followers fetching from broker-2; in Redpanda the Raft leader sends the entries to its followers. The leader and one follower are already a majority of three, so the high watermark moves to 2 on orders-1 and orders-4 and both producers are acked at that moment: Cloud Topics force a quorum ack, so p-one's acks=1 waits for the upload and the majority just as p-all's acks=all does. The cross-zone counter shows 4 data hops (the records, az-a to broker-2) and 8 metadata hops (the placeholders, to az-a and az-c).

Open at this step: step 5, The placeholders replicate to the followers; at a majority, acks=all and acks=1 are acked together

What you start with

Redpanda Cloud Topics keep each partition's Raft group: a leader and followers, as on any Redpanda topic. Only the payload moves to S3. The leader's broker buffers the batches of every partition it leads into one L0 object and uploads it; then it appends a placeholder of about 100 bytes, pointing at the object, to each partition's Raft log, and the followers replicate the placeholder. Raft assigns the offset when the placeholder is appended. Every acks value waits for the upload and for a Raft majority: Cloud Topics force a quorum ack. Producers p-all (acks=all) and p-one (acks=1) sit in az-a and write two partitions led by broker-2 in az-b; consumer g1 sits in az-b. Timings are slowed so each phase gets its own frame.

Step by step

  1. Three brokers, a Raft group per partition, no KRaft t+0.000s orders is a Redpanda Cloud Topics topic (v26.2.2): 6 partitions with 3 replicas each, and every partition keeps its own Raft group, a leader and two followers. Three brokers, one per zone (broker-1 in az-a, broker-2 in az-b, broker-3 in az-c), lead two partitions each. There are no KRaft controllers (Redpanda's own controller is not drawn). Producers p-all (acks=all) and p-one (acks=1) sit in az-a; consumer group g1 has one member in az-b. Open at this step: step 1, Three brokers, a Raft group per partition, no KRaft
  2. The batch waits in the leader's L0 buffer, with no offset yet t+0.400s Each producer sends one record to orders-1 and one to orders-4. broker-2 in az-b leads both, so all four records cross from az-a to az-b. broker-2 puts them in its L0 buffer, one buffer for every partition it leads, opened at 150 ms. No record has an offset yet: every log end offset and high watermark is still 0. The buffer closes after 500 ms here (Redpanda uploads at 250 ms or 4 MiB). Open at this step: step 2, The batch waits in the leader's L0 buffer, with no offset yet
  3. One L0 object mixes two partitions and uploads to S3 t+0.700s At 650 ms broker-2 closes its buffer into one L0 object, l0-0001, which holds the records of orders-1 and orders-4 from both producers, and starts uploading it to S3. Only the leader's broker uploads. The upload takes 600 ms here; until it is done no record has an offset and no producer is acked. Open at this step: step 3, One L0 object mixes two partitions and uploads to S3
  4. The placeholders enter the Raft log: now the records have offsets t+1.250s The upload finished at 1250 ms. broker-2 appends one placeholder per produce request to each partition's Raft log, in producer order: on orders-1, p-all's k5 gets offset 0 and p-one's k7 offset 1; on orders-4, p-all's k2 gets offset 0 and p-one's k9 offset 1. Each placeholder points at its batch in l0-0001, and the records go into broker-2's batch cache. Only the leader holds offsets 0 and 1, so the high watermark is still 0 and no producer is acked. Open at this step: step 4, The placeholders enter the Raft log: now the records have offsets
  5. The placeholders replicate to the followers; at a majority, acks=all and acks=1 are acked together t+1.550s 300 ms later the two placeholders of each partition reach broker-1 (az-a) and broker-3 (az-c): about 100 bytes each, pointing into l0-0001, not the records. The simulator draws this as the followers fetching from broker-2; in Redpanda the Raft leader sends the entries to its followers. The leader and one follower are already a majority of three, so the high watermark moves to 2 on orders-1 and orders-4 and both producers are acked at that moment: Cloud Topics force a quorum ack, so p-one's acks=1 waits for the upload and the majority just as p-all's acks=all does. The cross-zone counter shows 4 data hops (the records, az-a to broker-2) and 8 metadata hops (the placeholders, to az-a and az-c). Open at this step: step 5, The placeholders replicate to the followers; at a majority, acks=all and acks=1 are acked together
  6. The consumer reads the records from the leader's cache t+2.400s g1's member in az-b polls at 1800 ms and gets all four records from broker-2, the leader, in its own zone. broker-2 serves them from its batch cache, filled when the placeholders were appended, so nothing is read from S3. The member commits offset 2 on orders-1 and orders-4 at its next poll, at 2400 ms. Open at this step: step 6, The consumer reads the records from the leader's cache

The takeaway

broker-2 put the records of two partitions from two producers into one L0 object and uploaded it to S3 before any record had an offset. The offsets came from the Raft log when the placeholders were appended, in producer order on each partition. The followers received the placeholders, not the records, and once the leader and a follower held them, a majority of three, both producers were acked at the same moment: p-one's acks=1 waited for the upload and the majority just as p-all's acks=all did, because Cloud Topics force a quorum ack. The consumer read every record from the leader's batch cache, with no read from S3. Simulator choices: the 500 ms buffer interval is slowed from Redpanda's 250 ms or 4 MiB so each phase is a frame; the upload time is the simulator's own figure, since Redpanda's sources give none, slowed here to 600 ms for the same reason; Raft replication is drawn as the simulator's follower fetch, 300 ms after the append, where Redpanda's leader sends the entries to its followers; and each placeholder is drawn and counted as one metadata hop of about 100 bytes, since the simulator has no record size.

Configs in this scenario

  • acks On a Redpanda Cloud Topics topic (redpanda.storage.mode=cloud) acks=1 and acks=all are answered at the same point, once the L0 object holding the batch is uploaded and a Raft majority holds its placeholder, because Cloud Topics replace the requested level with a quorum ack (acks=0 takes the same path). How acks works

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=11.1.1" title="Kafka Simulator: Redpanda: the write path" 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/redpanda-write-path/">Redpanda Kafka write path: the offset comes after S3</a></p>

Further reading

Redpanda v26.2.2 source on GitHub

More in Diskless

All scenarios