duanque2413 2017-06-15 14:24
浏览 228

.php-fpm-bin 100%CPU使用率。 如何跟踪导致它的确切脚本?

I'm hosting a wordpress blog and since 5th of June, I've been having a 100% CPU load (up from 5%), hosted on AWS.

enter image description here

Now, I've added many plugins, mainly the ones that do 20 mysql queries per page load per user. The problem is that I've added many scripts without realising the load, and I can't disable them.

Ideally, I would change the code, so that the CPU load is restored.

  • 写回答

2条回答 默认 最新

  • doutuan6158 2017-06-15 14:55
    关注

    Something I've seen cause this on wordpress, especially on sites with lots of plugins is wp-cron.php. It's a pseudo cron job that runs every request and as it does more and more, these jobs can queue on top of each other, never completing before the next round start and causing the CPU to get out of hand.

    In wp-config.php, you can disable this by adding the following:

    define('DISABLE_WP_CRON', true);
    

    However this will prevent certain things that were relying on it from working. So you can add a cron to the server to run every 5 minutes:

    */5 * * * * wget -q -O - "http://example.com/wp-cron.php" > /dev/null 2>&1
    

    If you're unfamiliar with cron, you can add tasks by running crontab -e in your server console.

    评论

报告相同问题?

悬赏问题

  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型
  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条
  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离