-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IGNITE-22403 CDC: Improve Kafka partition ranges assignment for appliers #272
Merged
Conversation
This file contains 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
shishkovilja
suggested changes
Jul 5, 2024
modules/cdc-ext/src/main/java/org/apache/ignite/cdc/kafka/AbstractKafkaToIgniteCdcStreamer.java
Outdated
Show resolved
Hide resolved
modules/cdc-ext/src/main/java/org/apache/ignite/cdc/kafka/AbstractKafkaToIgniteCdcStreamer.java
Outdated
Show resolved
Hide resolved
modules/cdc-ext/src/main/java/org/apache/ignite/cdc/kafka/AbstractKafkaToIgniteCdcStreamer.java
Outdated
Show resolved
Hide resolved
modules/cdc-ext/src/main/java/org/apache/ignite/cdc/kafka/AbstractKafkaToIgniteCdcStreamer.java
Outdated
Show resolved
Hide resolved
modules/cdc-ext/src/main/java/org/apache/ignite/cdc/kafka/AbstractKafkaToIgniteCdcStreamer.java
Outdated
Show resolved
Hide resolved
modules/cdc-ext/src/main/java/org/apache/ignite/cdc/kafka/AbstractKafkaToIgniteCdcStreamer.java
Outdated
Show resolved
Hide resolved
shishkovilja
approved these changes
Jul 8, 2024
modules/cdc-ext/src/main/java/org/apache/ignite/cdc/kafka/AbstractKafkaToIgniteCdcStreamer.java
Outdated
Show resolved
Hide resolved
modules/cdc-ext/src/main/java/org/apache/ignite/cdc/kafka/AbstractKafkaToIgniteCdcStreamer.java
Outdated
Show resolved
Hide resolved
...dc-ext/src/test/java/org/apache/ignite/cdc/kafka/KafkaToIgnitePartitionDistributionTest.java
Outdated
Show resolved
Hide resolved
...dc-ext/src/test/java/org/apache/ignite/cdc/kafka/KafkaToIgnitePartitionDistributionTest.java
Outdated
Show resolved
Hide resolved
...dc-ext/src/test/java/org/apache/ignite/cdc/kafka/KafkaToIgnitePartitionDistributionTest.java
Outdated
Show resolved
Hide resolved
...dc-ext/src/test/java/org/apache/ignite/cdc/kafka/KafkaToIgnitePartitionDistributionTest.java
Outdated
Show resolved
Hide resolved
...dc-ext/src/test/java/org/apache/ignite/cdc/kafka/KafkaToIgnitePartitionDistributionTest.java
Outdated
Show resolved
Hide resolved
...dc-ext/src/test/java/org/apache/ignite/cdc/kafka/KafkaToIgnitePartitionDistributionTest.java
Outdated
Show resolved
Hide resolved
...dc-ext/src/test/java/org/apache/ignite/cdc/kafka/KafkaToIgnitePartitionDistributionTest.java
Outdated
Show resolved
Hide resolved
shishkovilja
suggested changes
Jul 8, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maksaska , please, fix code related to my comments.
maksaska
changed the title
IGNITE-22403 Algorithm improvement for kafka topic partition distribution
IGNITE-22403 CDC: Improve Kafka partition ranges assignment for appliers
Jul 8, 2024
shishkovilja
approved these changes
Jul 9, 2024
NSAmelchev
approved these changes
Jul 10, 2024
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.
Distribution for partitions from kafka topic over requested threads in
AbstractKafkaToIgniteCdcStreamer
(CDC Kafka to Ignite) is not uniform.There might be cases with unequal load on threads, that reads data from kafka, which might result in overhead/bottleneck and slow workflow in general for the whole CDC with Kafka process. The improved version takes that into account.
Initially, for uniform distribution to form, the streamer calculated the ratio between the number of partitions and the number of threads.It didn't take into account the modulus of the result, thus leading to underestimated number of partiotions one thread can take. The fixed version of the algorithm uses modulus to round up the underestimated number to pump up the load on the first threads. To make things work, the number of partitions taken by each thread is reevaulated for each thread, which allows to reduce the difference in parity and integral division in general. In other words, threads balance themself out while partitions are being distributed from the first thread to the last one.