-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Broker] Fix precision issue and initial value for Consumer#avgMessagesPerEntry #14666
Merged
+19
−14
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
codelipenghui
approved these changes
Mar 15, 2022
aloyszhang
approved these changes
Mar 15, 2022
codelipenghui
pushed a commit
that referenced
this pull request
Mar 18, 2022
…esPerEntry (#14666) ### Motivation 1. Precision issue There is precision issue to use int type for `Consumer#avgMessagesPerEntry`. ``` tmpAvgMessagesPerEntry = (int) Math.floor(tmpAvgMessagesPerEntry * avgPercent + (1 - avgPercent) * totalMessages / entries.size()); ``` For example, if `tmpAvgMessagesPerEntry` = 1 and new value of `totalMessages / entries.size()` is always 5, then the `tmpAvgMessagesPerEntry` is always 1 and never increase. 2. Initial value issue. And the init value of 1000 seems confusing in consumerStats for users, and it need quite a long time to decrease if message rate is very slow. ### Modifications 1. Change type of avgMessagesPerEntry to double. 2. Change init value from 1000 to first `totalMessages / entries.size()`. (cherry picked from commit de2e6c8)
codelipenghui
pushed a commit
that referenced
this pull request
Mar 19, 2022
…esPerEntry (#14666) ### Motivation 1. Precision issue There is precision issue to use int type for `Consumer#avgMessagesPerEntry`. ``` tmpAvgMessagesPerEntry = (int) Math.floor(tmpAvgMessagesPerEntry * avgPercent + (1 - avgPercent) * totalMessages / entries.size()); ``` For example, if `tmpAvgMessagesPerEntry` = 1 and new value of `totalMessages / entries.size()` is always 5, then the `tmpAvgMessagesPerEntry` is always 1 and never increase. 2. Initial value issue. And the init value of 1000 seems confusing in consumerStats for users, and it need quite a long time to decrease if message rate is very slow. ### Modifications 1. Change type of avgMessagesPerEntry to double. 2. Change init value from 1000 to first `totalMessages / entries.size()`. (cherry picked from commit de2e6c8)
aparajita89
pushed a commit
to aparajita89/pulsar
that referenced
this pull request
Mar 21, 2022
…esPerEntry (apache#14666) ### Motivation 1. Precision issue There is precision issue to use int type for `Consumer#avgMessagesPerEntry`. ``` tmpAvgMessagesPerEntry = (int) Math.floor(tmpAvgMessagesPerEntry * avgPercent + (1 - avgPercent) * totalMessages / entries.size()); ``` For example, if `tmpAvgMessagesPerEntry` = 1 and new value of `totalMessages / entries.size()` is always 5, then the `tmpAvgMessagesPerEntry` is always 1 and never increase. 2. Initial value issue. And the init value of 1000 seems confusing in consumerStats for users, and it need quite a long time to decrease if message rate is very slow. ### Modifications 1. Change type of avgMessagesPerEntry to double. 2. Change init value from 1000 to first `totalMessages / entries.size()`.
Nicklee007
pushed a commit
to Nicklee007/pulsar
that referenced
this pull request
Apr 20, 2022
…esPerEntry (apache#14666) ### Motivation 1. Precision issue There is precision issue to use int type for `Consumer#avgMessagesPerEntry`. ``` tmpAvgMessagesPerEntry = (int) Math.floor(tmpAvgMessagesPerEntry * avgPercent + (1 - avgPercent) * totalMessages / entries.size()); ``` For example, if `tmpAvgMessagesPerEntry` = 1 and new value of `totalMessages / entries.size()` is always 5, then the `tmpAvgMessagesPerEntry` is always 1 and never increase. 2. Initial value issue. And the init value of 1000 seems confusing in consumerStats for users, and it need quite a long time to decrease if message rate is very slow. ### Modifications 1. Change type of avgMessagesPerEntry to double. 2. Change init value from 1000 to first `totalMessages / entries.size()`.
Shawyeok
pushed a commit
to Shawyeok/pulsar
that referenced
this pull request
Sep 5, 2022
…esPerEntry (apache#14666) ### Motivation 1. Precision issue There is precision issue to use int type for `Consumer#avgMessagesPerEntry`. ``` tmpAvgMessagesPerEntry = (int) Math.floor(tmpAvgMessagesPerEntry * avgPercent + (1 - avgPercent) * totalMessages / entries.size()); ``` For example, if `tmpAvgMessagesPerEntry` = 1 and new value of `totalMessages / entries.size()` is always 5, then the `tmpAvgMessagesPerEntry` is always 1 and never increase. 2. Initial value issue. And the init value of 1000 seems confusing in consumerStats for users, and it need quite a long time to decrease if message rate is very slow. ### Modifications 1. Change type of avgMessagesPerEntry to double. 2. Change init value from 1000 to first `totalMessages / entries.size()`. (cherry picked from commit de2e6c8)
Shawyeok
pushed a commit
to Shawyeok/pulsar
that referenced
this pull request
Sep 6, 2022
…esPerEntry (apache#14666) ### Motivation 1. Precision issue There is precision issue to use int type for `Consumer#avgMessagesPerEntry`. ``` tmpAvgMessagesPerEntry = (int) Math.floor(tmpAvgMessagesPerEntry * avgPercent + (1 - avgPercent) * totalMessages / entries.size()); ``` For example, if `tmpAvgMessagesPerEntry` = 1 and new value of `totalMessages / entries.size()` is always 5, then the `tmpAvgMessagesPerEntry` is always 1 and never increase. 2. Initial value issue. And the init value of 1000 seems confusing in consumerStats for users, and it need quite a long time to decrease if message rate is very slow. ### Modifications 1. Change type of avgMessagesPerEntry to double. 2. Change init value from 1000 to first `totalMessages / entries.size()`. (cherry picked from commit de2e6c8)
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
cherry-picked/branch-2.9
Archived: 2.9 is end of life
doc-not-needed
Your PR changes do not impact docs
release/2.9.3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
There is precision issue to use int type for
Consumer#avgMessagesPerEntry
.For example, if
tmpAvgMessagesPerEntry
= 1 and new value oftotalMessages / entries.size()
is always 5, then thetmpAvgMessagesPerEntry
is always 1 and never increase.And the init value of 1000 seems confusing in consumerStats for users, and it need quite a long time to decrease if message rate is very slow.
Modifications
totalMessages / entries.size()
.Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
This change is already covered by existing tests, such as (please describe tests).
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation
Check the box below and label this PR (if you have committer privilege).
Need to update docs?
no-need-doc
Internal fix.