Open-Source Virtualization Master Thesis Jan Magnus Granberg Opsahl
Total Page:16
File Type:pdf, Size:1020Kb
UNIVERSITY OF OSLO Department of Informatics Open-source virtualization Functionality and performance of Qemu/KVM, Xen, Libvirt and VirtualBox Master Thesis Jan Magnus Granberg Opsahl Spring 2013 Abstract The main purpose of this thesis is to evaluate the most common open-source virtualization technologies available. Namely Qemu/KVM, Xen, Libvirt and VirtualBox. The thesis investigates the various virtualization platforms in terms of architecture and overall usage. Before further investigating the platforms through a series of benchmarks. The results gathered from the benchmarks presents Qemu/KVM as the bet- ter in terms of performance in most of the benchmarks. Of these we can count the CPU- and memory intensive benchmarks. For the file-systems benchmarks, Xen delivers performance that is above the other examined virtualization plat- forms. The results also highlight the performance gained with processor ad- ditions such as Intel Extended Page Tables and AMD Rapid Virtualization Indexing, to enable hardware assisted paging. i ii Acknowledgments First and foremost, I thank my thesis supervisor Knut Omang, for his insights, directing me in the right direction when I have lost my way, and most impor- tantly for being incredibly patient. I would also like to thank my fellow students at the Dmms laboratory for a thriving environment, inspiring discussions and their feedback. Last I thank my family for their patience, understanding and endless sup- port during my thesis work. Most importantly I thank my wonderful girlfriend Ingebjørg Miljeteig for believing in me and her enduring support and love. May 2. 2013. Jan Magnus Granberg Opsahl iii iv Contents 1 Introduction 1 1.1 Introduction . .1 1.2 Motivation . .2 1.3 Previous work . .2 1.4 Thesis structure . .3 2 Background 5 2.1 Introduction . .5 2.2 Terms and definitions . .5 2.2.1 On Intel VT and AMD-V . .6 2.3 What is virtualization? . .6 2.3.1 Characteristics . .6 2.3.2 Virtualization Theorems . .7 2.3.3 Types of VMMs . .8 2.3.4 Types of virtualization . .9 2.4 Background for virtualization . 11 2.4.1 Historic background for virtualization . 11 2.4.2 Modern background for virtualization . 12 2.5 A brief history of virtualization . 13 2.5.1 Early history of virtualization . 13 2.5.2 X86 virtualization and the future . 17 2.6 Benefits and different solutions . 21 2.6.1 Advantages and the disadvantages of virtualization tech- nology . 21 2.6.2 Virtualization technology and solutions . 23 2.7 Conclusion . 26 3 Virtualization software 27 3.1 Introduction . 27 3.2 Qemu/KVM . 27 3.2.1 KVM . 27 3.2.2 Qemu . 29 3.3 Xen . 32 3.4 Libvirt . 33 3.4.1 User tools and usage . 34 3.5 VirtualBox . 37 3.5.1 About . 37 3.5.2 Usage . 38 v 3.6 Comparison . 39 4 Benchmarks 43 4.1 Introduction . 43 4.2 Motivation and previous work . 43 4.2.1 Summary . 46 4.3 Virtual Machine Monitors . 47 4.3.1 KVM . 48 4.3.2 QEMU . 48 4.3.3 QEMU-KVM . 48 4.3.4 Virtual Machine Manager and libvirt . 48 4.3.5 Xen . 49 4.3.6 Virtualbox . 49 4.3.7 Equipment and operating system . 49 4.4 Benchmarking suites . 49 4.4.1 Context Switches . 50 4.4.2 Cachebench . 50 4.4.3 LMBench . 51 4.4.4 Linpack . 51 4.4.5 IOZone . 52 4.5 Experiment design . 53 4.5.1 CPU-based tests . 53 4.5.2 Memory-based tests . 54 4.5.3 I/O-based tests . 54 4.5.4 Platform configurations . 55 5 Results 57 5.1 Introduction . 57 5.1.1 Regarding the Host benchmarks . 58 5.2 CPU-based benchmarks . 58 5.2.1 High Performance Linpack . 58 5.2.2 LMBench Context Switch (CTX) . 62 5.2.3 Context Switching . 67 5.2.4 Comments to the CPU benchmarks . 71 5.3 Memory-based benchmarks . 72 5.3.1 Cachebench . 72 5.3.2 LMBench . 75 5.3.3 Comments upon the memory benchmarks . 79 5.4 I/O-based benchmarks - IOZone . 80 5.4.1 Comments . 89 6 Conclusion 91 6.1 About the conclusion . 91 6.2 Virtualization software . 91 6.3 Benchmarking results . 92 6.3.1 CPU-based benchmarks . 92 6.3.2 Memory-based benchmarks . 92 6.3.3 I/O-based benchmarks . 93 6.3.4 Final words . 94 6.4 Shortcomings . 94 vi 6.5 Future work . 95 A Additional results 97 A.1 About . 97 A.2 LMBench CTX . 97 A.3 LMBench MEM . 99 B Installation of used software 101 B.1 Introduction . 101 B.2 KVM . 101 B.3 QEMU . 102 B.4 QEMU-KVM . 102 B.5 High Performance Linpack (HPL) . 102 C Virtualization suite configuration 105 C.1 Qemu/KVM . 105 C.2 Xen . 106 vii viii List of Tables 2.1 Instructions that cause traps. 18 2.2 Intel and AMD new and modified instructions for the X86 hard- ware virtualization extensions. 20 4.1 Table showing the various hypervisors to be tested. 47 4.2 Various process grid configurations for HPL benchmark. 52 4.3 CPU-based tests . 53 4.4 Memory-based tests . 54 4.5 File-based tests . 55 ix x List of Figures 2.1 The typical architecture of virtualization software. Hardware at the bottom and an abstract layer to expose a VM, which runs its own operating system on what it thinks is real hardware. .9 2.2 Paravirtualization abstraction showing the modified drivers that need be present in the OS. 10 2.3 Operating system level virtualization. 11 2.4 Virtual memory abstraction with pointers to RAM memory and the disk. 14 2.5 An IBM System/360-67 at the University of Michigan. Image courtesy of Wikimedia Commons. 16 2.6 Hypervisor and guests with regard to processor rings. 18 3.1 The KVM basic architecture. 28 3.2 Simplified view of Qemu with regard to the operating system. 30 3.3 The basic flow of a KVM guest in Qemu. 30 3.4 Qemu-kvm command-line example. 31 3.5 Xen architecture with guest domains. 32 3.6 Libvirt with regard to hypervisors and user tools. 34 3.7 Guest creation in virt-manager. 36 3.8 Guest installation using virt-install. 36 3.9 virt-viewer commands. 37 3.10 VirtualBox main screen. 38 3.11 xl.cfg file for a Xen-HVM guest. 40 3.12 Comparison of the various virtualization suites. 41 4.1 The different QEMU configurations and abbreviations. 55 4.2 Xen configurations and abbreviations. 56 4.3 Libvirt configurations and abbreviations . 56 4.4 Virtualbox configuration and abbreviation. 56 5.1 HPL benchmark for 1 cpu core. 59 5.2 HPL benchmark for 2 cpu cores. 59 5.3 HPL benchmark for 4 cpu cores. 60 5.4 HPL benchmark for 8 cpu cores. 61 5.5 LMBench CTX with 2 processes. ..