>_
EngineeringNotes
Module 02

Virtual Machines

How we slice one big computer into hundreds of small ones.

01

The Problem with Big Servers

Imagine a Data Center has a Super Computer with:

  • 128 CPU Cores
  • 512 GB RAM
  • 100 TB Storage

You come along and say: "I need a server for my small blog."

They cannot give you the whole machine. It would be a waste of 99.9% of resources. They need a way to slice this machine.

02

Virtualization & Hypervisors

Virtualization is the technology that allows you to run multiple simulated environments (Virtual Machines) on a single physical machine.

VM 1 (Ubuntu)
VM 2 (Windows)
VM 3 (Kali)
HYPERVISOR
PHYSICAL HARDWARE (Host)

The Hypervisor is the software layer that sits between the hardware and the virtual machines. It tricks each VM into thinking it has its own dedicated CPU and RAM.

03

Cloud Terminology

Every Cloud Provider wants to sound fancy, so they invent their own names. But under the hood, they are all just Virtual Machines.

AWS Calls it
EC2
Elastic Compute Cloud
DigitalOcean Calls it
Droplet
Azure Calls it
Azure VM
Google Calls it
Compute Engine
04

VM vs. Bare Metal

Virtual Machine (EC2, Droplets)

  • Cheap: Pay for small slice.
  • Fast: Spin up in seconds.
  • Scalable: Upgrade RAM easily.
  • Noisy Neighbor: If another VM on the same host goes crazy, you might lag.

Bare Metal (Dedicated)

  • Performance: 100% of hardware is yours.
  • Isolation: No neighbors.
  • Expensive: Costly to rent.
  • Slow Deploy: Can take hours/days.
05

Deep Dive: Performance & Flaws

Why isn't everything a VM?

For 99% of web apps, VMs are perfect. But for Performance Critical tasks likeBitcoin Mining orHigh-End Gaming, VMs suck.

The "Hypervisor Tax"

The Hypervisor is a middleman. Every time your App asks the CPU for math, it has to go through the Hypervisor. This adds a tiny delay (overhead). For mining, where every millisecond counts, this 5-10% loss is money lost.

The "Noisy Neighbor" Flaw

Since you share physical hardware, if your neighbor (another VM on the same box) starts running a heavy calculation,YOU might slow down. The Hypervisor tries to be fair, but it's not perfect. Bare Metal servers don't have neighbors.

06

Why We Still Use VMs: Scalability

If VMs are slower and have noisy neighbors, why do we use them?
Because Hardware is cheap. Engineer time is expensive.

📸

Snapshots

You can "freeze" a VM in time. If you break something, you can restore the entire server state in seconds. You can't do this with a physical server.

🚀

5-Second Deploy

Need 100 more servers for Black Friday? Click a button. With Bare Metal, you'd have to physically rack servers and plug in cables.

🔄

Flexibility

Resize from 1 CPU to 64 CPUs with a reboot settings change. Modern machines are so powerful, the "Hypervisor Tax" is barely noticeable for web apps.