Skip to content

Conversation

@SimonUnge
Copy link
Collaborator

@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.

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally with my changes
  • If relevant, I have added necessary documentation to https://github.com/rabbitmq/rabbitmq-website
  • If relevant, I have added this change to the first version(s) in release-notes that I expect to introduce it

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
Collaborator

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
Collaborator

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
Collaborator Author

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

@kjnilsson Curious, what was your idea?

@michaelklishin
Copy link
Collaborator

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