|
| 1 | +🗓️ 12112024 0930 |
| 2 | + |
| 3 | +# virtualization |
| 4 | + |
| 5 | +**What it is:** |
| 6 | +- Technology that creates isolated virtual versions of computing resources |
| 7 | +- Abstracts physical hardware from software |
| 8 | +- Enables multiple operating systems or applications to run on single physical machine |
| 9 | + |
| 10 | +**Problem it solves:** |
| 11 | +- Running multiple workloads on dedicated hardware is wasteful and inflexible |
| 12 | +- Without virtualization: need separate physical machines for each application |
| 13 | +- Result: Poor resource utilization, high costs, difficult migration |
| 14 | + |
| 15 | +## Hardware vs OS-level Virtualization |
| 16 | + |
| 17 | +**Hardware virtualization (VMs):** |
| 18 | +- Each virtual machine runs complete OS with own kernel on top of hypervisor |
| 19 | +- Full isolation between VMs |
| 20 | +- Heavier resource overhead |
| 21 | + |
| 22 | +**OS-level virtualization (containers):** |
| 23 | +- Multiple isolated user spaces share same kernel |
| 24 | +- Lightweight and fast |
| 25 | +- Can only run applications compatible with host kernel |
| 26 | +- See [[docker_overview]] for container details |
| 27 | + |
| 28 | +Key distinction: VMs virtualize hardware (can run different OS types), containers virtualize OS (share kernel). |
| 29 | + |
| 30 | +## Hypervisor Types |
| 31 | + |
| 32 | +**Type 1 (Bare Metal):** |
| 33 | +- Runs directly on hardware without host OS |
| 34 | +- Examples: VMware ESXi, Hyper-V, KVM, Xen |
| 35 | +- Better performance, lower overhead |
| 36 | +- Used in production data centers and cloud infrastructure |
| 37 | + |
| 38 | +**Type 2 (Hosted):** |
| 39 | +- Runs on top of host OS |
| 40 | +- Examples: VirtualBox, VMware Workstation, Parallels |
| 41 | +- Easier to set up, more overhead |
| 42 | +- Used for development and testing |
| 43 | + |
| 44 | +Pattern: Type 1 for production workloads and server consolidation. Type 2 for development and desktop virtualization. |
| 45 | + |
| 46 | +## VMs vs Containers |
| 47 | + |
| 48 | +**VMs:** |
| 49 | +- Full OS per instance, GBs in size, minutes to start |
| 50 | +- Complete kernel isolation |
| 51 | +- Use when need different OS types on same hardware, maximum security isolation, or legacy applications requiring specific OS versions |
| 52 | + |
| 53 | +**Containers:** |
| 54 | +- Shared kernel, MBs in size, seconds to start |
| 55 | +- Process-level isolation |
| 56 | +- Use when application-level isolation sufficient, need fast startup/scaling, want resource efficiency, or building microservices |
| 57 | +- Covered in [[docker_overview]] |
| 58 | + |
| 59 | +Pattern: VMs for OS isolation, containers for application isolation. Or combine: run containers within VMs for both levels. |
| 60 | + |
| 61 | +## When to Use VMs |
| 62 | + |
| 63 | +Use for: |
| 64 | +- Multiple OS environments on single hardware |
| 65 | +- Strong isolation between workloads for security |
| 66 | +- Legacy application support requiring specific OS versions |
| 67 | +- Disaster recovery with snapshots and migration |
| 68 | +- Resource consolidation to reduce hardware costs |
| 69 | +- Dev/test environments isolated from production |
| 70 | + |
| 71 | +Skip for: |
| 72 | +- Performance-critical applications where overhead unacceptable |
| 73 | +- Simple application isolation (containers more lightweight) |
| 74 | +- Resource-constrained environments |
| 75 | +- Bare-metal performance required (GPUs, high-frequency trading) |
| 76 | + |
| 77 | +## Key Benefits and Trade-offs |
| 78 | + |
| 79 | +**Benefits:** |
| 80 | +- Complete OS isolation |
| 81 | +- Run different OS types on same hardware |
| 82 | +- Strong security boundaries |
| 83 | +- Hardware independence |
| 84 | +- Easy backup/recovery with snapshots |
| 85 | +- Live migration between hosts |
| 86 | + |
| 87 | +**Drawbacks:** |
| 88 | +- Resource overhead (each VM runs full OS) |
| 89 | +- Slower startup times |
| 90 | +- Larger storage requirements |
| 91 | +- More complex management |
| 92 | +- License costs for guest operating systems |
| 93 | + |
| 94 | +## Virtualization in Cloud Computing |
| 95 | + |
| 96 | +Cloud IaaS built on virtualization: |
| 97 | +- AWS EC2, Azure VMs, Google Compute Engine |
| 98 | +- On-demand virtual machines without managing physical hardware |
| 99 | +- Cloud provider handles hypervisor layer |
| 100 | + |
| 101 | +For container workloads in cloud, see [[docker_orchestration]] for managing containerized applications at scale. |
| 102 | + |
| 103 | +## Common Pitfalls |
| 104 | + |
| 105 | +```ad-warning |
| 106 | +**Over-provisioning VMs**: Allocating too many resources (CPU, RAM) wastes capacity. VMs don't use what they're allocated, they use what they need. Monitor actual usage and right-size allocations. |
| 107 | +``` |
| 108 | + |
| 109 | +```ad-danger |
| 110 | +**VM sprawl**: Unmanaged VM creation leads to wasted resources and security risks. Implement VM lifecycle policies, regular audits, and automated cleanup of unused VMs. |
| 111 | +``` |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +## References |
| 116 | + |
| 117 | +- https://www.vmware.com/topics/glossary/content/virtualization.html |
| 118 | +- https://www.redhat.com/en/topics/virtualization/what-is-virtualization |
| 119 | +- https://aws.amazon.com/what-is/virtualization/ |
0 commit comments