Closed (fixed)
Project:
Redis
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Nov 2016 at 12:21 UTC
Updated:
17 Dec 2020 at 00:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
geek-merlinTrivial patch flying in.
Using it in production here... awesome.
Comment #3
geek-merlinRobustified it.
Comment #4
pounardSeems a nice place to explore. How about the performance impact and how does it compare with igbinary ?
I want to see more numbers before adding this, although it remains an optional implementation, why not. Still, it makes it harder to debug by querying Redis directly.
See me some more figures and I might merge it! Thanks for the effort, I'll think about this on my side and talk to my colleagues while you gather some numbers :)
Comment #5
geek-merlinNo problem. Rethinking it, think this feature should not be coupled to a specific backend. Instead i'll make it a generic cache backend wrapper so also memcache and whoever folks can benefit from it.
Comment #6
idebr commentedRelated core issue: #1281408: Add a compressing serializer decorator
Comment #7
memtkmcc commentedWe have tested this patch in production on 46 various VPS-es since November 15, and it drastically lowered RAM usage, without any detectable CPU overhead -- see the screenshot attached.
Big +1 for adding this feature.
Comment #8
pounardIf more than one person is interested in this patch, I'm not against pushing it into the module, but it will remain an optional behaviour.
I'm do agree with Alex that it could be generic in someway and be applicable to any cache backend, but in the meantime, the patch is simple enough for me to be added to Redis.
I just need to plug unit tests with the compressed version to see how they behave and ensure there is no regression.
Comment #9
pounard@memtkmc Is the reported CPU usage the one of the Redis' server ? If so, PHP CPU usage would be more relevant.
Comment #10
memtkmcc commented@pounard It is a total CPU usage on production VPS-es with running PHP-FPM, Nginx, MariaDB, Solr/Jetty and Redis. We couldn't notice any difference in the overall CPU usage after enabling compression in Redis.
Comment #11
geek-merlinTHe interesting point is the uncompress time and as a rule of thumb i got ~100kb/ms so i decided tnis a non-issue for my use.
Compression time is a bit higher but this too is neglegible in most cases.
Comment #12
pounardOk, thank you both for your answers. I will add this optional feature and run some tests myself. Thank you again!
Comment #14
pounardOkay, stable enough for me. I did extends all unit tests to verify this works gracefully (only extended them with PhpRedis but it's a tranversal feature that should work with it too).
Alex, for the sake of consistency, I just mostly reformatted your code to my own conventions, but that's still your code and you're officially the author of this patch.
I added two variables for sites admins to control the compression behavior:
Thank you very much to all, this is indeed a very nice patch and idea, and we'll start using it ourselves on our not-yet-in-production projects.
Thanks again!
Comment #15
pounardRelease 7.x-3.13 is on the move, and will appear soon. You both have been credited on the project home page, thanks.
Comment #16
pounardComment #17
geek-merlinGreat work @pounard!
Comment #18
pounardThank you, but it is mostly your work!
Comment #20
slasher13Why was it removed in D8 version?
Comment #21
bceyssensHere's a port for anyone looking for this functionality in Drupal 8. To enable compression, add following configuration to your environment's
settings.local.php.If the maintainers find this useful, they can reopen this issue.
Comment #23
berdirPlease open a new issue, also the 8.x version already integrates with the igbinary project, see #2143149: PHPRedis and igbinary support for read performance and memory reductions..
Comment #24
ccjjmartin commented@bceyssens Thank you so much for your code. My test procedures were:
And results showed:
Before your patch
After your patch
That is a savings of 17.76M (or 68% memory usage) for just a single test page.
So to dive more into the theory behind this, while igbinary handles serialization of data it does not handle compression of data which is what the patch in #21 provides. This looks like a great commit for the D8 version, +1 on RTBC. I can't reopen this but have opened a new issue here: https://www.drupal.org/project/redis/issues/3188791
Comment #25
ccjjmartin commentedOk, while the patch here works it looks like this is the issue that ultimately added this feature to D8: https://www.drupal.org/project/redis/issues/2991121
Dropping it here for anyone who needs it.