colinmollenhour / Cm_RedisSession

Redis-based session handler for Magento with optimistic locking
208 stars 121 forks source link

Load From Slaves? #151

Closed awilsonCurt closed 6 years ago

awilsonCurt commented 6 years ago

I was just wondering, is there anything in this library that would enable the functionality that Cm_Cache_Backend_Redis has in terms of writing to a master, and reading from slaves? This option has greatly helped performance for us in the other library, but we unfortunately can't get the same benefit from this one. Are there any plans to include this feature in Cm_RedisSession?

Or perhaps could I get the same thing from switching our master/slave setup to be a sentinel setup?

colinmollenhour commented 6 years ago

The problem is that for locking to work well the reading kinda needs to happen on the slave. I haven't tried it so in practice maybe it would not be a major issue, but even the slightest slave lag would introduce potential for inconsistent data since this relies on atomic operations (INCR). Perhaps the locking could happen on the master and the reading of the data from the slaves but then you are just increasing the number of connections.

awilsonCurt commented 6 years ago

You know, that's a really good point that I hadn't thought of, the locking does make it difficult to argue for. I think you're right, the increase in connections would pretty much negate any benefit from loading from slaves.

Thanks for the quick response, I didn't even notice until today that you had responded almost immediately.