Chapter 2.
Virtualization and
Containerization
Recap : Virtualization
• Host Machine: The machine on which the virtual machine is going to be built is known as Host Machine
• Guest Machine: The virtual machine is referred to as a Guest Machine.
18-03-2024 School of Computer Science and Engineering 2
Virtualization Types
Application Virtualization: Application virtualization helps a user to have remote access to an
application from a server. Ex: user who needs to run two different versions of the same software
Network Virtualization: The ability to run multiple virtual networks with each having a separate
control and data plan
Desktop Virtualization: Desktop virtualization allows the users’ OS to be remotely stored on a server
in the data center.
Storage Virtualization: Storage virtualization is an array of servers that are managed by a virtual
storage system.
Server Virtualization: This is a kind of virtualization in which the masking of server resources takes
place. the central server (physical server) is divided into multiple different virtual servers by changing
the identity number, and processors.
18-03-2024 School of Computer Science and Engineering 3
Virtualization : Different Approaches
- Software emulation - Para-virtualization - Full virtualization
• Emulation involves replicating the complete hardware environment of one
machine on another machine.
• Emulation typically involves significant overhead because the emulator has to
translate every instruction and I/O operation from the emulated system to the
host system.
• Examples include emulators like QEMU (Quick Emulator) and Bochs.
18-03-2024 School of Computer Science and Engineering 4
Virtualization : Para-Virtualization
• Paravirtualization presents a software interface to guest operating systems that is similar
but not identical to that of the underlying hardware.
• In other words, the guest operating system is aware that it is being virtualized.
• Paravirtualization requires modifications to the guest operating system to replace certain
privileged instructions with calls to the hypervisor or virtual machine monitor (VMM).
• Examples include Xen and the Kernel-based Virtual Machine (KVM).
• Advantage : maximum utilization of resources.
• Limitation: Driver is required to build paravirtualization environment
18-03-2024 School of Computer Science and Engineering 5
Virtualization : Full-Virtualization
• Full virtualization simulates complete hardware environments to allow unmodified guest
operating systems to run in isolation.
• Unlike paravirtualization, the guest operating systems are unaware that they are being virtualized.
• Full virtualization typically involves a hypervisor or virtual machine monitor (VMM) that intercepts
and manages privileged instructions from the guest operating system, translating them into
equivalent instructions that can be executed safely on the underlying hardware.
• Full virtualization usually incurs more overhead compared to paravirtualization but offers greater
compatibility with unmodified operating systems.
• Examples include VMware ESXi, Microsoft Hyper-V, and Oracle VirtualBox
18-03-2024 School of Computer Science and Engineering 6
Types of VM Migration
1. Live/Hot migration
2. Regular/Cold Migration
3. Live Storage Migration
• What is live migration (vMotion) ?
Live migration is the process of moving a running virtual machine or an application
between different physical machines without disconnecting the client , memory, network
connectivity and storage of the virtual machine are transferred from the original host
machine to the destination.
• Use cases:
– Hardware/software upgrades
– Distributed resource management
– Distributed power management
18-03-2024 School of Computer Science and Engineering 7
Live Migration
Virtual Machine Virtual Machine
Source Destination
Disk is placed on a shared volume (100GBs-1TBs)
CPU and Device State is copied (MBs)
Memory is copied (GBs)
– Large and it changes often → Iteratively copy
Live VM Migration steps
• Stage 0: Pre-Migration
• Stage 1: Reservation
• Stage 2: Iterative Pre-Copy
• Stage 3: Stop-and-Copy
• Stage 4: Commitment
• Stage 5: Activation
Copyright © 2012, Elsevier Inc. All rights reserved. 3 - 11
Benefits of Live VM Migration
• It provides special benefit to server virtualization and has
become a powerful tool for a variety of scenarios/applications.
• Power management: The aim is to consolidate virtual machines
through live migration on an optimal number of servers and
selectively switch off underutilized servers to reduce data
centers power consumption.
• IT maintenance: Administrators can transparently move virtual
machines to free and shut down hosts for maintenance purpose.
• Load balancing: The aim is to adjust virtual machine placement
to achieve critical business goals, such as high throughput and
high availability
Migration of Memory, Files and Network Resources
• Memory Migration: Moving the memory instance of a VM from
one physical host to another
• Memory Migration can be approached in number of ways
depending on the characteristics of application/workloads
• Memory migration can be in the range of hundred's of megabytes
to few gigabytes in a typical system
Pre-copy memory migration:
- Warm-up phase:
• The Hypervisor typically copies all the memory pages from
source to destination while the VM is still running on the source.
• If some memory pages change (become 'dirty') during this
process, they will be re-copied until the rate of re-copied pages is
not less than page dirtying rate.
Migration of Memory
- Stop-and-copy phase :
• After the warm-up phase, the VM will be stopped on the
original host, the remaining dirty pages will be copied to the
destination, and the VM will be resumed on the destination
host
• The time between stopping the VM on the original host and
resuming it on destination is called "down-time", and ranges
from a few milliseconds to seconds according to the size of
memory and applications running on the VM.
Migration of Memory
Post-copy memory migration:
• Post-copy VM migration is initiated by suspending the VM at
the source. With the VM suspended, a minimal subset of the
execution state of the VM (CPU state, registers and,
optionally, non-pageable memory) is transferred to the target.
• The VM is then resumed at the target. Concurrently, the source
actively pushes the remaining memory pages of the VM to the
target - an activity known as pre-paging
• At the target, if the VM tries to access a page that has not yet
been transferred, it generates a page-fault. These faults, known
as network faults, are trapped at the target and redirected to the
source, which responds with the faulted page.
File system Migration
• A system must provide each VM with consistent, location-
independent view of file system that is available on all host s
• Provide each VM with virtual disk which the file system is
mapped to and transport the contents of this virtual disk.
Network Migration:
• Each VM has its own distinct virtual MAC address
• The VMM maintains a mapping of the virtual IP and MAC
addresses to their corresponding VM’s
• ARP : Mapping IP to MAC
Linux Namespaces Used For Isolation
The most significant advances in isolation mechanisms have arisen in the open
source community; cloud computing has spurred adoption. Under various names,
such as jails, the community has incorporated isolation mechanisms into the Linux
operating system. Known as namespaces, a current set of mechanisms can be used
to isolate various aspects of an application.
Containers and Orchestration
• Separate space for each individual user is called as container or instance or jail
• A container runs on a conventional operating system, and multiple containers
can run on the same operating system concurrently.
• Each container provides isolation
18-03-2024 School of Computer Science and Engineering 18
Containers and Orchestration
Container Organisation
- H/W Resources
- Host OS’s
- Containers
EX: Banks Operations: Loans; Fix deposit, online banking; mobile banking,etc
18-03-2024 School of Computer Science and Engineering 19
Orchestration
Orchestration : maintaining and managing of containers
Orchestration is performed using kubernetes,
Docker, etc..
18-03-2024 School of Computer Science and Engineering 20
Weblogic app was installed thrice why?
Due to computing environment, the app may not work on other systems;
Drawback: time consumption
Why not try Docker Containers?
18-03-2024 School of Computer Science and Engineering 21
What is Docker?
Docker provides framework and efficiently utilizes system resources
18-03-2024 School of Computer Science and Engineering 22
What is Docker Container
18-03-2024 School of Computer Science and Engineering 23
Benefits of Docker Container
18-03-2024 School of Computer Science and Engineering 24
18-03-2024 School of Computer Science and Engineering 25
Containerization Vs. Virtualization
18-03-2024 School of Computer Science and Engineering 26
Docker Container with applications
18-03-2024 School of Computer Science and Engineering 27
Containerization Vs. Virtualization
18-03-2024 School of Computer Science and Engineering 28
Docker Architecture
18-03-2024 School of Computer Science and Engineering 29
Docker Architecture
18-03-2024 School of Computer Science and Engineering 30