Skip to content

Commit

Permalink
Reduce the time it takes for namespace bundle unloading to time out (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
Masahiro Sakamoto authored Nov 29, 2021
1 parent cf19f71 commit 0715fcd
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions conf/broker.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,9 @@ loadBalancerDirectMemoryResourceWeight=1.0
# It only takes effect in the ThresholdShedder strategy.
loadBalancerBundleUnloadMinThroughputThreshold=10

# Time to wait for the unloading of a namespace bundle
namespaceBundleUnloadingTimeoutMs=60000

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

# Enable replication metrics
Expand Down
3 changes: 3 additions & 0 deletions conf/standalone.conf
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,9 @@ loadBalancerDirectMemoryResourceWeight=1.0
# It only takes effect in the ThresholdShedder strategy.
loadBalancerBundleUnloadMinThroughputThreshold=10

# Time to wait for the unloading of a namespace bundle
namespaceBundleUnloadingTimeoutMs=60000

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

# Enable replication metrics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1895,6 +1895,11 @@ public class ServiceConfiguration implements PulsarConfiguration {
doc = "Option to override the auto-detected network interfaces max speed"
)
private Double loadBalancerOverrideBrokerNicSpeedGbps;
@FieldContext(
category = CATEGORY_LOAD_BALANCER,
doc = "Time to wait for the unloading of a namespace bundle"
)
private long namespaceBundleUnloadingTimeoutMs = 60000;

/**** --- Replication --- ****/
@FieldContext(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ private Optional<String> getLeastLoadedFromLoadManager(ServiceUnitId serviceUnit

public CompletableFuture<Void> unloadNamespaceBundle(NamespaceBundle bundle) {
// unload namespace bundle
return unloadNamespaceBundle(bundle, 5, TimeUnit.MINUTES);
return unloadNamespaceBundle(bundle, config.getNamespaceBundleUnloadingTimeoutMs(), TimeUnit.MILLISECONDS);
}

public CompletableFuture<Void> unloadNamespaceBundle(NamespaceBundle bundle, long timeout, TimeUnit timeoutUnit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,9 @@ public void unloadNamespaceBundlesGracefully() {
serviceUnits.forEach(su -> {
if (su instanceof NamespaceBundle) {
try {
pulsar.getNamespaceService().unloadNamespaceBundle(su, 1, TimeUnit.MINUTES).get();
pulsar.getNamespaceService().unloadNamespaceBundle(su,
pulsar.getConfiguration().getNamespaceBundleUnloadingTimeoutMs(), TimeUnit.MILLISECONDS)
.get();
} catch (Exception e) {
log.warn("Failed to unload namespace bundle {}", su, e);
}
Expand Down
1 change: 1 addition & 0 deletions site2/docs/reference-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ You can set the log level and configuration in the [log4j2.yaml](https://github
| loadBalancerMemoryResourceWeight | The heap memory usage weight when calculating new resource usage. It only takes effect in the ThresholdShedder strategy. | 1.0 |
| loadBalancerDirectMemoryResourceWeight | The direct memory usage weight when calculating new resource usage. It only takes effect in the ThresholdShedder strategy. | 1.0 |
| loadBalancerBundleUnloadMinThroughputThreshold | Bundle unload minimum throughput threshold. Avoid bundle unload frequently. It only takes effect in the ThresholdShedder strategy. | 10 |
| namespaceBundleUnloadingTimeoutMs | Time to wait for the unloading of a namespace bundle in milliseconds. | 60000 |
|replicationMetricsEnabled| |true|
|replicationConnectionsPerBroker| |16|
|replicationProducerQueueSize| |1000|
Expand Down

0 comments on commit 0715fcd

Please sign in to comment.