1

How do we evict in-memory caches at different instances?

We have a scale-out architecture, multiple instances service requests simultaneously. Each one of them has in-memory cache attached to it.

We need eviction accross all instance, at once.

Why NOT Memcache/Redis or Other Provider? Calls to Redis/Memcache creates network latency. Apart from its speed, our data size is much smaller that can easily fit within an instance [Max 100MB]

Temporary Solution As a temporary solution, we have time based eviction, time being relatively lower 2.5Minute. But for 2.5 minute, It can each instance can serve own copy of data, that can lead to Inconsistency. How do we keys of cache at multiple instances at once?

Mohsin Mansoor
  • 155
  • 1
  • 1
  • 8
  • 1
    A common solution is to broadcast invalidations on a message bus. For example using Redis as a remote cache and its pub/sub to synchronize local caches. The right choice depends on your current infrastructure, desired infrastructure, and existing needs. – Ben Manes Apr 13 '18 at 14:35
  • ^ that's indeed a good solution. – MD Ruhul Amin Apr 13 '18 at 17:58
  • Redis is still a dependency that needs to be configured and maintained and yet it isn't primary purpose of redis. With single bus if one instance consumes that event, its gone. If we extend this idea to a bus per service and somehow insert that event in each queue, it can work. Is there any other idea that can work? – Mohsin Mansoor Apr 25 '18 at 18:46

0 Answers0