开发者

Are Memcache and APC good together?

I have installed PHP5 - PHP5-MEMCACHE - PHP-APC.

Can they work like that together? Will the loading be fast with these modules ?

I tried to use them, I don't "see" particular differences, maybe the CPU 开发者_运维知识库is used less with these modules. My website doesn't have high traffic, but If i can save resources is better!

Thank you


APC keeps cache of PHP bytecode. Memcache keeps cache of your vars, that you set. So answer is Yes, they can. They're made for different things.


They work together very well, you just need to use them properly :

  • Memcached is a distributed cache system. What that means in a nutshell is that if you have a cluster of servers all of them can access the same cache pool
  • APC is an opcache and local cache system. Meaning it optimizes the php scripts so when going through the compiler less operations are made and the code is executed way faster. Another use of APC is local cache, which means you can store values in the cache and access them from the machine running the code.


Yes, they can work together. Whether they will on a production system is another story...

Personally, I had to give up trying to get the following to work for any extended period of time:

Ubuntu 10.04
NGINX 0.7.65
PHP 5.3.2
php-apc
php5-memcache

It will run for awhile, but after stress testing php errors out. I can restart php-fastcgi via /etc/init.d/php-fastcgi and things will role along for some time more, but it always crashes again sooner than later.

I can run either/or without issue, but the two together won't cooperate for me. FYI I tried using binaries (apt-get packages), installing as PECL extensions, downloading source, but all roads lead me to the same sad fate. I also tried running the memache daemon local & remotely on my web host, but same outcome.


I'm working on mmo game based on JavaScript and PHP. We are using both of them. I can't tell you more, beacause I am only frontend developer, however I think if APC and memcache were bad we were not using it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜