Talking about COW and ROW snapshot technology

Source: Internet
Author: User
Directory

Catalog Preface snapshot and Backup differences snapshot technology incremental snapshot COW increment snapshot row

Objective

After a period of practice, again review the implementation of the Cow/row snapshot technology, the temperature is known new. The difference between snapshots and backups

Traditionally, people have been using data replication, backup, recovery and other technologies to protect important data information, regular data backup or replication. Because the data backup process can affect application performance and is time-consuming, data backups are often scheduled to occur when the system load is lighter (such as at night). In addition, in order to conserve storage space, it is usually combined with full volume and incremental backup technology. Obviously, there is a significant deficiency in this way of data backup, that is, the backup window problem. During the data backup, the enterprise business needs to temporarily stop the external provision of services. As enterprise data volumes and data growth speed up, this window may be more and more long, which is unacceptable for critical business systems. such as banks, telecommunications and other institutions, information systems require 24*7 uninterrupted operation, short downtime or a small amount of data loss will lead to huge losses. As a result, you need to shrink the data Backup window as much as possible, or even reduce it to zero. Technologies such as data snapshots (Snapshot), Continuous data protection (CDP, continuous data Protection) are the data protection technologies that arise to meet such requirements. It is important to note that, with the increasing reliance on information systems, even in traditional key industries such as banking and telecommunications, more and more systems in government, education, and enterprise require smaller backup windows and shorter downtime. "Reduce the cost of data protection, improve the application awareness in the process of data protection, and gradually become the core demands of customers". Snapshot technology

Definition of a snapshot: a fully available copy of the specified data set, which includes an image of the corresponding data at a point in time (the point at which the copy begins). A snapshot can be a copy of the data it represents, or it can be a replica of the data. From more specific technical details, a snapshot is a reference mark or pointer to data stored in a storage device. As we can understand, snapshots are a bit like a detailed data address directory table, but snapshots are treated as a complete data backup in the computer.

The role of snapshot technology: the main ability to do online data recovery, when the storage device failure or damage to the real-time data recovery, the storage state to the snapshot point of time state. Another role is to provide storage users with another channel of data access, when the source data for online application processing, users can choose to access the snapshot data, but also to apply the snapshot to the test and so on. Therefore, all storage systems, regardless of high school low-end, as long as the application of online systems, then snapshots become an indispensable function. Snapshots play an increasingly important role in the backup, data protection process.

Advantages of Snapshots:

Snapshots can be set up within seconds to be used by backup applications. With the snapshot technology, with the common backup software is implemented: The graphical management interface to emit snapshots of the command snapshot function automatically look for no data changes at the moment to copy, a few seconds after the copy generation
-use backup software to back up the copy

Mirroring of snapshots can restore data to the point-in-time of snapshots in seconds, allowing system administrators to selectively and quickly recover damaged or deleted files

There are many uses for data snapshots, such as the need for an up-to-date production data to test new systems or to provide decision support and data analysis, while the system is not shut down, and a tape backup is a long time to recover data. In this case, the backup function of the data snapshot can be used to establish the snapshot copy at any point in time, and the data of the copy will be used to test and analyze without affecting the normal use of the system.

Classification of snapshots:

Full-scale snapshots: mirror separation (split Mirror)

Incremental snapshot Write-time copy (Copy-On-Write)-write-time redirect (Redirect-on-write) incremental Snapshot COW

COW (Copy-On-Write), also known as "write-and-copy" snapshot technology or "write-time Replication" snapshot technology, is often referred to as the "metadata (source data pointer table)" copy. As the name suggests, if someone attempts to overwrite the original data on the source block, first copy the original data into a new block of data, and then rewrite it. When you need to reference the original data when you restore the snapshot, the snapshot software maps the original data to the new data block.

Take a closer look at the COW process, COW when you create a snapshot, there is no physical copy of the data, only the physical location metadata of the source block where the original data resides. Therefore, COW snapshots are created very quickly and can be done instantaneously. After the snapshot is created, the snapshot software monitors the changes to the original data (that is, writes to the source block). Once the original data in the source block is overwritten, the data on the source block is copied into the new block of data, and the new data is written to the source block to overwrite the original data. All of the source blocks form the so-called source data volume, and the new data block makes up the snapshot volume. You should be able to see that COW has a very obvious drawback, is that it will reduce the write performance of the source data volume, because each rewrite new data, actually two times write.

Take a closer look at the principle of COW, when the snapshot is created, the snapshot volume is created at the same time, but only a relatively small amount of storage space is allocated to save the updated data in the source data volume after the snapshot was created. Each source data volume has a data pointer table (metadata), referred to as the source data pointer table, and the table record is the address pointer to the corresponding source data block. When a snapshot is created, the storage subsystem establishes a copy of the source data pointer table (a metadata copy) as the data pointer table for the snapshot volume, or the snapshot data pointer table. Therefore, after the snapshot is created, the snapshot is equivalent to a storage logical copy that is accessible to the top-level application, and the snapshot volume shares the same physical data with the source data volume through its own pointer table. When any data in the source data volume is about to be overwritten, COW needs to ensure that the copy of the original data occurs before the original data is overwritten, and that the original data is updated to the snapshot data pointer table record in the new address in the snapshot volume, so that the data that is updated after the snapshot point does not appear in the snapshot volume. The data in the snapshot volume must be data at the moment of snapshot time to ensure the integrity of the snapshot data.

1 The source data volume contains the raw data a~g, and the record of the source data pointer table points to the original data a~g when the snapshot is created.
2 When the snapshot is created, the snapshot point-in-time is established, the snapshot software creates the snapshot volume, and the Copy source data pointer table is the snapshot volume pointer table, at which point the snapshot pointer table record also points to the original data a~g.
3 After the snapshot is created, new data is first updated to the source data volume, such as: New Data d ' update raw data d. Before d ' overwrites D, you need to copy D to the snapshot volume and update the record of the snapshot data pointer table to point to the new storage address. Finally, the d ' is written to the original location of D, and the source data pointer table does not need to be updated.

NOTE1: In step 3, use the " First "word, this means that when the data in the same position on the source volume is modified more than once, it is only copied on the first modification, in other words, the copy is only triggered when the original data is updated, and the updated data update does not affect the integrity of the snapshot data. So COW will occasionally be expressed as COFW (Copy-on-first-write)

NOTE2: The source data pointer table does not change to this point, so COW does not have a significant impact on the read operation of the source data volume and on the performance of multiple write operations to a single location on the source data volume. In contrast, the snapshot volume data is discontinuous and the data becomes very discrete after multiple snapshot operations, so the read-write latency of the snapshot volume data is greater.

Scenario: This implementation will require a read operation (read the original location data) for the first time to write to a storage location, two write operations (write the original location and write snapshot space), and if the write is frequent, this method consumes Io time very much. Therefore, it is inferred that the snapshot implementation technique of this approach is an ideal choice if the majority of the I/O on a volume is expected to be predominantly read and less write, since the completion of the snapshot requires less time. In addition, if an application is prone to write hotspots, that is, only for a limited range of data to write operations, then cow Snapshot implementation is also a more ideal choice. Because its data changes are limited to one scope, a write-time copy operation occurs only once for multiple writes of the same data. But the drawbacks of this approach are also very obvious. If the write operation is too fragmented and frequent, the overhead of cow is not negligible, and sometimes even unacceptable. Therefore, when applied, it is necessary to evaluate the usage scenarios of the application system synthetically to determine whether the snapshot of this method is applicable.

After understanding the principle of COW and then looking back at the difference between COW and backup, COW technology does not consume any storage resources or affect system performance until the snapshot is created. And COW is very flexible to use and can create snapshots of any data volume at any point in time. The length of the backup window generated at the snapshot point in time is linearly proportional to the capacity of the source data volume, typically for a few seconds, with little impact on the application, and the storage space allocated for the snapshot volume is greatly reduced. The copy operation is only triggered when the source data volume is updated, so the system overhead is very small. However, because the snapshot volume saves only the data that is updated by the source data volume, the snapshot technology does not get a full physical copy of the data. Row of incremental snapshots

ROW (Redirect-on-write) is also called write-time redirection. The implementation of the ROW is very similar to COW, except that the first write operation on the original data volume "row the new data to the reserved snapshot volume, rather than COW typically overwrites the original data with the new data. Therefore, the original data in the ROW snapshot remains in the source data volume and, in order to ensure the integrity of the snapshot data, the source data volume status is read-only when the snapshot is created. If multiple snapshots of a virtual machine are made, a snapshot chain is generated, and the disk volumes of the virtual machines are always mounted at the very end of the snapshot chain, where the write operations of the virtual machine are all dropped to the end of the snapshot volume. This feature causes a problem, that is, if you make 10 snapshots altogether, then, when you revert to the latest snapshot point, you need to merge 10 snapshot volumes to get a complete update of the snapshot point data, and if you are recovering to the 8th time to find the time, then you need to merge the first 8 snapshot volumes into a full snapshot point data. From here you can see that the main disadvantage of the ROW is that there is not a full snapshot volume, the relationship between its snapshots is chained, and if the more snapshot levels are available, the overhead of snapshot recovery will be greater. But row's advantage is that it solves the problem that the COW snapshot writes two times, so in terms of write performance, row is definitely superior to COW.

And look at the principle of row, and when you create a snapshot, the row will copy a copy of the source data pointer table as the snapshot data pointer table, where both tables have the same pointer record. After the snapshot has been created, that is, after the snapshot point, the new data is written directly to the snapshot volume, and then the record of the source data pointer table is updated to point to the snapshot volume address where the new data resides. As you can see, the biggest difference between row and COW is that the COW snapshot volume holds the raw data and the row's snapshot volume holds the new data. Because ROW is such a setup, the relationship between its multiple snapshots must be chained, because the original data for the most recent snapshot is likely to be stored in the snapshot volume that was created when the last snapshot was made.

1 above, Vd is the source data pointer table of the source data volume, pointing to 4 original data respectively.
2 When the snapshot is created, the source data pointer table is used as the Snapshot Data pointer Table snap of the snapshot volume, also points to 4 raw data, and the storage space is allocated as a snapshot volume.
3 After the snapshot is created, the new data is written directly to the snapshot volume when new data is written, and then the records in Vd are modified to point to the new data. And the record of the snap does not change.

It is worth noting that ROW in traditional storage scenarios, the biggest problem is the impact on read performance is relatively large. Indeed, ROW's write performance is basically no loss, just modify the pointer, to achieve high efficiency. But after many reads and writes, the data of the source data volume of a certain time becomes very discrete (the source data pointer table record is updated), this is row's continuous read-write performance is inferior COW. Therefore, ROW is more suitable for use in write-intensive (write-intensive) storage systems. However, however, in the case of distributed storage, the row's continuous read and write performance is higher than the COW. The bottleneck of read and write performance in traditional storage scenarios is typically on disk, but this bottleneck does not exist in distributed storage scenarios. Users in the business layer to see continuous storage, is actually distributed in different servers in different hard disks, the more dispersed data, the higher the system performance. A ROW that breaks the original data in the source data volume is good for performance. So at this stage, ROW + Distributed storage Snapshot mode is the main direction of industry development.

The "incremental backup" in the figure uses the ROW snapshot technique.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.