开发者

How to force Magento to use APC cache

I just installed Magento Commerce on my hosting account and am getting fairly sluggish performance. To help speed up the site, I installed the APC cache but am having trouble getting it to work. I used these install instructions.

I followed all the steps and seemed to get APC installed. No problems. When I check APC.php, it only shows 1 hit and 1 miss to the cache, which can't be right... Making me think APC isn't active or being used.

I tried to ensure Magento uses APC by adding the follo开发者_运维知识库wing to /var/www/app/etc/local.xml.

            <cache>
                    <backend>apc</backend>
                    <prefix>alphanumeric</prefix>
            </cache>

Any help is much appreciated.


I suggest that you use a unique string other than "alphanumeric". That way if you are sharing APC with other users or applications, your cache will be differentiated.

Have you placed the xml nodes in the correct location in local.xml? The context should be like this:

  ...
  <session_save><![CDATA[db]]></session_save>
  <cache>
    <backend>apc</backend>
    <prefix>ReplaceThisWithSomeUniqueString</prefix>
  </cache>
</global>

Also, make sure that you did a rm -rf /var/www/var/cache/* after changing local.xml.


Check your server logs and look for segmentation violations. When you ever only see 1 hit/miss, it's a sure sign that each hit kills the server process. This is a problem with certain combinations of PHP and APC versions.

If you're using the mmap backend, try compiling APC again without mmap. (I often experienced crashes using the mmap backend.)

A question, do you use PHP 5.2 or 5.3?


I ran into the same issue. In my case I set the parameter for the max file size in the wrong way. I didn't append a M behind the value.

So instead of apc.max_file_size=10M I wrote apc.max_file_size=10.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜