AmadeusITGroup / HttpSessionReplacer

Store JEE Servlet HttpSessions in Redis
MIT License
49 stars 33 forks source link

Add session stickiness to ZRANGE expiration management #16

Closed nbogojevic closed 7 years ago

nbogojevic commented 7 years ago

SortedSetSessionExpirationManagement currently doesn't support session stickiness expiry on correct node - expiry happens on first node that retrieves session id. The algorithm should be improved to handle it.

Currently each client starts cleanup task which triggers every 10s by default. This task loads expired session keys using zrangeByScore and deletes each session - the result is that the first one to take hold of session id would delete it even if it is not the owner.

We could change the logic so that we store session owner in the zrange, and then on cleanup task only delete sessions client is owner of. In order to assure cleanup when client goes away, we could look for elments in zrange that are too old (e.g. longer then task cleanup interval) and delete them even if we are not owner.

We'd probably need to handle session failover too.

nbogojevic commented 7 years ago

Solved in #20