]> xenbits.xensource.com Git - libvirt.git/commitdiff
Adjust block size used by dd to speed QEMU domain save operations.
authorLaine Stump <laine@laine.org>
Fri, 4 Jun 2010 03:36:00 +0000 (23:36 -0400)
committerLaine Stump <laine@laine.org>
Fri, 4 Jun 2010 19:36:17 +0000 (15:36 -0400)
See https://bugzilla.redhat.com/show_bug.cgi?id=599091

Saving a paused 512MB domain took 3m47s with the old block size of 512
bytes. Changing the block size to 1024*1024 decreased the time to 56
seconds. (Doubling again to 2048*1024 yielded 0 improvement; lowering
to 512k increased the save time to 1m10s, about 20%)

src/qemu/qemu_driver.c
src/qemu/qemu_monitor.h

index 2dc32fa01b2b3907db1220b62feca7afa2b9d4cc..647c3f4d392d623f41bda3ff608f2f291ab7735b 100644 (file)
@@ -4964,7 +4964,15 @@ static int qemudDomainSaveFlag(virDomainPtr dom, const char *path,
     /* Due to way we append QEMU state on our header with dd,
      * we need to ensure there's a 512 byte boundary. Unfortunately
      * we don't have an explicit offset in the header, so we fake
-     * it by padding the XML string with NULLs */
+     * it by padding the XML string with NULLs.
+     *
+     * XXX: This means there will be (QEMU_MONITOR_MIGRATE_TO_FILE_BS
+     *      - strlen(xml)) bytes of wastage in each file.
+     *      Unfortunately, a large BS is needed for reasonable
+     *      performance. It would be nice to find a replacement for dd
+     *      that could specify the start offset in bytes rather than
+     *      blocks, to eliminate this waste.
+     */
     if (offset % QEMU_MONITOR_MIGRATE_TO_FILE_BS) {
         unsigned long long pad =
             QEMU_MONITOR_MIGRATE_TO_FILE_BS -
index 1870b22440f2cf936e60b153b25daf5716e4ed87..e03b4dff19f4d94863384caac6d570fc7c35072e 100644 (file)
@@ -261,7 +261,10 @@ int qemuMonitorMigrateToCommand(qemuMonitorPtr mon,
                                 unsigned int background,
                                 const char * const *argv);
 
-# define QEMU_MONITOR_MIGRATE_TO_FILE_BS 512llu
+/* In general, a larger BS means better domain save performance,
+ * at the expense of a larger resulting file - see qemu_driver.c
+ */
+# define QEMU_MONITOR_MIGRATE_TO_FILE_BS (1024llu * 1024)
 
 int qemuMonitorMigrateToFile(qemuMonitorPtr mon,
                              unsigned int background,