24
02
2008
Not content with just creating PHP APC packages for Ubuntu Hardy, I have also created updates for the current Memcached and PHP5 Memcache packages as they are a couple of versions old now.
Again these should re-compile on 32bit machines with ease and probably Gutsy too.
Comments :
No comments »
Categories : PHP
Trackbacks :
No Trackbacks »
22
02
2008
In 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.
Comments :
No comments »
Categories : PHP
Trackbacks :
No Trackbacks »
06
01
2008
I have been benchmarking APC and memcached to find which is the best in certain situations. Obviously APC is a much faster cache but memcached is designed for scaling across servers.
The most interesting thing I found is APC is a lot slower at storing arrays than memcached. In most cases it is still faster at reading them. For example on my test virtual server, with 4k of text memcached will do 100,000 writes in around 4 seconds whereas APC will do 100,000 writes in around 2 seconds. If I instead try to store a small array with 8 elements memcached constantly does 100,000 writes in 4 seconds, APC however takes 13 seconds! This figure seems to grow exponentially as the array grows as well. Reads speed appears to be consistent for each with around 4 seconds for 100,000 memcached reads and 0.5 seconds for 100,000 APC reads.
In the application I was working on we are storing some large arrays and some small segments of data. The smaller segments of text data also changes a lot less often than the arrays so we are storing the small text data in APC and the arrays in memcached.
Note: I am not using current versions of either APC or Memcached for this, I know both have had a couple of new releases and both have had speed improvements.
Comments :
No comments »
Categories : PHP
Trackbacks :
1 Trackback »