Currently, cluster login sessions are handled in the following ways:
1. Session broadcast mode, that is, sessions in each Web container are copied to each other. When a container session changes, all other containers in the cluster are notified,
This method is easy to cause a broadcast storm (similar to a hub, depending on the implementation method, for example, the two methods). It is easy to configure and can be used for small-scale users in small clusters.
2. Centralized session management, modify container configurations, and centralize all sessions on the Cache Server (such as memcached, redis, or database). The memory processing efficiency is high, but all sessions will be lost when the server goes down,
The storage efficiency of databases is low, and most sessions can still be saved when the database goes down. For databases, choose MySQL or Berkeley dB. For example:
2.1 In some cases, the session cache server can only store login information, and write other data into cookies. However, the cookie is restricted and the design can be changed based on the actual situation.
3. Default session stickiness, that is, all requests are forwarded to one server until the browser is closed. Disadvantage: server downtime leads to the loss of all user sessions served on the server,
Applicable scenarios: Suitable for medium-sized enterprises (for example, TPS is 300-500 ).
How to handle cluster session sharing issues