jPOS MUXPool as Load Balancer

As promised before, today i want to share about using jPOS MUXPool as Load Balancer. This is internal load balancer, so we don’t need to buy external load balancer. The idea is using two layer instance, the load balancer instance and worker instance.

The benefit when using MUXPool is, that when there are fault for example link down on Instance 1, MUXPool will automatically send the request with next available MUX.
In this post, i will share the MUXPool configuration. But, if you really need the source, you can contact me here

jPOS MUXPool as Load Balancer
jPOS MUXPool as Load Balancer

With jPOS version 1.9.2 MUXPool, there are two load balancing methods: Round Robin, and Primary Secondary methods. From the latest version, there are four type balancing you can find here

First, create two channel that using same configuration specs, but different destination port.
[xml]

client-channel-A.send
client-channel-A.receive
30000

[/xml]

[xml]

client-channel-B.send
client-channel-B.receive
30000

[/xml]

And then, create two mux that will use each channel adaptor.
[xml]


client-channel-A.receive
client-channel-A.send
client-channel-A.ready

[/xml]

[xml]


client-channel-B.receive
client-channel-B.send
client-channel-B.ready

[/xml]

We have to pay attention with in out for each mux and channelAdapter. And the MUXPool configuration just like this:

[xml]

client-mux-A client-mux-B
round-robin

[/xml]

That’s All the jPOS MUXPool as Load Balancer.. Hope this post can help you. Thanks for visiting my blog.

8 responses to “jPOS MUXPool as Load Balancer”

  1. demigod Avatar
    demigod

    Hi, so in order to use MUXPool as load ballance I should use

    MUXPool pool = (MUXPool) NameRegistrar.getIfExists(“client-mux”);

    instead of the usual

    MUX mux = QMUX.getMUX(cfg.get(“client-mux”));

    so the MUXPool will automatically manage the incoming request based on the registered muxes and the strategy defined?

    1. Didik H Avatar

      i use this line to get the mux.

      MUX mux = (MUX) NameRegistrar.get("mux.client-mux");

      Yes, MUXPool will automatically choose the mux of registered muxes to send request based on your strategy config.

  2. adhi Avatar
    adhi

    why not use

    on channel property?

    1. Didik H Avatar

      Sorry, i dont know that channel property can be used for internal load balancer.

      could you share the approach?

      1. adhi Avatar
        adhi

        true
        send
        receive
        ready
        10000

        1. Didik H Avatar

          Hi Adhi..
          So, how it work as load balancer?

  3. Frank Lawlor Avatar
    Frank Lawlor

    Very interesting. We are using jPOS 1.8.2. Will the MUXPool there work?
    Thanks.

    1. didikhari Avatar
      didikhari

      Yes, i think so.

Leave a Reply

Your email address will not be published. Required fields are marked *