Engineers from La Salle-URL share the latest news and projects in the field of network solutions in telematic engineering.

13 May 2021 | Posted by userDataCenter

VMs vs Containers

A recurring theme when talking about virtual machines is virtualization, but there are different types of virtualization with their characteristics, their advantages and their disadvantages. In this post we are going to make a comparison that allows us to understand a little more about the subject.

What are Virtual Machines?

A virtual machine (VM) is an environment that functions as a virtual computer system with its own CPU, memory, network interface, and storage, but which is created on a physical hardware system.

VMs are isolated from the rest of the system, but there can be multiple VMs on a single piece of hardware, such as a server. Additionally, they can be moved between host servers based on demand, or to use resources more efficiently.

VMs allow several different operating systems to run at the same time on the same device (in this case the same server).

 

What are containers?

A container is a standard unit of software that packages the code and all its dependencies so that the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, self-contained, executable software package that includes everything you need to run an application: code, runtime, system tools, system libraries, and settings.

Multiple containers can run on the same machine and share the operating system kernel with other containers, each running as isolated processes in user space. Containers take up less space than VMs (container images are typically tens of MB in size), they can handle more applications.

Its main limitation is that you cannot emulate a Windows system if the host is Linux, for example, using containers. In other words, containers are dependent on the host's operating system, unlike virtual machines.

 

Comparison

  • Price: Using containers, a single operating system can support multiple containers, each of which runs within its own separate runtime environment. By running multiple components on a single operating system, the money spent on licenses is reduced. On the other hand, if we make use of VMs, we will need a license for each of the operating systems of the VMs (plus the host).
  • Efficiency: containers are more efficient than virtual machines, since the resources they consume go directly to the application process that is running. Virtual machines, on the other hand, require more resources, many of which are destined for the operating system and not for the application itself.
  • Size: a container is typically as small as 10 MB, while a virtual machine takes up at least a few GB of storage space. Thus, a server fits many more containers than virtual machines, making these the preferred option in many cases.
  • Speed ​​of execution: virtual machines are created by a hypervisor that requires many configuration decisions at startup. On the other hand, containers are created faster than virtual machines due to the absence of a hypervisor. Therefore, the startup time for Docker containers varies from a few milliseconds to a couple of seconds, which makes it much faster than a VM (which can take minutes).

 

Bonus: a solution for multi-cloud management

Kubernetes is an open-source platform that automates Linux container operations. Thus, it eliminates many of the manual processes involved in the deployment and scalability of containerized applications.

In other words, you can create a cluster of host groups running Linux containers, and Kubernetes helps you easily and efficiently manage those clusters.

These clusters can span hosts in public, private, or hybrid clouds. For this reason, Kubernetes is the ideal platform for hosting applications that require rapid expansion.

Kubernetes is often used in multi-cloud solutions as it allows you to automate and manage containers in the simplest and most efficient way possible.

 

Authors

Joan Farràs

Ferran Montoliu

Share