Skip to content

Add virtio-blk cachingMode and synchronizationMode options #383

@nirs

Description

@nirs

virtio-blk devices have cachingMode and synchronziationMode options that are critical for correctness and performance, but the user of vfkit cannot control them.

Disk image caching modes

The default mode is not documented, but VZDiskImageCachingModeAutomatic is the only mode that make sense as default.

Disk image synchronization modes

The default is not documented, Apple probably want to keep the option to change the default.

Add new virtio-blk options

We cannot select the right options for the user, since every user may have different needs. vfkit should not dictate the policy but pass the options the virtualization framework gave us to the user.

When we give the user the options, the user is responsible for issues and we don't need to spend time on debugging and support. If we document the options correctly, and pass them to Apple virtualization framework correctly, now any issue is on the user or Apple side.

User can contribute performance testing results using the new options.

  • cache:
    • auto: Allows the virtualization framework to automatically determine whether to enable data caching.
    • cached: Enables data caching.
    • uncached: Disables data caching.
  • sync:
    • full: Synchronizes data to the permanent storage holding the disk image.
    • fsync: Synchronizes data to the drive using the system’s best-effort synchronization mode.
    • none: Disables data synchronization with the permanent storage.

Use cases

We can document typical use case and add fio performance results to show the effect of the configuration. The following are my guess for typical usage - I did not do any preforamnce testing since we don't have the option yet.

General purpose VM

vfkit should keep the virtualization framework defaults, unless we know that the defaults are broken. In this case we need a vfkit issue and open an Apple bug.

--device virtio-blk,...

Ephemeral VM

In this case you don't care about the data so you can use:

--device virtio-blk,cache=cached,sync=none,...

Database VM

In this case you care about the data so you can use:

--device virtio-blk,cache=uncached,sync=full,...

Testing

User can any combination for testing vfkit performance or robustness.

Similar options in other systems

qemu

See -drive cache=cache section
https://www.qemu.org/docs/master/system/invocation.html#hxtool-1

krunkit

Currently does not provide any options, we need the same options for compatibility with vfkit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions