Redis is the default implementation for Java's Spring session storage. But Redis is an in-memory value-key storage and sooner or later it will run out of memory. And once it does, it will do one of the following:
- Throws an error for commands requesting new memory
- Frees memory according to policy set in the configuration (
maxmemory-policy
).
I see that there has been some feature called Virtual Memory in Redis but it's been discontinued and since version 2.4, it's not available.
Is Redis capable of using hard disk as the backup storage when it runs out of memory or it's really a bad choice for session storage? Or maybe Redis relies on OS to use swap as the last resort?
I'm using Redis 3 and Spring session 1.1.1