What does StackExchange.Redis do with configured masters / slaves?

I look at StackExchange.Redis and notice that it has functions to automatically detect which of the configured servers are the master and which are the slaves.

I was unable to determine what the StackExchange is actually doing with the configured masters / slaves. Does it always run commands on the Master and only use the configured slaves to fail over? Or is the answer deeper than this?

Any pointers appreciated!

+3


source to share


1 answer


The key point here is the CommandFlags

parameter for each method. However, by default, the majority PreferMaster

; note that write commands automatically go to DemandMaster

. However, if you want to spread the load, you can choose read commands (preferably expensive) for slaves via PreferSlave

and DemandSlave

.



Other things you will allow is to switch master (promote to master) - although this is naturally more invasive.

+2


source







All Articles