APC缓存碎片问题 [英] APC cache fragmentation problem

查看:273
本文介绍了APC缓存碎片问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个媒体网站上运行的APC(PHP缓存)运行PHP 5.3.3与3.1.4 APC与4GB内存一个CentOS服务器5(13 000天的访问)。在过去的几个星期,我经历了许多无法分配池内存错误日志中,常常网站会下降。

I'm running APC (php cache) on a medium website (13 000 visits a day) on a CentOS server 5 running php 5.3.3 with APC 3.1.4 with 4Gb of RAM. In the last weeks I'm experiencing many "unable to allocate memory for pool" errors in logs, and often the site goes down.

我觉得这个问题是在APC。从统计我看到缓存一两个小时后已满,破碎始终跳转到100%。这是apc.ini我的配置设置:

I think the problem is in APC. From the stats I see that the cache is full after an hour or two, and the fragmentation always jumps to 100%. This are my config settings of apc.ini:

apc.cache_by_default    1
apc.canonicalize    0
apc.coredump_unmap  0
apc.enable_cli  0
apc.enabled 1
apc.file_md5    0
apc.file_update_protection  2
apc.filters 
apc.gc_ttl  3600
apc.include_once_override   0
apc.lazy_classes    00
apc.lazy_functions  0
apc.max_file_size   1M
apc.mmap_file_mask  /dev/zero
apc.num_files_hint  0
apc.preload_path    
apc.report_autofilter   0
apc.rfc1867 0
apc.rfc1867_freq    0
apc.rfc1867_name    APC_UPLOAD_PROGRESS
apc.rfc1867_prefix  upload_
apc.rfc1867_ttl 3600
apc.shm_segments    1
apc.shm_size    512M
apc.slam_defense    1
apc.stat    1
apc.stat_ctime  0
apc.ttl 7200
apc.use_request_time    1
apc.user_entries_hint   0
apc.user_ttl    7200
apc.write_lock  1

从APC统计数据,我可以看到的缓存文件的数量是非常高的(40 000),这是由于phpBB和的MediaWiki缓存文件过多。我一定要prevent APC使用缓存此文件 apc.filters ?是否有解决问题的方法?

From APC stats I can see that the number of cached files is very high (40 000), and this is due to the plethora of cache files of phpbb and mediawiki. Do I have to prevent APC caching this files using apc.filters? Are there solutions to the problem?

推荐答案

您真的应该在生产服务器上设置apc.stat = 0,它将从实际去到IO来检查文件是否具有prevent APC被更改。

You really should set apc.stat=0 on your production server and it will prevent APC from actually going to the IO to check if the file has been changed.

还设置apc.slam_defense = 0,因为它是德precated

also set apc.slam_defense=0 as it's deprecated

检查出其他选项文档:<一href=\"http://php.net/manual/en/apc.configuration.php\">http://php.net/manual/en/apc.configuration.php

这篇关于APC缓存碎片问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆