DEV Community

Cover image for Containerization Vs Virtualization, which is better and why?
AK DevCraft
AK DevCraft Subscriber

Posted on • Edited on

Containerization Vs Virtualization, which is better and why?

Introduction

In the last post, I described the differences between Private and Public clouds (here is the link to it: private-vs-public-cloud-computing). As a next step, I'm going to talk about the differences between Containerization and Virtualization (Virtual Machines). So, let's dive deep in.

Virtualization

Virtualization is a technology in which one or more virtual machines run on the same physical hardware. This way, you get the advantage of utilizing more resources than running applications on a single piece of hardware. In the case of a virtual machine (VM), we have the underlying hardware and on top of it a hypervisor (a component that creates an abstraction on top of the actual hardware that lets you run the virtual machine).
Then, as a part of the virtual machine, you package the operating system, OS dependencies, and runtime libraries. The application code is deployed on it. Below is an illustration of VM.

Virtual Machines

Containerization

When compared to virtualization, containerization is lightweight as the operating system (OS) is not packaged as a part of the container. You have the hardware, OS, Docker (there are other abstractions similar to Docker, but it’s the popular one). On top of Docker, you deploy the container where you package just the runtime libraries and the application code.

Containers

Comparison

Parameters Virtualization Containerization
CPU and Memory Utilization Because the OS consumes a lot of resources, and every VM has its own OS. That results in higher utilization of CPU and memory OS is shared across all containers. That results in lower utilization of resources
Disk Space Consumption Again, as every VM has its own OS, resulting in more disk space consumption Shared OS results in lower disk consumption
Boot time Little slower, mostly in minutes Faster boot time, mostly in seconds
Isolation As an advantage, independent OS results in more isolation Less isolation due to shared resources

Final Thought

In software engineering, it's always about trade-offs; based on the use case, one will choose Containerization vs Virtual Machine.

If you have reached here, then I have made a satisfactory effort to keep you reading. Please be kind to leave any comments or ask for any corrections. Happy Learning!

My Other Blogs:

Top comments (0)