1

Note that for maximum performance, it's recommended to have /var/lib/lxd on a btrfs filesystem or setup ZFS or LVM and configure LXD to use a ZFS pool or LVM VG. Source

Why is that? I.e. How will those file systems (on the host) equate to better container performance?

Is it computational performance, is it just reduced hard drive consumption because of copy-on-write, both, neither, or something else?

Edit 1

Thanks to @Sven for pointing out that "LVM VG" refers to Logical Volume Manager Volume Group.

pleasedesktop
  • 201
  • 1
  • 4
  • 9
  • 1
    `VG` = Volume Group. You use one or more physical volumes (PV) to create a VG and then create a logical volume (LV) on that VG. – Sven Feb 29 '16 at 09:39

2 Answers2

3

In addition to what @Sven said; ZFS, btrfs and LVM all provide copy-on-write clone/snapshot features. This makes it very cheap storage and time-wise to spin up new containers. With an image stored on regular ext2-4 filesystem, LXD will have to copy all the data itself, which takes more time and storage.

2

First off, btrfs and ZFS offer features similar to LVM where space is offered not as a file but as a device with direct block device access.

When using disk image files (e.g. qcow), a file system operation in the container will be translated like this:

FS op.-> virtual block device -> FS op in the host on the container file 
     -> physical block device (or any number of  VFS layers like e.g. LVM)  

where the FS op on the container is a comparatively expensive operation. Using some kind of logical volume instead of a container file gets rid of this expensive FS operation:

FS op.-> virtual block device -> logical volume -> physical block device

where the logical volume operation is much cheaper than a file system operation.

Sven
  • 98,649
  • 14
  • 180
  • 226
  • I see what you are getting at, but could you add one or more example operations at each level, to provide a more concrete answer? E.g. At the file system operation in the host: seek to location XYZ in file and write ABC bytes. – pleasedesktop Feb 29 '16 at 11:01
  • When did Btrfs start providing "a device with direct block device access"? O_o – poige Dec 03 '16 at 07:18
  • btrfs doesn't seem to support yet to create block device inside its fs: https://btrfs.wiki.kernel.org/index.php/UseCases#Can_we_create_virtual_block_device_in_BTRFS.3F – Mircea Vutcovici Dec 07 '16 at 01:44