Using too much CPU on HostGator?
CPU overages happen when your hosting plan has insufficient resources. CPU spikes can be caused by plugins, spammy bots, background tasks, bloat, incorrect CDN configuration, or a lack of good optimization. You can find HostGator’s resource usage policy on their TOC page.
A good starting point is to check your AWStats and error logs in HostGator and also run the Query Monitor plugin to identify slow plugins/queries. From there, you can work on specific items causing high CPU usage. Or if you’re not sure, you can do “general optimizations” like using PHP 7.4, offloading resources to Cloudflare, and other recommendations from this guide.
It’s well-known in Facebook Groups that HostGator is infamous for slow shared hosting and overcrowded servers. It simply can’t support heavy tasks (especially WooCommerce or slow page builders) without getting CPU issues + 503 errors. I use Cloudways Vultr HF and you can check my GTmetrix report. LiteSpeed is also a good option which you can get through someone like NameHero. Even if you don’t use those two recommendations, you should leave HostGator.
- Upgrade to PHP 7.4
- Offload resources to Cloudflare
- Block spam bots
- Enable Hotlink Protection
- Consider Cloudflare’s APO
- Enable crawler hints
- Limit WordPress Heartbeat
- Clean your database
- Invest in a premium cache plugin
- Eliminate high CPU plugins
- Don’t run WooCommerce on shared hosting
- Check for a slow TTFB
- Keep email/web hosting separate
- Replace wp-cron with a real cron job
- Check AWStats to find what’s causing high CPU
- Leave HostGator for Vultr or LiteSpeed
1. Upgrade To PHP 7.4
HostGator supports up to PHP 7.4 at the time of writing this while most hosts have released PHP 8.0. Upgrading to the latest PHP version can improve both your speed and memory usage.
Step 1: In your HostGator cPanel, click the MultiPHP Manager.
Step 2: Select PHP 7.4 (or latest version) and click “apply.”
Step 3: If you see errors, chances are you’re running plugins that aren’t compatible with the newer PHP version. You can run PHP Compatibility Checker or revert to an older PHP version.
2. Offload Resources To Cloudflare
Cloudflare has several features that can reduce CPU and speed up your website. Their CDN helps offload bandwidth to their data centers, plus they have APO, Argo, and other features.
To use Cloudflare’s additional features, you will need to set up Cloudflare manually. While it’s easiest to activate it in your HostGator account and be done with changing nameservers, this doesn’t give you access to Cloudflare’s full dashboard where you can make other optimizations.
It’s better to add Cloudflare manually by signing up through their website, adding your website to Cloudflare, then they will scan DNS records and tell you to update HostGator’s nameservers.
Login to HostGator and go to Hosting → Manage → Settings. You’ll see an option to manually set nameservers. Just delete your HostGator nameservers and replace them with Cloudflare’s. If you registered your domain somewhere else, you’ll need to change your nameservers there. By doing this, you’ll be using Cloudflare for your DNS which is much faster than most other DNS providers like HostGator and GoDaddy (you can compare their speeds on dnsperf.com).
Now you have access to Cloudflare’s full dashboard which has quite a few extra settings that can reduce CPU usage and speed up your site. Many of these are covered in this tutorial (bot fight mode, hotlink protection, APO, Argo), but you should also check out page rules and WAF.
In your Cloudflare DNS settings, change your website from DNS only to Proxied to activate Cloudflare’s CDN. Congrats! Now you’re already using Cloudflare for both your DNS and CDN.
3. Block Spam Bots
When bad bots hit your website or login page, they consume CPU.
There are many ways to block bad bots, but activating Cloudflare’s bot fight mode is probably easiest. You can use Wordfence’s live traffic report to see which bots hit your site in real-time, but I don’t recommend using Wordfence as a permanent solution since the plugin consumes CPU. Blackhole For Bad Bots is also solid but requires adding a rule to your site’s robots.txt file.
Bonus Tip: Use the Limit Login Attempts plugin. In case bots or attackers try to login too many times, they will be locked out to prevent CPU spikes and repetitive attempts.
4. Enable Hotlink Protection
Hotlink protection prevents people from copying your images and pasting them on their website which consumes bandwidth since you’re still hosting those images. This often happens if your site has high quality images (i.e. photography sites) but it happened to me too. You can either use HostGator or Cloudflare to enable hotlink protection (it can be activated in 1-click).
5. Consider Cloudflare’s APO
APO can improve TTFB while reducing CPU usage with full page caching. It’s $5/mo but worth testing. It’s compatible with some cache plugins (FlyingPress) but not with others (WP Rocket). Check your cache plugin’s documentation to make sure it’s compatible. Below are instructions.
- Login to Cloudflare → My Profile → API Tokens → Create Token.
- Click “Use Template” (use the “WordPress” option).
- Click Continue to Summary → Create Token.
- Copy the token which you’ll need later.
- Install the Cloudflare plugin.
- In WordPress, go to Settings → Cloudflare.
- Enter your Cloudflare email address and API token.
- Activate APO in Cloudflare under Speed → Optimization.
- In the plugin, click “Apply Recommended Cloudflare Settings for WordPress.”
6. Enable Crawler Hints
Crawler hints is another Cloudflare feature that can reduce CPU on HostGator.
It basically tells search engines when content changes on your website so crawlers can time their crawling more efficiently. This can be activated in Cloudflare → Caching → Configuration.
7. Limit WordPress Heartbeat
The Heartbeat API runs in the background and generates a request every 15-30+ seconds. While it can be helpful for showing real-time plugin notifications or when other users are editing a post, it can usually be limited or disabled completely. Many cache plugins have an option to disable/limit Heartbeat, otherwise use the Heartbeat Control plugin or do it manually.
8. Clean Your Database
Some cache plugins (kind of) do this, but you’ll want to install WP-Optimize to do a thorough cleaning of your database.
On top of the junk it removes (post revisions, trashed posts, etc) it also lets you remove tables left behind by old plugins. This usually happens when you install a plugin, delete it, then it leaves behind stored data. Go ahead and click remove next to all the plugins you’re not currently using.
While cleaning your database tables, you may notice some plugin features cause database bloat. Since some plugins are module-based (i.e. most SEO and page builder plugins), you can make sure you disable specific modules you’re not using so they don’t add bloat to the database.
9. Invest In A Premium Cache Plugin
There’s an endless debate about which cache plugin is best.
From my experience, you should ideally be using FlyingPress by Gijo (from WP Speed Matters) or WP Rocket. Yes, they cost money, but premium cache plugins usually do a much better job at addressing core web vitals and speeding up your site compared to free cache plugins. I recently moved from WP Rocket to FlyingPress and noticed a huge improvement when clicking through my posts. LiteSpeed Cache plugin is arguably the fastest, but it requires using a LiteSpeed host.
Once you’ve decided on a cache plugin, it’s critical to configure it correctly. I have several tutorials on WP Rocket, LiteSpeed Cache, and WP Johnny has one for FlyingPress. Some settings can increase CPU usage such as caching logged-in users and separate mobile cache.
10. Eliminate High CPU Plugins
Some plugins add extra CSS/JS to the frontend of your site while others run CPU-hungry tasks in the background. While neither are good, you want to avoid plugins impacting memory usage if you’re having CPU issues on HostGator. You can find slow plugins in Query Monitor (view the Queries by component tab) or see my list of slow plugins. WP’s Hive Chrome Extension is handy since it lets you browse the WP plugin repository and view which plugins impact memory usage.
Plugin | Category | Memory Impact | PageSpeed Impact |
---|---|---|---|
Analytify | Analytics | X | ✓ |
Backup Buddy | Backup | X | ✓ |
iThemes Security | Security | X | ✓ |
Broken Link Checker | SEO | X | ✓ |
Jetpack | Security | X | X |
Query Monitor | Analytics | X | ✓ |
NextGEN Gallery | Gallery | X | X |
Site Kit by Google | Analytics | X | ✓ |
Wordfence | Security | X | ✓ |
wpDiscuz | Comments | X | X |
WPML | Translate | X | X |
Yoast SEO | SEO | X | ✓ |
If you plan on using resource-hungry plugins, you will inevitably need to upgrade your HostGator plan. Their Business plan is better, their VPS is even better, but if you’re spending that kind of money, you’ll be better off moving to a different provider that uses cloud hosting.
11. Don’t Run WooCommerce On Shared Hosting
Never run WooCommerce on any shared hosting.
It requires extra scripts, styles, plugins, cart fragments, and you should ideally be skipping shared hosting all together. Using WooCommerce on shared hosting is a recipe for CPU issues.
12. Check For A Slow TTFB
High CPU usage usually leads to a slow TTFB which can be seen in PageSpeed Insights or KeyCDN’s Performance Test which measures TTFB in 10 global locations. Google flags this if it’s over 600ms, so if you manage to reduce CPU but TTFB is still slow, HostGator is the issue.
13. Keep Email/Web Hosting Separate
If you check your HostGator account and are exceeding the inode limit (200,000), it’s probably because you’re using your web hosting for email as well. There are many reasons not to do this, but your email can take up a lot of inodes (files) and also consumes resources. By keeping your web/email hosting separate, you’re dedicating your resources to only powering your website – not your email. This is why some hosts like Cloudways and Kinsta don’t even offer email hosting.
14. Replace WP-Cron With A Real Cron Job
HostGator has a tutorial on this and it’s pretty easy.
WP-cron can take up a lot of server resources and it’s a good idea to replace it with a real cron job no matter which host you’re using. To do this, Open your wp-config.php file in your main WP folder. Then add the following code before the line: /* That’s all, stop editing! Happy blogging. */
define('DISABLE_WP_CRON', true);
Now in HostGator’s cPanel, find the cron job section. Add a new cron job using the following code and replace https://yourwebsite.com with your own site. Set the cron job to run 2x/hour.
wget -q -O - https://yourwebsite.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
15. Check AWstats To Find What’s Causing High CPU
AWStats is found in the “statistics” section of your HostGator cPanel and can identify the source of high CPU. It tells you how much bandwidth is consumed by certain websites, bots, images, and other elements on your site. It’s also a good idea to check error logs in HostGator.
15. Leave HostGator For Vultr Or LiteSpeed
Cloudways Vultr High Frequency or NameHero (who uses LiteSpeed) are both solid options.
I don’t recommend using SiteGround because of their slow TTFB, Hostinger who writes fake reviews, and staying on HostGator is the last thing you want to do. I’m guessing you’re only using them because you’re in a contract. It’s not worth sticking around for when you can move your site and instantly get faster load times, better core web vitals, and no more CPU issues.
I use Cloudways (Vultr HF) who has always given me a fast TTFB and great GTmetrix results even on huge posts. You can click through my posts (most of them are very long) and they will load instantly. LiteSpeed is also popular which you can get through NameHero or A2 Hosting. I like NameHero’s Turbo Cloud plan which includes more RAM, NVME storage, and is still cheap.
Both have different setups. On Cloudways, I use WP Rocket + BunnyCDN. On NameHero or A2, you would use the LiteSpeed Cache plugin + QUIC.cloud CDN. They’re both great setups and should give you a fast TTFB, especially if you use my WP Rocket or LiteSpeed Cache guide.
You can read my Cloudways review or NameHero review. NameHero is easier (cPanel, A+ support, email hosting) while Cloudways is a little “techier” but gives you better control of your server and has way more data centers in the US, India, UK, etc. Cloudways has monthly pricing with a free migration while NameHero has a 30-day refund policy and also does free migrations.
I switched from SiteGround to Cloudways in 2019. My response times were 2x faster, I was paying 1/2 the price of what I was on SiteGround, and had no CPU issues or high renewal prices.
When in doubt, check recent Facebook polls and migration results (view more here).
How do I reduce CPU usage on HostGator?
The easiest way to reduce CPU on HostGator is to set up Cloudflare manually so you have access to their full dashboard which has other settings that can reduce CPU. You can also remove high CPU plugins, background tasks, database bloat, and use latest PHP versions.
What are HostGator CPU limits?
HostGator's CPU limits allow for 200,000 inodes, 5000 database tables, 10GB total database usage or 5GB database usage in a single database. These can be found on their terms of service page.
I hope this helped! Drop me a comment if you have questions.
Cheers,
Tom