Diagnosing WP-Cron jobs locking up my server
I have two self-hosted WordPress servers load balanced and running the same three sites on both servers. For a while now, we have an issue where we either get unexpected CPU spikes causing one or both of the servers to lock up and freeze for a couple minutes, or a sudden drop and then spike in network traffic also causing the servers to freeze up.
Every time I have tried investigating the issue, the only clue I find is calls to wp-cron.php around the same time the issue occurs. I have no idea if this is actually the cause though.
How can I get more details on what jobs are being run by WP-Cron and also how long each one took to run, and any relevant logs I can look through? I’m desperately trying to fix this recurring issue and feel pretty lost right now.