tlovett1 / simple-cache

A simple caching plugin for WordPress.
https://wordpress.org/plugins/simple-cache/
130 stars 34 forks source link

Redis vs Memcache speed #35

Open misiman opened 7 years ago

misiman commented 7 years ago

Hi and thanks for the plugin.

I am using SimpleCache for DB (not page) caching only and have done some analysis of Redis vs Memcache performance. My (simple) understanding of DB caching is that Redis is superior in its method of storing and retrieving cached items, but using Query Monitor I have discovered the following results:

1) 0.53S 44,571KB 0.0063S 67Q (dashboard, no cache, buddypress|bbpress) 2) 0.46S 37,618KB 0.0045S 49Q (homepage, no cache, buddypress|bbpress) 3) 1.60S 45,463KB 0.0054S 58Q (dashboard, redis, buddypress|bbpress) 4) 0.46S 37,869KB 0.0052S 50Q (homepage, redis, buddypress|bbpress) 5) 0.53S 43,075KB 0.0013S 10Q (dashboard, memcache, buddypress|bbpress) 6) 0.42S 36,118KB 0.0005S 3Q (homepage, memcache, buddypress|bbpress)

These tests were performed on a vanilla WP 4.7.2 running 2017 theme with BuddyPress and BBPress as test plugins because, combined, they contribute a notable load. SimpleCache was disabled/enabled between cache changes and each test was performed 3 times with the last result taken for each.

These results show that Memcache is significantly faster, outperforming Redis by several factors both in execution time and query count. Result 3) is very odd because it shows the Redis cache slowing Wordpress' dashboard down from 0.53s without any cache to 1.6s with?

Not sure if this information is useful or not, but I would very much appreciate an understanding of why the SimpleCache Redis implementation is so much slower than Memcache which appears to buck the general accepted suggestion to move from Memcache to Redis for increased speed and flexibility.

tlovett1 commented 7 years ago

Definitely a surprise. I don't have an answer but would love to hear one if someone figures it out.

mxmkmarquette commented 7 years ago

habitually for make it simple it's depending on what you want to cache, if it's big "object" or "data" you will preferably use redis, and if it's relatively small "object" or "data" you will go with memcached.

http://www.infoworld.com/article/3063161/application-development/why-redis-beats-memcached-for-caching.html

that what i learn from reading online but it's always depend on the scenario.