[Update 2021] This approach is now very out-dated.
I’m working on a project where we’re in need of a cache inside Service Fabric. Now the cache doesn’t need to be durable just nice, quick and easy to use.
So I came up with the idea of running a Redis cache inside the cluster as a stateless service fabric service. The problem with this is that when the cluster re-balances the services between nodes I will lose the inmemory data in Redis (all of it). What I can do is set the movement cost set to ‘high’, to discourage the cluster from reallocating the service between nodes regularly and causing unnecessary loss of the cache. Great read on how and why the Resource Manager allocations services between nodes here, if you’d like to know more.
It’s worth noting that, if I wanted a durable cache, I could look at using Redis Clustering/Redis as a Service in Azure to prevent this occurring but for what we need it’s overkill.
Either way, I got this up and running and have shared the code here with a ReadMe going into more detail for others that are interested in having a play. Hope it’s useful!
3 thoughts on “Running Redis in a Service Fabric cluster”
Hey, nice article 🙂
One question: why did you choose to use Redis instead of having SF Durable Services/Actors?
Thanks, I was using redis pub/sub and didn’t have any spare time to re-architect
If you are thinking of running Redis in service fabric, you should first checkout this open source project:
you can also find it on GitHub here: