Uday Sawant
Uday Sawant

Reputation: 5798

How to de-fragment APC cache

Is it possible to de-fragment a APC cache or the only available option is to clear and rebuild it?
If we can't de-fragment it, is it a good idea to dump an entire cache clear it and then reload the dump? will this clear the fragmentation?

Upvotes: 5

Views: 4041

Answers (3)

Peter Nikolow
Peter Nikolow

Reputation: 1

There is alternative way. If you install somewhere file called apc.php with password (very important!) you can login on that site and flush opcode and user caches from there.

Upvotes: 0

Lysergia25
Lysergia25

Reputation: 144

On Debian 8, install APC:

sudo apt-get install -y php5-apcu

Then copy apc.php into your web root:

cp /usr/share/doc/php5-apcu/apc.php /var/www/html

Edit the file, modifying the ADMIN_USERNAME & ADMIN_PASSWORD.

Then visit the apc.php file in your browser, login, & hit Clear Cache.

Upvotes: -1

bokan
bokan

Reputation: 3692

APC store opcodes in ram. It has no fragmentation management.

The only way to deframent is to flush cache. Use apc_clear_cache() in php script. Or restart httpd.

Note that APC will have to rebuild its cache.

There should be no (or few) fragmentation if you give APC enough memory. Check my answer here to see how to guess the required ram What is causing "Unable to allocate memory for pool" in PHP?

Upvotes: 7

Related Questions