is it possible to prevent concurrent modifications of a session when running multiple load balanced instances of an application?
Context: Multiple tomcats, all running the same application. The application uses spring session to store the sessions in a redis cluster. A load balancer distributes incoming requests to one of the tomcats (non-sticky). User hits Button, tomcat 1 processes the request very slowly (performance problem or whatever). User hits Button again, tomcat 2 is much faster and replies success. User proceeds to following pages. Tomcat 1 finishes the very first request and overwrites the session – the data of all proceeding pages is lost.
A solution would be to lock the session. Thereby tomcat 2 can detect the concurrent modification and reply with an error (much better than getting an inconsistent state).
Thx a lot AB