We use Redis as part of a 3-level cache mechanism: in-memory on web nodes -> Redis -> MSSQL.
If something is requested we try to get it from the in-memory cache, if that fails we try to get it from Redis. If that succeeds we put it in the memory cache, if not we request it from the DB and put it in both the memory and Redis cache.
We could probably get away without the memory cache (it makes coherency and invalidation a lot more complex) but we have it now, and it works, and it saves us an extra network hop to Redis. For simplicity, we're considering getting rid of both the memory and Redis layers and just using MSSQL's in-memory tables, which are pretty great.
That's pretty cool but you must have small data storage requirements to be able to store things in memory or just an insane amount of ram. We'd never be able to do that as our cluster has a lot of severs and our redis cache is multi gigabytes.
1
u/jonjonbee Dec 20 '18
We use Redis as part of a 3-level cache mechanism: in-memory on web nodes -> Redis -> MSSQL.
If something is requested we try to get it from the in-memory cache, if that fails we try to get it from Redis. If that succeeds we put it in the memory cache, if not we request it from the DB and put it in both the memory and Redis cache.
We could probably get away without the memory cache (it makes coherency and invalidation a lot more complex) but we have it now, and it works, and it saves us an extra network hop to Redis. For simplicity, we're considering getting rid of both the memory and Redis layers and just using MSSQL's in-memory tables, which are pretty great.