简体   繁体   English

APC显示100%碎片

[英]APC is showing 100% fragmentation

APC is showing 100% fragmentation. APC显示100%碎片。 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. 提前致谢。

In my experience, yes. 根据我的经验,是的。 I had a system where APC was showing 100% fragmentation, and performance was bad. 我有一个系统,APC显示100%碎片,性能不好。 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. 我增加了APC的内存限制(在我的情况下达到200 MB - 但我们有很多代码)足以让它有一些松弛的空间。 Fragmentation dropped to zero, and IIRC, CPU usage on the server dropped by 50%. 碎片降至零,而IIRC,服务器上的CPU使用率下降了50%。

Also, make sure you're using the apc.php script that comes with APC to monitor fragmentation/utilization. 此外,请确保使用APC附带的apc.php脚本来监视碎片/利用率。 We've even written a nagios check to watch APC, 'cause we have enough traffic that apache locks up entirely when APC fills up. 我们甚至写了一张nagios支票来观看APC,因为我们有足够的流量,当APC填满时,apache会完全锁定。

Moral of the story: give APC enough memory, and monitor utilization. 故事的道德:给予APC足够的记忆,并监控利用率。

Fragmentation means that apc often throws out items from it's cache and adds new ones and has trouble finding large enough continous blocks. 碎片意味着apc经常从它的缓存中抛出项目并添加新的项目,并且无法找到足够大的连续块。

There are two main ways to improve performance then 那么有两种主要方法可以提高性能

  • Give more memory to APC. 为APC提供更多内存。 Ideally APC can store your complete scripts in memory. 理想情况下,APC可以将完整的脚本存储在内存中。
  • use apc.filter in php.ini to filter out files which aren't requested often or change often. 在php.ini中使用apc.filter来过滤掉经常没有请求或经常更改的文件。

Also using apc_store() with a short time to live is bad, as is overwriting using apc_store() often. 使用apc_store()并且生存时间很短也很糟糕,因为经常使用apc_store()进行覆盖。

[...] 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 另请注意,apc.php的图表似乎存在错误: http ://pecl.php.net/bugs/bug.php?id = 13146

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM