-
-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redis cluster refactoring #178
Conversation
hofrob
commented
Dec 17, 2018
•
edited
Loading
edited
Q | A |
---|---|
Is bugfix? | yes |
New feature? | yes |
Breaks BC? | no |
Tests pass? | yes |
Fixed issues | #147 #143 #142 #136 #135 #134 #66 |
Connections to redis are now pooled, to enable redirects without opening and closing connections during a request. If redis is running in cluster mode, it is possible to supply a hashtag for To test this locally I used a ready-to-use docker cluster container:
Put a PHP container with Yii in the same network ( |
I should implement some tests for this change. Probably by using the aforementioned docker container. But to be honest, I have no idea where to start. If someone could point me in the right direction, I'd be happy to get started. |
This PR would fix the problem you mentioned here: #147 (comment) |
Thanks for your work on this. I am planning to use a redis cluster in the near future and will review this PR when I get to that. |
I can give you an update from what we're using now. Turns out this solution works, but somehow it was the slowest of all the solutions we tried (our production env runs on AWS EB with extensive use of redis ElastiCache). Our requests were just about 10-15% slower than before. But it was noticeable. And yes, weirdly enough opening and closing the connections after redirects was faster. But I did not do any more research on that because.... We then tried the redis pecl extension. It supports cluster mode completely and we're now at about the same request duration we were before. To be able to use the pecl extension with
So I've not yet tackled this. I think it would be great if you could switch from |
That is interesting, especially for 3.0. |
@cebe did you have a chance to use Redis cluster? |
@samdark do you think we can get this merged soon? We are looking to use cluster Redis for our use case. We did test out the fork and it works with cluster redis config. |
Overall it looks OK. Some minor adjustments and changelog line are needed. |
Unit tests would be awesome as well. |
@hofrob would you please apply suggestions? |
1fd9d4d
to
44b9d17
Compare
Since this is a really old branch, is there a preferred way how to update it? I'd just rebase it (and then add the changelog). |
Either merging master into it or rebasing. |
multi get in a cluster with read replicas only works when the keys to be retrieved are allocated in the same hash slot https://redis.io/topics/cluster-spec#keys-hash-tags
separate option to turn off `multiGet` even when no read replicas are configured
suggestions by samdark
44b9d17
to
d1d78f9
Compare
d1d78f9
to
d6b3d87
Compare
After a quick look at the sources I'm not really sure how to configure/start/use a redis cluster for tests. |
Merged. Thank you very much! |
Not so quickly. Look how much time it took me to get to it and review/merge it :) @hofrob sorry for that btw. |