Thursday 9 November 2023

Bare Metal vs. Virtual Machines vs. Containers:

In this post, I am going to explain about bare metal, virtual machine and containers at very high level. With this, you will get some basic understanding on each.

 

Let’s start with Bare metal.

 

Bare metal

Bare metal is a single computer that is dedicated to a single tenant or user. Before Virtualization concept comes into picture, all the servers are Bare metal systems.

 

Following diagram depicts how a Bare metal looks like.

 


 

Advantages of Bare metal system

a.   It gives complete control over all the Hardware resources.

b.   Since Bare metal systems are isolated, these are not affected by Noisy Neighbour problem. Noisy Neighbour problem occur in Virtualization where multiple Virtual Machines share the same hardware. 'Noisy Neighbour Problem' is a scenario where one virtual machine hosted on a physical server consumes excessive amounts of hardware computing resources such as CPU, memory, storage, or network bandwidth, which negatively impacts the performance of other VMs running on the same physical server.

c.    Since one Bare metal system is isolated from other Bare metal system, they can provide a high level of security due to strong isolation and customization capabilities.

 

Disadvantage of Bare metal system

a.   These require more maintenance than Virtual Machines

b.   These are more expensive than Virtual Machines.

c.    Hard to manage and scale.

d.   As these require a dedicated hardware, and procuring a new hardware takes time, it is complex to scale up or scale down Bare metal systems on demand.

e.   Since Bare Metal System is dedicated to one tenant, we can’t effectively use the hardware resources.

 

Virtual Machines

Virtual Machine is a software based emulation on a physical computer. You can run multiple Virtual Machines on a single Physical system.


As you see above Image, There is a special software ‘Hypervisor’ that manages the virtual machines and provide access to the Host server’s resources. There are two types of Hypervisors.

 

a.   Type 1 Hypervisor: It runs directly on the Host hardware, do not require a Host Operating system. Ex: Microsoft Hyper-V.

       


As you see above image, Type 1 Hypervisor controls the Hardware directly.

b.   Type 2 Hypervisor: It runs on top of a host operating system. Ex: Oracle VirtualBox.

 

Advantages of Virtual Machines

a.   Effective resource utilization: Sharing the hardware resources across multiple virtual machines make more efficient use of Hardware.

b.   Since Virtual machines are hardware agnostic, you can easily move the virtual machine from one hardware to other.

c.    You can clone a Virtual machine and move the clone to other system easily.

d.   Since Virtual Machines are sharing the same Hardware, these are cheaper to run.

e.   Virtual Machines are easier to scale as compared to Bare Metal Machine.

 

Disadvantages of Virtual Machines

a.   These can be vulnerable to Noisy Neighbour problem which is described earlier.

b.   Managing multiple VMs, configuring virtual networks, and dealing with the intricacies of the hypervisor can be challenging.

c.    Since spinning up a VM takes some time (where as containers spin up faster), using these for real time scale up and scale down operations is not efecient.

d.   Vulnerabilities in the hypervisor can potentially compromise the security of all VMs on that host.

 

Containers

Containers are lightweight virtualization technology which share the host operating system's kernel. Since Containers share Host Operating system kernel, these are less isolated as compared to Virtual Machines.

 

How containers provide isolation?

Containers leverage Linux kernel features like namespaces and control groups (cgroups) to provide isolation.

 

Each container host an application which is isolated from the application deployed to different containers. Container doesn't run its own separate operating system. Instead, it leverages the host operating system's kernel to execute its processes. 

 


 

Advantages

a.   Deploying containers is simple and less complex as compared to Virtual Machines

b.   It is easy to scale up and scale down containers.

c.    Now a days, most of the microservices are deployed to containers.

d.   Containers require less hardware resources to run as compared to Virtual Machines.

e.   In a given hardware, you can host more containers than virtual machines.

f.     Container images can be versioned.

 

 

Disadvantages of Containers

a.   Vulnerability in the kernel can potentially impact all containers running on the host.

b.   Containers provide less isolation as compared to Virtual Machines.

c.    Containers are mainly designed to host stateless applications. Handling persistent data and storage can be challenging.

 

Can containers run on Virtual Machines?

Yes, some systems run containers on Virtual machines to provide better security.


                                                             System Design Questions

No comments:

Post a Comment