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

Clean consumer stats samples differently depending on how many there are #10451

Closed
wants to merge 2 commits into from

Conversation

SimonUnge
Copy link
Member

@SimonUnge SimonUnge commented Jan 31, 2024

Proposed Changes

This is a revision of #9356.

Check number of consumers for a terminated channel, If over 1000, bulk delete metrics, if under 1001, do it the old way.

Types of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)
  • Build system and/or CI

Checklist

Put an x in the boxes that apply.
You can also fill these out after creating the PR.
If you're unsure about any of them, don't hesitate to ask on the mailing list.
We're here to help!
This is simply a reminder of what we are going to look for before merging your code.

Further Comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc.

ets:delete(IndexTable, Id),
ok;
index_delete(consumer_stats = Table, {channel = Type, Count}, Id) ->
case Count > ?LARGE_CONSUMER_COUNT of
Copy link
Member

Choose a reason for hiding this comment

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

We can add a comment explaining the condition here: ets:match_delete/2 is acceptable or optimal for a large number of entries on this particular channel but when there are many channels with a few (very often just one) consumers each, its sequential scans become prohibitively expensive.

@michaelklishin michaelklishin changed the title Check consumer size for clean strats Clean consumer stats samples differently depending on how many there are Feb 1, 2024
@SimonUnge SimonUnge marked this pull request as ready for review February 1, 2024 19:12
@michaelklishin
Copy link
Member

The forced push was a rebase.

Copy link
Contributor

@kjnilsson kjnilsson left a comment

Choose a reason for hiding this comment

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

LGTM! Simpler than the idea I had but should be effective. Cheers.

@SimonUnge
Copy link
Member Author

LGTM! Simpler than the idea I had but should be effective. Cheers.

@kjnilsson Curious, what was your idea?

@michaelklishin
Copy link
Member

Merged with a cosmetic change from me in #10476

mergify bot pushed a commit that referenced this pull request Feb 3, 2024
(cherry picked from commit dad9379)
@michaelklishin michaelklishin removed this from the 3.13.0 milestone Feb 3, 2024
michaelklishin added a commit that referenced this pull request Feb 29, 2024
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.

3 participants