difference engine: harnessing memory redundancy in virtual machines by diwaker gupta et al....
TRANSCRIPT
![Page 1: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/1.jpg)
Difference Engine: Harnessing Memory Redundancy
in Virtual Machinesby Diwaker Gupta et al.
presented by Jonathan Berkhahn
![Page 2: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/2.jpg)
Motivation
• Virtualization has improved and spread over the past decade
• Servers often run at 5-10% of CPU Capacityo High capacity needed for peak workloadso Fault isolation for certain serviceso Certain services run best on particular configurations
• Solution: Virtual Machines
![Page 3: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/3.jpg)
Problem
• CPU's suited to multiplexing, main memory is not• Upgrading not an ideal option
o Expensiveo Limited by slots on the motherboardo Limited by ability to support higher capacity moduleso Consumes significant power, and therefore produces
significant heat• Further exacerbated by current trends toward many-core
systems
![Page 4: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/4.jpg)
How do we fix this memory bottleneck for virtual machines?
![Page 5: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/5.jpg)
Difference Engine
• Implemented as an extension to the Xen VMM o Sub-page granularity page sharingo In-memory page compression
• Reduces the memory footprint by up to 90% for
homogenous workloads and up to 65% for heterogeneous workloads
![Page 6: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/6.jpg)
Outline
• Related Work• Difference Engine algorithms• Implementation• Evaluation
![Page 7: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/7.jpg)
Page Sharing
• Transparent page sharingo Requires guest OS modification
• Content-based
o VMWare ESX
![Page 8: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/8.jpg)
Delta Encoding
• Manbero Rabin fingerprintso Inefficient
• Brodero Combined Rabin fingerprints and sampling
• Both focused on identifying similar files, but not encoding the differences
![Page 9: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/9.jpg)
Memory Compression
• Douglis et al.o Sprite OSo Double-edge sword
• Wilson et al.o Previous results due to slow hardwareo Developed algorithms that exploit virtual memory
structure
![Page 10: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/10.jpg)
Outline
• Related Work• Difference Engine algorithms• Implementation• Evaluation
![Page 11: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/11.jpg)
Page Sharing
• Content-based• Hash pages and index by hash value
o Hash collisions indicate a potential matcho Compare byte-by-byte to ensure pages are
identicalo Reclaim one page, update virtual memoryo Writes cause a page fault trapped by the VMM
![Page 12: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/12.jpg)
Patching
• Sharing of similar pages• Identify similar pages, store differences as a
"patch"• Compresses multiple pages down to single
reference copy and a collection of patches
![Page 13: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/13.jpg)
Identifying Candidate Pages
![Page 14: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/14.jpg)
Compression
• Compression of live pages in main memoryo Useful only for high compression ratios
• VMM traps requests for compressed pages
![Page 15: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/15.jpg)
Overview
![Page 16: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/16.jpg)
Paging Machine Memory
• Last resort • Copy pages to disk• Extremely expensive operation• Leaves policy decisions to end user
![Page 17: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/17.jpg)
Caveat
Both patching and compression are only useful for infrequently accessed pages.
So, how do we determine "infrequent"?
![Page 18: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/18.jpg)
Clock
• Not-Recently Used policy• Checks if page has been referenced/modified
o C1 - Recently Modifiedo C2 - Recently Referencedo C3 - Not Recently Accessedo C4 - Not Accessed for a While
![Page 19: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/19.jpg)
Outline
• Related Work• Difference Engine algorithms• Implementation• Evaluation
![Page 20: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/20.jpg)
Implementation
• Modification to Xen VMM• Roughly 14,500 lines of code, plus 20,000 for ports of
existing patching and compression algorithms• Shadow Page Table
o Difference Engine relies on modifying the shadow page and P2M tables
o Ignored pages mapped by Dom-0 • Complications: Real Mode and I/O support
![Page 21: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/21.jpg)
Complications
• Booting on bare metal disables pagingo Requires paging to be enabled within guest OS
• I/Oo Xen hypervisor emulates I/O hardware with a Dom-0
process ioemu, which directly accesses guest pageso Conflicts with policy of not acting on Dom-0 pageso Unmap VM pages every 10 seconds
![Page 22: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/22.jpg)
Clock
• NRU policy• Tracked by Referenced and Modified bits on each
page• Modified Xen's shadow page tables to set bits
when creating mappings• C1 - C4
![Page 23: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/23.jpg)
Page Sharing
• Hash table in Xen heapo Memory limitations - 12 Mb
• Hash table only holds entries for 1/5 memoryo 1.76 Mb hash table
• Covers all of memory in 5 passes
![Page 24: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/24.jpg)
Detecting Similar Pages
• Hash Similarity Detector (2,1) o Hash similarity table cleared after all pages have
been considered• Only building the patch and replaced the page
requires a locko May result in a differently sized patch, but will
still be correct
![Page 25: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/25.jpg)
Compression & Disk Paging
• Antagonistic relationship with patchingo Compressed/Disk pages can't be patched
• Delayed until all pages have been checked for similarity and the page has not been accessed for a while (C4)
• Disk paging done by daemon running in Dom-0
![Page 26: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/26.jpg)
Disk Paging
![Page 27: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/27.jpg)
Outline
• Related Work• Difference Engine algorithms• Implementation• Evaluation
![Page 28: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/28.jpg)
Evaluation
• Experiments run on dual-processor, dual-core 2.33 GHz Intel Xeon, 4 KB page size
• Tested each operation individually for overhead
![Page 29: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/29.jpg)
Page Lifetime
![Page 30: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/30.jpg)
Homogenous VMs
![Page 31: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/31.jpg)
Homogenous Workload
![Page 32: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/32.jpg)
Heterogeneous Workload
![Page 33: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/33.jpg)
Heterogeneous Workload 2
![Page 34: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/34.jpg)
Utilizing Savings
![Page 35: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/35.jpg)
Conclusion
• Main memory is a primary bottleneck for VMs• Significant memory savings can be achieved from:
o Sharing identical pageso Patching similar pageso In-memory page compression
• Implemented DE and showed memory savings of as much as 90%
• Saved memory can be used to run more VMs
![Page 36: Difference Engine: Harnessing Memory Redundancy in Virtual Machines by Diwaker Gupta et al. presented by Jonathan Berkhahn](https://reader036.vdocuments.mx/reader036/viewer/2022062421/56649c905503460f9494a958/html5/thumbnails/36.jpg)
Discussion