Skip to content

Conversation

@Technoboy-
Copy link
Contributor

@Technoboy- Technoboy- commented Jul 19, 2022

Fixes #16654

Master Issue: #16654

Motivation

Add keyHashRangeIndex to distinguish the same hashRanges with the same consumerName.

Documentation

  • doc-not-needed

@Technoboy- Technoboy- self-assigned this Jul 19, 2022
@Technoboy- Technoboy- added this to the 2.11.0 milestone Jul 19, 2022
@Technoboy- Technoboy- added type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages area/broker labels Jul 19, 2022
@github-actions
Copy link

@Technoboy- Please provide a correct documentation label for your PR.
Instructions see Pulsar Documentation Label Guide.

@Technoboy- Technoboy- added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Jul 19, 2022
@merlimat
Copy link
Contributor

I think this will remove the possibility of having a stable assignment logic. Right now, if you specify the same consumer names, you will be guaranteed to receive the same keys after reconnections.

@codelipenghui
Copy link
Contributor

I think this will remove the possibility of having a stable assignment logic. Right now, if you specify the same consumer names, you will be guaranteed to receive the same keys after reconnections.

Oh, good point. Maybe we should try to add more information to the topic stats instead of changing the behavior.

@codelipenghui codelipenghui modified the milestones: 2.11.0, 2.12.0 Jul 26, 2022
return result;
}

private String getConsumerUniqueId(Consumer consumer) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we make consumerUniqueId a method of Consumer?

@Technoboy- Technoboy- changed the title [improve][broker] Use the unique consumer identifier to make the range more spread out. [improve][broker] Add keyHashRangeIndex to distinguish the same consumerName with the same hashRanges Aug 23, 2022
@Technoboy- Technoboy- changed the title [improve][broker] Add keyHashRangeIndex to distinguish the same consumerName with the same hashRanges [improve][broker] Add keyHashRangeIndex to distinguish the same hashRanges with the same consumerName Aug 23, 2022
@Technoboy-
Copy link
Contributor Author

I think this will remove the possibility of having a stable assignment logic. Right now, if you specify the same consumer names, you will be guaranteed to receive the same keys after reconnections.

Oh, good point. Maybe we should try to add more information to the topic stats instead of changing the behavior.

Add a new field to help user distinguish the same hashRanges.

Comment on lines +1091 to +1094
long sameNameConsumerCount = consumerKeyHashRanges.keySet()
.stream()
.filter(c -> c.consumerName().equals(consumer.consumerName()))
.count();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we get the consumer count without going through all the items of consumerKeyHashRanges? If we have many consumers under a topic, this might introduce CPU spike

@Technoboy- Technoboy- closed this Aug 29, 2022
@Technoboy-
Copy link
Contributor Author

Decide to add more descriptions for this part.

@Technoboy- Technoboy- deleted the fix-16654 branch November 11, 2023 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/broker doc-not-needed Your PR changes do not impact docs type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When using Key_Shared and set the same consumerName, keyHashRanges is same in topics stats

4 participants