Architecting for the Cloud
This article provides a basic idea about what a cloud is, how you can use it effectively, and why it can transform your business.
What is Cloud Hosting?
Cloud has become something of a marketing moniker, being used to categorize a wide variety of products and platforms, with different capabilities. Some clouds focus exclusively on data storage and retention (for instance, Google® Photo and Apple® iCloud), some are used as a hosting platform, and many others have various other uses. This article focuses specifically on the cloud as it pertains to SpinUp, which fits in the hosting category.
So what is cloud hosting? Cloud hosting is a system that enables the creation and consumption of Virtual Private Servers (VPSs), also referred to as Virtual Machines (VMs). These VPSs are fully functional Cloud Servers with complete operating systems, which means they are just as capable as similarly configured physical devices.
VPSs are created and run on the physical host machines within the cloud. These machines run a hypervisor operating system. A hypervisor acts as the resource manager for any VPS on the device. You can run multiple VPSs from a single hypervisor. A VPS is technically just a data and software construct from the point of view of the host machine and hypervisor. The VPS communicates with the hypervisor to acquire and consume resources, such as random access memory (RAM) and the central processing unit (CPU). For the purposes of this article, the physical host machine and the hypervisor are interchangeable.
Cloud hosting solutions can also encompass supporting products, such as additional storage via Block Storage, or a load balancing solution such as SpinUp Load Balancers. These, and other products, are designed to supplement and support the main advantages of a cloud solution.
Why is this important?
Cloud hosting allows a few significant advantages over a bare-metal solution. One of the biggest is cost. VPSs are often less expensive than their bare-metal counterparts, due to economies of scale in a cloud hosting environment.
You can think of SpinUp as an apartment management company. Each apartment complex the company owns is like a data center. Every building is like a cabinet of host servers in that data center, and each floor is like a physical server. Finally, an individual apartment is like a VPS itself. Just like apartment complexes aggregate and subdivide real estate to lower costs for consumers, SpinUp Cloud Servers aggregate and subdivide computing resources into affordable Cloud Servers. Lower costs mean a better return on investment and less expensive redundancy, while also offering some additional advantages as well.
Flexibility is another benefit of cloud hosting. Because a VPS in a cloud hosting environment is a data and software entity, this means you can manipulate it in ways that you cannot manipulate a physical machine. For example, you can easily resize a SpinUp Cloud Server to add additional RAM, CPU, and disk resources, with just a few clicks. This enables changes in your environment in just a few minutes that might normally take weeks of planning and preparation to perform in a bare-metal environment.
This flexibility applies to more than just an individual VPS as well. You can add new Cloud Servers to your environment in just the few minutes it takes to spin up additional VPSs, and you can simply delete unnecessary Cloud Servers without having to worry about repurposing, selling, or recycling hardware. This enables rapid scaling in your environment and application, allowing you to add resources for traffic spikes and remove resources during slow times. With SpinUp, you only pay for resources while they are in use, which means you can limit the operational costs of your environment to only what you need at a given time for additional cost savings.
What are the risks?
Cloud hosting has very few drawbacks compared to a bare-metal solution. Only two items come into consideration, and you can mitigate both by intelligently designing and deploying your environment.
The first risk is hardware failure.
A common misconception of cloud hosting is that your VPS doesn’t live on physical hardware, and thus is infallible, which is simply not the case.
A VPS lives on a distinct hypervisor. If the hypervisor that a VPS resides on has an issue, it might affect the VPS as well. Hardware failure is, unfortunately, a part of the life cycle of a physical machine.
While SpinUp attempts to be as proactive as possible and works to resolve issues quickly should they arise, the simple fact is that given enough time, the physical devices involved will fail. Of course, this issue also affects bare-metal solutions.
The other potential issue with cloud hosting is known as the noisy neighbor problem.
Let’s revisit the apartment management company analogy from earlier in this article. Just like a loud tenant in an apartment complex can cause issues for other tenants, sometimes VPSs on a host machine can cause issues for other VPSs on that machine.
Because cloud hosting allows you to create multiple VPSs on a single hypervisor, that means those VPSs are sharing the physical host’s resources, namely CPU, RAM, disk, networking, and so on. If one or more of these VPSs starts consuming large amounts of one or more of these resources, this can cause that resource to be in high demand, and thus slow down all the VPSs on the host machine that are requesting that resource. SpinUp always attempts to automatically place VPSs in such a way to avoid this issue, but it can still occur on rare occasions.
You can mitigate both of these issues using one simple and recommended solution: split out your application into multiple servers.
SpinUp attempts to place any VPSs you procure on different physical devices. This means that if you have two or more servers that can service your application, and a hardware or neighbor problem affects one, the other can continue to serve your application without the need for downtime because it is running on completely different physical hardware.
You can then simply take the problem Cloud Server out of service and troubleshoot or replace it.
What architecture considerations should I keep in mind while building my environment?
The most important thing to keep in mind when architecting an environment on a cloud hosting platform is redundancy.
You should try to avoid creating a single point of failure for your applications. This helps avoid any potential hardware failures and mitigates the effects of a noisy neighbor problem.
While these issues can still occur even with redundancy, problem nodes can be safely taken out of rotation and dealt with while the redundant node(s) pick up the slack. You should apply this mentality to all layers of your application, not just the front-end web nodes.
Pets versus cattle
This leads to the next recommendation, which is to treat your servers as disposable entities.
In a traditional bare-metal environment, every server is precious, since it represents a hardware investment as well as compute resources for your application. If you consider the lead time on replacing a hardware device, individual servers end up being very valuable, and staff end up doing as much as possible to keep such a device up, or perform recovery on the device in the event of failure. These servers are perceived as more like pets.
In a cloud environment, the only thing a server represents is a compute resource for your application. The investment and hardware concerns are solely the responsibility of SpinUp, so you don’t have to worry about them.
Additionally, a new device takes minutes to create, instead of having to order additional hardware, wait days or weeks for it to arrive, and then configure it. Due to these features and the subdivision of responsibility, it is advantageous to treat Cloud Servers more like livestock or cattle than the pets they are in a dedicated environment.
If there is a problem that is not easily solved, simply delete the server and spin up a new one. The use of images and automation, such as Ansible or Salt, can also greatly reduce or eliminate the time and effort needed to configure a new server for your application. This can mean mere minutes for a working replacement, instead of difficult troubleshooting that might drag on for hours or longer, waiting for new hardware to arrive.
In almost all cases, even with these considerations in mind and implemented, a cloud solution still costs less than a bare-metal solution, and following these recommendations makes your application very resistant to downtime.
Redundancy preserves the functionality of your application in the case of an issue, and adopting a livestock mentality for your environment ensures problem devices are replaced with working devices quickly. Working in tandem, these two key recommendations allow you to present an application or website with nearly uninterrupted uptime, even when a critical issue occurs with a particular device in your environment.
We have a great article which goes into more detail about Server Redundancy and how you can ensure your environment is redundant.
Of course, there are several other best practices and recommendations that you can take to improve your cloud hosting experience, but following these guidelines provides you with a solid base infrastructure that you can customize and tweak as needed.