There are primarily two reasons why your website might encounter a sudden spike of traffic. The first is great; one of your posts went viral and is being circulated everywhere online. You’re pulling in hundreds of new backlinks and thousands of new visitors.
The second is the opposite; someone has taken it into their mind to crash your site via a Denial of Service attack. You’re not getting links from this one; you’re just getting traffic that eats up your server resources.
In both cases, the same sort of thing is happening on your server’s back end. Most web hosts have a finite amount of bandwidth they allocate to their sites each month. Traffic surges eat into this allotment and can very easily exceed it, if your hosting isn’t sufficiently scaled.
When your allotment of bandwidth is completely consumed, one of two things happens. Either your site is taken down until the end of the month, when bandwidth refreshes, or your site stays up and your host starts to charge you overage fees by the megabyte. The first can cost you a lot of money in lost profits; the second costs you a lot of money in overage fees.
The Denial of Service attack is more nefarious; it eats up your allowed connections at any given time, to force long load times or broken renders for your site. Legitimate users aren’t able to force their way in, so they can’t see your site at all. In some extreme cases, the traffic causes errors in the server that lead to exploits a hacker can use to gain access.
How can you prepare for, and deal with, a traffic spike that threatens to bring down your site?
You should attempt to create a lite version of your site to hold in reserve in the case of a traffic spike. This version should be very pared down. Strip out all unnecessary images and fancy scripts. Minimize the number of database calls that are necessary to load your content. Just make sure to avoid stripping out the content users actually came to see; don’t take down the infographic they’re swarming, for example.
One interesting option is to use a mobile version of your site. Mobile sites tend to be very lightweight because smartphone connections – and data limits – are generally small. This helps them load faster, but it also helps you minimize the impact of that traffic on your server.
A CDN is a third party service that hosts your content and serves it up when a user loads your page. This distributes some of the server load to other servers, which are specifically designed to be able to withstand a huge amount of traffic. A good CDN can be set up and implemented within a few minutes, but it’s not the best option for everyone. If you use site-wide SSL, for example, you have trouble serving third-party content.
You can distribute some of your content, whatever the users are flocking towards, on other services. Use Google Drive to share content without eating up your bandwidth. You can also contact other webmasters and create mirrors of your site, giving users an option until the traffic settles down.
Whenever possible, try to use lightweight file types. A compressed jpg, gif or png is going to be smaller than a large, high resolution image in other file formats. A document in .txt or .rtf will be a lot smaller than a .docx or a .pdf. The smaller your files are, the less bandwidth you use up each time a user loads your page.
Compressing an image to save 12 kilobytes may not seem like much, but if it’s a branded logo or part of your navigation, it loads on every page and subpage on your site. If a user loads three pages on average, that’s 36kb per user. Multiply that by thousands and you have megabytes of data usage saved every day. Large optimizations, like the pdf to rtf conversion, can save you megabytes per load.
Many web platforms, including WordPress, render and build content each time a user loads it. This means every time a user loads a page, every server call goes out and every file is loaded again and again. You can use server-side caching to alleviate this problem.
Server-side caching essentially creates a pre-rendered mirror of your page when a user loads it, and serves that pre-rendered version to a set of users until it expires, generally a sort time later. The cache refreshes occasionally, to ensure your site is as updated as possible. When no changes are made, a cache can significantly decrease the load on your servers.
Many web hosts allow you to pay more to upgrade your package at any time. Some have a delay before the change takes effect, while others are immediate. Web hosts typically have a vested interest in making sure their client sites are up as much as possible, so be sure to call your host and talk to them if a spike occurs.
Paying more to increase your hosting may not seem like an ideal option, but it’s better than your site going down or suffering through overage charges. Some popular websites, upon a viral release, can rack up $10,000+ in overage charges in a single day.
If you find that your web host does not work well under pressure, you may consider switching to a new web host. You can wait until the traffic surge dies down, or you can try to migrate in the midst of the chaos.
Without going so far as to create a lite website version, you can work to lighten the load your website causes. A lot of this will involve streamlining code, removing unnecessary code and hidden code that doesn’t matter. The biggest offenders are typically scripts and plugins that are no longer active or valuable, but were never removed.
A Denial of Service attack is typically on a whole other magnitude from a viral traffic surge. A DDoS is much harder to guard against, and typically requires quick thinking and dynamic blocking. A DDoS occurs from a range of IP addresses, but they typically all have similar behavior. A dynamic protection scheme can help ban IPs as they attack, so they are limited in their dangerous effects. This helps keep your site online and error-free.
Growtraffic.com is the leading pop-under traffic network.
Get thousands of targeted visitors for wholesale prices.