Search code examples
phpcachingapc

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?


Solution

  • 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?