PDA

View Full Version : GXT applications in clustered environment



akulkarni
2 Aug 2010, 6:03 AM
We have a GXT application that needs to be deployed on a clustered environment with 2 nodes with session persistence. We are seeing an issue: when node 1 sets something in the session, and node 2 tries to access, it gets a null. The session variable is of java.lang.Long type which is Serializable.

Anyone has deployed a GXT app in a clustered env. ?

sven
2 Aug 2010, 6:13 AM
GXT is clientside and is not linked to a serverside cluster.

Is it possible that your cluster is not sharing the session informations between its different nodes?

Colin Alworth
2 Aug 2010, 6:15 AM
This isn't really a gxt question, but a javax.servlet question - if you have two jvms running, and nothing making sure their Session objects are sync'd up, you are going to miss details if the user switches back and forth.

Ideas to consider:
- On your load balancing node, set a cookie to fixate a user to a single server so that you don't need to push session data to both machines
- Look into frameworks that share session-like data between running jvms - I've never tried to push the entire session to both machines, instead I look into db solutions that will solve the same problem. If you want your actual session object shared, look into something like http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html

akulkarni
2 Aug 2010, 6:19 AM
When a RPC call is made from the client side; the server side code would read some information from the session. Since the request may go to any node; we need to share the session information across different nodes.

akulkarni
2 Aug 2010, 6:24 AM
We are using the apache tomcat's session sharing framework; but the session information is not getting persisted across 2 nodes

Colin Alworth
2 Aug 2010, 6:28 AM
If session info is not getting shared, then it seems pretty clear that you are not using tomcat's session sharing, or at least not correctly. Having not used it, I can't help too much, and as this is a client forum and you have a server issue, I'd suggest you check out tomcat's user groups, either via mailinglist or irc. GWT's RPC mechanism is just a bit of reflection to make using a standard java servlet easier - there is nothing special going on that would stop the session from working.

If you need to demonstrate this to yourself, make a regular servlet or jsp that reads/writes to the session, and deploy it to multiple nodes - the issue should appear again. If in fact it _is_ a GWT bug, you need to file an issue at the GWT website, or ask someone in ##gwt on irc.