Docker Qcow2 Vs Raw

Posted on  by 

This page is intended to be a collection of various performance tips/tweaks to help you get the most from your KVM virtual servers.

Introduction to Containers and Docker. Containerization is an approach to software development in which an application or service, its dependencies, and its configuration (abstracted as deployment manifest files) are packaged together as a container image. The containerized application can be tested as a unit and deployed as a container image. Raw is direct access to a hard disk device like /dev/sdx, it will be faster then qcow2. Qcow2 supports snapshots and thin provisioning which raw does not. As you went with ext4 with hw raid i would only go with qcow2.

However, the gotcha is that, for some reason, when writing directly to a ZFS file system, ProxMox insists on writing both the VMs and VM backups as raw block files instead of a much more compact qcow2. Ironically, if writing to an ext4 file system, Proxmox can write both VM's and VM backups in the qcow2 file format. So, a VM of, say, PopOS. For 'thin provisioning' go with qcow2. It can be converted in many formats, if needed. It is a question of compatibility and convenience vs sheer power and stability, but imo, in this case, the gains with raw are far from compensating the losses in the other chapters, but to each their own.

VirtIO

Use virtIO for disk and network for best performance.

  • Linux has the drivers built in since Linux 2.6.24 as experimental, and since Linux 3.8 as stable
  • FreeBSD has the drivers built in since 9.0
  • Windows requires the Windows VirtIO Drivers to be downloaded and installed manually

Disk Cache

Note: The information below is based on using raw volumes, other volume formats may behave differently.

Small Overview

Note: The overview below is dependent of the specific hardware used, i.e. a HW Raid with a BBU backed disk cache works just fine with 'writeback' mode, so take it just as an general overview.

ModeHost Page CacheDisk Write CacheNotes
nonedisabledenabledbalances performance and safety (better writes)
writethroughenableddisabledbalances performance and safety (better reads)
writebackenabledenabledfast, can loose data on power outage depending on hardware used
directsyncdisableddisabledsafest but slowest (relative to the others)
unsafeenabledenableddoesn't flush data, fastest and unsafest

cache=none seems to be the best performance and is the default since Proxmox 2.X.

cache=writethrough


cache=directsync.


cache=writeback

For read cache memory: try to add more memory in your guest, they already do the job with their buffer cache

cache=writethrough or directsync can be also quite fast if you have a SAN or HW raid controller with battery backed cache.

Using qcow2 backed disks and either cache=directsync or writethrough can make things slower.


some interestings articles :

cache mode and fsync : http://www.ilsistemista.net/index.php/virtualization/23-kvm-storage-performance-and-cache-settings-on-red-hat-enterprise-linux-62.html?start=2

Windows

Download

USB Tablet Device

Disabling the USB tablet device in windows VMs can reduce idle CPU usage and reduce context switches. This can be done on the GUI. You can use vmmouse to get the pointer in sync (load drivers inside your VM).[1]

Use raw disk image and not qcow2

Consider using raw image or partition for a partition, especially with Microsoft SQL database files because qcow2 can be very slow under such type of load.

Docker Qcow2 Vs Rawlings

Trace Flag T8038 with Microsoft SQL Server

Docker Qcow2 Vs Raw Download

Setting the trace flag -T8038 will drastically reduce the number of context switches when running SQL 2005 or 2008.

To change the trace flag:

  1. Open the SQL server Configuration Manager
  2. Open the properties for the SQL service typically named MSSQLSERVER
  3. Go to the advanced tab
  4. Append ;-T8038 to the end of the startup parameters option

For additional references see: Proxmox forum

Do not use the Virtio Balloon Driver

The Balloon driver has been a source of performance problems on Windows, you should avoid it.(see http://forum.proxmox.com/threads/20265-SOLVED-Hyper-Threading-vs-No-Hyper-Threading-Fixed-vs-Variable-Memory for the discussion thread)

Retrieved from 'https://pve.proxmox.com/mediawiki/index.php?title=Performance_Tweaks&oldid=10996'

Coments are closed