Monedula

Scenario 08.2.3 · KafScale: S3 goes down

KafScale 2.1 diskless Kafka: when S3 goes down

Diskless · Advanced · about 4 min · Apache Kafka 4.4 · KafScale 2.1

KafScale 2.1 · a failed segment upload answers REQUEST_TIMED_OUT while the S3 health monitor reports S3 degraded, then KAFKA_STORAGE_ERROR once it reports unavailable; the producer retries, and once the monitor clears, the record lands at the offset that failed, with no gap.

Run this scenario in the playground

The upload fails: REQUEST_TIMED_OUT. t+2.950s

order-2 took offset 1 and its segment upload started at 2250 ms. The upload failed at 2890 ms. The monitor records the failed call first: 1 of the 3 S3 calls in its 60 s window failed, 33%, and from 20% it reports S3 degraded, so KafScale answered REQUEST_TIMED_OUT, which Kafka clients retry. (At 60% or more it would report S3 unavailable and answer KAFKA_STORAGE_ERROR.) The owner's next offset went back to 1: offsets move on only after the upload and the etcd write succeed.

Open at this step: step 2, The upload fails: REQUEST_TIMED_OUT

What you start with

KafScale writes each produce request to S3 as a segment before it acks, and every broker runs an S3 health monitor over its own S3 calls, with a 60 s window. Once 20% of those calls failed it reports S3 degraded, from 60% unavailable, and either way the broker refuses produce and fetch up front: REQUEST_TIMED_OUT while degraded, KAFKA_STORAGE_ERROR while unavailable. Kafka clients retry both, and a failed upload gives its offsets back, so no gap is left. Here S3 stops just before a segment uploads and starts again 2.4 s later. Producer p1 is set to retries=100 and retry.backoff.ms=1000. Watch the object storage lane, the S3 health line in its Inspector, p1's errors and c1.

Step by step

  1. S3 goes down t+2.150s orders is a KafScale topic (KafScale 2.1) with one partition, owned by broker-2 through its etcd lease. order-1 became one S3 segment, etcd recorded the end offset and p1 was acked at 790 ms; c1 read it at 2000 ms. S3 stopped at 2100 ms. Each broker's S3 health monitor still says healthy: it only learns from S3 calls, and its 60 s window holds two good ones, order-1's segment and index uploads. Open at this step: step 1, S3 goes down
  2. The upload fails: REQUEST_TIMED_OUT t+2.950s order-2 took offset 1 and its segment upload started at 2250 ms. The upload failed at 2890 ms. The monitor records the failed call first: 1 of the 3 S3 calls in its 60 s window failed, 33%, and from 20% it reports S3 degraded, so KafScale answered REQUEST_TIMED_OUT, which Kafka clients retry. (At 60% or more it would report S3 unavailable and answer KAFKA_STORAGE_ERROR.) The owner's next offset went back to 1: offsets move on only after the upload and the etcd write succeed. Open at this step: step 2, The upload fails: REQUEST_TIMED_OUT
  3. S3 is back, the monitor still refuses t+6.100s S3 started again at 4500 ms, but the health monitor does not probe: it judges only the calls in its window, and refused requests make no S3 call. So p1's retries at 3890, 4890 and 5890 ms were refused at once with REQUEST_TIMED_OUT, before any S3 call, and c1's fetches at 4000 and 6000 ms were refused the same way. etcd is fine, so c1's offset commit at 4000 ms went through. p1 keeps retrying every second. Open at this step: step 3, S3 is back, the monitor still refuses
  4. The good calls leave the window: KAFKA_STORAGE_ERROR t+61.000s At 60790 ms order-1's two good calls were 60 s old and left the window. Only the failed call is left: 100% failed, so the monitor now reports S3 unavailable and the refusals change to KAFKA_STORAGE_ERROR, still retriable. p1 got REQUEST_TIMED_OUT 58 times, from 2890 to 59890 ms (the failed upload, then 57 refused retries), and now KAFKA_STORAGE_ERROR at 60890 ms. S3 has been back for 56 s; the monitor clears when the failed call leaves the window too, at 62890 ms. Open at this step: step 4, The good calls leave the window: KAFKA_STORAGE_ERROR
  5. Healthy again: order-2 lands at offset 1 t+63.600s At 62890 ms the failed call left the window, which was then empty, and the monitor reported S3 healthy. c1's fetch at 62000 ms was the last one refused. p1's retry at 62890 ms was uploaded at offset 1, committed in etcd and acked at 63530 ms. That is the offset the failed upload had taken: no gap. Open at this step: step 5, Healthy again: order-2 lands at offset 1
  6. c1 reads order-2, no gap t+66.050s c1 polled at 64000 ms and got order-2 at offset 1, and committed offset 2 at 66000 ms. Of two records sent, both were acked, at offsets 0 and 1, and read once. No offset was left empty: the failed upload gave offset 1 back. Open at this step: step 6, c1 reads order-2, no gap

The takeaway

The failed upload did not lose the record. It left 1 failed call of 3 in the health monitor's window, so S3 was degraded and KafScale answered REQUEST_TIMED_OUT. p1 retried every second, and the broker refused each retry before touching S3. When order-1's two good calls were 60 s old and left the window, only the failed call was left, so the monitor reported S3 unavailable and the refusals turned into KAFKA_STORAGE_ERROR, for the last 2 s. Once the failed call left the window too, 58 s after S3 was back, order-2 was uploaded, committed in etcd and acked at offset 1, the offset its failed upload had taken: the owner gave the offset back, so there is no gap, and c1 read both records. On a busy broker the same failure would count for less: below 20% failed calls the monitor stays healthy, the failed request alone gets KAFKA_STORAGE_ERROR and the next one is served. Simulator choices: one monitor for the cluster (KafScale runs one per broker), uploads at normal speed count as fast, fetches take no samples, and p1's backoff is fixed at 1 s.

Configs in this scenario

  • retries How 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.backoff.ms How long the producer waits before retrying a failed send, so it does not hammer a broker that is still recovering.

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.3" title="Kafka Simulator: KafScale: 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/kafscale-2-s3-outage/">KafScale 2.1 diskless Kafka: when S3 goes down</a></p>

Further reading

KafScale v2.1.0 source on GitHub

Troubleshooting

More in Diskless

All scenarios