Skip to content
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

Kafka scaler should concurrently query brokers and partitions for their message offsets #2377

Closed
bpinske opened this issue Dec 1, 2021 · 1 comment · Fixed by #2405
Closed
Labels
feature-request All issues for new features that have not been committed to needs-discussion

Comments

@bpinske
Copy link
Contributor

bpinske commented Dec 1, 2021

Proposal

Currently, the kafka scaler serially queries kafka brokers for partitions one at a time. For very large topics with many hundreds of partitions, this can be quite slow. During this slow query, the controller-manager hpa loop blocks preventing other HPA actions from taking place.

This has previously been optimized with only querying each broker once for the entire list of all partitions held by the broker, but ultimately this process remains serial.

All brokers should be concurrently queried to minimize time to calculate the total number of unprocessed messages in a topic.

Use-Case

As of now, the kafka scaler is non-performant when multiple kafka-based scaledObjects are querying large topics.

This change would make the kafka scaler usable.

Anything else?

image

@bpinske bpinske added feature-request All issues for new features that have not been committed to needs-discussion labels Dec 1, 2021
@bpinske bpinske changed the title Kafka scaler should concurrently query partitions for Kafka scaler should concurrently query partitions for their message offsets Dec 1, 2021
@bpinske bpinske changed the title Kafka scaler should concurrently query partitions for their message offsets Kafka scaler should concurrently query brokers and partitions for their message offsets Dec 1, 2021
@VerstraeteBert
Copy link
Contributor

Hey @bpinske

I've tried my hand at implementing this. Haven't had the chance to properly test this myself, feel free to try it out :-). Note that I'm quite a golang novice still, especially its concurrency patterns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request All issues for new features that have not been committed to needs-discussion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants