How to implement distributed Session in cluster deployment?

1. Tomcat + Redis 2. spring session + redis

(1) Tomcat + Redis uses the same code as before, which is based on tomcat’s native session support, and then uses something called Tomcat RedisSessionManager. In the Tomcat configuration file, Configure all our Tomcat deployments to store session data to Redis.

Sping session data is stored based on Redis, and then a spring session filter is configured. All session-related operations will be handled by Spring Session. Then in the code, we use the native session operation, which is directly based on Spring sesion to fetch data from Redis.