-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[10.x] Remove serializer and compression for RedisQueue #48180
Conversation
A bit concerned about caching off this connection on this class and what implications that has for long-lived applications like Octane, queues, etc. Is there a solution that doesn't require that kind of caching? Please mark as ready for review if you need my input again. |
@taylorotwell
I think that 2. would be easiest to realize. Don't know if there are other benefits for 5. Maybe @tillkruss could elaborate on that. Will open this for review just for your feedback, Taylor. |
if ($this->redisConnection instanceof PhpRedisConnection) { | ||
$this->redisConnection = $this->redis->resolve($this->connection); | ||
|
||
if (defined('\Redis::OPT_COMPRESSION') && $this->redisConnection->client()->getOption(\Redis::OPT_COMPRESSION) !== \Redis::COMPRESSION_NONE) { |
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.
OPT_COMPRESSION
is always defined.
if (defined('\Redis::OPT_COMPRESSION') && $this->redisConnection->client()->getOption(\Redis::OPT_COMPRESSION) !== \Redis::COMPRESSION_NONE) { | ||
$this->redisConnection->client()->setOption(\Redis::OPT_COMPRESSION, \Redis::COMPRESSION_NONE); | ||
} | ||
if (defined('\Redis::OPT_SERIALIZER') && $this->redisConnection->client()->getOption(\Redis::OPT_SERIALIZER) !== \Redis::SERIALIZER_NONE) { |
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.
OPT_SERIALIZER
is always defined, so is SERIALIZER_NONE
and COMPRESSION_NONE
.
$this->redisConnection = $this->redis->resolve($this->connection); | ||
|
||
if (defined('\Redis::OPT_COMPRESSION') && $this->redisConnection->client()->getOption(\Redis::OPT_COMPRESSION) !== \Redis::COMPRESSION_NONE) { | ||
$this->redisConnection->client()->setOption(\Redis::OPT_COMPRESSION, \Redis::COMPRESSION_NONE); |
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.
I wouldn't access \Redis
directly here, you can make $this->redisConnection->client()
a variable and reference the constant on it.
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 your input. Since I will have to change that code, I will wait for Taylors answer.
Maybe you can give me/us a hint why the MULTI (transaction) would be better than the currently used Lua script.
Thanks again!
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.
Because multi()
works with serializer and compression.
Honestly seems like we could just add note to the docs. |
I have same issue. Does this mean there is no way to use compression/serialize for one connection, and using queues on another connection? My current workaround is to use database for jobs, but it's not very scalable. So for me the nicest solution would be if it's possible to set diffent options per redis connection so the connection for queue jobs will not use compression. |
I see now that it actually worked to specify options inside the queue connection block. So I think that should also be added to docs that it's how you can solve it. So thanks SudoGetBeer for mentioning it as a solution, |
@cyppe could you explain more? |
I just mean I was not aware of the possibility to set 'options' specifically for one redis connection. I thought as all examples I can find is that options is in top of redis config block, and not inside each connection. So I had the same issue where queues did not work. But now I added options for my queue connection to disable compression only for that connection and now it works as expected. ` 'redis' => [
|
This PR should address #47356 and #47578.
Alternatively, maybe reference in the documentation that you should use a separate database.redis connection like that:
and then you can use that in the queue.php config file.
(First PR here hope I didn't miss anything)