Search code examples
phpwordpressperformancesslcaching

How to fix performance problems?


Every 4-5 days my site gets hyper slow. About 2-3 minutes to load a page. And I can't find what it is.

  • I empty my source cache.
  • I empty my Cloudflare cache.
  • I check if an attack is going on (There are attaches all the time).
  • I shutdown the Cloudflare firewall.
  • I disable plugins.
  • I check the traffic.
  • I shutdown Wordpress heartbeat.
  • I shutdown Wordpress cron.
  • I ... And then, out of the blue the site is fast again. But I don't know what triggered that. It is shared hosting and loging is poor. So I can't check all errors. Could it be processor memory? Or a SSL mismatch between source hosting, GTranslate and Cloudflare handshakes? (Translated pages doesn't seem to be affected that much). I plan to migrate to VPS with PHP 7.4 but I have to do some re-coding for that. I am affraid that migrating a malfunctioning website results in a migrated malfuntioning website. So I like the fix the problem before I migrate.

Any suggestions?


Solution

  • As @amarinediary has already noted, it can be the hosting provider. But I'd like to add few suggestions on his point.

    Shared hosting, as it derives from their name, are literally sharing the resources of a server to every website that it hosts. They also have limitations per website, but it's not always controllable.

    If another website on the same hosting is being attacked by DDOS, it requires additional resources from the server, henceforth there's nothing left for your website. And if this is exactly what's happening, just feel free to migrate to VPS.

    But there's another important reason why this might be happening. And the funny thing is that few years ago that was exactly what happening to my website, and I broke all my brains to understand what that was. And it's very simple: Search Engines Robots. I see that you're quite proficient on that topic, so I won't explain you basic things about how they work, and why do they do that. But you see, when Google or any other SE is indexing your website, it requests every single page on it, and the effect may be exactly as if it would be DDOS. And it happens every 4 - 5 days, exactly as you described.

    What'd be solution to this? Give the website more resources and migrate to VPS. Or, if you want to make sure this scenario is correct, tell Google and other SE robots to make crawl less frequent. Add this to your robots.txt:

    Crawl-delay: 5
    

    This means that robots will request every page only once per 5 seconds.

    I plan to migrate to VPS with PHP 7.4 but I have to do some re-coding for that. I am affraid that migrating a malfunctioning website results in a migrated malfuntioning website. So I like the fix the problem before I migrate.

    The worst thing happens is that you receive the same website as it was before. In any scenario, VPS is a win-win solution. Feel free to (you won't regret it).