Magento + APCu caching issue. Site is slow and there is more cache misses than hits

By | January 12, 2018
Questions:

I have a Magento 1.7.0.2 installation running on LEMP Stack; Nginx + PHP-FPM (PHP v5.5.6 w/ APCu v4.0.2) + Percona.

I’ve configured my magento to use APCu caching like this:

app/etc/local.xml

<config>
    <global>
        ...
        <cache>
            <backend>apc</backend>
            <prefix>BDWEB_</prefix>
        </cache>
    </global>
    ...
</config>

and the APC is configured like this:

/etc/php.d/apcu.ini

extension=apcu.so

apc.enabled          = 1
apc.shm_segments     = 1
apc.shm_size         = 512M
apc.ttl              = 7200
apc.user_ttl         = 7200
apc.num_files_hint   = 10240
apc.mmap_file_mask   = /tmp/apc.XXXXXXX
apc.enable_cli       = 1
apc.cache_by_default = 1
apc.max_file_size    = 10M
apc.stat             = 1

and here’s the apc info page displaying the huge miss to hit ratio:

enter image description here

Any idea what might be wrong?

Answers:

We had the same problem. After days of changing things it was a simple solution.

In the local.xml file you have used

<prefix>BDWEB_</prefix>

for some reason Magento & APCu will only accept alphanumeric characters in the prefix so we found that dropping the underscore “_” solved our problems

Questions:
Answers:

APC settings seems to be fine. You can do next:

1) Clear var/cache in Magento web root folder.

2) Check, do you have enabled eAccelerator? If yes – disable it.

Btw, APC is not a good tool for Magento caching because Magento use built-in Zend-based cache.

Leave a Reply

Your email address will not be published. Required fields are marked *