colinmollenhour / Cm_Cache_Backend_Redis

A Zend_Cache backend for Redis with full support for tags (works great with Magento)
Other
389 stars 142 forks source link

Fix 'load_from_slaves' option #115

Closed Xon closed 7 years ago

Xon commented 7 years ago

getRandomSlaveClient doesn't exist, note; the sentinel-and-slaves branch has a trivial merge conflict with master

colinmollenhour commented 7 years ago

Thanks, Xon! Have you successfully tested this branch by any chance?

Xon commented 7 years ago

@colinmollenhour I thought it was being used on SpaceBattle forums, but a miss-configuration it wasn't being used. I fixed this and currently https://forums.spacebattles.com hits the sentinel to locate the master redis instance. I tested failover since one node was experiencing significant redis latency spikes, and shutting down the master forcing another slave to be prompted worked.

I need todo some testing/work before the load_from_slaves option can be used. I tried naively enabling, and it resulted in a newly created session (backed by Redis) failing. My fix will be to use the master when Xenforo reads the session.

The sentinel support (less the load from slaves) code is being executed ~2.5 million times a day, so looks good to me!

colinmollenhour commented 7 years ago

I'm confused, are you using Cm_Cache_Backend_Redis as a session backend?

Xon commented 7 years ago

Yes, XenForo can use a Zend_Cache instance for the session store vs the database. It doesn't require (or use) php session locking.

colinmollenhour commented 7 years ago

Ahh. Just an FYI, if you do want locking or other advanced features like adjusting lifetimes for bots and such you might want to look at https://github.com/colinmollenhour/php-redis-session-abstract