Scenario 13.1.3 · Ursa for Kafka: from WAL to Parquet
Ursa for Kafka compaction: from WAL objects to Parquet
StreamNative Ursa for Kafka · the compaction service rewrites WAL objects as Parquet files, one Oxia commit repoints the offset index at them and the WAL objects are deleted; a lagging consumer reads the files, a tailing one read the owner's memory.
Run this scenario in the playgroundWAL objects pile up; the offset index points at them. t+2.400s
Producer p-b (client.id: zone_id=az-b) sent three records at 100 and three more at 800, one to each partition of orders each time. broker-2, its zonal owner in az-b, put each three into one WAL object: Oxia committed wal-0001 at 1450 and wal-0002 at 2150. The offset index now maps offset 0 of every partition to wal-0001 and offset 1 to wal-0002, so one WAL object holds pieces of three partitions and each partition is spread over two objects. Consumer group g-tail (zone_id=az-b) has read all six records as they were committed, at 1800 and 2400, from broker-2's memory (frame 5).
Open at this step: step 1, WAL objects pile up; the offset index points at themThe compaction service writes one Parquet file per partition; one Oxia commit repoints the index. t+4.250s
The compaction service, which runs outside the brokers, started a run at 3450, 2 s after the first Oxia commit. It took both committed WAL objects and wrote one Parquet file per partition, each with that partition's records from both objects: pq-0001 for orders-0, pq-0002 for orders-1 and pq-0003 for orders-2, offsets 0-1 each. Until now the index pointed at the WAL objects. At 4250 the upload and one Oxia commit land together, and the commit repoints the offset index of all three partitions at the files: offsets 0-1 of orders-0 now map to pq-0001, those of orders-1 to pq-0002 and those of orders-2 to pq-0003. The offsets do not change, only the file behind them. The 2 s interval, one file per partition per run and the upload and commit landing together are the simulator's choices. The WAL objects leave the bucket in the same step (next frame).
Open at this step: step 2, The compaction service writes one Parquet file per partition; one Oxia commit repoints the indexThe WAL objects are deleted. t+4.400s
With every range of wal-0001 and wal-0002 now pointing at a Parquet file, the run deleted both WAL objects at 4250, and they left broker-2's memory: the bucket holds only the three Parquet files, and the canvas marks the two objects as compacted for one second. Ursa deletes the WAL objects once the files are verified; the simulator deletes them in the same step as the commit. Consumer group g-late joins now in az-c (zone_id=az-c) with auto.offset.reset=earliest, so it starts at offset 0, which is only in Parquet now.
Open at this step: step 3, The WAL objects are deletedA lagging consumer reads the Parquet file, converted back to records. t+5.000s
g-late's first poll goes to broker-3, its zonal owner in az-c. The index maps offset 0 of orders-0 to pq-0001, so broker-3 fetches the Parquet file from object storage (one GET) and converts it back to records: order-1 at offset 0, the record broker-2 first wrote to wal-0001. The first offset of a fetch decides where it is served from, and g-late, joining behind, reads one record per poll (simulator choices).
Open at this step: step 4, A lagging consumer reads the Parquet file, converted back to recordsA tailing consumer reads the owner's memory; both see the same records. t+8.600s
g-late read the rest one per poll, each through broker-3 from a Parquet file with its own GET: six GETs, two per file, since Parquet reads are not cached (a simulator choice). It committed offset 2 on every partition at 8600. g-tail read the same six records at 1800 and 2400, before the run, from broker-2's memory: broker-2 is its zonal owner in az-b and wrote both WAL objects, so the tail was still in its write buffer and needed no object storage read. Both groups read order-1 to order-6 at the same offsets: the tier changed, the records did not.
Open at this step: step 5, A tailing consumer reads the owner's memory; both see the same recordsWhat you start with
In Ursa for Kafka a diskless topic's records first land in WAL objects, each holding the batches of many partitions, and the offset index in Oxia maps every partition's offsets to the object that holds them. The compaction service, which runs outside the brokers, rewrites those WAL objects as Parquet files, repoints the index at the files and, once they are verified, deletes the WAL objects. Here producer p-b writes six records through broker-2, its zonal owner in az-b, three into each of two WAL objects. Consumer group g-tail, also in az-b, reads from the start; group g-late joins in az-c after the first compaction run, with auto.offset.reset=earliest. The timings are slowed so each phase gets its own frame (a simulator choice).
Step by step
- WAL objects pile up; the offset index points at them t+2.400s Producer p-b (client.id: zone_id=az-b) sent three records at 100 and three more at 800, one to each partition of orders each time. broker-2, its zonal owner in az-b, put each three into one WAL object: Oxia committed wal-0001 at 1450 and wal-0002 at 2150. The offset index now maps offset 0 of every partition to wal-0001 and offset 1 to wal-0002, so one WAL object holds pieces of three partitions and each partition is spread over two objects. Consumer group g-tail (zone_id=az-b) has read all six records as they were committed, at 1800 and 2400, from broker-2's memory (frame 5). Open at this step: step 1, WAL objects pile up; the offset index points at them
- The compaction service writes one Parquet file per partition; one Oxia commit repoints the index t+4.250s The compaction service, which runs outside the brokers, started a run at 3450, 2 s after the first Oxia commit. It took both committed WAL objects and wrote one Parquet file per partition, each with that partition's records from both objects: pq-0001 for orders-0, pq-0002 for orders-1 and pq-0003 for orders-2, offsets 0-1 each. Until now the index pointed at the WAL objects. At 4250 the upload and one Oxia commit land together, and the commit repoints the offset index of all three partitions at the files: offsets 0-1 of orders-0 now map to pq-0001, those of orders-1 to pq-0002 and those of orders-2 to pq-0003. The offsets do not change, only the file behind them. The 2 s interval, one file per partition per run and the upload and commit landing together are the simulator's choices. The WAL objects leave the bucket in the same step (next frame). Open at this step: step 2, The compaction service writes one Parquet file per partition; one Oxia commit repoints the index
- The WAL objects are deleted t+4.400s With every range of wal-0001 and wal-0002 now pointing at a Parquet file, the run deleted both WAL objects at 4250, and they left broker-2's memory: the bucket holds only the three Parquet files, and the canvas marks the two objects as compacted for one second. Ursa deletes the WAL objects once the files are verified; the simulator deletes them in the same step as the commit. Consumer group g-late joins now in az-c (zone_id=az-c) with auto.offset.reset=earliest, so it starts at offset 0, which is only in Parquet now. Open at this step: step 3, The WAL objects are deleted
- A lagging consumer reads the Parquet file, converted back to records t+5.000s g-late's first poll goes to broker-3, its zonal owner in az-c. The index maps offset 0 of orders-0 to pq-0001, so broker-3 fetches the Parquet file from object storage (one GET) and converts it back to records: order-1 at offset 0, the record broker-2 first wrote to wal-0001. The first offset of a fetch decides where it is served from, and g-late, joining behind, reads one record per poll (simulator choices). Open at this step: step 4, A lagging consumer reads the Parquet file, converted back to records
- A tailing consumer reads the owner's memory; both see the same records t+8.600s g-late read the rest one per poll, each through broker-3 from a Parquet file with its own GET: six GETs, two per file, since Parquet reads are not cached (a simulator choice). It committed offset 2 on every partition at 8600. g-tail read the same six records at 1800 and 2400, before the run, from broker-2's memory: broker-2 is its zonal owner in az-b and wrote both WAL objects, so the tail was still in its write buffer and needed no object storage read. Both groups read order-1 to order-6 at the same offsets: the tier changed, the records did not. Open at this step: step 5, A tailing consumer reads the owner's memory; both see the same records
The takeaway
broker-2 wrote two WAL objects, wal-0001 and wal-0002, each with one record of every partition, and the offset index pointed offsets 0 and 1 of each partition at them. 2 s after the first Oxia commit the compaction service ran: it wrote one Parquet file per partition, pq-0001 to pq-0003, each holding offsets 0-1 of its partition from both objects, and one Oxia commit repointed the index at the three files. The two WAL objects were then deleted, and left broker-2's memory. g-late, which joined after the run, read every record from the Parquet files, converted back to records, with one GET per read. g-tail had read the same six records from broker-2's memory before the run, so both groups read order-1 to order-6 at the same offsets. Ursa facts: the compaction service rewrites WAL objects as Parquet files and deletes them once the files are verified; the offset index maps offsets to the WAL object or Parquet file that holds them; the owner that wrote the tail serves it from memory. Simulator choices: the service runs every 2 s, writes one Parquet file per partition per run, lands its upload and its Oxia commit together and deletes the WAL objects in the same step as that commit; the first offset of a fetch decides where it is served from; Parquet reads are not cached, so each one is a GET; a group that joins behind reads one record per poll; and the 500 ms buffer close, the 600 ms upload and the 200 ms Oxia commit are slowed. StreamNative's lakehouse tables are a separate feature the simulator does not draw: Stream Delivered Tables, which have shipped, write a separate copy of the data to a lakehouse table, while zero-copy Stream Backed Tables are marked "Coming Soon" in its docs.
Configs in this scenario
-
auto.Where a consumer starts when its group has no committed offset or the offset no longer exists: latest (the default), earliest, by_duration (a time back from now, such as by_duration:PT1H), or none to throw an exception instead. How auto.offset.reset worksoffset. reset -
client.On Ursa for Kafka a client asks for zone affinity by starting its client.id with zone_id= and its zone (zone_id=az-a, or zone_id=az-a,key1=value1 with other entries after it), and at least one broker must run in that zone.id
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=13.1.3" title="Kafka Simulator: Ursa for Kafka: from WAL to Parquet" 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/ursa-wal-to-parquet/">Ursa for Kafka compaction: from WAL objects to Parquet</a></p> Further reading
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: a lease owner crashes
- 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 broker failure: a kill and a silent broker
- Ursa for Kafka: diskless and disk topics, side by side