VSWAPPER A MEMORY SWAPPER FOR VIRTUALIZED ENVIRONMENTS 1

  • Slides: 27
Download presentation
VSWAPPER: A MEMORY SWAPPER FOR VIRTUALIZED ENVIRONMENTS 1 NADAV AMIT, DAN TSAFRIR, ASSAF SCHUSTER

VSWAPPER: A MEMORY SWAPPER FOR VIRTUALIZED ENVIRONMENTS 1 NADAV AMIT, DAN TSAFRIR, ASSAF SCHUSTER

VIRTUALIZATION • Hardware virtualization enables the cloud ecosystem • Higher server utilization • Up

VIRTUALIZATION • Hardware virtualization enables the cloud ecosystem • Higher server utilization • Up to 50% less operating expenses • Up to 80% less power expenses • Memory is the biggest constraint for consolidation [IDC’ 09, Birke’ 12] • Essential for server consolidation App. VM Hypervisor 2 • Memory overcommitment

P 1 RAM disk B RAM host view P 2 (1) Access P 1

P 1 RAM disk B RAM host view P 2 (1) Access P 1 P 3 P 2 Guest Code (2) Exit disk VM image host swap area P 2 (3) Swap Hypervisor Poor performance due to the semantic gap 3 guest view UNCOOPERATIVE SWAPPING

MEMORY BALLOON inflate guest memory deflate guest memory balloon swap out virtual disk swap

MEMORY BALLOON inflate guest memory deflate guest memory balloon swap out virtual disk swap in • Allows guest to make paging decisions, yet: • Virtualization vendor use host swapping as a backup 4 • Ballooning takes time • Not a complete solution • Paravirtual

DEMONSTRATION: SEQUENTIAL FILE READ 512 MB VM; 100 MB cap; 200 MB file; Read

DEMONSTRATION: SEQUENTIAL FILE READ 512 MB VM; 100 MB cap; 200 MB file; Read & re-read Swapping st Disk read Balloon 5 ac c Files e n gu i d e h y; mor e m t s ho not in

AGNEDA • Introduction • Problems • Solutions 6 • Evaluation

AGNEDA • Introduction • Problems • Solutions 6 • Evaluation

PROBLEM #1: STALE SWAP READS 7 Stale swap reads

PROBLEM #1: STALE SWAP READS 7 Stale swap reads

guest view PROBLEM #1: STALE SWAP READS RAM P 2 VM reads P 2

guest view PROBLEM #1: STALE SWAP READS RAM P 2 VM reads P 2 disk P 2 (2) RAM host view (1) P disk VM image host swap area P 2 P #PF reading P P P 2 (3) overwrite it with P 2 P 2 P 8 Swap data is read just for disk blocks to overwrite it

PROBLEM #2: FALSE SWAP READS (1) host view RAM disk VM image host swap

PROBLEM #2: FALSE SWAP READS (1) host view RAM disk VM image host swap area VM writes to P P (2) P VM overwrites P P Guest reallocates page frames: • Copy-on-write • Slab pages 9 • Zero page before use

PROBLEM #3: SILENT SWAP WRITES host view disk VM image host swap area P

PROBLEM #3: SILENT SWAP WRITES host view disk VM image host swap area P P RAM P (2) (1) vm reads page P host swaps page P P 10 Data read from the image is written back to the host swap

11 PROBLEM #4: DECAYED SWAP SEQUENTIALITY

11 PROBLEM #4: DECAYED SWAP SEQUENTIALITY

PROBLEM #4: DECAYED SWAP SEQUENTIALITY host view RAM disk VM image host swap area

PROBLEM #4: DECAYED SWAP SEQUENTIALITY host view RAM disk VM image host swap area P 1 P 2 P 3 P 1 VM image data gradually loses sequentiality on swap 12 Poor prefetch

PROBLEM #5: FALSE ANONYMITY anon host view RAM Userspace hypervisor code guest: named host:

PROBLEM #5: FALSE ANONYMITY anon host view RAM Userspace hypervisor code guest: named host: anon P 4 P 1 P 3 QEMU disk VM image P 1 Swap out P 2 P 3 host swap area OS prefers to evict named pages; hypervisor ignores 13 All guest memory is considered anonymous

14 DEMONSTRATION: SEQUENTIAL FILE READ

14 DEMONSTRATION: SEQUENTIAL FILE READ

AGNEDA • Introduction • Problems • Solutions 15 • Evaluation

AGNEDA • Introduction • Problems • Solutions 15 • Evaluation

SOLUTIONS • Extension to existing swapping • Full-virtualization • No VM introspection • Based

SOLUTIONS • Extension to existing swapping • Full-virtualization • No VM introspection • Based on general OS concepts • Can be used with ballooning • Two mechanisms 16 • Swap mapper • False read preventer

P RAM (1) Read command disk B (2) Exit host view RAM P disk

P RAM (1) Read command disk B (2) Exit host view RAM P disk VM image B (3) File read Associate guest memory page with disk block (P=B) (3) mmap to file (4) Remove mapping on write to P or B Similar flow for writes 17 guest view SOLUTION: SWAP MAPPER

SOLUTION: SWAP MAPPER Solves: • • • Subtleties: • • • Stale swap reads

SOLUTION: SWAP MAPPER Solves: • • • Subtleties: • • • Stale swap reads – map instead of read Silent swap writes – no WB of clean pages Decayed swap sequentiality – Data in its original place False anonymity – pages from image are named Consistency VM disk uses 4 KB blocks Prefetch only if present in guest physical memory Remove from host cache if overwritten Limitations • • Overheads – CPU and memory Cannot track migrated pages 18 •

SOLUTION: FALSE READ PREVENTER mov [0 x 10], 5 • Save VM writes to

SOLUTION: FALSE READ PREVENTER mov [0 x 10], 5 • Save VM writes to buffer Virtual Machine Exit • If not, fetch asynchronously and merge Hypervisor • Subtleties: • Selective emulation • Efficient emulation • Host reads Entry Fetch Record Map [0 x 10]=5 Writeback …. 5…. 19 • If page is rewritten, allocate one from free pool and remap

AGNEDA • Introduction • Problems • Solutions 20 • Evaluation

AGNEDA • Introduction • Problems • Solutions 20 • Evaluation

EVALUATION IBM R 420 Server KVM Hypervisor Enterprise disk baseline: host-swapping, no host caching

EVALUATION IBM R 420 Server KVM Hypervisor Enterprise disk baseline: host-swapping, no host caching mapper: swap mapper vswapper: swap mapper and false read preventer balloon: paravirtual balloon, host swapping enabled 21 Configurations

PBZIP 2 VM: 512 MB, 1 VCPU 1. 63 x speedup 22 OOM

PBZIP 2 VM: 512 MB, 1 VCPU 1. 63 x speedup 22 OOM

KERNBENCH 23 VM: 512 MB, 1 VCPU

KERNBENCH 23 VM: 512 MB, 1 VCPU

DYNAMIC WORKLOAD: METIS MAP-REDUCE (WC) VM: 2 GB; Host: 8 GB Mo. M manages

DYNAMIC WORKLOAD: METIS MAP-REDUCE (WC) VM: 2 GB; Host: 8 GB Mo. M manages balloon VMs started 10 sec. apart 24 2 x speedup (w/balloon)

RELATED WORKS • Monitoring the buffer-cache [Jones 06] • Non-blocking writes [Useche 12] •

RELATED WORKS • Monitoring the buffer-cache [Jones 06] • Non-blocking writes [Useche 12] • Memory overcommit mechanisms 25 • Transcendent memory [Magenheimer’ 09] • Cooperative memory management [Schwidefsky’ 06] • Memory hot-plug [Schopp’ 06]

CONCLUSION • Host-swapping poor performance analysis and solution • Swap mapper • False read

CONCLUSION • Host-swapping poor performance analysis and solution • Swap mapper • False read preventer • VSwapper integrates with balloon 26 • Vswapper code is available nadav. amit. to/vswapper

27 QUESTIONS

27 QUESTIONS