So you’re about to be featured on some very high ranking website.
You’re worried that when all the visitors come rushing towards you, your web server is going to crash and burn. Well, you’re probably right!
Did you know that 95% of all websites on the internet are not able to handle more than 30 concurrent visitors the way they are setup?
Even worse still, most websites run off of either Shared hosting or un-tweaked VPS configurations that are not meant to handle many visitors in the first place.
You are completely right to start panicking about how you should handle all this traffic once it finally comes your way.
The funniest thing about most website owners is that all they want is to get more traffic, but once they do, they are not able to handle the load and with so many alternatives found online, once visitors see your site isn’t working, they will simply move on to the next one that does work correctly and never come back.
This means that you lost your chance and you have to start again at ground zero. Only thing is that now it’s even worse because your site has probably been de-ranked for not being able to keep up and your URLs that were advertised on the major site leading everyone to you has probably also been removed because someone found it to be a dead link.
Thankfully this guide will help you how to keep your web server or blog up when you get a traffic spike.
Types of Hosting
There are basically 4 different options available when it comes to hosting your website or blog.
- Shared hosting
- VPS hosting
- Dedicated hosting
- Cloud hosting
Ahh, the good old famous Shared hosting providers from back in the day, before the word “cloud” was used for everything.
Advertising that anybody can have a website for almost no cost whatsoever. Unlimited this, unlimited that, we even throw in a domain name for you if you pay for a whole year upfront. To be fair, it’s not a terribly bad option, that is, if you are alright with never being able to handle any type of traffic spike at all. Just remember that “unlimited” actually means “limited everything just most people won’t realise it yet”, and then there’s that small fact that every other person/website on the “Shared hosting” are all using the same server’s resources. So if you’ve got one “power user” or “abuser” then every other site will come to a complete standstill.
Let’s move on shall we?
VPS hosting is that comfortable in-between that pretty much any website could actually fit in. It’s basically a dedicated server partitioned into chunks so that more than one account/user/domain can use it.
If setup correctly, this can get you far. Potentially so far that you never need change at all.
It’s pretty simple really. You get a server with whatever specs you pay for (can afford), you rent it per month or year, it’s connected to a super duper fast internet cable and all the rest you need to do yourself!
Do you enjoy doing your own setups, backups, troubleshooting (unless you go for managed dedicated servers.. but it’s considerably more expensive..). Then this is the option for you!
The word “cloud” has found its way into the internet slang world over the past few years. The only probably is that nobody really realises what “cloud” actually means.
No it’s not “unbreakable”, no it’s not “indestructible”. It’s just plain old VPS type hosting with a different, much catchier name.
The only real difference between VPS and Cloud hosting is that Cloud usually has more bells and whistles thrown at it, such as things like Auto Scaling Groups, Load Balancers, Block Storage and all sorts of other things that you could actually not care all that much about.
So what’s the trick?
The trick is knowing what to tweak and where to offload things from the beginning.
It’s quite simple really.
A web server works as follows: it allocates as many “worker processes” to start as you want it to, each one of these takes up memory, each time a visitors lands on your website, one of these “worker processes” runs off and grabs the page data, performs any database querying etc and then renders the results to an HTML page. This is then given back to the visitor and so it goes on indefinitely.
For each visitor, a Timeout property and Keep-Alive property are adhered to, if these settings are adjusted or tweaked, then you will immediately see a change in overall performance when your server is being hammered by hundreds of thousands of requests from visitors browsers.
Caching assets and placing applications/tools such as Varnish, Memcached or equivalent in front of web servers will remove heavy loads from re-triggering the same content other visitors have already been provided with.
More often than not, the actual database of the website is the bottleneck and this can be resolved by either.
- Running the database on it’s own server, this way you will be able to add additional slaves/masters when needed.
- Optimising queries to run quicker by means of indexes, or tweaking/removing JOINs for less complex queries.
- Adding indexes to the most common queries to avoid Full Table Scans.
- Pushing recordset results to disk for commonly run queries.
Let us know if you are interested in a more complex and in-depth look at tweaking your web server to handle a much greater amount of visitors so that we can follow up with it.