Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to de-fragment APC cache

Tags:

php

caching

apc

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?

like image 544
Uday Sawant Avatar asked May 04 '12 10:05

Uday Sawant


1 Answers

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?

like image 115
bokan Avatar answered Oct 21 '22 10:10

bokan