-
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
[improve][loadbalance] added loadBalancerReportUpdateMinIntervalMillis and ignores memory usage in getMaxResourceUsage() #17598
[improve][loadbalance] added loadBalancerReportUpdateMinIntervalMillis and ignores memory usage in getMaxResourceUsage() #17598
Conversation
} | ||
|
||
public double getMaxResourceUsage(boolean checkMemoryUsage) { | ||
if (checkMemoryUsage) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to remove this config option and instead only check the direct memory but not the heap memory usage here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
I initially thought this checkMemoryUsage config is safer since it does keep the old behavior(checking memory).
I see that memory usage is always noisy, so I agree that we could remove it from getMaxResourceUsage
.
Note that we keep getMaxResourceUsageWithWeightWithinLimit()
as-is -- we are not removing the memory usage signal in this func, as its memory usage can be already disabled by loadBalancerMemoryResourceWeight=0.0
.
e0d963d
to
94ad0f9
Compare
/pulsarbot run-failure-checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And could you please also add a test for the new configuration?
conf/broker.conf
Outdated
@@ -1163,6 +1163,9 @@ loadBalancerEnabled=true | |||
# Percentage of change to trigger load report update | |||
loadBalancerReportUpdateThresholdPercentage=10 | |||
|
|||
# minimum interval to update load report | |||
loadBalancerReportUpdateMinIntervalMilliSeconds=5000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loadBalancerReportUpdateMinIntervalMilliSeconds=5000 | |
loadBalancerReportUpdateMinIntervalMillis=5000 |
Just keep consistent with other configuration names in the broker.conf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated.
@FieldContext( | ||
category = CATEGORY_LOAD_BALANCER, | ||
dynamic = true, | ||
doc = "Min delay of load report to collect, in milli-seconds" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should move to line 2090?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated.
@@ -235,7 +235,8 @@ private void updateBundleData(final Map<String, NamespaceBundleStats> bundleStat | |||
} | |||
|
|||
public double getMaxResourceUsage() { | |||
return max(cpu.percentUsage(), memory.percentUsage(), directMemory.percentUsage(), bandwidthIn.percentUsage(), | |||
// does not consider memory because it is noisy by gc. | |||
return max(cpu.percentUsage(), directMemory.percentUsage(), bandwidthIn.percentUsage(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please help add a unit test?
Looks like we changed the behavior, but all the tests got passed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated.
… config and ignores memory usage in getMaxResourceUsage$()
94ad0f9
to
5844002
Compare
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
@Anonymitaet the configuration doc update can be automated in the next version, which means we don't need to update https://pulsar.apache.org/docs/reference-configuration/#broker manually, correct? |
yes |
…s and ignores memory usage in getMaxResourceUsage() (apache#17598) (cherry picked from commit de7c586) (cherry picked from commit a6cb786)
Fixes #
Master Issue: #
Motivation
Currently, the load report frequency is hard-coded at 5secs, and the JVM memory usage is re-computed in the ZK report thread every 5 sec. In the high traffic environment, when GC is frequent, the memory usage could fluctuate in 5 secs, and this could result in writing load reports to ZK too frequently(every 5 sec).
Modifications
Adds a config,
loadBalancerReportUpdateMinIntervalMilliSeconds (default 5000)
to configure the minimum frequency of the load update to ZK instead of hard-coded 5secs.Removes the memory usage check in
getMaxResourceUsage()
to ignore the noisy memory usage signals.Currently, there are three places where Pulsar uses
getMaxResourceUsage()
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/OverloadShedder.java
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LeastLongTermMessageRate.java
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
Search Result: https://github.com/apache/pulsar/search?q=getMaxResourceUsage
Note that this PR does not update
getMaxResourceUsageWithWeight*()
, as it already controls the memory usage byloadBalancerMemoryResourceWeight=0.0
Verifying this change
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc-required
(Your PR needs to update docs and you will update later). It needs to update the broker config doc. https://pulsar.apache.org/docs/reference-configuration/#broker
[]
doc-not-needed
(Please explain why) loadBalancerReportUpdateMinIntervalMilliSeconds
doc
(Your PR contains doc changes)
doc-complete
(Docs have been already added)