Redis is perfect for storing sessions. All operations are performed in memory, and so reads and writes will be fast.
The second aspect is persistence of session state. Redis gives you a lot of flexibility in how you want to persist session state to your hard-disk. You can go through http://redis.io/topics/persistence to learn more, but at a high level, here are your options –
- If you cannot afford losing any sessions, set
appendfsync alwaysin your configuration file. With this, Redis guarantees that any write operations are saved to the disk. The disadvantage is that write operations will be slower. - If you are okay with losing about 1s worth of data, use
appendfsync everysec. This will give great performance with reasonable data guarantees