How much more efficient is php_apc than memcached?
There are various problems when using php_apc with symfony,
If the boost is not so significant,I'm going to replace apc with memcached开发者_运维技巧.
APC and memcached are not the same things :
Fisrt of all, APC has two roles :
- It's an opcode cache (which means each PHP page will generally require less CPU, as it remove the "compilation" part ; the first time we enabled APC as an opcode cache, CPU load on our webservers went from something like 80% to something like 40-50%)
- It's also a non-distributed data cache
- which means, if you have several servers, that each one of your servers has a local copy of the cache
- which also means there is a pretty low limit on the amount of data you can store in cache
And for memcached :
- It's only a data-cache
- It's distributed
- i.e. no limit on the number of servers in a memcached cluster
- i.e. no limit on the amount of cache you can have
You can use either APC or memcached, or both, as a data-cache (that's what we are doing on the project I'm currently working on : some data are cached in APC, and some others using memcached).
But, if you want some opcode cache, you'll have to go with APC (or eAccelerator ; but not sure it's well maintained).
See this please :)
Memcached is a distributed caching system, whereas APC is non-distributed - and mainly an opcode cache.
If (and only if) you have a web application which has to live on different webservers (loadbalancing), you have to use memcache for distributed caching. If not, just stick to APC and its cache.
You should always use an opcode cache, which APC is (also APC will get integrated into php6 iirc, so why not start using it now).
You can/should use both for different purposes.
精彩评论