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.
发布评论
评论(3)
根据我的经验,是的。我的系统中 APC 显示 100% 碎片,并且性能很差。我增加了 APC 的内存限制(在我的例子中增加到 200 MB,但我们有很多代码),足以给它一些宽松的空间。碎片下降到零,IIRC,服务器上的 CPU 使用率下降了 50%。
另外,请确保您使用 APC 附带的 apc.php 脚本来监视碎片/利用率。我们甚至编写了一个 nagios 检查来监视 APC,因为我们有足够的流量,当 APC 填满时,apache 会完全锁定。
这个故事的寓意是:为 APC 提供足够的内存,并监控利用率。
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.
碎片意味着 apc 经常从缓存中丢弃项目并添加新项目,并且很难找到足够大的连续块。
提高性能主要有两种方法:
另外,使用生存时间较短的 apc_store() 也是不好的,就像经常使用 apc_store() 进行覆盖一样。
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
Also using apc_store() with a short time to live is bad, as is overwriting using apc_store() often.
另请注意,apc.php 的图表似乎存在一个错误: http://pecl.php.net/bugs/bug.php?id=13146
Note also that there seems to be a bug with apc.php's graph: http://pecl.php.net/bugs/bug.php?id=13146