Contain Yourself! The VM Is Evolving
IT these days is all about servers. There are tens of millions of them, holding websites, databases, documents, custom business applications, emails, and so on. Some systems can run on a single server or two, while others need thousands to cope with demand.
Just a decade ago, most servers were physical metal boxes in dedicated rooms on company premises. If you needed another server you had to buy a new box, and then find power and some space in a rack for it. When that server needed more RAM or disk space you had to shut it down, open the case, and install stuff. And then wait with bated breath as you hit the switch and hoped it would come back up cleanly.
The server world has undergone two major evolutionary steps in recent years and a third is underway right now.
The first step was the move to virtualization. The trouble with physical servers is that they are expensive to run and maintain. Even if you run a busy company, chances are that most of your servers are not very busy, most of the time. So although you might have 10 boxes (email, web, documents, backups, intranet, customer database and so on) it was not uncommon for CPU usage on those servers to remain at less than 10% for most of the day. Even less at night. It’s inefficient and costly.
Virtualization changed the way that people managed servers. Those 10 physical boxes were replaced by a single box containing lots of RAM, processors and disk space (often as a Storage Area Network). The physical box no longer ran an operating system such as Windows Server or Linux, but instead ran a hypervisor such as VMware. IT staff could then create a virtual server on that box, which behaved just like a physical one on its own hardware but was actually running as an isolated task on the box.
If you needed another server, just click a few buttons and it’s up and running. If it breaks, just delete it and start again. Or clone it if you want another one just the same. If it needs more memory or disk space, log into the hypervisor and allocate it. Neither a screwdriver nor any downtime was required.
Virtualization wasn’t, and indeed isn’t, without its problems. It’s very easy — sometimes too easy — to create new VMs. Early research suggested that companies which switched from physical to virtual servers typically ended up with 11 times as many servers as they had before.
Virtualization is, on the whole, way more efficient than using separate physical servers. When one VM isn’t particularly busy, its virtual CPU will be used by a different VM instead of standing idle.
And so to the second evolution, namely the move to the cloud. Companies stopped hosting their own physical servers in their own physical data centers and began renting VMs from providers such as Alibaba Cloud. You can create a new virtual server on Alibaba Cloud in just five minutes for less than $5, and delete it just as quickly if you no longer need it. Financing servers can now be done on expenses via an employee’s credit card rather than being a major CapEx project.
Incidentally, do you know why externally hosted computers are known as the cloud? When marketing people in IT companies used to draw diagrams of computer networks and how all the servers and other devices fitted together, the Internet was typically represented by a drawing of a cloud. The term gradually moved out of the IT companies and is now ubiquitous.
And so to the third evolution. It’s called container technology and the word you’ll hear most often is Docker.
As efficient as the virtualization model is, it has its drawbacks. Consider a VM host machine, which might have 1TB of RAM, 10TB of disk space and 128 processors. You can run 30 instances of Windows Server on such a box. But if you look inside each of those virtual machines, 95% of the files are probably identical. There are 30 copies of Windows Server (and 30 Windows Server licenses!), all running the same kernel, the same drivers and the same libraries. Only 5% is unique, such as specific libraries or application code or content files.
Having a separate copy of each system file for each VM helps to keep things separate, of course, which is vital for security. If anything other than the hypervisor can access files in multiple VMs then you have a serious problem. It also means that you can run multiple guest operating systems on a single host box. Instead of 30 Windows Server VMs, for example, you could have 7 Windows Server 2016, 3 legacy Windows 2008 R2, 10 Ubuntu, 5 Debian and 5 Android.
The infrastructure of a virtualization environment looks like this (Source: www.docker.com).
The host hypervisor runs multiple guest operating systems and a VM comprises a guest OS and any additional software it requires (i.e. PHP and Apache, or perhaps a custom Line Of Business (LOB) application).
A container-based system, on the other hand, looks like this.
The host OS runs the Docker software. A container consists solely of the unique parts of the guest OS that are not present in the host. Again, this could be Apache and PHP, or some custom LOB software. Because there are no guest operating systems, each container has to run under the same OS kernel as every other container on the system.
Containers are, relatively speaking, tiny and rarely more than 100MB. They start up in just a second or two. Compare this with a Windows Server VM which can take 10 minutes to start up and might be 80GB in size!
The lack of guest OS’ has another benefit. With 30 VMs on a host, there are 30 operating systems that you have to keep patched and updated. With Docker, such effort isn’t required. If a container hasn’t been used for a while, it won’t spend an hour installing updates when you eventually spin it up.
Making the Move to Containers
Creating a container is actually very easy because most of the hard work has already been done by the community and is available as a free download from the Docker website. You can build on those ready-made containers with minimal effort. For example, to create a simple Hello World project, it takes a 3-line script file to download a base container image of Apache and PHP, incorporate your own PHP script that displays the message, and then output a revised image. A further single Docker command launches that container image, which runs the web server and displays the message.
You’re probably now itching to try containers yourself. One option is to fire up Docker on a spare PC if you wish. It’s available for both Windows and Linux. Another option is to fire up a VM on a platform such as Alibaba Cloud and install Docker on there.
By managing your containers on the cloud, you can keep a tight rein on resources and adjust them as required. Simply use Alibaba Cloud Elastic Compute Service (ECS) to set up an ECS instance as your first virtual server and get started straight away. If you make a mistake in configuring things the way you want, ECS allows you the flexibility to delete that server and start again with a new one. If you decide that container technology is the way forward for your company, create a container cluster using ECS servers to host as many containers as you wish.
Plus, in the case of Alibaba Cloud, the container service is currently free to use. You only pay for the ECS instances, plus any other related services such as Server Load Balancer.
The Future of Virtual Machines
So have VMs had their day? Certainly not. They are here to stay as a way of efficiently running multiple instances of complete operating systems on a single box either in your own data center or someone else’s. But if many of your virtualized servers currently run the same operating system, and you’re fed up with endlessly having to patch and update them all, containers could well be the way to go.
Perhaps unfairly, containers are seen as being slightly scary. A conventional VM is simply a virtualized version of an entire physical box, with which we are all familiar. Moving to containers takes some additional experimentation, research, and re-thinking, which often we simply don’t have the time to do. But next time you need to set up a new system for something relatively low-key, consider going down the container route rather than a traditional VM. You might just be pleasantly surprised how easy it actually is.
To whet your appetite, look at the Docker hub on hub.docker.com. See all those thousands of container images? Once you’ve installed Docker on a VM you can download any one of them and have it up and running with a single command. To add your own content to one of them in order to create your own customized version, it is just one more command. And then another single command to run the container, which should spin up in just a second.
Established in September 2009, Alibaba Cloud is a business within Alibaba Group, which is listed on the New York Stock Exchange (NYSE) under the symbol BABA. To get started with Alibaba Cloud’s Container Service, visit https://www.alibabacloud.com/product/container-service.