OPENSTACK NOVA AND KVMOPTIMISATIONKavit Munshi, CTO, Aptira
OPENSTACK NOVANova is the project name for OpenStack Compute, a cloud computing fabriccontroller, the main part of an IaaS system. Individuals and organizations canuse Nova to host and manage their own cloud computing systems.Key components of the compute part of OpenStack are• Nova• Cinder• GlanceThese are also the weakest points of an OpenStack deployment and suffer themost from performance hits.
COMPUTE PERFORMANCE BOTTLENECKSCompute nodes run the actual virtual instances that power an IaaS solution.These run Hypervisors to share resources between the instances. Theperformance of the hypervisor can be affected by.• I/O : All instances use local file system to host filesystems. Scarce resources as more instances are run per server by increasing cores. First to be hit.• Memory/RAM: Second factor to be hit after disks. Most VMs use RAM more extensively than CPU. With increasing cores and larger VMs RAM contention becomes a problem• CPU: Usually the last to be hit. Not as much of a problem any more because of Hyper threading and multiple cores.
NOVA CONFIGURATION TO AVOID BOTTLENECKSAdmins can take several precautions in the way Nova is configured to ensureoptimal performance of the hypervisor• Flavours: Only allow sensible flavours for the users. Example on a compute node with 8 CPU cores and 96 GB ram avoid creating a flavour that uses 1 vCPU and 64 GB RAM• Quotas: Used to limit the number of resources used by a particular tenant: number of instances, block volume number and space, or number of snaphsots and images kept in Glance. Consider the potential number of tenants and available hardware.• Overprovisioning: Use technologies like thin provisioning, hyper threading to over provision resources but have to be careful about performance hits.
CHOICE OF HYPERVISORMany kinds of hypervisors are supported by Nova. The most popular ones are:• KVM• Xen• Hyper-V• VMWare ESXi For the purpose of this talk we are going to assume that we will be using KVM. It is the most popular and the best supported hypervisor on Nova. KVM has also have a great improvement in performance in the recent times. KVM is also best suited to run Linux machines.
OPTIMISING KVMList of KVM settings that can improve guest performance:• Kernel I/O scheduler to “Deadline”. Default is cfq, good enough for most work loads but for over povisioning use “deadline”• Huge pages enabled• Kernel same-page merging enabled (KSM)• Hyper threading turned on• Place guest file systems directly on hypervisor block devices instead of in files.For optimising running instances use the following drivers• Virtio_net (Network driver)• Virtio_blk (block device driver)
PERFORMANCE IMPROVEMENT WITH DEADLINE SCHEDULER
HUGE PAGESA page, memory page, or virtual page is a fixed-length contiguous block of virtualmemory, and it is the smallest unit of data for the following:• memory allocation performed by the operating system for a program; and• transfer between main memory and any other auxiliary store, such as a hard disk drive.On x86_64 architecture standard page size is 4kb. A huge page is 4MB and alarge page is 1 GB.There are couple of important benefits of HugePages:• Page size is set 2MB instead of 4KB• Memory used by HugePages is locked and cannot be swapped.Huge Pages can also be enabled INSIDE running instances for best performance.
KERNEL SAME-PAGE MERGINGKSM lets the hypervisor system share identical memory pages amongst differentprocesses or virtualized guests.The ksmtuned process work in the following way:• scans through the memory finding duplicate pages• Merges duplicate page to single page• Map to all virtual machine locations• Set copy on write• Separate page when individual guests write to it.KSM is critical to performance if you want to over provision your resourcessuccessfully.
SOURCESThis presentation was created from the following sources. Please read them tobetter understand the conceptshttp://www.linux-kvm.org/wiki/images/5/59/Kvm-forum-2011-performance-improvements-optimizations-D.pdfhttp://www.mirantis.com/blog/making-most-of-openstack-compute-performance/http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/index.jsp?topic=%2Fliaat%2Fliaatbpperfmods.htmhttp://www.linux-kvm.com/content/using-ksm-kernel-samepage-merging-kvmhttp://www.pythian.com/news/1326/performance-tuning-hugepages-in-linux/http://www.linux-kvm.org/wiki/images/9/9e/2010-forum-thp.pdf