Exceeding your bandwidth limits on HostGator?
Bandwidth limits happen when your hosting plan doesn’t have enough server resources to accommodate your plugins, images, theme, and other things that might be causing high CPU. You can use AWstats (built-in to your HostGator cPanel) and the Query Monitor plugin to find the source, but this tutorial outlines the most common solutions (I had CPU overages myself).
Just a heads up, HostGator is terrible. They restrict CPU usage and have slow server response times. Just look at the Facebook polls or read some conversations in the WordPress Hosting Facebook Group. They’re owned by EIG and have gone completely downhill. If you want to stop exceeding bandwidth limits, this guide will help, but I would switch to SiteGround or Cloudways. I use SiteGround (you can view my GTmetrix/Pingdom report with <1s load times).
1. Upgrade To PHP 7.2
Upgrading to PHP 7.1 or 7.2 can make your site significantly faster, while reducing CPU usage. This is especially true if you haven’t upgraded PHP versions for awhile (or have never done it).
Step 1: In your HostGator cPanel, select the PHP Selector.
Step 2: Select a newer PHP version (the higher, the faster).
Step 3: Check your website for errors. If you see errors, chances are you’re running plugins that aren’t compatible with the newer PHP version. In this case, run the PHP Compatibility Checker plugin to see which plugins are incompatible. You either need to delete these plugins (and replace them with plugins that are maintained better) or revert to an earlier PHP version.
Step 5: Enjoy your website which should be much faster.
2. Offload Resources To Cloudflare CDN
Step 1: Sign up for Cloudflare (free plan).
Step 2: Run the scan and you will eventually come to a page with 2 nameservers.
Step 3: Login to your HostGator account > Domains > Gear Option > Change Nameservers.
Step 4: Replace HostGator’s nameservers with the ones Cloudflare’s provided you.
3. Control WordPress Heartbeat API
The WordPress Heartbeat API runs in the background of your admin panel automatically. It shows real-time plugin notifications, when other users are editing a post, and other resource-hungry tasks. This generates a request every 15-30 seconds, so it’s best to disable it to save on bandwidth. Install the Heartbeat Control plugin and set it to 60s, or better, disable it entirely.
Some cache plugins like WP Rocket have an option for heartbeat control.
4. Clean Your Database
A bloated database can slow down your website and also consume bandwidth. Install the WP-Optimize plugin and schedule it to run every 1-2 weeks, keeping your database nice and clean.
5. Use A Great Cache Plugin
All 3 are super important:
- If you’re using a cache plugin
- Which cache plugin you’re using
- Whether the settings are configured optimally
- Database cleanup (built-in to WP Rocket, or use WP-Optimize)
- Heartbeat control (built-in to WP Rocket, or use Heartbeat Control)
- Lazy load images/videos (built-in to WP Rocket, or use WP YouTube Lyte)
- Host Google Analytics locally (built-in to WP Rocket, or use CAOS For Analytics)
- Host Google Fonts locally (built-in to WP Rocket, or use CAOS For Fonts, or SHGF)
- Integration with Cloudflare + other CDNs (built-in to WP Rocket, or use CDN Enabler)
WP Rocket has more features than other cache plugins:
6. Configure Optimal Cache Plugin Settings
7. Eliminate High CPU Plugins
Too many plugins (or 1 single high CPU plugin) can skyrocket bandwidth usage. Common high CPU plugins include social sharing, statistic, backup, live chat, page builders, and related post plugins. You should either delete them, replace them with lightweight plugins (you may need to do research), or you will need a hosting plan with enough server resources to accommodate them. Thank you Ivica from the WordPress Speed Up Facebook Group for starting this list.
You can also use the GTmetrix Waterfall tab (or Query Monitor) to find your slowest plugins:
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 with SiteGround, Cloudways, Kinsta, or WP Engine).
8. Eliminate External Resources
External resources are almost inevitable. Embedding a YouTube video, a tweet, using a social plugin that connects to Facebook, Google Fonts, running AdSense… these will generate extra requests and will likely appear in your GTmetrix / Pingdom reports. Here are some quick tips:
- High CPU Plugins – many plugins from my list generate external requests.
- Gravatars – host them locally (WP User Avatar) or cache them (Harry’s or FV).
- Google AdSense – use Cloudflare’s Rocket Loader, workers, and using ad balance.
- Google Maps – only use them on pages you absolutely need them (eg. contact page).
- Google Fonts – host them locally using Self-Hosted Google Fonts or CAOS Webfonts.
Prefetch DNS Requests
In cases where you must use external resources, you can prefetch them. This helps browsers anticipate them and loads them faster. Luke created a nice list of common domains to prefetch including Google Maps, Fonts, Analytics, YouTube (when embedding videos), Disqus and more.
WP Rocket has an option for prefetching:
Otherwise you can add it to your header:
9. Serve Scaled Images
If you see serve scaled image errors in GTmetrix, it means you need to resize large images. GTmetrix tells you which images need to be resized and their correct dimensions, but it only shows unoptimized images for the single page you test. If you have common image dimensions (sliders, widgets, carousel, fullwidth blog images) you can create a cheat sheet with all their dimensions. Then crop/resize images before uploading them. This can save you time, and CPU.
10. Losslessly Compress Images
This means you need to lossless compress them (ShortPixel is great). Set the compression level, then optimize a couple images in your media library to make sure you’re happy with the quality. If yes, you can bulk optimize images, and automatically compress images upon upload.
11. Block Spam Bots
These are way more common than you think.
compute.amazonaws.com was hitting my site every 3 seconds and draining CPU on literally nothing. If you haven’t checked to see which bots are hitting your site, I would 100% do this.
Write down all hostnames that look suspicious and hit your site frequently. Google them, and see if other people are reporting them as spam. If yes, go to Wordfence’s Blocking settings (you can also use Cloudflare firewall rules) and block the spam bots here. Be sure to user an asterisk to block all variations of that bot. Check your blocking log and watch the bots get blocked. If your site was getting hit frequently by spam bots, this can save a LOT of bandwidth.
Wordfence also has rating limiting settings. This limits/blocks crawlers (and humans) from making excessive requests, blocks fake Google crawlers, and improves security on 404 pages. The settings below are the same ones recommended by Wordfence on their rate limiting page.
Another alternative, is to simply install the Blackhole For Bad Bots plugin.
12. Enable Hotlink Protection
Hotlink protection prevents people from copying your images and pasting them on their website, which consumes bandwidth since you are still hosting those images. This usually only happens if your website has high quality images (eg. photography). Follow these instructions:
- Login to cPanel and click HotLink Protection.
- Make sure the domain name you wish to protect is in the box called “URLs to allow access”.
- In the box called “Block direct access for these extensions”, provide the extensions for which you would like to block.
- We suggest you check the box for “Allow direct requests”.
- Skip the “Redirect request to this URL” box and hit Submit.
13. Check AWstats To Find Source Of High CPU
AWstats is built-in to the statistics section of your HostGator cPanel and can help you identify the source of high CPU. It tells you exactly how much bandwidth is consumed by bots, images, and other elements. Remember, you can block spam bots with Wordfence or the Blackhole For Bad Bots plugin, and you can optimize your images using tools like GTmetrix and ShortPixel.
14. Check Server Response Times
CPU and server response times go hand-in-hand. If you went through my tutorial and you still have high CPU usage on HostGator, you probably know what the problem is – it’s HostGator.
15. Get Better Hosting
They were rated very poorly in Facebook polls and people constantly complain about their slow server response times, bandwidth limits, and of course their bad support and uptimes.
I use SiteGround and have 200ms response times with 100% GTmetrix scores and .4s Pingdom load times. Do a hosting check, run your own tests, or click through my fast loading pages. They were rated the #1 host in 26 Facebook polls and are worlds better than EIG (Bluehost, HostGator), Godaddy, and other hosts who pack too many people on the same server. There have been plenty of people who migrated and posted results on Facebook and Twitter. Tweet after tweet, post after post, poll after poll after poll, faster hosting will fix slow response times. They’re recommended by WordPress, do free migrations, and I use their semi-dedicated plan.
SiteGround has 3 plans:
Higher plans include more server resources (#1 factor in the WordPress optimization guide). Here’s the full comparison chart, but GrowBig gives you about 2x more server resources than StartUp, and GoGeek is semi-dedicated hosting which gives you even more. GrowBig and up comes with a free migration, staging, advanced caching, and ability to host multiple websites. GoGeek comes with priority support. Their cloud hosting is quite the price jump at $80/month.
You can see this on the features page…
Read up for yourself:
Hope this helped.