-
1. Re: HTTP Session Failover in WildFly 11 for different machines
rhn-support-abhati Jun 28, 2018 6:11 AM (in response to almiller)HI,
Are you using UDP based clustering in your setup or TCP based.
For UDP based you need to define a multicast address while starting server like "./standalone.sh -u 230.0.0.5", please try this.
Also make sure that your network is properly configured.
-
2. Re: HTTP Session Failover in WildFly 11 for different machines
almiller Jun 28, 2018 12:13 PM (in response to rhn-support-abhati)Hi, thanks for your reply.
Tried again to run standalone servers with UDP based clustering:
on Machine A = 192.168.10.114:
1) >bin\standalone.bat -b 192.168.10.114 -u 224.0.0.1 -Djboss.server.base.dir=node1 --server-config=standalone-ha.xml -Djboss.socket.binding.port-offset=200 -Djboss.node.name=node1
2) >bin\standalone.bat -b 192.168.10.114 -u 224.0.0.1 -Djboss.server.base.dir=node2 --server-config=standalone-ha.xml -Djboss.socket.binding.port-offset=300 -Djboss.node.name=node2
and on Machine B = 192.168.10.7:
3) >bin\standalone.bat -b 192.168.10.7 -u 224.0.0.1 -Djboss.server.base.dir=node3 --server-config=standalone-ha.xml -Djboss.socket.binding.port-offset=250 -Djboss.node.name=node3
4) >bin\standalone.bat -b 192.168.10.7 -u 224.0.0.1 -Djboss.server.base.dir=node4 --server-config=standalone-ha.xml -Djboss.socket.binding.port-offset=350 -Djboss.node.name=node4
The result: Cluster is constructed as expected containing 4 nodes: [node1,node2,node3,node4].
But.. I'm getting same session id only for nodes 1,2 and 3,4 but not for 1,2,3,4. As far as I understand, having <distributable/> in my web.xml enables session replication and that's why nodes 1 & 2 share same session as nodes 3 & 4 do as well.
But how to make all of them share the same session?
Thanks!
-
3. Re: HTTP Session Failover in WildFly 11 for different machines
plohia Jul 2, 2018 6:49 AM (in response to almiller)Hi ,
Could you please confirm below :
1> Are you deploying the same application on both the machines ?
2> Please share me the configuration files .
3> Could you switch to TCP based clustering and check if it resolves the issue.
-Pranab
-
4. Re: HTTP Session Failover in WildFly 11 for different machines
rhn-support-abhati Jul 2, 2018 8:23 AM (in response to almiller)Hi Alex,
Can you please confirm if you have deployed same application on all 4 servers ?
Can you elaborate on this "But how to make all of them share the same session?"
If your cluster is formed with all 4 nodes in cluster, then the session id would be replicated and present in all 4 nodes.
You can enable TRACE logging and check in logs for the generated session id.
-
5. Re: HTTP Session Failover in WildFly 11 for different machines
almiller Jul 3, 2018 12:27 PM (in response to plohia)Hi,
1.Yes, same war file. All it's doing is answering rest GET http request and showing sessionid.
2. standalone-ha.xml for node 1(machine A) : https://drive.google.com/file/d/12BcEqLPCoCYX-9qO4CTuJbbNlk0jlGjn/view?usp=sharing
settings for another node on Machine B are almost the same, just the IP specified in <interfaces> is the one of Machine B.
3. switched to TCP, it's the same.
I'm wondering, this probably my lack of knowledge, it would be great if you could confirm and elaborate:
If we try to access our app via different nodes http://192.168.10.114:8180/simple-service-webapp/webapi/myresource/hello and http://192.168.10.7:8330/simple-service-webapp/webapi/myresource/hello, I'm getting different session id.
But if I hit: http://192.168.10.114:8180/simple-service-webapp/webapi/myresource/hello and http://192.168.10.114:8280/simple-service-webapp/webapi/myresource/hello (only the port is different), I'm getting same session id.
So, my question is why at all I expect to see same session id if we hit different urls? And why when the difference is only in port number it works? (port number is not considered part of url for server in order to decide whether to create new session id or not?)
If this is the issue, may be the solution would be to put a Load Balancer in front of app-servers and that way we would always hit the same url?
Thanks!!
-
6. Re: HTTP Session Failover in WildFly 11 for different machines
almiller Jul 3, 2018 1:00 PM (in response to rhn-support-abhati)Hi,
- yes, same war file was deployed.
- as I wrote in previous response:
I'm wondering, this probably my lack of knowledge, it would be great if you could confirm and elaborate:
If we try to access our app via different nodes http://192.168.10.114:8180/simple-service-webapp/webapi/myresource/hello and http://192.168.10.7:8330/simple-service-webapp/webapi/myresource/hello, I'm getting different session id's.
But if I hit: http://192.168.10.114:8180/simple-service-webapp/webapi/myresource/hello and http://192.168.10.114:8280/simple-service-webapp/webapi/myresource/hello (only the port is different), I'm getting same session id.
So, my question is why at all I expect to see same session id if I hit different url's? And why when the difference is only in port number it works? (port number is not considered part of url for server in order to decide whether to create new session id or not?)
If this is the issue, may be the solution would be to put a Load Balancer in front of app-servers and that way we would always hit the same url?
Can you refer to it?
p.s. Tried it. I put a load balancer (another wildfly on Machine A - undertow) in front of app-servers and try to access: http://192.168.10.114:8080/simple-service-webapp/webapi/myresource/hello (8080 - is the LB) and I'm getting same session id as when I hit: http://192.168.10.114:8180/simple-service-webapp/webapi/myresource/hello (directly invoking machine A, means that the request goes through machine A). When I try to hit http://192.168.10.7:8330/simple-service-webapp/webapi/myresource/hello (Machine B), I'm getting different sessionid.
But.. if I turn off app-server on Machine A, and try to access my app via LB I see that sessionid is kept although machine A is off which means that Machine B responded and sessionid maintained. Can someone confirm/elaborate if this is an expected behavior?
Thanks a lot!
-
7. Re: HTTP Session Failover in WildFly 11 for different machines
plohia Jul 4, 2018 3:18 AM (in response to almiller)Hi Alex ,
>> So, my question is why at all I expect to see same session id if I hit different url's? And why when the difference is only in port number it works?
I understand that it's not able to replicate the session among the machines , if the machines are in the different network it may be caused due to firewall issue.
Could you change it to TCP clustering and let me know if this resolves your issue.
-Pranab
-
8. Re: HTTP Session Failover in WildFly 11 for different machines
rhusar Jul 4, 2018 7:08 AM (in response to almiller)Your test is wrong. Think how browsers work: they can only send cookies to the same domain where they originated, so 192.168.10.114 and 192.168.10.7 are clearly different domains from browsers' perspective, so its not going to send over that cookie at all, thus its a new and different session.
You either need to setup a load-balancer or make both ip addresses resolve for the same domain (e.g. by editing /etc/hosts).
-
9. Re: HTTP Session Failover in WildFly 11 for different machines
rhusar Jul 4, 2018 7:10 AM (in response to rhn-support-abhati)If your cluster is formed with all 4 nodes in cluster, then the session id would be replicated and present in all 4 nodes.
Not entirely correct: yes, the session will be available on all nodes, but by default, WF11 uses distribution cache mode with default two owners, so the data will be physically always on 2 nodes. If accessed on a node which does not have the data physically, it will be fetched from a node which holds the data.
-
10. Re: HTTP Session Failover in WildFly 11 for different machines
almiller Jul 4, 2018 12:38 PM (in response to rhusar)Hi Radoslav, thanks a lot for your answer.
It confirms my concern "So, my question is why at all I expect to see same session id if I hit different url's? And why when the difference is only in port number it works? "
I'd like to summarize and it would be great if you could confirm:
1) Since we hit different domains (192.168.10.114 & 192.168.10.7) we end up with 2 different jsessionid's generated by wildfly. That's why we use Load Balancer to make server create one session id and reuse it when it's coming from another machine?
2) Regarding the ports difference and why it works, the fact that session id is maintained for 192.168.10.114:8180 & 192.168.10.114:8280 (same machine, different ports) means that browser doesn't distinguish between client requests coming towards different ports and this is an expected behavior (according to some RFC probably)?
Thanks
-
11. Re: HTTP Session Failover in WildFly 11 for different machines
almiller Jul 4, 2018 1:37 PM (in response to plohia)Hi, thanks for you reply
- It's in the same network
- TCP clustering gives same result.
I think Radoslav's answer exactly refers to the point why it happens (different domains).