APC is showing 100% fragmentation

Deadly 提交于 2019-12-21 07:05:41

问题


APC is showing 100% fragmentation. Is this bad?

Does it mean that it's not helping at all? What paths do I go down to improve situation?

Thanks in advance.


回答1:


In my experience, yes. I had a system where APC was showing 100% fragmentation, and performance was bad. I increased APC's memory limit (to 200 MB in my case -- but we had a lot of code) enough to give it some slack room. Fragmentation dropped to zero, and IIRC, CPU usage on the server dropped by 50%.

Also, make sure you're using the apc.php script that comes with APC to monitor fragmentation/utilization. We've even written a nagios check to watch APC, 'cause we have enough traffic that apache locks up entirely when APC fills up.

Moral of the story: give APC enough memory, and monitor utilization.




回答2:


Fragmentation means that apc often throws out items from it's cache and adds new ones and has trouble finding large enough continous blocks.

There are two main ways to improve performance then

  • Give more memory to APC. Ideally APC can store your complete scripts in memory.
  • use apc.filter in php.ini to filter out files which aren't requested often or change often.

Also using apc_store() with a short time to live is bad, as is overwriting using apc_store() often.




回答3:


[...] Fragmentation is what hurts performance, not the size of memory per se. But it also seems that fragmentation happens when memory is low [...]

Note also that there seems to be a bug with apc.php's graph: http://pecl.php.net/bugs/bug.php?id=13146



来源:https://stackoverflow.com/questions/2279448/apc-is-showing-100-fragmentation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!