[GSoC 2026] Kafka Streams runner: measure how long work takes to move between instances - #39745
Closed
junaiddshaukat wants to merge 1 commit into
Conversation
… between instances Measures the claim the runner is proposed on. Each instance stamps what it processes with its own name, which is what makes the number mean anything: the runner reads an unbounded source with a single reader (apache#39626), so only one instance works at a time and removing the other would prove nothing. The test removes the instance that is actually producing and times the handover. As configured today a handover takes about 44 seconds, because Kafka Streams does not leave the consumer group when it closes and the coordinator waits for session.timeout.ms to expire. Setting the consumer to leave the group on close brings it to about 1.8 seconds. This changes no configuration: that setting is an internal Kafka config, and Kafka Streams defaults it off on purpose. No GroupByKey in the pipeline, deliberately: a windowed group's output arrives in bursts about 23 seconds apart (apache#39633), far coarser than what is measured. The integration task now shows standard output so the measurement is visible.
junaiddshaukat
force-pushed
the
feat/ks-rescaling-measurement
branch
from
August 13, 2026 13:13
6d092b9 to
ff0326e
Compare
Contributor
|
Assigning reviewers: R: @tvalentyn added as fallback since no labels match configuration Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
Contributor
Author
|
Closing — the measurement belongs in a real application rather than a test, per discussion. The two option changes will go in their own PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of #18479. Measures how long work takes to move to another instance when the instance doing it goes away — the claim the runner is proposed on, which up to now has been an argument from the architecture rather than a number.
What it measures, and why it is built this way
Each instance stamps what it processes with its own name. That is not decoration: the runner reads an unbounded source with a single reader (#39626), so at any moment exactly one instance is doing the work, and removing the other one proves nothing while producing a very flattering number. The test finds the instance that is actually producing, removes that one, and times how long until the other produces. It fails loudly if both are producing, since then the removal would not isolate a handover.
There is no
GroupByKeyin the pipeline, deliberately. A windowed group emits only when a window fires, and the bundle downstream of it closes only on element count or on a watermark arriving (#39633), so its output comes in bursts about 23 seconds apart — far coarser than the thing being measured. Reading and counting gives a steady signal, and the task reading the source is what has to move.Results
Kafka Streams does not send a
LeaveGroupwhen it closes, so the group coordinator only notices the instance has gone oncesession.timeout.msexpires — 45 seconds by default, which is what the first row measures.This PR changes no configuration. Setting the consumer to leave the group on close makes scale-down 24x faster, but
internal.leave.group.on.closeis an internal Kafka config with no compatibility guarantee, and Kafka Streams defaults it off deliberately so that rolling restarts do not cause rebalance churn. For a runner whose instances are added and removed on purpose it looks like the right trade, but that is a decision for review rather than something to slip in with a test.What this does not measure
The instance removed here shuts down in an orderly way, and this pipeline holds no state.
A machine that dies does neither. It cannot announce its own departure, so no configuration makes it detectable faster than
session.timeout.ms; and a pipeline with state has to restore that state before it can carry on. So these numbers are the cost of moving stateless work between instances, and a lower bound on anything else. Recovery from a crash is detection plus at least this.That is worth being plain about, because it bears on how the runner should be described: the advantage over a checkpoint-based engine is in what happens after a failure is detected — reassigning partitions and restoring from a changelog, rather than restarting the job graph from a checkpoint — and not in detecting the failure sooner.
Testing
The integration task now shows standard output, so the measurement is visible when the test is run; it is a manually invoked verification task, so the extra output costs nothing in CI.