APC vs. Memcached revisited
22 02 2008In my previous post on the subject I stated that Memcache was faster at storing arrays than APC was by quite a large margin.
I will re-itterate that the 2 aren't really comparable in their target design. Memcached is designed as a distributed cache and as such is expected to be slower than APC. That said Memcached is still bloody fast and in my opinion one of the top server enhancement tools of the decade (as is APC, but I praise it more for its op-code caching abilities).
'Fail' responded to this and stated that I should serialize the array first (sorry, comments were not ported when I changed blog software), which I have since tried. It brings the APC store time down to a respectable 2 seconds from 13 seconds on the same testing environment. I guess my question now is: why doesn't APC serialize automatically when it detects an array?
Anyway it has helped massively with the caching methods I use now. I now go by the rule that small commonly accessed items (such as main menus) are stored in APC and larger items (such as articles) are stored in Memcache between multiple servers. I don't really worry if the data is a string, array or object.
I do intend to follow this up with a graph comparing APC, Memcached, file based cache and MySQL's query cache but that will take some time to prepare, mainly down to the fact that my laptop now has Ubuntu Hardy in it which has no APC build.
Categories : PHP
Trackbacks : No Trackbacks »




Trackbacks
No Trackbacks