3 ms·
It depends on the use case. eg if you have multiple web servers and a lot to keep cached then it’s more economical to have one machine with a lot of memory tha
by tybit 8y ago
It depends on the use case.
eg if you have multiple web servers and a lot to keep cached then it’s more economical to have one machine with a lot of memory than each web server.
Another would be keeping the cache consistent, a single instance of Redis offers atomic operations and strong consistency. E.g ensuring rate limiting is correctly applied across a service’s instances.
Another would be decoupling state from apps which is especially important for serverless/FaaS where app memory is frequently cleared.
If latency is an issue it can be mostly resolved by using a 2 tier cache, an in memory cache that is backed by a Redis cache. Redis pub sub can then be used to keep the in memory caches in sync. Stackoverflow is a good example of this architecture.