Skip to content

perf(quickemu): improve disk I/O defaults (cache,aio)#1837

Merged
flexiondotorg merged 1 commit intomasterfrom
disk-optim
Jan 25, 2026
Merged

perf(quickemu): improve disk I/O defaults (cache,aio)#1837
flexiondotorg merged 1 commit intomasterfrom
disk-optim

Conversation

@flexiondotorg
Copy link
Member

  • add cache=writeback and aio=threads to DRIVE_OPTIMISATIONS
  • retain existing optimisations: discard=unmap,detect-zeroes=unmap
  • improve write performance (host writeback caching) and async I/O parallelism via thread-based AIO
  • follows Proxmox/libvirt QEMU disk best practices; researched for macOS but applies to all guests

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have performed a self-review of my code

- add cache=writeback and aio=threads to DRIVE_OPTIMISATIONS
- retain existing optimisations: discard=unmap,detect-zeroes=unmap
- improve write performance (host writeback caching) and async I/O
  parallelism via thread-based AIO
- follows Proxmox/libvirt QEMU disk best practices; researched for macOS
  but applies to all guests

Signed-off-by: Martin Wimpress <martin@wimpress.org>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Confidence score: 3/5

  • Defaulting to cache=writeback in quickemu can increase data-loss risk on host failure because writes may be acknowledged before reaching storage
  • Score reflects a concrete user-impact risk (data integrity) with moderate severity, even though scope is limited to disk cache defaults
  • Pay close attention to quickemu - default disk cache behavior could lead to data loss on crashes
Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="quickemu">

<violation number="1" location="quickemu:1892">
P2: Setting `cache=writeback` as a default for all VM disks increases the risk of data loss on host failures (docs warn that writeback reports writes complete before they hit storage). Consider leaving cache unspecified or using a safer mode by default and making writeback opt‑in.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

DRIVE_OPTIMISATIONS="discard=unmap,detect-zeroes=unmap"
# Optimise disk I/O: enable TRIM/discard, zero detection for thin provisioning,
# writeback caching and threaded async I/O
DRIVE_OPTIMISATIONS="discard=unmap,detect-zeroes=unmap,cache=writeback,aio=threads"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Setting cache=writeback as a default for all VM disks increases the risk of data loss on host failures (docs warn that writeback reports writes complete before they hit storage). Consider leaving cache unspecified or using a safer mode by default and making writeback opt‑in.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At quickemu, line 1892:

<comment>Setting `cache=writeback` as a default for all VM disks increases the risk of data loss on host failures (docs warn that writeback reports writes complete before they hit storage). Consider leaving cache unspecified or using a safer mode by default and making writeback opt‑in.</comment>

<file context>
@@ -1887,8 +1887,9 @@ function vm_boot() {
-    DRIVE_OPTIMISATIONS="discard=unmap,detect-zeroes=unmap"
+    # Optimise disk I/O: enable TRIM/discard, zero detection for thin provisioning,
+    # writeback caching and threaded async I/O
+    DRIVE_OPTIMISATIONS="discard=unmap,detect-zeroes=unmap,cache=writeback,aio=threads"
 
     if [[ "${boot}" == *"efi"* ]]; then
</file context>
Suggested change
DRIVE_OPTIMISATIONS="discard=unmap,detect-zeroes=unmap,cache=writeback,aio=threads"
DRIVE_OPTIMISATIONS="discard=unmap,detect-zeroes=unmap,aio=threads"

@flexiondotorg flexiondotorg merged commit e777817 into master Jan 25, 2026
4 of 5 checks passed
@flexiondotorg flexiondotorg deleted the disk-optim branch January 25, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant