Click here to Skip to main content
15,031,680 members
Articles / DevOps
Article
Posted 19 Feb 2019

Tagged as

Stats

7.7K views
8 bookmarked

Application Deployment Strategy – Virtual Machine vs. Containers

Rate me:
Please Sign up or sign in to vote.
4.00/5 (5 votes)
19 Feb 2019CPOL4 min read
The scope of this article is to compare the various deployment models available for our application deployment use case. This article assumes that readers will have basic knowledge of Virtual Machines, Containers and Hypervisors.

1. Introduction

There are a range of techniques available to deploy the applications to production and choosing the right strategy is an important decision for a particular use case. In this article, we will focus mainly on choosing a right deployment model for our in-house built applications.

2. Deployment Use Case

Let us consider two applications, “File Downloader” and “File Processor”. The functional details are described in the below table:

Image 1

Note that we have one Physical Server with 100GB HDD, 16 GB RAM and 4 Core Processor.

Our goal is to deploy both applications to this server for optimal utilization of infrastructure and better performance.

3. Deployment Options

The below diagram shows various deployment options available for us.

Image 2

3.1 Single Server

In this option, both the applications were deployed in a single available server.

3.2 Virtual Machine

In this option, we will split the available server into two virtual machines using Hypervisor. Hypervisor, also known as virtual machine monitor/supervisor, is a process that creates and runs virtual machines. A hypervisor allows one host computer to support multiple guest VMs by virtually sharing its resources, like memory and processes.

There are two types of hypervisors as below:

Type 1 - Run directly on the system hardware, example, Hyper Kit for MacOS, Hyper-V for Windows and KVM for Linux.

Type 2 (Hosted) - Run on a host operating system that provides virtualization services. Example: VirtualBox and VMWare

The above diagram utilizes Type 1 Hypervisor.

Each VM will have guest operating system and we will plan to deploy the “File Downloader” in VM1 and “File Processor” in VM2.

Since “File Downloader” app consumes more memory, we need to allocate more memory limit for VM1 as compared to VM2.

Since “File Processor” app consumes more processor time, we need to allocate more CPU core limit for VM2 as compared to VM1.

In this way, we can optimally utilize the server resources.

3.3 Containers

In this option, we will install the Container Engine (for example, Docker Engine) on top of the existing operating system. We will create two containers to host “File Downloader” and “File Processor” apps.

Since “File Downloader” app consumes more memory, we need to allocate more memory limit for Container 1 as compared to Container 2.

Since “File Processor” app consumes more processor time, we need to allocate more CPU core limit for Container 2 as compared to Container 1.

In this way, we can optimally utilize the server resources.

4. Resource Utilization Comparison

The below diagram shows the resource utilization chart for all three deployment options which we have discussed so far.

Image 3

Based on the utilization chart, we have noticed the below observations:

  1. Single server deployment offered poor performance as both applications are sharing the same resources.
  2. Both virtual machine and container deployment offered nearly equal performance.
  3. More resources are consumed by virtual machine deployment.
  4. Both single server and container deployment offered nearly equal resource utilization.

5. Comparison of Virtual Machine & Container

The below table shows the comparison between Virtual Machine and Container based deployments:

SL # Virtual Machine Container
1 Heavy weight with limited performance Light weight with improved performance
2 Each VM runs in its own OS and can’t run more VMs on an average server All Containers share the same kernel of the host and can run more containers on an average server
3 Virtual machines take few minutes to start Containers take few milliseconds to start
4 Wastage of resources – Requires more space and memory for each VM (terms of GB) Saves resources - Requires less space and memory for each Container (terms of MB)
5 Hardware-level virtualization and requires more OS license and cost OS virtualization and requires only one OS license and reduced cost
6 VM is running instance of physical files (. VMX and. VMDK) Container is running instance of Container Image
7 Each VM will have its own virtual network adapter, IP and Ports Each Container will have its own virtual network adapter, IP and Ports
8 Virtual machines are scalable and come with dedicated disk space, core and memory allocations Containers are scalable and come with dedicated disk space, core and memory allocations
9 Processes in one VM can’t be seen from another VM Processes in one Container can’t be seen from another Container
10 Each VM will have its own root file system Each Container will have its own root file system

Points of Interest

Based on the various deployment options, resource utilization chart and comparison between VM, Containers, for our use case, Container based deployment option gave us the cost-effective solution with good performance.

In the next article, I will introduce Docker Containers with detailed deployment architecture overview.

History

  • 19th February, 2019: Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Chandru BK
Architect EVRY (india) Private Limited
India India
TOGAF 9 Certified professional, has over 19+ years of experience in Information technology with experience in providing solution architecture, designing, implementing effective technical business solutions using Architecture Development Methodologies (ADM), Technical Leadership, Software Development and Project Leadership based on Microsoft .Net and JavaScript Technologies

Comments and Discussions

 
GeneralThis article deserves a higher vote Pin
wmjordan13-Mar-19 0:16
professionalwmjordan13-Mar-19 0:16 
Someone voted it 2 points only. This article deserves at least 4 points.
It did help me to compare VM and containers.
And I even tried to cast the comparison table factors to developer team management: separated teams V.S. matrix organized project groups. Smile | :)

Suggested improvements:
- Including single server into the VM vs container comparison table;
- Maintenance (for instance, how the system and data can be recovered if hard-drives running those things goes wrong; how to migrate systems; how to deploy new instances, etc.)

QuestionSingle server performance Pin
smuccione19-Feb-19 13:03
professionalsmuccione19-Feb-19 13:03 
AnswerRe: Single server performance Pin
Chandru BK21-Feb-19 4:16
professionalChandru BK21-Feb-19 4:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.