-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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] Change the default number of namespace bundles to 32 #12137
[Broker] Change the default number of namespace bundles to 32 #12137
Conversation
7341c7d
to
284c56d
Compare
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.
This change makes sense to me. However, it looks like @merlimat's original PR to introduce this configuration, #854, started with 16 bundles and was dropped to 4 after some discussion with @rdhabalia about broker shutdown times. Does the concern still apply?
Before we merge this, I think you'll need to update the website's reference-configuration.md
file: https://github.com/apache/pulsar/blob/master/site2/docs/reference-configuration.md.
|
That's true that it's configurable, but the default value 4 leads often to a case where a broker in a 3 broker cluster doesn't get bundles assigned and is completely idling while the other 2 brokers take all of the load. I can provide a repro for this case if that helps describing the problem. |
user can always enable auto bundle unloading in loadbalancer. and default-bundle =4 is not defined for test cluster with 1 namespace but it considers a normal cluster that is serving multiple namespaces with considerable traffic. again, higher number of bundles comes with cost specially for znodes and default behavior unnecessarily will add more bundles for users who are using default conf file. |
I have a test cluster on GCP/GKE where the auto bundle unloading never happens and one of the broker pods is completely idling (all 4 bundles get assigned to 2 of the 3 broker pods). It's using the default settings which contains
The test load is created with this type of pulsar-perf command (using 2.7.3 pulsar-perf since current 2.8.0 contains a bug that is fixed in master, the bug causes partitions to stop consuming in pulsar-perf).
(these are run on a pod which has 2CPU + 4GB RAM requested/limits, using pulsar-perf from Pulsar 2.7.3 docker image) The traffic can go on for hours and the CPU load will be very low. Since the threshold never gets exceeded, the auto unload and splitting of the bundle never happens. |
I agree that 16 or 32 are better defaults that would avoid many surprises out of the box. That has been the config I have set in prod for the past many years. The case of having a huge namespaces with limited load on each is far less common and it can always be adjusted in the config, where it poses a problem. The default should be a good setting for ~80% of users. |
284c56d
to
e83415b
Compare
@merlimat Is 32 fine as a default, or should I change it to 16 in this PR? |
I now realised that public/default gets always created with 16 bundles, regardless of what the configuration of defaultNumberOfNamespaceBundles is. Bundles is hard coded to 16 when public/default gets created in cluster metadata setup: pulsar/pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataSetup.java Line 304 in 9905a9d
this gets called from this location: pulsar/pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataSetup.java Lines 265 to 266 in 9905a9d
The root cause of the problem where one of the servers was idling must have been caused by something else than the default bundles of 4 since public/default has 16 by default. I now checked with |
Yes, they should be getting split when the load increases, still it takes some time to converge to a reasonable number |
Note also that the |
Should this be considered for a PIP since we are changing a default value that can potentially impact users that would create a lot of namespaces? |
I'm closing this since the I had done the analysis of the problem incorrectly and the actual problem that load didn't get balanced was caused by the behavior of the Pulsar load balancer. |
Motivation
Currently, the default number of namespace bundles is 4. This leads to cases where a lot of topics can reside in just 1 or 2 brokers in 3 broker cluster.
Side note:
A good rule of thumb rule for defining the number of shards is to have at least 10x more shards than there are nodes (this 10x rule of thumb comes from Akka Cluster documentation). In Pulsar a "namespace bundle" behaves like a shard. In addition to this, there are some recommendations to use a power of 2 for the number of shards (reference to this recommendation not found).
From these rules, you could get that a 3 broker node cluster should use 32 bundles, a 4-6 node cluster 64 bundles and 7-12 node cluster should use 128 bundles.
This might not be the best advice, but I haven't seen better rule of thumb rules for choosing the number of namespace bundles.
Modifications
Change the defaultNumberOfNamespaceBundles to 32.