Testing Redis for object-cache support
Plugin: https://wordpress.org/plugins/wp-redis/
Please note that this is dropin plugin.
We need to check how redis works as object-cache instead of using w3tc's memcache for object-cache and database-cache.
This Redis plugin provides only object cache. We need to disable w3tc's memcache for object-cache first.
Also, we may disable w3tc's memcache for database-cache. (Personally, I always felt that database-cache feature of w3tc is somewhat misfit)
I don't see any independent database cache plugin actively developed - https://wordpress.org/plugins/db-cache-reloaded/ and https://wordpress.org/plugins/db-cache-reloaded-fix/ are both outdated.
We can start testing on our sites first. If this works, we can add it to main EasyEngine in future.
Very nice idea!
I've tried redis as object cache in some past project, they're good. i have no benchmarked proof but, it perform better than page cache. the downside is, wordpress will miss scheduled post. don't know why. but if we don't need scheduled post, it is a great optimization.
@rahul286 - In my experience Query Cache, something that's native to MySQL/MariaDB/Percona, is more effective than db.php file routing & controlling the cache, so long as Query Cache configured to work through my.cnf.
From what I've read, they recommend turning on the slowlog to make sure latency isn't an issue for one, and also making sure /sys/kernel/mm/transparent_hugepage/enabled isn't active. Those two things aside, Redis seems to be the better option unless the only thing we're caching is small static data.
I need something to tinker with tonight anyway ;)
@iouxui Thanks for your inputs. I always felt dp.php is unnecessary. Glad to know somebody think alike.
MySQL query cache should be better at handling queries!
For manual setup: https://rtcamp.com/tutorials/wordpress/redis-wordpress-object-cache/ https://rtcamp.com/tutorials/php/redis-php-sessions/
my redis object cache recently got to the limit of how much ram i allowed it to use and using the default settings in redis.conf i started seeing problems in wordpress. first issue i saw was that people couldn't sticky and unsticky posts. the solution i found was to change the maxmemory-policy from the default volatile-lru to allkeys-lru. this seems to have fixed the sticky issue.
to test, you can change it on the fly without restarting the redis-server by doing:
redis-cli config set maxmemory-policy allkeys-lru
if all seems good make the same change in /etc/redis/redis.conf
Thanks for suggestion. :-)
On a customer site, we has some WooCommerce cart/session related issue with redis object-cache. I will test your workaround there soon.
i saw the same in tests, so i am unfortunately not running redis object-caching on my WC sites. but i would like to, so if you figure out how, make a big announcement.
i assume that it would require a plugin that does something similar to what W3TC does in the object-cache section where you can exclude certain things from being put in the cache. i also assume that someone smart enough with WP and WC internals could hack the object-cache.php file to exclude WC stuff, but i don't have that knowledge.
You should consider this plugin https://wordpress.org/plugins/redis-cache/ as it is better supported and is constantly updated :-)
This is a PPA if you want to use the latest version 3.0 for the moment https://launchpad.net/~rwky/+archive/ubuntu/redis and here is the thread for an "official" PPA. https://github.com/antirez/redis/issues/1732
Hey @solhuebner thanks for calling those out. I will give both a try. I did originally try that redis cache plugin when i first deployed redis, but at the time, I had problems with it, I think because I am running under HHVM. You can see my support thread with the author here. But I see that he has since incorporated support for the HHVM redis extension, so I will definitely give it a try again.
Hi @pjv please post how it works :-)
I installed both the redis cache plugin and the rwky PPA on my production server. Both seem to be working fine. The CPU usage issue that I had originally experienced with an earlier version of the wordpress plugin is gone. Server seems happy. Sites seem responsive.
Thank you for the update :-)
@rahul286 did you manage to fix the WC issues?
Thanks @solhuebner and @pjv for sharing your knowledge. :-)
We will try @solhuebner's solution manually on few servers and if all goes well, add it in EE core.
@solhuebner I never had any issue with WC and object cache so no idea about it. It seems @pjv ran into issues with WC.
@pjv did new solution work well on WC sites?
@pjv did new solution work well on WC sites?
I haven't tried object caching on my WC sites since the original problem. Mostly because I don't really feel like I have enough technical understanding of what is being cached when, where, and how so I am stuck with doing trial and error and I hate that.
If I have a chance, I'll give this setup a try on a test WC site and report back.
Preliminary good news: on the test WooCommerce server, I'm not having trouble with redis object caching using the new object cache plugin. My recollection is that there were shopping cart collisions when I originally tried it some months ago. One person would put five things in their cart and those five things would show up in someone else's cart. Very bad. But I installed the plugin and set everything up on the test server and then started making carts in 3 different browsers, putting stuff in, taking it out, moving all around the site, and I had no collisions and no problems of any kind.
So sometime when it looks like a good time, I'll give it a go on one of my production WC client sites and see if it works properly under real load. Would be nice to have object caching on the WC sites again.
@pjv thanks for sharing your result :-)
I came across another plugin today - https://wordpress.org/plugins/cache-buddy/ which really help us speed up buddypress sites. Some user reported speed increase for other non-buddypress "membership" sites.
If you have a buddypress or other membership site, where logged in users are making caching difficult, try https://wordpress.org/plugins/cache-buddy/ (I guess it works with object-cache only)