Introduction to Virtualization, Hypervisor, and Containers

Introduction to Virtualization, Hypervisor, and Containers

Virtualization

Virtualization is a technology that uses software to create an abstraction layer over computer hardware that allows the hardware elements of a single computer-processors, memory, storage, and more—to be divided into multiple virtual computers, commonly called virtual machines (VMs).

Each VM runs its own operating system and behaves like an individual independent computer, even though it is running on just a portion of actual underlying computer hardware.

Virtualization is what made cloud computing economical and possible. It enables cloud users with their existing physical computer hardware, to enable purchase only computing resource allocation to people who need it, whenever they need it.

Advantages

  • Efficient resource utilization - Before virtualization technology, each application server required its own dedicated physical CPU. One application, one server. This made scaling resource-intensive and cumbersome. Now, it is possible to run multiple VM OS on the same server.

  • Easier management - Due to multiple VM on the same server, management became easier. Automated deployment and configuration tools enabled administrators to define a collection of virtual machines and applications.

  • Scaling - Scaling compute up or down depending on the requirement became a reality.

Hypervisor

Introduction

A hypervisor is a software that coordinated Virtual machines and is present between the underlying physical hardware and Virtual machine, as an interface between the two.

It makes sure that the virtual machines don't interfere with each other by impinging on each other's memory space or computer cycles.

Types

There exist two types of hypervisors, hypervisor.png

Type 1 - Bare metal

Bare metal, sounds like the name of a rock band but it simply means the hypervisor directly interacts with the physical resources, or "bare-metal", replacing the traditional operating system altogether.

A bare-metal hypervisor acts as a lightweight operating system and runs directly on the host hardware. Generally, this type is deployed in enterprise companies' servers as it is isolated from the attack-prone operating system and is extremely secure.

They generally perform better and are more efficient than hosted hypervisors.

Type 2 - Hosted

The hosted hypervisor runs on top of the operating system of the host machine. Although hosted hypervisors run within the Operating system, additional and even different operating systems can be installed on top of the hypervisor.

The hosted hypervisor has a higher latency than a bare-metal hypervisor because of the added communication between the hardware and the hypervisor which passes through the Operating system.

Hosted hypervisors are sometimes known as client hypervisors because they are most often used with end-users and software testing, where higher latency is less of a concern.

Container

A container is a standard unit of software that packages up code and all its dependencies so that the application runs quickly and reliably from one computing environment to another.

Container virtualizes that underlying operating system and causes the containerized application to perceive that it has the OS including the CPU, memory, file storage, and network connections- all to itself.

They are packages of software that contain all the necessary elements to run in any environment. Containers virtualize the operating system and run anywhere, from a private data center to the public cloud or even on a developer's personal laptop.

Containers are used for deploying Microservices applications in an easy way.

features.png

Container Benefits

Containers have become popular because they provide extra benefits, such as:

  • Agile application creation and deployment: Increased ease and efficiency of container image creation compared to VM image use.

  • Continuous development, integration, and deployment: Provides for reliable and frequent container image build and deployment with quick and efficient rollbacks (due to image immutability).

  • Dev and Ops separation of concerns: Create application container images at build/release time rather than deployment time, thereby decoupling applications from infrastructure.

  • Observability: not only surfaces OS-level information and metrics but also application health and other signals.

  • Environmental consistency across development, testing, and production: Runs the same on a laptop as it does in the cloud.

  • Cloud and OS distribution portability: Runs on Ubuntu, RHEL, CoreOS, on-premises, on major public clouds, and anywhere else.

  • Application-centric management: Raises the level of abstraction from running an OS on virtual hardware to running an application on an OS using logical resources.

  • Loosely coupled, distributed, elastic, liberated micro-services: Applications are broken into smaller, independent pieces and can be deployed and managed dynamically – not a monolithic stack running on one big single-purpose machine.

  • Resource isolation: predictable application performance.

  • Resource utilization: High efficiency and density.

Containers Examples

Docker

Docker open source project. Timing and simplicity are everything. Docker containers can only run Linux workloads but can run on both Linux and Windows hosts.

Docker containers have enabled huge efficiencies in the development of software but require runtime tooling such as Swarm or Kubernetes, for use in the enterprise.

Java Containers

Jetty, Tomcat, Wildfy, and Springboot are all examples of container technologies that enable standalone Java applications. They have been used for years to incorporate parts of the Java runtime into the app itself.

The result is a Java app that can run without requiring an external Java environment, making the app containerized. While Java containers are indeed container technologies they are not a variant of the Linux containers that are associated with the Docker hype.

Unikernels

Unikernels as designed to optimize the resources required by a container at runtime: by mapping runtime dependencies of the application and only packaging the system functionality that is needed at runtime into a single image. Unlike Docker containers, Unikernels can boot and run entirely on their own, without a host OS or external libraries. That’s different from Docker containers, which rely on external resources and a host environment to run.

LXD

A container platform from the company behind Ubuntu Linux. LXD containers are built and operated with the same tools as traditional VMs but can achieve similar runtime performance to containers and better-improved utilization over VMs. That’s different from Docker containers which give an order of magnitude better density but require a container orchestration platform like Swarm or Kubernetes to manage them at scale.

OpenVZ

OpenVZ is different from a traditional virtual machine hypervisor because it requires both the host and guest OS to be running Linux but because it shares the host OS kernel (like Linux containers) OpenVZ containers are much faster and more efficient than traditional hypervisors. OpenVZ also happens to be one of the oldest container platforms still in use today, with roots going back to 2005.

Rkt

Rocket containers emerged from CoreOS to address security vulnerabilities in early versions of Docker. In 2014 CoreOS published the App Container Specification (appc) in an effort to drive innovation in the container space which spawned a number of open source projects. The early vulnerabilities in Docker have long been addressed and Docker containers are compatible with Docker so can run side by side.

Windows Server Containers

The recent launch of Windows Server 2016 has brought the benefits of Linux containers to Microsoft workloads. Microsoft has re-engineered the core windows OS to enable container technology and worked closely with Docker to ensure parity in the Docker management tooling. There is still some work to do on optimizing the size of the container images and they will only run on Windows 10, Server 2016, or Azure but this is great news for Microsoft-based engineering teams.

Hyper-V Containers

Greater security can be achieved by hosting Windows Server Containers in lightweight “Hyper-V” virtual machines. This brings a higher degree of resource isolation but at the cost of efficiency and density on the host. Hyper-V containers would be used when the trust boundaries on the host OS require additional security. Hyper-V containers are built and managed in exactly the same way as Windows Servers Containers and therefore Docker containers.

Container vs Hypervisor

In Hypervisor, each Virtual machine contains a guest Operating system, a virtual copy of the hardware that the OS requires to run.

Containers, instead of virtualizing the underlying hardware, virtualize the operating system so each container contains only the application and its libraries.

You might be thinking, which technology is more used? The answer is both are used, in fact, containers are run on top of virtual machines in enterprise environments.

container.png

Conclusion

You have learned Hypervisor, Container, and Virtualization. Now, set up your own virtual OS inside your host OS. Use some virtual environments such as Hyper- V, VirtualBox and have a feel of how they work.

Resources

Did you find this article valuable?

Support Eshan's Blog by becoming a sponsor. Any amount is appreciated!