How to do Session Transfer from one server to another in Haproxy

Hi All,

We have a haproxy that load balances two servers say app1 and app2 .
we had performed testing that and we are getting session expired error, the our case performed as:

  • Web Server
  • App1 and App2
    The load balancer HAProxy server for App1 and App2 unable to maintained session.

I will attach our haproxy config (App1 + App2) below:-

    log local2
    chroot      /var/lib/haproxy
    pidfile     /var/run/
    maxconn     4000
    user        haproxy
    group       haproxy
    stats socket /var/lib/haproxy/stats
    mode                    tcp
    log                     global
    option                  tcplog
    option                  dontlognull
    #option http-server-close
    #option forwardfor       except
    option                  redispatch
    retries                 3
    #timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    #timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000

#--------------   Start ------------
frontend haproxy_inbound
        bind *:1000
        mode tcp
        default_backend LB
backend LB
        mode tcp
        balance roundrobin
        cookie JSESSIONID prefix nocache
        server APP1 check cookie APP1
        server APP2 check cookie APP2

peers Mypeer
                peer LB1 
                peer LB2

Hi Ali,

Today we our vendor had done more test with Application load balance they found the application Load Balance unable to maintained the session for JBOSS ID.
Testing status App load balance server unable to maintained session as following:

Server Web1 = On

Server App1 = On

Server App2 = On

Can I ask if there is any way to keep/store the jboss session ID in both App1 and App2 at the same time?? if App1 goes down the second App2 can continue processing the same jboss session ID and retrained to the customer request.

thank you.

Hi Ali,

To be able to failover from one node to another session-wise, you’ll need to set up session replication on the JBoss servers. What JBoss version are you running?

Hi Sandmann,
the JBoss version now running is jboss-eap-7.1

thank you

Hi Ali,

On eap 7.1 you’ll need to use a High Availability profile to enable session replication. You’ll also need the sticky session config on the load balancer, which I believe is already in place.

hi Sandmann,

i don’t know, but the Vendor they are not co-operate with us to fix this. they all time saying that the issue with our software HAproxy configuration and we are the owner of this and we should handle it in any of cases -_-!!..
is there any solution using other loadbalancer software to provide us two feature one for load balancing and second sticky session to use it for two nodes front-end which is Web servers and two nodes back-end which is App servers???


Hi Ali,

If HAproxy need to be replaced, I would suggest Apache httpd webserver. Apart from being able to proxy the requests to the application, it does handle sticky sessions and load balancing.

hi sandmann,

thank you very much,
we can’t go with your solutions in this time because this will conflict with our resources.
The second solution but this is expensive … build a new hardware proxy like Citrix load balancer