Skip to content

Commit

Permalink
[improve] [pip] PIP-364: Introduce a new load balance algorithm AvgSh…
Browse files Browse the repository at this point in the history
…edder (apache#22949)

Co-authored-by: Kai Wang <[email protected]>
Co-authored-by: Yunze Xu <[email protected]>

(cherry picked from commit c160cc9)
Signed-off-by: Zixuan Liu <[email protected]>
  • Loading branch information
3 people authored and nodece committed Jul 23, 2024
1 parent 54c8077 commit 580af14
Show file tree
Hide file tree
Showing 6 changed files with 716 additions and 4 deletions.
18 changes: 18 additions & 0 deletions conf/broker.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,24 @@ loadBalancerBundleUnloadMinThroughputThreshold=10
# Time to wait for the unloading of a namespace bundle
namespaceBundleUnloadingTimeoutMs=60000

# configuration for AvgShedder, a new shedding and placement strategy
# The low threshold for the difference between the highest and lowest loaded brokers.
loadBalancerAvgShedderLowThreshold = 15

# The high threshold for the difference between the highest and lowest loaded brokers.
loadBalancerAvgShedderHighThreshold = 40

# The number of times the low threshold is triggered before the bundle is unloaded.
loadBalancerAvgShedderHitCountLowThreshold = 8

# The number of times the high threshold is triggered before the bundle is unloaded.
loadBalancerAvgShedderHitCountHighThreshold = 2

# In the UniformLoadShedder and AvgShedder strategy, the maximum unload ratio.
# For AvgShedder, recommend to set to 0.5, so that it will distribute the load evenly
# between the highest and lowest brokers.
maxUnloadPercentage = 0.2

### --- Replication --- ###

# Enable replication metrics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2078,21 +2078,51 @@ public class ServiceConfiguration implements PulsarConfiguration {
@FieldContext(
dynamic = true,
category = CATEGORY_LOAD_BALANCER,
doc = "In the UniformLoadShedder strategy, the minimum message that triggers unload."
doc = "The low threshold for the difference between the highest and lowest loaded brokers."
)
private int loadBalancerAvgShedderLowThreshold = 15;

@FieldContext(
dynamic = true,
category = CATEGORY_LOAD_BALANCER,
doc = "The high threshold for the difference between the highest and lowest loaded brokers."
)
private int loadBalancerAvgShedderHighThreshold = 40;

@FieldContext(
dynamic = true,
category = CATEGORY_LOAD_BALANCER,
doc = "The number of times the low threshold is triggered before the bundle is unloaded."
)
private int loadBalancerAvgShedderHitCountLowThreshold = 8;

@FieldContext(
dynamic = true,
category = CATEGORY_LOAD_BALANCER,
doc = "The number of times the high threshold is triggered before the bundle is unloaded."
)
private int loadBalancerAvgShedderHitCountHighThreshold = 2;

@FieldContext(
dynamic = true,
category = CATEGORY_LOAD_BALANCER,
doc = "In the UniformLoadShedder and AvgShedder strategy, the minimum message that triggers unload."
)
private int minUnloadMessage = 1000;

@FieldContext(
dynamic = true,
category = CATEGORY_LOAD_BALANCER,
doc = "In the UniformLoadShedder strategy, the minimum throughput that triggers unload."
doc = "In the UniformLoadShedder and AvgShedder strategy, the minimum throughput that triggers unload."
)
private int minUnloadMessageThroughput = 1 * 1024 * 1024;

@FieldContext(
dynamic = true,
category = CATEGORY_LOAD_BALANCER,
doc = "In the UniformLoadShedder strategy, the maximum unload ratio."
doc = "In the UniformLoadShedder and AvgShedder strategy, the maximum unload ratio."
+ "For AvgShedder, recommend to set to 0.5, so that it will distribute the load "
+ "evenly between the highest and lowest brokers."
)
private double maxUnloadPercentage = 0.2;

Expand Down
Loading

0 comments on commit 580af14

Please sign in to comment.