-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] Add Redis Relay support #48930
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
Conversation
Ping @michael-grunder. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
What's the plan for cluser/array clients?
For the proxy, it'd be great to amend RedisProxiesTest.php to sync it if needed.
src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/VarDumper/Tests/Caster/RedisCasterTest.php
Outdated
Show resolved
Hide resolved
We're actively working on Cluster support, it will go into the 1.0 release in a few weeks. I'm not sure about |
My preference would be to not replicate As @tillkruss said, we're working on Cluster support now. Feel free to mention any quality-of-life features you'd like to see. |
Thanks for the hints. Another thing I'm wondering about is ext-redis v6: I'm seeing active dev on it. What's the plan related to that + relay? |
For now, I'm just making sure that the two extensions remain compatible. |
35462a6
to
8d7c7ba
Compare
All feedback addressed |
src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php
Outdated
Show resolved
Hide resolved
One thing I'm wondering is: did you consider keeping the same class names as phpredis? |
f0a0725
to
8ea5149
Compare
I've rebased the branch to solve the conflicts. Can we expect the merge soon? I promise I'll create a PR with migration to shivammathur/setup-php when they release the version ;) |
@michael-grunder @tillkruss any hints about my previous comment? Why a new set of symbols? Why not release as phpredis v5.4? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks!
We did, but that would mean PhpRedis no Relay can't be installed at the same time and easily switched between.
We did initially in 2020 consider this, but leveraging server-assisted client-side caching required starting from scratch, hence a separate name, new codebase, etc. PhpRedis has a lot of legacy junk that we didn't want to bring over.
People don't like change, PhpRedis will remain FOSS and we'll suggest users to move to Relay once 1.0 is out. Predis and PhpRedis will remain maintained of course, but who doesn't want a more modern, faster client ✌️ |
(rebase needed 🙏 + don't miss #48930 (comment)) |
afb9fd9
to
ad9c24d
Compare
done |
Psalm found 1 relevant issue (missing \Relay\ in \Relay\Exception) so I fixed that. Not sure what is a desired fix for the other issues though. I think ideally, here if ($this->redis instanceof \Predis\ClientInterface) {
$prefix = $this->redis->getOptions()->prefix ? $this->redis->getOptions()->prefix->getPrefix() : '';
$prefixLen = \strlen($prefix ?? '');
} before calling getPrefix, we should check if prefix is instanceof KeyPrefixProcessor. And for other issues, ProxyHelper should be fixed to account for missing magic methods in parent. I think none of these are related to this PR. |
Thank you @ostrolucky. |
…n (ostrolucky) This PR was merged into the 6.3 branch. Discussion ---------- Utilize shivammathur/setup-php to install Relay extension | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Follow-up to #48930 | License | MIT | Doc PR | This is possible since https://github.com/shivammathur/setup-php/releases/tag/2.24.0. A bit unfortunate timing since they tagged it one day after we merged relay, but no biggie. Commits ------- b2b0a75 Utilize shivammathur/setup-php to install Relay extension
@tillkruss I'm sorry but I didn't manage to find the source code of the Relay extension. Can you please let me know the link to it? |
@nicolas-grekas We haven't published the source of Relay, because of it's commercial tier. We may in the future. As for security, we've done code audits our larger customers in the past with, if that's something you'd like. |
This PR adds support for Relay, a next-gen Redis client written in C by the makers of PhpRedis and Predis. It’s built as a drop-in replacement for PhpRedis with a backwards compatible interface for easy adoption. Relay is significantly faster than existing clients by leveraging Redis 6's client-side-caching.
While Relay is still on 0.x (pending the addition of cluster support in a few weeks for a 1.0 tag), it’s interface is stable and it’s heavily used in production deployments.
Similarly, I've also added Relay support to most popular symfony redis bundle, snc/redis-bundle. But to be able to support these new Redis instances in Symfony components as a Cache, Lock and so on, support had to be added here as well.
Since method and constant declarations are compatible with PhpRedis, I've opted into reusing most of the code instead of creating completely new adapters, similarly as was done in case of Predis+PhpRedis. At the same time, I made it a goal not having to have PhpRedis installed in case somebody wishes to use Relay, which explains things like conditional fetch of value constants.