Today, I’d like to start with a story. Bill is a website owner whose site is experiencing a period of unprecedented traffic. Unfortunately, his servers were ill-prepared for such a spike; unable to withstand the strain, they’ve come grinding to a halt. Suddenly, all those users who were discovering or visiting his website are instead being directed to an error page.
It’s a catastrophe. Bill knows full well that this has the potential to severely damage his site’s reputation; a fact made all the worse by the disheartening knowledge that this whole fiasco was entirely preventable. If he’d made the necessary preparations, he could have weathered the storm and enjoyed his newfound popularity – even if it was only temporary.
So, the next question is clear: how can you prevent this from happening to you? How can you prepare yourself for traffic spikes, while adequately predicting your average required capacity in the process?
Predict And Measure
Assuming you don’t already have an established infrastructure, the first step is capacity planning. You need to determine how much data your servers are going to be crunching on a regular basis before you do anything else. This depends on several factors:
- How large a user/client base you intend to serve. This will form the lower limit of your bandwidth requirements.
- How you plan to serve them (Email, blog pieces, file transfer, financial transactions, application development, etc.)
- Related to the above, how long each user will typically use your website or service before signing off.
- The size/complexity of your website/application platform. The more complex the interface, the less traffic a server will be able to withstand before it reaches its limit.
- How quickly you expect your website or service to grow. This will determine how much additional capacity you’ll require in order to scale with that growth. If you’re expecting extremely fast growth with a relatively small infrastructure, it may be worthwhile to look into cloud computing.
This information should be drawn from several different sources, including usage statistics for similarly-sized websites/platforms and your own personal experience. From all of this information, you should be able to accurately predict your scaling requirements, as well as how large your traffic spikes are likely to be. Note that I say “should” rather than “will.” This is because, depending on what sort of website or service you’re operating, it may be impossible to accurately predict overages; websites serving a large and relatively unknown audience will have a much more difficult time than those serving a known demographic.
Unfortunately, in the case of the former, ‘prediction’ may involve responding retroactively to an overage, scaling up capacity after the fact so you’re not caught unawares next time.
Test And Monitor
Once you’ve planned out your current capacity requirements, your next task is to determine potential bottlenecks. Where are your servers most likely to encounter site-stopping problems? For this, you need to have mapped out the components of your site. Pay particular attention to resource-heavy and/or high-traffic pages.
If you’ve the capability, set up a lab to stress test your servers. Monitor performance as you gradually increase processing demands, and note the levels at which your servers crash. If you’re not satisfied with the numbers, tweak your site/platform and try again.
Beyond the initial testing phase, you’re going to want to regularly monitor your network, paying close attention to any potential spikes in traffic. If you notice a higher than average influx of visitors, it may be time to start preparing your servers for a heavy load. Ultimately, the key here is to remain proactive.
That said, there are always a few points in time where it’s obvious you’re going to be dealing with high traffic; high-profile product releases, for example, almost always coincide with traffic spikes.
Manage Your Loads
Believe it or not, this is actually the easiest step in the process: either you can provision additional infrastructure, or you’ll predict and purchase or lease additional hardware that you can use to manually scale with demand. So long as you’re properly monitoring everything, you shouldn’t have much trouble here.
To that end, whether or not you’re provisioning additional infrastructure it may also be worthwhile to install automated load balancing software. This will ensure that traffic demands are distributed evenly throughout your network, while at the same time taking a fair bit of stress off of your own shoulders.
Beyond that, the only further advice I can give you is to make sure your website is optimized to load efficiently, constantly update your capacity estimations; and always, always, always remain vigilant.