Skip to content

Commit

Permalink
[pulsar-server] add broker-configuration for relative dispatch thrott…
Browse files Browse the repository at this point in the history
…ling (apache#5804)

### Motivation 
As we discussed at apache#5797, adding broker level relative dispatch-throttling-config.
  • Loading branch information
rdhabalia authored and sijie committed Dec 9, 2019
1 parent 6be2c08 commit 03d9e1f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions conf/broker.conf
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ dispatchThrottlingRatePerReplicatorInMsg=0
# Using a value of 0, is disabling replication message-byte dispatch-throttling
dispatchThrottlingRatePerReplicatorInByte=0

# Dispatch rate-limiting relative to publish rate.
# (Enabling flag will make broker to dynamically update dispatch-rate relatively to publish-rate:
# throttle-dispatch-rate = (publish-rate + configured dispatch-rate).
dispatchThrottlingRateRelativeToPublishRate=false

# By default we enable dispatch-throttling for both caught up consumers as well as consumers who have
# backlog.
dispatchThrottlingOnNonBacklogConsumerEnabled=true
Expand Down
5 changes: 5 additions & 0 deletions conf/standalone.conf
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ dispatchThrottlingRatePerTopicInMsg=0
# default message-byte dispatch-throttling
dispatchThrottlingRatePerTopicInByte=0

# Dispatch rate-limiting relative to publish rate.
# (Enabling flag will make broker to dynamically update dispatch-rate relatively to publish-rate:
# throttle-dispatch-rate = (publish-rate + configured dispatch-rate).
dispatchThrottlingRateRelativeToPublishRate=false

# By default we enable dispatch-throttling for both caught up consumers as well as consumers who have
# backlog.
dispatchThrottlingOnNonBacklogConsumerEnabled=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,13 @@ public class ServiceConfiguration implements PulsarConfiguration {
doc = "Default number of message-bytes dispatching throttling-limit for every replicator in replication. \n\n"
+ "Using a value of 0, is disabling replication message-byte dispatch-throttling")
private long dispatchThrottlingRatePerReplicatorInByte = 0;

@FieldContext(
dynamic = true,
category = CATEGORY_POLICIES,
doc = "Dispatch rate-limiting relative to publish rate. (Enabling flag will make broker to dynamically "
+ "update dispatch-rate relatively to publish-rate: "
+ "throttle-dispatch-rate = (publish-rate + configured dispatch-rate) ")
private boolean dispatchThrottlingRateRelativeToPublishRate = false;
@FieldContext(
dynamic = true,
category = CATEGORY_POLICIES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ private DispatchRate createDispatchRate() {
dispatchThrottlingRateInByte = -1;
}

return new DispatchRate(dispatchThrottlingRateInMsg, dispatchThrottlingRateInByte, 1);
return new DispatchRate(dispatchThrottlingRateInMsg, dispatchThrottlingRateInByte, 1,
config.isDispatchThrottlingRateRelativeToPublishRate());
}

/**
Expand Down

0 comments on commit 03d9e1f

Please sign in to comment.