PHP high CPU usage - how to detect and best settings
How can I troubleshoot high CPU usage caused by PHP-FPM on a production server running PHP 8.1 on Ubuntu 22.04 when the same issue is not present on a development server with identical PHP settings? I setup correct values for pm_start_servers etc (https://thisinterestsme.com/php-fpm-settings/ following this)
4 cores, WordPress site with woo-commerce, and 8 GB ram. Ram usage around 30%)
The key difference between development and production servers is that on production you can have a lot of concurrent requests. Have you tried to determine if there's any specific PHP code that is consuming a lot of CPU when running concurrently?
not so much in this situation. When there was no visitors, i still get 100% CPU usage (4 cores, wordpress site with woocommerce, and 8 GB ram). Ram usage arround 30%)
could be anything but most likely a plugin, wp has internal tasks, so does woo, if you use Jetpack or vaultpress etc expect high CPU and network usage as they backup on every single db change including page hits etc by default, check for things like that, there is plugins to monitor whats happening inside wp tasks
thanks for the advice I just don't understand why that load isn't present on the dev server. I just want to figure out what is using that CPU power inside those PHP-fpm processes