From: Dietmar Maurer <dietmar@proxmox.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, Dietmar Maurer <dietmar@proxmox.com>
Subject: [Qemu-devel] [PATCH 1/5] RFC: Efficient VM backup for qemu (v1)
Date: Wed, 21 Nov 2012 10:01:00 +0100 [thread overview]
Message-ID: <1353488464-82756-1-git-send-email-dietmar@proxmox.com> (raw)
This series provides a way to efficiently backup VMs.
* Backup to a single archive file
* Backup contain all data to restore VM (full backup)
* Do not depend on storage type or image format
* Avoid use of temporary storage
* store sparse images efficiently
The file docs/backup-rfc.txt contains more details.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
docs/backup-rfc.txt | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 119 insertions(+), 0 deletions(-)
create mode 100644 docs/backup-rfc.txt
diff --git a/docs/backup-rfc.txt b/docs/backup-rfc.txt
new file mode 100644
index 0000000..5b4b3df
--- /dev/null
+++ b/docs/backup-rfc.txt
@@ -0,0 +1,119 @@
+RFC: Efficient VM backup for qemu
+
+=Requirements=
+
+* Backup to a single archive file
+* Backup needs to contain all data to restore VM (full backup)
+* Do not depend on storage type or image format
+* Avoid use of temporary storage
+* store sparse images efficiently
+
+=Introduction=
+
+Most VM backup solutions use some kind of snapshot to get a consistent
+VM view at a specific point in time. For example, we previously used
+LVM to create a snapshot of all used VM images, which are then copied
+into a tar file.
+
+That basically means that any data written during backup involve
+considerable overhead. For LVM we get the following steps:
+
+1.) read original data (VM write)
+2.) write original data into snapshot (VM write)
+3.) write new data (VM write)
+4.) read data from snapshot (backup)
+5.) write data from snapshot into tar file (backup)
+
+Another approach to backup VM images is to create a new qcow2 image
+which use the old image as base. During backup, writes are redirected
+to the new image, so the old image represents a 'snapshot'. After
+backup, data need to be copied back from new image into the old
+one (commit). So a simple write during backup triggers the following
+steps:
+
+1.) write new data to new image (VM write)
+2.) read data from old image (backup)
+3.) write data from old image into tar file (backup)
+
+4.) read data from new image (commit)
+5.) write data to old image (commit)
+
+This is in fact the same overhead as before. Other tools like qemu
+livebackup produces similar overhead (2 reads, 3 writes).
+
+Some storage types/formats supports internal snapshots using some kind
+of reference counting (rados, sheepdog, dm-thin, qcow2). It would be possible
+to use that for backups, but for now we want to be storage-independent.
+
+Note: It turned out that taking a qcow2 snapshot can take a very long
+time on larger files.
+
+=Make it more efficient=
+
+The be more efficient, we simply need to avoid unnecessary steps. The
+following steps are always required:
+
+1.) read old data before it gets overwritten
+2.) write that data into the backup archive
+3.) write new data (VM write)
+
+As you can see, this involves only one read, an two writes.
+
+To make that work, our backup archive need to be able to store image
+data 'out of order'. It is important to notice that this will not work
+with traditional archive formats like tar.
+
+During backup we simply intercept writes, then read existing data and
+store that directly into the archive. After that we can continue the
+write.
+
+==Advantages==
+
+* very good performance (1 read, 2 writes)
+* works on any storage type and image format.
+* avoid usage of temporary storage
+* we can define a new and simple archive format, which is able to
+ store sparse files efficiently.
+
+Note: Storing sparse files is a mess with existing archive
+formats. For example, tar requires information about holes at the
+beginning of the archive.
+
+==Disadvantages==
+
+* we need to define a new archive format
+
+Note: Most existing archive formats are optimized to store small files
+including file attributes. We simply do not need that for VM archives.
+
+* archive contains data 'out of order'
+
+If you want to access image data in sequential order, you need to
+re-order archive data. It would be possible to to that on the fly,
+using temporary files.
+
+Fortunately, a normal restore/extract works perfectly with 'out of
+order' data, because the target files are seekable.
+
+* slow backup storage can slow down VM during backup
+
+It is important to note that we only do sequential writes to the
+backup storage. Furthermore one can compress the backup stream. IMHO,
+it is better to slow down the VM a bit. All other solutions creates
+large amounts of temporary data during backup.
+
+=Archive format requirements=
+
+The basic requirement for such new format is that we can store image
+date 'out of order'. It is also very likely that we have less than 256
+drives/images per VM, and we want to be able to store VM configuration
+files.
+
+We have defined a very simply format with those properties, see:
+
+docs/specs/vma_spec.txt
+
+Please let us know if you know an existing format which provides the
+same functionality.
+
+
--
1.7.2.5
next reply other threads:[~2012-11-21 9:01 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-21 9:01 Dietmar Maurer [this message]
2012-11-21 9:01 ` [Qemu-devel] [PATCH 2/5] add basic backup support to block driver Dietmar Maurer
2012-11-22 11:25 ` Stefan Hajnoczi
2012-11-22 11:29 ` Dietmar Maurer
2012-11-23 8:56 ` Dietmar Maurer
2012-11-21 9:01 ` [Qemu-devel] [PATCH 3/5] introduce new vma archive format Dietmar Maurer
2012-11-21 16:06 ` Eric Blake
2012-11-21 17:56 ` Dietmar Maurer
2012-11-21 9:01 ` [Qemu-devel] [PATCH 4/5] add backup related monitor commands Dietmar Maurer
2012-11-21 16:16 ` Eric Blake
2012-11-21 17:59 ` Dietmar Maurer
2012-11-21 18:49 ` Dietmar Maurer
2012-11-21 9:01 ` [Qemu-devel] [PATCH 5/5] add regression tests for backup Dietmar Maurer
2012-11-21 10:48 ` [Qemu-devel] [PATCH 1/5] RFC: Efficient VM backup for qemu (v1) Kevin Wolf
2012-11-21 11:10 ` Dietmar Maurer
2012-11-21 12:37 ` Kevin Wolf
2012-11-21 13:23 ` Paolo Bonzini
2012-11-23 7:42 ` Dietmar Maurer
2012-11-23 9:18 ` Paolo Bonzini
2012-11-23 9:28 ` Dietmar Maurer
2012-11-23 8:12 ` Dietmar Maurer
2012-11-23 9:01 ` Dietmar Maurer
2012-11-23 9:05 ` Dietmar Maurer
2012-11-23 9:15 ` Paolo Bonzini
2012-11-23 9:17 ` Dietmar Maurer
2012-11-23 9:55 ` Kevin Wolf
2012-11-23 10:55 ` Markus Armbruster
2012-11-21 13:25 ` Dietmar Maurer
2012-11-21 13:58 ` Kevin Wolf
2012-11-21 15:47 ` Dietmar Maurer
2012-11-23 7:38 ` Dietmar Maurer
2012-11-23 9:08 ` Kevin Wolf
2012-11-23 9:21 ` Dietmar Maurer
2012-11-23 9:31 ` Dietmar Maurer
2012-11-23 10:29 ` Kevin Wolf
2012-11-26 5:51 ` Dietmar Maurer
2012-11-26 12:07 ` Paolo Bonzini
2012-11-27 6:20 ` Dietmar Maurer
2012-11-27 7:15 ` Dietmar Maurer
2012-11-27 8:48 ` Kevin Wolf
2012-11-27 10:24 ` Dietmar Maurer
2012-11-21 11:23 ` Dietmar Maurer
2012-11-22 11:12 ` Stefan Hajnoczi
2012-11-22 11:26 ` Dietmar Maurer
2012-11-22 12:44 ` Stefan Hajnoczi
2012-11-22 12:55 ` Dietmar Maurer
2012-11-22 15:30 ` Stefan Hajnoczi
2012-11-22 15:58 ` Dietmar Maurer
2012-11-22 17:02 ` Stefan Hajnoczi
2012-11-22 17:34 ` Dietmar Maurer
2012-11-22 11:40 ` Dietmar Maurer
2012-11-22 15:42 ` Stefan Hajnoczi
2012-11-22 12:00 ` Dietmar Maurer
2012-11-22 15:45 ` Stefan Hajnoczi
2012-11-22 15:56 ` Dietmar Maurer
2012-11-22 16:37 ` Stefan Hajnoczi
2012-11-22 12:03 ` Dietmar Maurer
2012-11-22 17:16 ` Stefan Hajnoczi
2012-11-22 17:46 ` Dietmar Maurer
2012-11-23 5:23 ` Stefan Hajnoczi
2012-11-23 5:25 ` Stefan Hajnoczi
2012-11-23 6:18 ` Dietmar Maurer
2012-11-23 6:13 ` Dietmar Maurer
2012-11-22 17:50 ` Dietmar Maurer
2012-11-23 5:21 ` Stefan Hajnoczi
2012-11-22 18:05 ` Dietmar Maurer
2012-11-23 5:19 ` Stefan Hajnoczi
2012-11-23 6:05 ` Dietmar Maurer
2012-11-22 18:15 ` Dietmar Maurer
2012-11-27 10:09 ` Wenchao Xia
2012-11-27 10:37 ` Dietmar Maurer
2012-11-28 9:39 ` Wenchao Xia
2012-11-28 11:08 ` Dietmar Maurer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1353488464-82756-1-git-send-email-dietmar@proxmox.com \
--to=dietmar@proxmox.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).