简体   繁体   English

APC吹扫速率和碎片

[英]APC Purge Rate & Fragmentation

I have got a Magento running on Nginx, PHP-FPM, Varnish & APC setup. 我在Nginx,PHP-FPM,Varnish和APC设置上运行了Magento。

APC is running high on both fragmentation and purge rate. APC的碎片和吹扫率都很高。

Fragmentation increases in 2 hours >50% and slowly goes to 100%. 碎裂在2小时内增加> 50%,然后缓慢上升到100%。

Even more disturbin is the fact and Munin shows that the purge rate is almost in 100% all the time. 更令人不安的事实是,穆宁(Munin)表明清除率一直都在100%左右。

I tried to increase the shm size to 1G (APC normally uses about 200M of this, total RAM is 6G) which didn't help, as well tried to tweak the ttl:s without any luck. 我试图将shm的大小增加到1G(APC通常使用其中的200M,总RAM为6G),这没有帮助,还试图调整ttl:s,但没有任何运气。

Is there something in varnish that is causing the constant purging of APC? 是否有清漆引起APC的持续清洗?

Here is my APC.ini 这是我的APC.ini

extension = apc.so
apc.enabled=1
apc.shm_segments=1
apc.shm_size=1024M
apc.num_files_hint=10000
apc.user_entries_hint=10000
apc.max_file_size=5M
apc.stat=0
apc.enable_cli = 1
apc.optimization=0
apc.cache_by_default=1
apc.slam_defense=0
apc.include_once_override=0
apc.ttl=3600
apc.user_ttl=7200
apc.gc_ttl = 600

apc.php: apc.php:

**File Cache Information**
Cached Files    1053 ( 58.1 MBytes)
Hits    40172
Misses  1038
Request Rate (hits, misses) 102.26 cache requests/second
Hit Rate    99.68 cache requests/second
Miss Rate   2.58 cache requests/second
Insert Rate 10.41 cache requests/second
Cache full count    0

**User Cache Information**
Cached Variables    74 ( 1.2 MBytes)
Hits    374
Misses  5907
Request Rate (hits, misses) 15.59 cache requests/second
Hit Rate    0.93 cache requests/second
Miss Rate   14.66 cache requests/second
Insert Rate 0.18 cache requests/second
Cache full count    0

One trick I've found effective in keeping APC sane is to set gc_ttl to 600, as you have, but keep ttl at 0. This is less efficient and could theoretically cause stampedes on a very busy site, but it stops fragmentation building up. 我发现保持APC正常运行的一个有效技巧是,将gc_ttl设置为600,但是将ttl为0。这效率较低,理论上会在非常繁忙的站点上造成踩踏事件,但会阻止碎片堆积。 You also need to keep your purge rate down by making sure you're not placing too much stuff in the cache (ie allocate it enough memory). 您还需要通过确保没有在缓存中放置过多的东西(即为其分配足够的内存)来降低清除速率。

This may sound counterintuitive, but here's what happened when I switched to this approach on a server today: 这听起来可能违反直觉,但是当我今天在服务器上切换到这种方法时,就会发生以下情况:

缓存命中率碎片化净化率

This munin plug-in is great for monitoring how APC changes over time, much better than trying to decipher the apc status page. 这个munin插件非常适合监视APC随时间的变化,比试图破译apc状态页要好得多。

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

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