Skip to content

rhythm: fair partition consumption #4655

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

Merged

Conversation

javiermolinar
Copy link
Contributor

@javiermolinar javiermolinar commented Feb 3, 2025

What this PR does:

The current loop has two drawbacks. The first one is that it keeps consuming from a single partition while it has a record, neglecting the others. This is not a problem right now since every blockbuilder is in charge of a single partition. The second problem is the main run loop; after consuming a complete cycle (that can take much more than the consuming cycle due to the first drawback), it waits another fixed time, incrementing the lag.

This PR tries to tackle this by first prioritizing the partitions with more lag. For that, we get first the lag in time for every partition. We continue consuming from the laggiest partition until the lag is less than the cycle time.

The number of FetchOffsetsForTopics and ListEndOffsets requests has been reduced now to only one request per cycle instead of one request for every partition cycle

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@javiermolinar javiermolinar changed the title rhythm: weighted partition consumption rhythm: fair partition consumption Feb 5, 2025
@knylander-grafana
Copy link
Contributor

HI, Javi. You have the docs box checked in the description but I don't see any. Are you working on docs for this?

@javiermolinar
Copy link
Contributor Author

HI, Javi. You have the docs box checked in the description but I don't see any. Are you working on docs for this?

My bad, I clicked all of them

Copy link
Contributor

@mapno mapno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good changes. I think the PR is going in the right direction 👍

Have some thoughts and nitpicks.

Copy link
Contributor

@mapno mapno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with these changes. I'll approve when this discussion is resolved

@mdisibio
Copy link
Contributor

+1 changes lgtm but defer to the rest of the team for final approval.

@javiermolinar javiermolinar merged commit 50a9daf into grafana:main Feb 21, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants