10.24. Switching Ploop I/O Engines

A ploop I/O engine is a driver that maps block device requests (REQ_XXX) to operations on an image file.

Virtuozzo Hybrid Server supports two ploop I/O engines: io_kaio and io_direct. The former, io_kaio, is used by default for virtual disk images on both local ext4 file systems and Virtuozzo Storage.

The advantage of io_kaio compared to io_direct is in the better usage of storage space on the host file system achieved by discard granularity that is a factor of 4 KB versus 1 MB of io_direct. In other words, io_kaio makes it possible to free up blocks smaller than 1 MB from mounted virtual disks.

The disadvantage of io_kaio compared to io_direct is in the increasing defragmentation of host physical disks. It reduces disk write speeds, as each request needs to be split into smaller fragments. It also leads to higher memory usage, because fragment data is cached, and the more fragments, the more memory is needed for the cache. This disadvantage affects HDDs much more than SSDs.

If you need to switch to io_direct, do the following:

  1. Set USE_KAIO_FOR_EXT4=no in /etc/vz/ploop.conf.

  2. As this parameter is read at ploop mount, re-mount the ploop images, e.g., by restarting the virtual environments.

    The newly created and started virtual environments will use the new ploop I/O engine as well.

To switch back to io_kaio, set USE_KAIO_FOR_EXT4=yes in /etc/vz/ploop.conf and remount the ploop images.

To check which engine is currently used by a mounted ploop image, check /sys/block/ploop<N>/pdelta/<highest_number>/io. For example:

# cat /sys/block/ploop61324/pdelta/0/io