繁体   English   中英

定影器过程php5使用大量cpu的cron作业

[英]fuser process php5 cron job using high amounts of cpu

我们正在每隔30分钟看到服务器的CPU峰值。 这很可能是由php5作业清理会话文件引起的。 这是从服务器上的/etc/cron.d/php5中获取的:

# /etc/cron.d/php5: crontab fragment for php5
#  This purges session files older than X, where X is defined in seconds
#  as the largest value of session.gc_maxlifetime from all your php.ini
#  files, or 24 minutes if not defined.  See /usr/lib/php5/maxlifetime

# Look for and purge old sessions every 30 minutes
09,39 *     * * *     root   [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -ignore_readdir_race -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete

在过去的版本中,这项工作似乎存在问题。 Ubuntu 11.10版本中存在一个问题,它占用大量CPU,但我们正在运行Ubuntu和PHP的更高版本。 这项工作对PHP有多重要? 我们可以停止该作业的运行或降低其优先级吗?

这是一个错误,它似乎重新存在于pmisc软件包中,但是当php5-apc起作用时,它也是php5的一部分。
这里有一个ubuntu错误报告和建议的workaroud: https : //bugs.launchpad.net/ubuntu/+source/php5/+bug/876387

09,39 * * * * root [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) -delete

还有Debian错误报告: https//bugs.debian.org/cgi-bin/bugreport.cgi? bug = 633100

我已经在debian wheezy上测试了解决方法,并且可以正常工作,尽管更新软件包会更好!

用find和fuse反复重复递归地在文件系统上抓垃圾是一个坏主意。

远离将会话存储在文件中,您将立即摆脱此问题和许多其他问题(如果尚未解决)。 如果您实际上没有将文件存储用于会话,则只需删除该行(或注释掉)即可。

暂无
暂无

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

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