Description
We have a strong requirement to use sticky sessions, because when content is written to our backend repository there is some asynchronous technology to update other cluster nodes. So only with sticky session it is guaranteed that the writing user can immediately on the next request read the updated content.
Therefore we are currently using the DefaultCookieSerializer and specify a jvmRoute similar to how it is done at Tomcat. However we would like to also provide failover support, so that when a server goes down, another cluster node is taking over the session. As the session is stored in Redis this is perfectly possible. However the problem we are facing is that now the session with the jvmRoute in the cookie still points to the node, which has been shut down.
Lets say I had servers with jvmRoute node1, node2, node3 and then node3 goes down. What happens next is that suddenly the requests will arbitrarily be sent to node1 and node2 (like non-sticky), whereas we would like that the requests of the session continue sticking always to the same server. For that it would be necessary to create a new cookie with the jvmRoute of the new cluster node, which will now continue working on that session.
When using Tomcat PersistentManager this problem is solved by using the org.apache.catalina.ha.session.JvmRouteBinderValve. How could something like that be best solved when using Spring Session?