Technology advancement has led to reduction in sizes of the primary components of a computer, viz., CPU, memory and hard disk. A small sized IC can now house a very powerful processor with multiple cores. RAM and hard disks are also now providing more storage in smaller physical size. Thus, more and more computing power and storage are now getting packed in a single small box, making today’s servers very high in specs.
Here is an illustration of a typical server.
So much of power is usually not needed for running most websites and web applications. A customer who may own one or two high traffic websites or a fairly complex web application (such as a CRM system with few users, or an e-commerce store) and needs a dedicated server, would consume only a fraction of the power that a server is capable of delivering.
Yet, it makes economic sense to pack so much of power in a single server box. It saves on data center space, saves on power consumption, and also enables efficient utilization of compute resources. So how do we utilize such a box to provide dedicated service to multiple customers? Virtualization is the solution.
Virtualization is a way of abstracting a single physical computer (server) to appear as multiple computers (servers). This abstraction is done with the help of software. The term virtual stems from the fact that in reality there is a single physical machine - the abstracted multiple machines are therefore termed as virtual machines (VMs).
A virtualization software (referred as hypervisor) sits on top of the physical hardware and its operating system (referred as host OS in this context) and takes care of all functions to enable setting up and running multiple VMs over it.
Here is a basic illustration of a typical VM.
Each VM can run its own OS (which may even be different from the host OS) and its own set of applications, viz., web server, database server, ftp server, email server, and so on.
The OS that runs in a VM is referred as guest OS. It is configured to use only an allocated portion of host server resources - primarily CPU, RAM, storage, & network adapters. The guest OS never knows the actual quantum of these resources available on the host machine - it only knows what is allocated to it. The hypervisor hides all details of the actual server resources so that the VMs cannot know the identity of the server that is providing the resources, whether it is a single server or multiple servers, what the underlying OS is, and what the actual capacity of the resources are. Advanced level virtualization would entail a cluster of physical servers instead of a single server, where CPU, RAM and storage are distributed across multiple machines - thus allowing resources to scale.
Each VM is completely isolated from the other VMs hosted on the same machine and hence to a user accessing a VM, it appears as if he/she is accessing a dedicated server exclusively. Any fault occurring in one VM will only break down that VM. There will be no effect on the other VMs. Also, each VM is fully secured from access by other VMs. There is no way that one VM would access the file system of other VMs on the same physical machine. Additionally, as each VM runs its own OS, the concerned customer can be granted root access to it so he/she can configure it the way he/she wants to and install whatever software and applications he/she requires. Of course, licensing of software installed on one VM cannot be shared across the entire machine i.e., on other VMs.
In commercial language, such a configuration is referred as virtual private server (VPS). This is a very efficient way of utilizing today’s powerful servers, and commercially very practical. Hosting companies can sell small sized VPS plans at very affordable price points.
Virtualization is not a new concept for the computing world. This concept has existed since the era of mainframes (1960s) and was implemented in mainframes to allow running multiple workloads in a time-sharing mode. Virtualization helped isolate these workloads from each other so that faults in one workload did not impact other running workloads. The mainframes were expensive and virtualization helped in their efficient utilization, thereby justifying the huge investment companies made to setup a mainframe in their office.
Subsequently, with the advent of the x86 series of micro-computers (in 1980s) that were cheaper, mainframes were replaced with multiple micro-computers. These micro computers had limited capacity, and hence each would be designated to run one workload - there was no need to divide them for multiple workloads - thus making virtualization redundant.
Virtualization became relevant again in early 2000s with the evolution of enterprise class servers that were packed with multiple powerful CPUs and loads of RAM. The first production ready virtualization software (hypervisor) was released in 2001 by VMware (ESX Server 1.0).
Virtualization technology is also the key driver for cloud computing. In a cloud architecture, a customer purchases a set of VMs, referred as server instances (in cloud parlance) and integrates them together to create a virtual private cloud (VPC). Virtualization technology enables creating & preserving a snapshot image of a server instance which includes guest OS, all pre-installed core software, and your own web application(s). To cater to fluctuating demands, when one VM becomes insufficient to cater to the workload, the preserved image is used to quickly (in a matter of seconds) launch additional instances (clones of the virtual machine). If the current host machine is already fully utilized, the additional instances are launched on other machines. Likewise, when demand decreases, the additional instances are terminated - thus providing the scalability that cloud delivers.
Further development in virtualization led to the development of Docker (in 2013). A docker is technically referred as a virtual container. Fundamentally, this is identical to a virtual machine. However, the guest OS does not exist. A docker engine allows creation of multiple virtual instances, each capable of handling a workload in isolation, but all instances share the common host OS. This deployment has paved the way for the micro-services architecture where light-weight instances of specialized applications can be quickly launched and terminated as per demand.
Other container alternatives to docker exists, such as - CoreOS rkt, Apache Mesos, LXC Linux, OpenVZ, etc.
As explained earlier, a hypervisor is a software that sits above the host OS and facilitates communication between all VMs that sit above it, and the underlying host OS. It ensures that resource requests from a VM are within its assigned limits and accordingly services requests with the help of the host OS controlling all the host hardware. It is configured to know which VM has access to which portions of the hardware resources, and thus prevents any conflict and protects the VMs from each other.
Numerous hypervisors are available in the market. Examples are Microsoft Hyper-V, and VMware vSphere. However, fundamentally, there are only two types of hypervisors:
Bare-metal Hypervisor: Also called type 1 hypervisor, this hypervisor can itself act as host OS and directly interact with the underlying hardware, thus removing the host OS completely. Now-a-days, the host OS itself includes a hypervisor module. KVM is one such example. Short for kernel based virtual machine, KVM is a virtualization module included in most linux kernels enabling the kernel to function as a hypervisor. Technically, this configuration too is bare-metal.
For windows machines, Microsoft has built a Hyper-V hypervisor that is a part of the windows OS. It creates a primary partition in the machines hard disk where the the hypervisor resides along with the windows OS. Secondary partitions are created for guest OSes.
Hosted Hypervisor: Also called type 2 hypervisor, this traditional hypervisor is a separate application that sits above the host OS. Naturally, this means an extra performance overhead. Hence this type of hypervisor is less prevalent now.
Here is an illustration of a typical virtual machines configuration as prevalent today:
While hypervisor driven virtualization is quite common, other methods of virtualization too exist, such as - hardware virtualization, hardware-assisted virtualization, paravirtualization, and OS-level virtualization (also referred as containerization). To stay focused on the main topic, I have avoided details about these other virtualization methods.
Which virtualization method to implement is determined by server administrators to suit the use cases i.e., the kind of workloads to be catered. Performance and cost are two main criteria that play a role in this decision. For instance, if a company requires several virtual machines, it would make economic sense to adopt a virtualization model that enables usage of one software license across multiple VMs thereby gaining significant reduction in license costs.
Virtual machines can be used for various use case scenarios. The notable use cases are -
VPS: For deploying virtual private servers that are sold by hosting companies as standalone package.
Cloud Server: For creating compute instances (eg: AWS EC2) on the cloud architecture.
Enterprise Server: For running multiple workloads that require different platforms and also protection from each other. Presence of varied workloads is quite common in an enterprise.
Multiple OS on PC: For running multiple operating systems simultaneously on a single desktop computer. This may be desirable when, you need to run an old software that is not compatible with your current OS; or you are a developer who builds software for different platforms and cannot afford a dedicated computer for each platform; or you want to try out a new or existing operating system other than the one already installed on your computer; or you are learning a new operating system and want to safely play around with it’s core features for a deeper understanding; or you want to try out a free software in an isolated environment as you are not sure if it contains malware.
To conclude, I would like to briefly summarize the pros and cons of virtualization. These points do not require much explanation as they have been dealt with earlier in this article.
Despite few drawbacks, virtualization is here to stay. I cannot imagine a scenario without VMs in decades to come; unless some researchers come out with a completely new paradigm that will dramatically change the entire architecture in which hardware and software run together.
VPS Hosting - Virtual Private Server
How to move your Email accounts from one hosting provider to another without losing any mails?
How to resolve the issue of receiving same email message multiple times when using Outlook?
Self Referential Data Structure in C - create a singly linked list
Mosquito Demystified - interesting facts about mosquitoes
Elements of the C Language - Identifiers, Keywords, Data types and Data objects
Moving Email accounts from one cPanel server to another
How to pass Structure as a parameter to a function in C?
Rajeev Kumar is the primary author of How2Lab. He is a B.Tech. from IIT Kanpur with several years of experience in IT education and Software development. He has taught a wide spectrum of people including fresh young talents, students of premier engineering colleges & management institutes, and IT professionals.
Rajeev has founded Computer Solutions & Web Services Worldwide. He has hands-on experience of building variety of websites and business applications, that include - SaaS based erp & e-commerce systems, and cloud deployed operations management software for health-care, manufacturing and other industries.