Caching: memcached vs MySQL
By Rayed
Several month ago I researched caching methods to use with Alriyadh.com, it was essential because we used old and slow hardware.
The result of my test showed that MySQL based caching was superior to memcached caching.
I did a new benchmark comparing MySQL, PHP memcache extension, and PHP memcache class.
The text is done by fetching the result of a complex query 1000 times, and calculated the time it took using my bechmark library (link dead!), times in seconds:
Data Size | 11513 |
MySQL query no cache | 9.16003489494 |
MySQL query with cache | 0.545562982559 |
memcached extension | 0.376034021378 |
memcached class | 0.493839025497 |
It seems that memcached is actually faster than MySQL caching, even when using memcache class. (In my old test, MySQL cache support only text caching, i.e. no serialize and unserialize)