1 of 1 people found this helpful
I've configured session replication at the SET level to replicate the Session object in jboss-web.xml in my JBoss AS 7.1.2 deployment.
What is the motivation for changing? Using the default is a good practice (which includes also non-primitive gets).
How do I figure out where this session is being set with a (presumably) non-serializable object? Is there a way to determine from the logs, or is there some other way?
This can only be detected at runtime, so you would see NotSerializableException in your log (error level).
And a follow up question: I have two nodes in a cluster running on seperate machines. I have logged into one node as a user (creating a new session). I"ve then taken a heap dump of both processes. Which objects should I look at to verify that session replication is happening? Meaning, without a cluster only one node should have some HttpSession implementation, but with clustering both nodes should have this session copied. I see a few objects like StandardSessionFacade which are being created with Sessions, but these are not found present in the "sessionless" node.
I don't see this as a reasonable way of verification. I would run a test such as 1/ store something in the session, 2/ let it replicate and 3/ load the session on the other node. Verify the data is there.
Thank you for the response.
Regarding the session replication verification, why do you think this is not a reasonable way to verify, just out of curiosity? We are currently working on setting up our own load balancer on top of the clustered deployment, so we don't have a load balancer at the moment. Therefore, we'd have to do it some non-standard way. Is there any other way one could view the sessions in a running JBoss deployment that you might suggest?
Thank you again.
1 of 1 people found this helpful
Regarding the session replication verification, why do you think this is not a reasonable way to verify, just out of curiosity?
So your goal is to verify that failover of HTTP sessions work. Looking into heap will hint that the data is there and was replicated, but that does not mean that failover actually works. E.g. in case of a bug, even if the data were there, failover might not work.
Moreover, the internals are ever changing, so your verification process will differ from version to version, from container to container.
The way to test is to do a system test, where you simulare real life clients and real life failures and make sure that everything works. While at it, you should also perform a stress test.
We are currently working on setting up our own load balancer on top of the clustered deployment, so we don't have a load balancer at the moment. Therefore, we'd have to do it some non-standard way.
Why not use mod_jk or mod_cluster or if that is not possible, why not integrate mod_cluster management protocol with your load-balancer? See Mod-Cluster_Management_Protocol
Is there any other way one could view the sessions in a running JBoss deployment that you might suggest?
Take a look at Infinispan mbeans via JConsole (JMX) at look at the statistics. That should do.
Thanks again for the follow up.
I'm looking at the JConsole monitoring tool's Infinispan MBean. It has a Cache and Cache Manager node. In the Cache node, each individual cache has its own Statistics node with attributes:
The closest thing I see to session information is "numberOfEntries" which lists the number of entries currently in the selected cache, which grows with each session, but this doesn't give me any session info. Any other possible suggestions? I appreciate the help because the info in this MBean is actually very helpful for my end-goal regardless.
You can ignore the previous question. My main issue is the following: How can I access all the sessions that have been replicated?
For example, in node 1 several users log in so several sessions are created. How can I access these HttpSession implementations programmatically in Node 2? I see with JMX that node 1 has several active sessions, but node 2 has 0 active sessions until manually logged into.
How can I access all the sessions that have been replicated?
How can I access these HttpSession implementations programmatically in Node 2?
You can't. It would be a major security hole to allow a thread to be able to access a session that it does not own. This functionality was removed as of version 2.1 of the servlet specification: See http://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpSessionContext.html#getSession(java.lang.String)
The only way to access a session on node 2 (that was created on node 1) is to direct your requests to the address/port of node 2's web connector.
I am facing same problem, Can you please explain your answer. thanks
# JBoss AS 7.1.0 master and slave
# apache httpd mod_cluster
> Hit goes to master node , after login its still in the master node,
> when master node is down , load balance shift its server to slave but it goes to login page
> mean session is not properly replicated..
Please explain you answer in detail thanks.