2

I have a KVM host server running Ubuntu 12.04 LTS, bare bones installation with only KVM installed. The server has an 8 Core Intel(R) Xeon(R) CPU E3-1230 V2 @ 3.30GHz CPU with 32GB of RAM and SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family SATA AHCI Controller (rev 05). There are two physical disks installed in a mdraid 1. I am using LVM partitions for /, /var, swap.

I am seeking advice on optimizing the disk performance of my KVM guests on this host configuration. My guests are running Ubuntu 12.04 LTS. One guest runs a CrashPlan PROe Master (not storage) Server (http://www.crashplan.com/enterprise/). CrashPlan PROe Server uses a database that is being read/written fairly intensively with our CrashPlan topology and load. As such, log reviews are indicating that transactions are waiting resulting in degraded performance.

My current guest parameters include:

  • Storage Format: RAW
  • Disk Bus: SATA
  • Cache Mode: None
  • IO Mode: Default
  • Memory Allocation: 8192 MB
  • CPU Allocation: 4

Can anyone suggest best practices to host or guest configuration to optimize performance of KVM guests disk IO performance particularly for random read/write (database)?

sardean
  • 833
  • 3
  • 14
  • 34
  • 1
    I think [this previous answer](http://serverfault.com/a/425654/126632) hits the high points. My feeling is you probably need more spindles or even SSD. – Michael Hampton Apr 09 '14 at 01:30

2 Answers2

4

I strongly suggest you to try with cache=writeback

With recent OS as guests it will be equally safe (if not better) but generally much faster then cache=none.

I conducted some tests in the past, you can read more here: http://www.ilsistemista.net/index.php/virtualization/43-kvm-scalability-and-consolidation-ratio-cache-none-vs-cache-writeback.html

As a side note, be sure to using VirtIO drivers to get the most from yours HDDs.

shodanshok
  • 44,038
  • 6
  • 98
  • 162
  • Wouldn't you only want to enable the write back cache on the host with the real disks, not the guests? – tomstephens89 Aug 24 '15 at 15:58
  • 1
    From the guest perspective, a write back enabled vdisk is like a real disk with an huge (and fast) DRAM cache. If you use a modern OS as guest (one capable of correctly issue wrote barriers using ATA flush commands or ATA FUAs, the guest can benefit from significantly faster disk I/O. Form more information, please read here: http://www.ilsistemista.net/index.php/virtualization/23-kvm-storage-performance-and-cache-settings-on-red-hat-enterprise-linux-62.html – shodanshok Aug 24 '15 at 16:05
  • What if the vm disk storage is RAW LVM inside a host LVM group. I use Proxmox (KVM) a lot and the general suggestion is that for max performance you set the guest disk to RAW with no cache? – tomstephens89 Aug 24 '15 at 16:12
  • 1
    It's the same thing. The advise to use __cache=none__ was given on the grounds that 1) __writeback__ was unsafe and that 2) double-caching was something to avoid. However, moder guest OS coupled with recent KVM versions (with barrier-passing support) obsoleted point n.1, and the vast amount of low-cost memory / high perf CPU available for hypervisors sidestepped point n.2 On the plus side, enabling writeback cache can significantly increase guest I/O speed, as both reads and writes are cached in the large hypervisor/hosts memory pool. – shodanshok Aug 24 '15 at 16:46
  • 1
    As an example consider a large memory (128 GB+) hypervisor hosting many small (1-4 GB) VMs. With cache=none, each virtual machine is in charge of caching its own data but, having limited memory resources, it can not cache much. Using cache=writeback each VM continue to cache the most recent data, but this time __the hypervisor is also caching other potentially useful data.__ The double caching scheme means that some more CPU cycles are used, but is has no negative effects on memory pressure (cache/buffers can be reclaimed almost immediately). For more info, please reads the provided links. – shodanshok Aug 24 '15 at 16:53
  • Thanks for the info, I am still unsure but will read up anyway and test this myself! – tomstephens89 Aug 24 '15 at 17:10
  • 1
    where I can read about "obsoleted point n.1" ? – zombi_man Dec 07 '15 at 08:22
  • @zombi_man, the link is given in the 2nd comment: http://www.ilsistemista.net/index.php/virtualization/23-kvm-storage-performance-and-cache-settings-on-red-hat-enterprise-linux-62.html – Alek_A Dec 27 '19 at 20:58
0

Unless you are using SSD's already then your two disk RAID1 configuration is going to be extremely limiting for random IO. You need more disk spindles in a configuration such as RAID10 or some SSD's to get more performance.

You should also be using VIRTIO as your storage interface on all guests.

tomstephens89
  • 981
  • 1
  • 11
  • 23