Univention Bugzilla – Bug 30504
Second snapshot takes a long time
Last modified: 2023-06-28 10:46:07 CEST
The first snapshot of a default Windows 7 VM takes about 4 seconds. The second snapshot takes about 6 minutes. I use paravirtual devices and qcow2 with cache=none. I can reproduce this with 3.1-0errata0 and the current errata versions which are in the QA.
I didn't see this issue in our own virtualization environment. Maybe it depend on the client hardware. My test hardware is desktop hardware (xen13).
I've had a look at it yesterday and also got very varying results: from 30s to 6 minutes. The cache setting (expect unsafe) does not affect the times very much, so I also conclude that there is some IO problem with the test hardware: The fdatasync() does horrible things to performance when the each 32 KiB data block is physically flushed to the hard disk. On server hardware with battery backed caching, that's fast, on consumer grade hardware it is abyssal slow. Newer qemu (AFAIK >= 1.2 or 1.3) the block layer was rewritten to not use the same code path for doing snapshots as with running VMs: For running VMs the sync() should only return, when the data is really stable, but for snapshots a single sync() after all writes is sufficient, as that process is singe threaded. I've added Bug #22231 as a dependency of this bug, because there I already did some work on performance improvements. It also contains some timing data from previous tests.
There is a patch series for qemu-1.4 which reduces the time for qcow2 internal snapshot creation significantly, from more than 3 minutes to under 1 second. <http://lists.nongnu.org/archive/html/qemu-devel/2013-02/msg02987.html>
Patch for qemu-1.6 <http://lists.gnu.org/archive/html/qemu-devel/2013-09/msg01186.html>
There's also <http://git.qemu-project.org/?p=qemu.git;a=commit;h=211ea74022f51164a7729030b28eec90b6c99a08> which fixes a performance-drop after a VM was migrated/suspended. The patch from qemu-1.6 does not apply to qemu-1.1.2 as-is and needs to be back-ported.
UCS-4.2 has Qemu-2.8, which has seen many improvements to Qcow2.