We're currently using a single topic to publish me...
# general
s
We're currently using a single topic to publish messages intended for multiple customers. Since these are push-based messages, we want to avoid overloading customer servers by implementing rate limiting. Our idea is to introduce a message router that directs messages into customer-specific topics. This way, we can apply dispatch rate limiting on each individual topic, effectively controlling the push rate for each customer. The consumption rate from Apache Pulsar would then directly map to our push rate, ensuring we stay within safe limits. We expect to create approximately 30 customer-specific topics and are considering using a multi-topic consumer to handle them. Here are our key questions: 1. What limitations should we be aware of when using a multi-topic consumer in Pulsar? 2. How scalable is this approach? Is a multi-topic consumer suitable for handling around 30 topics? 3. What happens if we scale to 100 topics or more does the multi-topic consumer model still hold up, or are there recommended alternatives at that scale?
l
> Here are our key questions: > 1. What limitations should we be aware of when using a multi-topic consumer in Pulsar? > 2. How scalable is this approach? Is a multi-topic consumer suitable for handling around 30 topics? > 3. What happens if we scale to 100 topics or more does the multi-topic consumer model still hold up, or are there recommended alternatives at that scale? Pulsar Java Client's multi-topic consumer works well with hundreds of topics, perhaps thousands. The Pulsar Java client automatically shares connections to the broker and the number of connections per broker can be configured. For dispatch rate limiting there aren't issues in shared connections. (Pulsar publishing rate limiting has a limitation that it will throttle all traffic for producers and consumers sharing the same connection when any producer gets throttled. ) I believe that the model will scale well to 100s of topics. When using exclusive (or shared if order doesn't matter) subscriptions, there could also be multiple pods (application instances) consuming the same set of topics and using the same base configuration, but with different unique consumer name for the consumer. For exclusive subscriptions, Pulsar broker will attempt to balance the active consumers across different available consumers (based on the unique consumer name) using consist hashing. This typically results is fairly even consumption even though it's not real load balancing that considers the actual load. Key_shared subscriptions can also be used for multi-topic consumers when ordering matters. With shared subscriptions (no ordering requirement), the consumption is even without any additional considerations.
🙏 2
s
Thanks for the feedback, it's good to hear how good pulsar scales in these ways. We're going to implement this in our poc.
👍 1