php-lock / lock

Lock library to provide serialized execution of PHP code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Investigate best locking approach for Redis cluster with Predis sentinel

willemstuursma opened this issue · comments

Predis abstracts the multi-redis server setup, but this package can also take multiple predis connections and do the abstraction itself. Which one would be "better" for a locking package?

Hi. Your package is really good. I think that in case of predis cluster, we should use it's built-in functionality for abstraction. It's easier to pass one instance of predis, because you don't need to check if it's cluster or not, you just pass the instance.

I guess I first would have to define better. I would like to know, if there are some features we could use when handling the multiple connections ourselves vs. having Predis handle it.

We would need to investigate if using Sentinel allow us to continue working if one server goes down in the middle of the lock.

Partial cluster failure works perfectly with the PHPRedisMutex, todo investigate how this should work with the PredisMutex. I don't think it is realistic that multiple Predis\ClientInterface objects would be passed to the mutex, so we should try to get the distinct connections from the Client in the mutex.