Optimize Kafka topic initialization on re-deploy - #794
Open
ehelms wants to merge 1 commit into
Open
Conversation
Check if topics exist before running expensive create operation. Reduces re-deploy time from ~11s to ~2s when topics already exist. Co-Authored-By: Claude <noreply@anthropic.com>
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.
Why are you introducing these changes? (Problem description, related links)
On every re-deploy, the Kafka topic initialization task (
iop_kafka : Initialize Kafka topics) runs the expensiveinit.sh --createoperation, which spawns 17 parallel JVMs to create topics. This takes ~11.4 seconds even when all topics already exist and no actual work is needed.This pattern mirrors the puppet-iop implementation (
puppet-iop/manifests/core_kafka.pp:80-91), which guards topic creation with anunlesscheck.What are the changes introduced in this pull request?
Check whether Kafka topics already existtask that runs/opt/kafka/init.sh --checkbefore topic creationInitialize Kafka topicstask conditional oniop_kafka_check.rc != 0--checkoperation runs a single JVM vs 17 parallel JVMs in--createHow to test this pull request
Steps to reproduce:
./foremanctl deploy --flavor katello --features ioppodman exec iop-core-kafka /opt/kafka/init.sh --check(should succeed)./foremanctl deploy --flavor katello --features iopiop_kafka : Check whether Kafka topics already existshould run in ~1-2s andInitialize Kafka topicsshould be skippedInitialize Kafka topicsran every deploy and took ~11.4sChecklist