Lanner

Virtual Machines vs Docker Containers: What’s the difference in their performance

Virtual Machines vs Docker Containers

For many years we started looking for the “virtualization” of computers that is, having the possibility of being able to use different “virtual” computers within a single physical computer. Which is carried out with software that simulates having more than one computer environment, with its own operating system, programs, processes and files. Now there’s the possibility of being able to change from one single physical computer, even from one virtual computer to another to perform a specific process. This brought great advantages not only technical, but also practical and economic.

But this technology that allows us to work with multiple virtual machines (VM’s) has not stopped there, but there have been other new technologies that also work in the virtual environment but in a different way. Let’s also talk about containers.

How exactly does a virtual machine and a container work? How do they differ and what advantages do one have over the other? Let’s talk first about virtual machines.

Virtual Machines

A virtual machine is one that emulates a complete computer. In very simple words, it is a software that can pass itself off as another device -like a PC- in such a way that you can run another operating system inside it. It has its own hard drive, memory, graphics card and other hardware components, although all of them are virtual.

When we say that its components are virtual does not mean that they do not physically exist. In fact, the hardware resources installed on the physical computer will be distributed in the virtual machines that are available. For example, suppose we have a desktop PC with 8 GB of RAM and 500 GB of hard disk. Now imagine that we have created a virtual machine within our PC operating system and that we want to allocate RAM and hard disk space. Maybe we can assign 4Gb of RAM and 100Gb of hard disk. That would leave our PC “host” with only 6Gb of RAM and 400 Gb of Hard Disk. This is very beneficial because we can work with different virtual machines for different purposes and even different operating systems, although they are not the same as the physical PC. As for example, we can have a virtual machine with Linux running on a Windows computer. The following image shows an example of how 2 virtual machines are configured on a PC:

This technology has been very beneficial, especially in server environments for the following reasons:

In the case of the servers, we may not even need an operating system but instead put the VM Host Software directly and create the virtual machines right there, as can be seen in the following image:

Docker Containers

Docker is an open source software platform where we can create “containers”, which simple definition is a lighter virtual machine, meaning it’s less demanding with the resources of the physical computer where they run. This have been especially useful for developers who want to test or use their applications in any environment. Some of the benefits of Docker Containers are:

 While in virtual machines we have virtual machine host software (Hypervisor) in containers we have a container engine which is used to running and ending the content. The following diagram is a visual representation of Dockers containers’ structure:

Another advantage of containers is that they can be used along with virtual machines with no conflicts, having twice the benefit as we can see on this diagram:

In conclusion as we can see there are common and different benefits from VMs and Containers. If you are a server or network admin VMs will be beneficial enough for that purpose. But if you’re into DevOps you may want to go with Docker Containers. And even why not go with both and get the best from both worlds.

Exit mobile version