Repository navigation
kafka-mesh: Add healthchecks for the Kafka brokers - #1701
Merged
Merged
Conversation
Nothing waited for the brokers, so the first produce through the proxy was retried until they were up. In the stress job it took up to 48s that way, of a wait that gives up after 30 attempts. Give the brokers a healthcheck, and have the proxy wait for them. A broker is listening well before it will answer, and asking with the Kafka tools starts a JVM each time, so the check sends a minimal API versions request and passes once the broker replies. The retry of the first produce is kept, as that is also what creates the topic. Signed-off-by: Ryan Northey <ryan@synca.io>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the broker healthchecks and proxy startup dependencies.
No open issues 🎉
What changed in this PR
This PR improves startup readiness in the Kafka mesh sandbox by waiting for both brokers to respond before starting the proxy.
Changes:
- Adds a shared, lightweight Kafka API-versions healthcheck to both brokers and makes the proxy depend on their healthy status.
- Clarifies why the first produce operation still retries during topic creation; verification behavior is unchanged.
| File | Description |
|---|---|
kafka-mesh/verify.sh |
Updates the comment explaining the retained first-produce retry. |
kafka-mesh/docker-compose.yaml |
Adds broker healthchecks and proxy readiness dependencies. |
Review effort: Balanced
phlax
marked this pull request as ready for review
November 29, 2026 22:30
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.
Nothing waited for the Kafka brokers in
kafka-mesh, so the first produce through the proxy was retried until they were up (verify.sh:17). In the stress job that took up to 48s, of a wait that gives up after 30 attempts, each of which starts a JVM.This gives both brokers a healthcheck and has the proxy wait for them, so
docker compose up --waitreturns when they can be used.A broker's port is open well before it will answer anything, so a port check passes too early, and asking with the Kafka tools means starting a JVM for every check, which is a lot to run every couple of seconds in a container that is busy starting. The check instead sends the smallest request there is, for the API versions the broker supports, from
bash, and passes once there is a reply.The retry of the first produce is kept: it is also what creates the topic. With the containers limited to 0.25 CPU locally it passed on its first attempt, in 11s.
Tested locally, and again with all of the example's containers limited to 0.25 CPU.
This touches
kafka-mesh/docker-compose.yamlandverify.sh, as does #1672, so whichever lands second will need rebasing.