so namespace bundles are how we support a large number of topics and that the granularity assignment we didn't want to track topic metrics at a very low level so we have this logical grouping of topics in what's called namespace bundles right so namespaces are as we talked about earlier you have tenants and you have name spaces the name spaces are it's a logical way of administering a large bundle of topics that are all related in some way they have same security policies and or data retention policies things of that nature and so that's sort of
another administrative unit inside pulsar and we use these namespaces to make sure that we you know keep track of this information install some information there so that is how and what name spaces do it keeps this information you know more more manageable rather than how to keep it at a low granular level now part of that is again to you take a namespace itself and all the topics inside of it and you split it into what's called what we call bundles right so if a namespace has a thousand Topics by default it's split up into
four bundles again that's a hash range and so in in theory roughly 250 topics are assigned to each one of those different bundles it's seemingly distributed and then a bundle is the unit of assignment to a broker right so a bundle a topic says hey you're not serving this topic it says hey you're serving this namespace bundle and this topic happens to reside inside of it right and so this allows us to just track uh this information at that level and then do load balancing based on that so if a bundle starts getting over balanced
then what we we do automatically what manually which is to split that bundle up in half uh roughly evenly and then that bundle one of those bundles is on the sign and it can automatically get reassigned to a different broker and this helps to balance out the load as well so again this is uh you can split it back up through multiple operations as well so again hash ring it's a namespace key and you're in this case the hash is the topic name within that namespace and it lands you on one of those however many
bundles you have uh and it gets assigned to that automatically and then that bundle is again grouped to a broker as well so uh and as you add more topics they will automatically land into one of those bundles uh and then that's that's how it happens automatically as you know as you add more topics or more Brokers you're going to need to add more bundles split by dividing the key space of an ex of a single existing bundle replacement with two new ones that cover that exact same key space and you can add bundles automatically
or by manually splitting basically I've got this many Topics in this half or I have 250 topics let's say I try to split it such a 125 are my you know one new bundle and 125 on the other new bundle and those get reassigned the other option is to say just split it evenly down the middle just zero you know zero to four then you get up with zero to two and two to four right it just sort of splits it even across those boundaries instead and you kind of hope that it ends up you
know readjusting back so there's two different options on that right so this is this is configured to happen or automatically this allows us to do auto balance and a lot of the broker organically scale and shift load and auto auto load itself so that one broker doesn't become overloaded uh and again Pulsar tracks the load at a bundle level on a topic level so it's a roll-up of all those different topics and then if a bundle crosses a threshold which is predefined inside Pulsar it says okay the broker is going to trigger to split that
bundle there it uses one of the two algorithms provided again we talked about equal hash range or you know equal number of topics and these are configured at the broker level whether you're enabled or not default to true and what's your name space bundle split algorithm is I think it's hash range equal is is the default on that and that's how load balancing has occur is is uh implemented and then it just then that again that bundle gets reassigned to another broker and the load shifts over to that guy and so the clients that are
connected we saw yesterday they get disconnected uh they go through that protocol pay you got to reconnect over here and start sending the messages again and that says all happens automatically for you