Very slow ‘Init Hook’ causes request delays
After moving my WordPress websites from one VPS to another, I noticed that administration began to randomly load very slowly.
There is no apparent reason for this – all requests load for > 15 seconds, suddenly after a few minutes they load in < 0.5 second. These cycles seem to be random and independent of each other amongst different websites.
After instaling Lap plugin, I noticed that it is the ‘Init Hook’ that is causing the delays. When the page loads fastly, the hook takes only a few milliseconds to finish. When it loads slowly, it takes about 95 % of the loadtime.
This sometimes happens on frontend as well, but mostly just in admin panel. It occurs in all of my installed WordPress instances. WooCommerce makes the delay even bigger, but it seems to me it just amplifies the issue rather than cause it.
I would be glad for any answer or hint how to fix this. I am not a WP expert so I have no idea how to debug this.
What could be a potential case of this problem is that Site Health says that backloop connection doesn’t work and causes a timeout. However my VPS provider says that it would be difficult to make backloop work, so I don’t want to spend a lot of time fixing it only to find out it wasn’t the cause.