MichaCo / CacheManager

CacheManager is an open source caching abstraction layer for .NET written in C#. It supports various cache providers and implements many advanced features.
http://cachemanager.michaco.net
Apache License 2.0
2.33k stars 458 forks source link

Config a read-only Redis instance #282

Open hobojoe opened 4 years ago

hobojoe commented 4 years ago

Hi,

I am using AWS Redis service and I have a primary server and 1 readonly replica. In my app, most of the cache usage is readonly, so I tried to configure cache manager to have 2 instances, one for Write and another for Read.

But while instantiating the READONLY one, it fails with the message: "No writeable endpoint found"

Is there a way to achieve what I want?

My main purpose is that the replicas sit there only waiting for the primary to go down. I would like to use those to "free" some of the load of the primary node.

Thanks

MichaCo commented 4 years ago

That's not really supported, no. But, you can trick it by enabling the twemproxy setting I think, which disables a couple of features, including the check for writeable nodes.

You'd have to test that, I cannot really tell what else might throw exceptions

jasenf commented 4 years ago

I was just looking at doing the same thing. Using Redis on Azure, highly distributed instances of our app service, so they can't all access the same Redis server. We setup a cluster with many read-only servers. Unfortunately, all writes need to go do a specific server, while reads should come from the instances "local" Redis server. This would be very slick if CacheManager supported it and I can imagine used by many.