.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.

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.

You will probably struggle to pinpoint the issue from top. You could install NewRelic Application Monitoring for PHP. This will highlight slow transactions and give you better insight into what's causing the high load.

I have no affiliation with NR but do use it on all of my servers/applications to good effect. I believe you can try it free for 14 days without a credit card.

Sorry this doesn't answer your issue specifically but hopefully will help you get to the bottom of it.