For Developers: When to Choose a VPS
As a website owner, you’ve probably heard that Google is using your page load times as a metric in their ranking algorithm. It is not given a lot of weight, but even for usability reasons, having a fast website means having happier visitors (and more of them). With tools like Google’s Page Speed and the YSlow firefox addon, you quickly run out of optimization tips to do on the page level. You need to dig deeper for real speed gains.
If you are a web developer, this post is for you. It goes over some of the experience I had with moving Tutorialzine to and configuring a VPS (virtual private server), the logical step after shared hosting.
You may wonder why it took nearly two years for me to decide to migrate this website. Well, it’s because
Shared hosting is not a bad idea
Coming to think of it, the Internet Revolution didn’t occur because of Google, Twitter, nor Facebook, as much as it did for offering a cheap way for people to publish content online. And it doesn’t get much cheaper than shared web hosting – thousands of websites on a single server, utilizing every bit of performance and bandwidth. And every couple of years, as servers become more and more powerful, it is possible to host ever larger websites on that same cheap platform.
But then, why does shared hosting have such a bad reputation? It is actually a combination of several factors. Having learned to use Google before asking trivial questions, I didn’t need much support from my web host. On the rare occasions that I did (usually to report issues like downtime, unreachable database server or undelivered email), it usually took about 24 hours to receive a response. While this has more to do with the company itself than shared hosting, it is still part of the experience. But before judging too harsh, keep in mind that you can’t expect miracles for $5 per month.
There is another bad practice that nearly all shared hosting providers are guilty of – overselling. Going after maximum returns, companies cram more websites than what is possible for a single server to handle, in the hope that not everyone will be using what they are promised. The result – bad performance and frequent downtime. Of course, I have to admin that there has been good progress in this area in recent years, but it is because of the more powerful hardware, and not that companies have become nicer to their customers.
However, you can work around this problem – with WordPress plugins such as W3 Total Cache, I managed to optimize the page load times of this site, and with services like MaxCDN (which kindly sponsor Tutorialzine), I was able to increase the download speed of static files like images, stylesheets and JS files by moving them onto a fast delivery network. So as a result, I had livable performance even on a commodity web hosting provider.
The bad news is that this comes at a price. Although my website was as optimized as possible this still didn’t save it from
We’ve all felt the frustration when a favorite website is unavailable; it is even worse if it’s yours. Downtime is a clear sign that your oversold web host is struggling with the load. It is understandable, once you take into account the millions of pageviews it has to serve every day. But there is another issue that becomes clear once you try to set up your own LAMP server: commodity web hosts aren’t tuned for speed, they are tuned for security. Isolating users from one-another on a shared system is an absolute must, which means that no system-wide caching or other performance optimizations are possible. They also have to stick to the slow Apache, as it is the most feature-rich webserver that a lot of software (including WordPress) depends on.
Here comes salvation
The obvious choice is to ditch shared hosting entirely and move to VPS. This is your individual slice of a real server, over which you have complete control. You can choose the OS (most likely a server-friendly Linux distribution) and the software on the machine, so you can install pretty much what you want. It is more expensive than the $5/m hosting plan, but you get guaranteed performance and the freedom that comes with it.
Sounds exciting? Yes, indeed! So you order one, spend a couple of hours following one of the friendly getting started guides, fire up your browser and discover that your website is as slow as it used to be. But how come?! You followed all the steps, embraced the open source philosophy, and still it isn’t much better.
The bad news
It is easy to have a LAMP stack up and running, but it is hard to have it running fast. As a minimum you will need to be comfortable at the terminal, doing basic Linux administration, configuring web servers, setting up virtual hosts, email and dns, while at the same time keeping you system secure. With a VPS you are on your own. If you don’t have experience working with linux, or the time and energy to read and experiment as things happen (a quite debilitating task, trust me), you are going to have a bad time.
Moving Tutorialzine required several days of testing different configurations, installing software and tweaking. I also had to read about all the topics above and become familiar with a lot of command-line utilities. But was it worth it? Of course it was. I now have complete control on my set up and can install exciting software that I couldn’t have hoped to find on a regular web host. The site is also much snappier than before, which will benefit everybody.
How to decide
Choosing where and how to host your website is not easy. Right now there are a lot of alternatives to shared hosting that do not require you to set up your own virtual server. There are cloud platforms like Heroku and PHP Fog, or grid hosting solutions that aim to narrow the gap between VPS and shared hosting. If you don’t want to spend time on a command line, I suggest that you give these a try.
For me going with VPS was a natural choice, as I had already spent some time reading about linux, so it was about time to put the things I have picked up over the last year into practice. But I will not be cancelling my hosting account any time soon. It is still a nice fit for simple or low volume client websites.
What is your experience?
Have you tried any of the cloud platforms? Do you keep a hosting account lying around? Share it in the comment section.