[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-API] How snapshot work on LVMoISCS SR
Ian Pratt wrote: Ack. Without application signalling (as provided by VSS) it's unclear whether there's any real benefit since the application data may still be internally inconsistent.That means if guest linux is executing "yum install kernel" when creating snapshot, the vm created from this snapshot might be not bootable.Because xen issues write completions to the guest only when IO is completed, the snapshot will at least be crash consistent from a filesystem point of view (just like a physical system loosing power).Linux doesn't have a generic mechanism for doing higher-level 'freeze' operations (see Windows VSS) so there's no way to notify yum that we'd like to take a snapshot. Some linux filesystems do support a freeze operation, but it's not clear this buys a great deal. FYI - for windows VMs XCP includes a VSS quiesced snapshot option (VM.snapshot_with_quiesce) which utilises the agent running in the guest as a VSS requestor to quiesce the apps, flush the local cache to disk and then trigger a snapshot for all the VMs disks. - Julian 99 times out of 100 you'll get away with just taking a snapshot of a VM. If you're wanting to use the snapshot as a template for creating other clones you'd be best advised to shut the guest down and get a clean filesystem though. Any snapshot should be fine for general file backup purposes. Ian PS: I'd be surprised if "yum install kernel" didn't actually go to some lengths to be reasonably atomic as regards switching grub over to using the new kernel, otherwise you'd have the same problem on a physical machine crashing or losing power.- AnthonyDanielHow does XCP make sure this snapshot is usable,say, virtual disk metadata is consistent? Thanks - Anthony On Tue, 2010-01-26 at 13:56 -0800, Ian Pratt wrote:I still have below questions. 1. if a non-leaf node is coalesce-able, it will be coalesced lateronregardless how big the physical size of this node?Yes: it's always good to coalesce the chain to improve accessperformance.2. there is one leaf node for a snapshot, actually it may beempty, doesit exist only because it can prevent coalesce.Not quite sure what you're referring to here. The current code has alimitation whereby it is unable to coalesce a leaf into its parent, so after you've created one snapshot you'll always have a chain length of 2 even if you delete the snapshot (if you create a second snapshot it can be coalesced).Coalescing a leaf into its parent is on the todo list: its a littlebit different from the other cases because it requires synchronization if the leaf is in active use. It's not a big deal from a performance point of view to have the slightly longer chain length, but it will be good to get this fixed for cleanliness.3. a clone will introduce a writable snapshot, it will preventcoalesceA clone will produce a new writeable leaf linked to the parent. Itwill prevent the linked snapshot from being coalesced, but any other snapshots above or below on the chain can still be coalesced by the garbage collector if the snapshots are deleted.The XCP storage management stuff is pretty cool IMO... Ian- Anthony On Tue, 2010-01-26 at 02:34 -0800, Julian Chesterfield wrote:Hi Anthony, Anthony Xu wrote: > Hi all, > > Basically snapshot on LVMoISCSISR workwell, it provides thin > provisioning, so it is fast and diskspaceefficient. > > > But I still have below concern. > > There isone morevhd chain when creating snapshot, if I creates 16 > snapshots,thereare 16 vhd chains, that means when one VM accesses a > diskblock, itmay need to access 16 vhd lvm one by one, then get the > rightblock,it makes VM access disk slow. However, it is > understandable,it ispart of snapshot IMO. > The depth and speed of access willdepend onthe write pattern to the disk. In XCP we add an optimisationcalled aBATmap which stores one bit per BAT entry. This is a fastlookup tablethat is cached in memory while the VHD is open, and tells theblockdevice handler whether a block has been fully allocated. Oncetheblock is fully allocated (all logical 2MB written) the blockhandlerknows that it doesn't need to read or write the Bitmap that corresponds to the data block, it can go directly to the diskoffset.Scanning through the VHD chain can therefore be very quick,i.e. theblock handler reads down the chain of BAT tables for each nodeuntilit detects a node that is allocated with hopefully the BATmapvalueset. The worst case is a random disk write workload whichcauses thedisk to be fragmented and partially allocated. Every read orwritewill therefore potentially incur a bitmap check at every levelof thechain. > But after I delete all these 16 snapshots, there isstill 16vhd chains, > the disk access is still slow, which is not understandable and > reasonable, even though there may be onlyseveralKB difference between > each snapshot, > There is a mechanismin XCPcalled the GC coalesce thread which gets kicked asynchronously following a VDI deletion event. It queries the VHD tree, and determines whether there is any coalescable work to do.Coalesceablework is defined as: 'a hidden child node that has no siblings' Hidden nodes are non-leaf nodes that reside within a chain. Whenthesnapshot leaf node is deleted therefore, it will leave redundantlinksin the chain that can be safely coalesced. You can kick off acoalesceby issuing an SR scan, although it should kick off automaticallywithin30 seconds of deleting the snapshot node, handled by XAPI. Ifyou lookin the /var/log/SMlog file you'll see a lot of debug information including tree dependencies which will tell you a) whether theGC threadis running, and b) whether there is coalescable work to do. Notethatdeleting snapshot nodes does not always mean that there iscoalescablework to do since there may be other siblings, e.g. VDI clones.is there any way we can reduce depth of vhd chain afterdeletingsnapshots? get VM back to normal disk performance.The coalesce thread handles this, see above.And, I notice there are useless vhd volume exist afterdeleting snapshots, can we delete them automatically?No. I do not recommend deleting VHDs manually since they arealmostcertainly referenced by something else in the chain. If youdelete themmanually you will break the chain, it will become unreadable,and youpotentially lose critical data. VHD chains must be correctlycoalescedin order to maintain data integrity. Thanks, Julian- Anthony _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api_______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api_______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |