DEV Community

Cover image for My Cloud Journey — Week 3: Virtualization
Asif Khan
Asif Khan

Posted on

My Cloud Journey — Week 3: Virtualization

Introduction

Welcome back to my cloud learning journey! This week, I am exploring the fascinating world of virtualization. As an aspiring cloud architect, understanding virtualization is crucial—it’s a cornerstone of modern IT infrastructure, enabling more efficient resource utilization, increased flexibility, and improved system scalability. It’s the technology that makes cloud computing possible. I’ll cover key concepts, types of hypervisors, and the various aspects of virtualizing CPU, memory, networking, and storage. I’ll also explore the benefits of virtualization, including efficiency and mobility, and the process of converting physical servers to virtual machines (VMs).

Understanding Physical vs. Virtual Servers

Physical Server

A physical server is a hardware device equipped with components like RAM, CPU, Network Interface Cards (NICs), and Hard Disk Drives (HDDs), running an operating system (OS) such as Windows or Linux. The OS manages the allocation of these hardware resources to various applications, ensuring they have the necessary resources to function properly.

Virtual Server (Host)

In contrast, a virtual server (Host) utilizes a hypervisor to manage the hardware resources. The hypervisor is a layer of software that sits between the physical hardware and the virtual machines (VMs). Each VM runs its own OS and appears to the user as a separate physical machine. The hypervisor allocates resources to each VM, ensuring they run efficiently. Examples of hypervisors include VMware ESXi, Microsoft Hyper-V, and VirtualBox.

Hypervisors: The Foundation of Virtualization

Type 1 Hypervisors (Bare-Metal)

Also known as Bare-Metal hypervisors, Type 1 hypervisors are installed directly on the physical server without an intervening OS. They provide high performance and are commonly used in enterprise environments. Examples include VMware ESXi, Microsoft Hyper-V, and Citrix XenServer. These hypervisors are responsible for managing and allocating resources directly to the VMs.

Type 2 Hypervisors

Type 2 hypervisors run on top of an existing operating system. They are generally used for development and testing purposes rather than in production environments due to their reliance on the host OS for resource management. Examples include VirtualBox, VMware Workstation, and Parallels (MAC). These hypervisors are easier to set up and use but typically offer lower performance compared to Type 1 hypervisors.

VM Files and Live State

The live state of a VM refers to its current operations and processes, including CPU usage, memory allocation, and disk I/O. The hypervisor manages these operations, ensuring efficient resource allocation and performance. Understanding the live state is crucial for managing VMs effectively and ensuring optimal performance.

The Four Food Groups of VM Resources

Virtual machines require specific resources to function optimally, often compared to the “Four Food Groups” of nutrition: CPU, memory, storage, and network. Each of these resources is essential for VM performance.

1. CPU Virtualization: Physical and Virtual CPUs

The host system contains physical CPUs (PCPUs) with multiple cores. VMs are allocated virtual CPUs (vCPUs), which represent the host’s physical processor cores. For example, a VM with two vCPUs can utilize two physical processor cores, although the allocation does not guarantee constant access. Multiple VMs can share the same physical cores, making proper sizing of VMs and the host system crucial to prevent performance issues.

Rightsizing: Rightsizing involves allocating the appropriate number of vCPUs based on actual usage. For instance, if a VM with four vCPUs is utilizing only 25% of the CPU, it can be downsized to two vCPUs for better efficiency and resource utilization.

2. Memory Virtualization

Each VM is allocated a specified amount of memory (e.g., 4GB, 8GB). However, this allocation does not guarantee physical memory availability at all times.

Memory Mapping: The guest OS inside a VM is unaware that it is running in a virtual environment and manages its memory using its own memory table. The hypervisor maps this memory and allocates or frees it as necessary, ensuring efficient memory utilization across multiple VMs.

Oversubscription: Oversubscription allows VMs to share the physical memory of the host, enabling more allocated memory than physically available. For example, if VM1 is allocated 4GB of RAM and VM2 is allocated 8GB of RAM, the total allocated memory is 12GB, even if the host only has 10GB of physical RAM. The hypervisor manages this oversubscription, ensuring both VMs can function without issues.

Memory Reservations: Memory reservations guarantee a specific amount of physical memory to a VM, ensuring it has exclusive use of that memory. This is useful for critical applications that require guaranteed performance.

3. Virtual Networking

Virtual networking allows VMs to communicate with each other and the external network.

Internal Communication: VMs on the same VLAN can communicate directly through the virtual switch (vSwitch) without leaving the host. This internal communication is efficient and fast.

External Communication: Traffic that needs to leave the host uses uplinks to the physical network. The vNIC in the VM sends traffic to the physical NIC, facilitating communication with the external world.

4. Storage Virtualization

Storage virtualization involves presenting a VM with a virtual SCSI controller, which mimics the functionality of a physical SCSI controller.

SCSI Commands: The VM’s OS generates SCSI commands for storage operations. These commands are sent to the vSCSI controller, which forwards them to the hypervisor. The hypervisor then directs the commands to the physical disk or another defined storage resource.

The Benefits of Virtualization

Efficiency

Virtualization enables more efficient use of hardware resources, much like how gyms get busier in January. During peak times, resources can be temporarily expanded, and during quieter times, they can be reduced. This elasticity is a core benefit of cloud computing, built on virtualization.

Elasticity

Cloud computing allows rapid scaling of resources based on demand. Instead of running one OS per server, virtualization allows multiple OS instances on a single server, maximizing hardware usage and enabling more workloads to run on fewer physical machines.

Mobility

VMs can be easily moved between hosts, enabling:

  • Load Balancing: VMs can be migrated to balance resource utilization across hosts.
  • Maintenance Without Downtime: VMs can be moved to other hosts during maintenance.

Load Balancing

VMs can be migrated between hosts to balance resource utilization. For example, if Host 1 has three VMs and is low on memory, some VMs can be moved to Host 2. This process, known as live migration, allows for maintenance and load balancing with minimal downtime.

Migration Steps:

  1. Create a Copy: Use the VMkernel port to create a copy of the VM on the destination host.
  2. Memory Bitmap: Capture and transfer any changes made during the copy process.
  3. Complete Migration: The VM on the destination host becomes the live, running instance.

Automated Load Balancing:

  • Cluster Configuration: Group hosts into a cluster to manage resources collectively.
  • Dynamic Resource Allocation: VMs can automatically migrate between hosts for optimal resource usage.
  • Distributed Resource Scheduler (DRS): VMware’s feature for automating load balancing through live migration of VMs.

Converting Physical Servers to VMs

Purpose

Converting existing physical servers to VMs allows them to run on hypervisors, offering numerous benefits.

Benefits

  • Mobility: VMs are independent of physical hardware, enabling easier management and migration.
  • Standardization: Simplifies OS configuration across VMs with similar virtual hardware.
  • Outcome: Successfully virtualized environments with optimized resource utilization and flexibility.

Conclusion

Week 3 has provided a comprehensive understanding of virtualization, covering the fundamental concepts, types of hypervisors, and the various aspects of virtualizing CPU, memory, networking, and storage. We also explored the significant benefits of virtualization, such as efficiency and mobility, and learned how to convert physical servers to VMs. This knowledge is essential for modern IT infrastructure management and lays a solid foundation for advanced cloud computing topics.

I’m excited to continue this journey and see how our understanding of virtualization translates into cloud architecture design. If you have any questions about this week’s topics or suggestions for future discussions, please share them in the comments below!

I’ll be dedicating the upcoming week to understanding databases, with a focus on SQL (Structured Query Language).

Until next week, keep exploring the virtual realms that power our cloud world!

Asif Khan — Aspiring Cloud Architect | Weekly Cloud Learning Chronicler

LinkedIn/Twitter/GitHub

Top comments (0)