How to scale services listening to multiple exclusive queues.

Options
Mallu Golageri
Mallu Golageri Member Posts: 10 ✭✭
edited August 2023 in PubSub+ Event Broker #1

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

  • Mallu Golageri
    Mallu Golageri Member Posts: 10 ✭✭
    Options

    Can some one through some light on this?

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 920 admin
    Options

    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: https://docs.solace.com/Messaging/Guaranteed-Msg/Partitioned-Queue-Messaging.htm

    And @Aaron recently did some office hours here which are useful: https://solace.com/blog/partitioned-queues-autoscaling-microservice/

    Hope that helps!

  • Mallu Golageri
    Mallu Golageri Member Posts: 10 ✭✭
    edited August 2023 #5
    Options

    @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

  • PaulN
    PaulN Member, Employee Posts: 1 Solace Employee
    #6 Answer ✓
    Options

    Hi Mallu - hope you can join us for our upcoming user group:

    https://solace.com/event/solace-connect-user-group-bengaluru/

  • Mallu Golageri
    Mallu Golageri Member Posts: 10 ✭✭
    edited December 2023 #7
    Options

    Can some one implemented sticky load balancing ? It will be great if one can help me understand the sample code to achieve this.

    https://solace.com/blog/sticky-load-balancing-in-solace-pubsub-event-broker/

    I came across this but still it's not clear. https://github.com/solacese/solace-qookeeper

  • Paul Nash
    Paul Nash Member Posts: 1
    edited January 26 #8
    Options

    Hi Mallu - as you are with ******* - can you please reach out to me on paul.nash@solace.com and I will put you in touch with the right expert…

  • steve_chan
    steve_chan Member Posts: 3
    Options

    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?

  • Mallu Golageri
    Mallu Golageri Member Posts: 10 ✭✭
    Options

    @steve_chan , No, we have not yet upgraded to 10.4

  • Mallu Golageri
    Mallu Golageri Member Posts: 10 ✭✭
    edited December 2023 #11
    Options

    @Paul Nash , Sorry actually my emails will not go to external emails. If you have sample github link a piece of code will help