Reputation: 1001
I need to know the number of active sessions in a Spring Cloud based application. It has multiple microservices, and Session information is shared using Redis (@EnableRedisHttpSession).
What would be valuable data to represent the number of active sessions? You'd think it is just the number of keys (Redis isn't used for anything else), but the keys count is a lot more - around 200, while there is maybe 20 active sessions in my test.
Thanks.
Upvotes: 1
Views: 2052
Reputation: 2389
You need the keys that match the spring:session:sessions:[session_id_uuid] pattern, where [session_id_uuid] is the Spring Session generated id of a session.
This is assuming you're not using a custom key namespace (EnableRedisHttpSession#redisNamespace
). If you do, you need to also take that into consideration so the pattern becomes spring:session:[namespace]:sessions:[session_id_uuid]
Upvotes: 1