January 9, 2012

Cloud Hosting for ZEROES


What is cloud hosting?

If you run a website, there are two kinds of cloud computing you might have heard about: cloud servers and cloud-based content delivery networks (CDNs). What are they, how do they work, and what benefits do they bring?

Cloud servers

Traditionally, web hosting came in two flavors: high-cost managed hosting, in which you have your own private server (an actual computer!) dedicated to running only your website and its applications, and low-cost shared hosting, where your site and apps run on a large server with a number of other sites operated by other people. Now there's a third option, widely marketed as cloud hosting in which your site runs on a virtual server somewhere up in the cloud; depending on how it's set up, a cloud server might be an actual computer, but it's just as likely to be a chunk of a much bigger machine—as with other kinds of cloud computing, the point is that it shouldn't matter either way to you as an end user. Rackspace's Cloud Servers, Liquid Web's Storm on Demand, and Amazon's Elastic Compute Cloud (EC2) are three examples of this kind of cloud hosting—and there are many more.

An example cloud server

So what's a cloud server like in practice? It's relatively easy to sign up to cloud services and see for yourself. With Storm on Demand, one of the cloud services I've used, you simply create a billing account and then tick the kind of server you want from a list of common examples (running from 1GB memory and 1CPU up to 96GB memory and 32 CPUs). Then you tick the "server image" (essentially the software you want on the server at startup, including the operating system) and specify whether you want a managed or self-managed server. Finally, you specify whether you want backups of your data and how you'll pay for bandwidth (either in large, specified blocks of GB or per GB used). When that's all done, you click to create the server and it's all "built" for you, on the fly, in a matter of minutes.
You can scale up or down any of the parameters you've chosen at any time (so at a time of peak demand—an end-of-season sale, perhaps—you could double or triple the power of your machine for a week or two before scaling back down again when traffic returns to normal).
Once the server's created, you can configure it in the usual way (just like a physical server) with software like WHM and cPanel—or however you wish. If you decide you no longer want your server you can destroy it just as easily, and you simply pay for what you've used (an hourly rate for the server and a per GB rate for the bandwidth). It's extremely easy to use. Even with only previous experience of shared hosting and no previous experience of WHM whatsoever, I had this website up and running on a Storm cloud server in a couple of hours.
Photos: Liquid Web's Storm on Demand allows you to set up a cloud server in a matter of minutes, simply by ticking a few boxes. Every aspect of the service is pay-as-you-go. It's easy to use even if you have little or no experience of setting up or managing dedicated servers.

Cloud servers or virtual servers?

How do cloud servers work? The important thing to remember is that "cloud server" is essentially a marketing term and not a technical description or explanation. Hosting products described as "cloud servers" are generally virtual slices of large, physical servers running what's called virtualization software(the most common types being VMware® and Xen® hypervisor for Linux and Microsoft® Hyper-V™ for Windows). In other words, they are effectively "virtual servers" (entirely independent virtual machines) running on a real, physical server. How is that different from shared hosting? The virtual servers are essentially independent of one another (though they do use the same processors and memory), so you're not at risk from other people's applications or websites. You have full root access to your virtual server (unlike on shared hosting, where different users' files are simply subdirectories of a single server running a single operating system), and you can reboot or reimage, as you wish—you can even run entirely different operating systems on the same physical server. The main benefit of using virtualization is reducing the number of physical servers you have to buy and manage. However, that doesn't necessarily translate into the cost savings you might expect because support costs may be higher and you may still need multiple software licenses for each virtual server.

Cloud-based content delivery networks (CDNs)

Your website can benefit hugely from cloud computing even if you don't want to migrate it to a cloud server. Information-rich sites like this one, with a lot of static content, typically use over 90 percent of their bandwidth serving up images (and other media) and CSS files that probably don't change from one month to the next. With traffic split equally between Europe, America, and Asia, there's no easy way to decide where to locate your main server: wherever you choose, some users will benefit and others will lose out. But putting the static content on a content delivery network (CDN) , dispersed across the cloud, will benefit everyone. Simply speaking, a CDN makes multiple copies of your static files and stores them at key "edge locations" around the world so that different users in different continents receive whichever files are nearest (and therefore quickest to download).

How do you set up a CDN in practice?

Suppose you want to speed up your website by moving all your images on to a CDN. You can sign up for a pay-as-go CDN in a matter of minutes (Amazon's Cloudfront and Rackspace Cloud Files are two popular, instant options, but there are plenty of others). Once you've sorted out the billing, you simply upload your files (in a similar way to using FTP) and you'll receive a web address (such as abcdefg123456789.cloudservice.whatever) that you can use to link to them. You can either use this address explicitly (referring to it directly in your IMG tags) or (more sensibly) refer to it through a CNAME (effectively a DNS alias) based on your own domain name. When people download your pages, the images are no longer pulled from your main server but from one of the edge locations around the world—ideally one that's geographically close to where they happen to be.
How does it work behind the scenes? It's easy to see if you do a DNS lookup for whatever domain name you're using for your CDN. Instead of a single IP address, you'll find the name resolves to different IP addresses in different parts of the world. In other words, the files resolve to a different IP address depending on where the end user happens to be. So for a person on the West Coast of the United States, abcdefg123456789.cloudservice.whatever might resolve to a server in Mountain View, California, while for a user in Europe, the same domain might resolve to a server physically located in Paris, France or London, England.
Pros and cons? There is almost always a significant performance boost from moving to a CDN, but if you're paying a fixed-price for your web hosting (or server) bandwidth, it's probably going to work out as an extra cost. CDNs rely on your files being copied, periodically, from the central server where you upload them to the edge locations around the world where they're served to users and typically cached for anything from a few days to several weeks or more (you can generally specify the cache expiry time)—so file management and updating can sometimes be a problem. For example, suppose you set a 30-day cache on your main CSS file but suddenly want to change the way some aspect of your site is presented. You can either upload a new CSS file and wait up to 30 days for all the edge locations to reflect the change or rename your CSS file (and all the pages that reference it), then upload new versions. Either way, you lose a certain amount of flexibility in file management and it's important to remember that different users in different locations may see different versions of the same file for a period of time. That's why CDNs work best for static (rarely changing) content.

Worth a go?

One of the best things about cloud services is that they're generally pay-as-you-go—so it's very easy to try them out, at relatively little cost, and see what difference they make.

No comments:

Post a Comment