Monedula

Scenario 09.1.5 · AutoMQ: S3 goes down

AutoMQ diskless Kafka: when S3 goes down

Diskless · Advanced · about 4 min · Apache Kafka 4.4 · AutoMQ 1.7.4

AutoMQ 1.7.4 · with S3 stopped nothing fails: WAL uploads retry without limit, acks=all waits, acks=1 is answered but unreadable, the WAL is not trimmed, and the uploads land in order when S3 returns.

Run this scenario in the playground

The WAL is not trimmed. t+6.000s

broker-1 should have turned wal-0001 into an SSO about 4 s after its confirm, but the SSO upload waits for S3 too, so the WAL is not trimmed. p-all has waited 3.8 s for order-2. A real AutoMQ broker would answer it with REQUEST_TIMED_OUT once the request's timeout ran out (the producer's request.timeout.ms, 30 s by default); the simulator has no produce request timeout.

Open at this step: step 4, The WAL is not trimmed

What you start with

AutoMQ 1.7.4 answers acks=all when a broker's WAL object is in S3, and acks=1 as soon as the record is appended in memory. Its S3 client retries a failed WAL upload on every error except 404, with no limit on attempts and no overall timeout. Here S3 stops for 5 s while producer p-all (acks=all) and p-one (acks=1) write to partitions broker-1 leads. Watch the object storage lane, the WAL objects under broker-1, both producers and consumer c1.

Step by step

  1. Steady state t+1.850s orders is an AutoMQ topic (AutoMQ 1.7.4): six partitions, one replica each. broker-1 leads orders-0 and orders-3. order-1 went into broker-1's WAL object wal-0001, the upload was confirmed and p-all (acks=all) was acked at 1250 ms. c1 in az-a read it from broker-1 at 1800 ms. Open at this step: step 1, Steady state
  2. S3 stops; acks=1 is answered anyway t+2.300s S3 stopped at 2000 ms. At 2250 ms broker-1 appended order-2 (p-all) to orders-0 and order-3 (p-one) to orders-3, in its WAL buffer wal-0002. p-one (acks=1) was acked right there, as AutoMQ does, with no S3 involved. p-all waits for the upload, and the high watermarks have not moved, so neither record can be read yet. Open at this step: step 2, S3 stops; acks=1 is answered anyway
  3. Uploads retry; nothing fails t+4.000s wal-0002's upload started at 2750 ms and keeps failing; AutoMQ retries a WAL upload on every error but a 404, with no attempt limit and no overall timeout (the simulator retries every second; AutoMQ backs off from about 1 s up to 60 s). order-4 went into wal-0003, which started uploading at 3950 ms behind it. No producer got an error. c1's polls bring nothing new: order-3 was acked to p-one but is still invisible. Open at this step: step 3, Uploads retry; nothing fails
  4. The WAL is not trimmed t+6.000s broker-1 should have turned wal-0001 into an SSO about 4 s after its confirm, but the SSO upload waits for S3 too, so the WAL is not trimmed. p-all has waited 3.8 s for order-2. A real AutoMQ broker would answer it with REQUEST_TIMED_OUT once the request's timeout ran out (the producer's request.timeout.ms, 30 s by default); the simulator has no produce request timeout. Open at this step: step 4, The WAL is not trimmed
  5. S3 is back: uploads confirm in order t+7.600s S3 started again at 7000 ms. wal-0002 was confirmed at 7350 ms on its next retry: the high watermarks moved, and p-all was acked for order-2 after 5.1 s. wal-0003 was confirmed after it, at 7550 ms, and order-4 was acked: AutoMQ completes WAL uploads strictly in the order they were written. Open at this step: step 5, S3 is back: uploads confirm in order
  6. c1 catches up; the WAL becomes SSOs t+12.050s c1 read order-2, order-3 and order-4 at 7800 ms and committed at 8400 ms. broker-1 committed wal-0001 as sso-0000 at 7890 ms and wal-0002 and wal-0003 as sso-0001 at 11990 ms, trimming the WAL. Nothing was lost and nothing failed; the outage only cost time. Open at this step: step 6, c1 catches up; the WAL becomes SSOs

The takeaway

Nothing failed. p-one was answered at append, before S3 was involved, but c1 could not read its record for 5 s: the high watermark only moves when the WAL upload is confirmed. p-all simply waited, 5.1 s for order-2. The uploads kept retrying, the second WAL object waited behind the first, and the SSO commit that would have trimmed the WAL waited too. When S3 came back, the uploads confirmed in the order they were written, p-all was acked twice, c1 read all three records, and the WAL became SSOs. Simulator choices: a failed upload is retried every second (AutoMQ backs off from about 1 s up to 60 s), and the simulator has no produce request timeout, so p-all never sees the REQUEST_TIMED_OUT a real broker would send once the request's timeout (the producer's request.timeout.ms, 30 s by default) ran out.

Configs in this scenario

  • acks How many replicas must have a write before the producer counts it as sent: 0 (none), 1 (the leader only) or all (every in-sync replica, the default, and required for idempotence). How acks works
  • request.timeout.ms How long the client waits for the response to one request before it sends it again or fails it (default 30000, 30 seconds); for a producer it should stay above the broker replica.lag.time.max.ms to avoid retries that write duplicates.

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=09.1.5" title="Kafka Simulator: AutoMQ: S3 goes down" 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/automq-s3-outage/">AutoMQ diskless Kafka: when S3 goes down</a></p>

Further reading

AutoMQ v1.7.4 source on GitHub

More in Diskless

All scenarios