How to scale services listening to multiple exclusive queues.
I have an application/service which listens to 10 exclusive queues(let's say we have 10 apache camel routes, each route is listening to one queue) where we are receiving the ordered messages in each queue. I want to scale this service upto 10 pods/instances incrementally. But now I want to have only 2 pods, each listening to 5 queues.
When I do the deployment with 2 replicas/pods, will each pod listens to exactly 5 queues ? How does this work?
Let's say pod1 tries to connect to all 10 queues and succeeds, what about pod2? How pods will be given active connection to the queues?
How does solace ensure that pod1 has only 5 active/primary connections with 5 queues(q1-q5) and pod2 has active connections with remaining queues(q6-q10)?
Also, I am assuming the pod1 will act as standby for remaining other queues.
If I have 10 queues & 5 pods/instances, each pod will be subscribed to 2 primary queues and 4 pods will act as standby, can I control this number? for example I want only 2 pods to be as standby consumer.
Best Answer
Answers
-
Can some one through some light on this?
0 -
Hi @Mallu Golageri ,
With Solace Exclusive queues the first consumer to connect to each queue will receive the messages and the second will be standby on a per queue basis. This will most likely end up with the first app starting to be the primary consumer from all 10 queues. With the setup that you describe, the broker does not include logic to say "hey give this instance 5 and the other instance 5" so you'd have to build that into your app in some way. Of course there are several ways to do that….BUT before you go down that route if your publishers aren't already in production and you can still modify them you might consider using Partitioned Queues instead. From what you shared in your original post it sounds like it would fit your use case while providing an easier to manage and more robust solution for the future. 1 Partitioned Queue w/ 10 partitions & 2 consumers. The broker will then handle the balancing of partitions (which are actually each their own exclusive queue under the covers) across your consumers. AND if you eventually decide you need to add more consumers it will handle that for you as well.
Check out the docs here:
And @Aaron recently did some office hours here which are useful:
Hope that helps!
0 -
@marc Thanks much for the response. This is exactly what we are looking for but unfortunately our org is not upgraded yet to have these features in the solace version that we 're using currently. Can we achieve the same without partitioned queues? Currently we 're on 10.0
0 -
Can some one implemented sticky load balancing ? It will be great if one can help me understand the sample code to achieve this.
I came across this but still it's not clear.
0 -
Hi Mallu,
Partitioned Queues is exactly what will provide Sticky Load Balancing. I understand a few months ago that you are on SolOS 10.0. Partitioned Queues went GA in 10.4. Has your organisation upgraded to 10.4 (or later) yet?
0 -
@steve_chan , No, we have not yet upgraded to 10.4
0 -
@Paul Nash , Sorry actually my emails will not go to external emails. If you have sample github link a piece of code will help
0