Php – APCu – NO HIT and / or MISS. What am I missing

alternative-php-cachePHPphp5

I just installed php-pecl-apcu:

# yum info php-pecl-apcu
Loaded plugins: amazon-id, priorities, rhui-lb
4 packages excluded due to repository priority protections
Installed Packages
Name        : php-pecl-apcu
Arch        : x86_64
Version     : 4.0.4
Release     : 1.el7
Size        : 138 k
Repo        : installed
From repo   : epel
Summary     : APC User Cache
URL         : http://pecl.php.net/package/APCu
License     : PHP
Description : APCu is userland caching: APC stripped of opcode caching in preparation
            : for the deployment of Zend OPcache as the primary solution to opcode
            : caching in future versions of PHP.
            : 
            : APCu has a revised and simplified codebase, by the time the PECL release
            : is available, every part of APCu being used will have received review and
            : where necessary or appropriate, changes.
            : 
            : Simplifying and documenting the API of APCu completely removes the barrier
            : to maintenance and development of APCu in the future, and additionally allows
            : us to make optimizations not possible previously because of APC's inherent
            : complexity.
            : 
            : APCu only supports userland caching (and dumping) of variables, providing an
            : upgrade path for the future. When O+ takes over, many will be tempted to use
            : 3rd party solutions to userland caching, possibly even distributed solutions;
            : this would be a grave error. The tried and tested APC codebase provides far
            : superior support for local storage of PHP variables.

# 

While using apc.php (to see stats), I'm not seeing any HIT and / or MISS(.

This is what in my /etc/php.d/apcu.ini:

extension = apcu.so
apc.enabled=1
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.shm_size=128M

I can't figure out what am I missing, any ideas?

Best Answer

I have run into the same issue and I suspect the answer lies in the package description: APCu is userland caching: APC stripped of opcode caching

That is, APCu is not functionally equivalent to APC, and will not be used if your application isn't explicitly calling it to store its own data. What would usually fill the APC cache automatically would be compiled php code, which is now handled by opcache.

Related Topic