5

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 following to /var/www/app/etc/local.xml.

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

Any help is much appreciated.

user523513
  • 957
  • 1
  • 7
  • 8
  • 1
    Just a silly question: you did restart your server, didn't you? PHP ini directives are loaded when the PHP module is loaded, i.e. when the server needs that module for the first time. – user268396 Apr 19 '11 at 23:58
  • I'm running on MediaTemple's Gridserver, so there is no need to restart Apache. Supposedly changes take effect immediately. – user523513 Apr 20 '11 at 23:18

3 Answers3

7

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.

Jonathan Day
  • 18,519
  • 10
  • 84
  • 137
  • Jonathan, I confirmed the placement of the XML nodes and changed the string. I'm still not having much luck. I checked the PHPInfo file and APC is indeed showing up there. The APCInfo still isn't showing any hits to the cache, though. – user523513 Apr 20 '11 at 23:20
1

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.

Flo
  • 27,355
  • 15
  • 87
  • 125
  • This did it for me. A lot of 'install' instructions are old enough to predate the M/G suffix that's now required by APC. – gazarsgo Dec 27 '12 at 19:38
1

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?

demonkoryu
  • 1,247
  • 10
  • 27