CN114661232A - Snapshot data reading method, device, system, equipment and storage medium - Google Patents

Snapshot data reading method, device, system, equipment and storage medium Download PDF

Info

Publication number
CN114661232A
CN114661232A CN202210153442.4A CN202210153442A CN114661232A CN 114661232 A CN114661232 A CN 114661232A CN 202210153442 A CN202210153442 A CN 202210153442A CN 114661232 A CN114661232 A CN 114661232A
Authority
CN
China
Prior art keywords
disk
snapshot
cache node
segment data
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210153442.4A
Other languages
Chinese (zh)
Inventor
佘海斌
刘小宇
彭海林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba China Co Ltd
Original Assignee
Alibaba China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba China Co Ltd filed Critical Alibaba China Co Ltd
Priority to CN202210153442.4A priority Critical patent/CN114661232A/en
Publication of CN114661232A publication Critical patent/CN114661232A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/065Replication mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0656Data buffering arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0662Virtualisation aspects
    • G06F3/0667Virtualisation aspects at data level, e.g. file, record or object virtualisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Software Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a method, a device, a system, equipment and a storage medium for reading snapshot data, wherein the method comprises the following steps: receiving a disk reading request initiated during delayed loading of a target disk; selecting a snapshot cache node from a block device storage cluster; if the selected snapshot cache node stores the disk segment data needing to be read, acquiring the disk segment data from the snapshot cache node; otherwise, acquiring the disk segment data from the mirror center; and storing the disk segment data in the selected snapshot cache node. According to the method and the device, the distributed cache of the disk snapshot is established in the block device storage cluster, the disk reading request during the delayed loading of the data is supported by using the internal memory and the network flow of the block device storage cluster, and the reading performance during the delayed loading is improved. Based on the cache, snapshot copies in different strip formats and encrypted snapshot copies corresponding to different keys are created, and the disk is cloned in batches through the copies, so that the method is more efficient and flexible.

Description

Snapshot data reading method, device, system, equipment and storage medium
Technical Field
The present application relates to the field of storage technologies, and in particular, to a method, an apparatus, a system, a device, and a storage medium for reading snapshot data.
Background
The mirror image center can store the mirror image file of the disk, and the disk can be cloned according to the mirror image file. An empty disk is created during the cloning process, along with a local snapshot. And downloading the image file from the image center to the local snapshot. And when all the data of the image file are downloaded, importing the data in the local snapshot into an empty disk.
Before the data in the local snapshot is imported to the empty disk, referred to as a data deferred loading period, during which the virtual machine corresponding to the disk is already started, a request for reading the disk data by the virtual machine may be received. At this time, the block service requests disk data from the snapshot service, the snapshot service acquires corresponding disk data from the mirror center and returns the disk data to the block service, and the block service sends the disk data to the virtual machine.
However, in an application scenario of batch disk cloning, if a large number of virtual machines request to read the same disk data during a data delayed loading period, concurrent processing pressure of a mirror center is large, response time of read requests is prolonged, and disk reading performance during the data delayed loading period is poor.
Disclosure of Invention
The application provides a method, a device, a system, equipment and a storage medium for reading snapshot data, wherein a distributed cache of disk snapshots is established in a block device storage cluster, and a disk reading request during data delayed loading is supported by using the internal memory and network traffic of the block device storage cluster, so that the reading performance during the delayed loading is improved.
An embodiment of a first aspect of the present application provides a method for reading snapshot data, including:
receiving a disk reading request initiated during the delayed loading of a target disk, wherein the disk reading request is used for reading disk segment data in a disk snapshot corresponding to the target disk;
selecting a snapshot cache node from a block device storage cluster;
if the selected snapshot cache node stores the disk segment data, acquiring the disk segment data from the snapshot cache node;
if the disk segment data is not stored in the selected snapshot cache node, acquiring the disk segment data from a mirror center; and storing the disk segment data in the selected snapshot cache node.
An embodiment of a second aspect of the present application provides a snapshot data reading apparatus, including:
a receiving module, configured to receive a disk reading request initiated during a delayed loading period of a target disk, where the disk reading request is used to read disk segment data in a disk snapshot corresponding to the target disk;
the selection module is used for selecting a snapshot cache node from the block device storage cluster;
the acquisition module is used for acquiring the disk segment data from the snapshot cache node if the selected snapshot cache node stores the disk segment data; if the disk segment data is not stored in the selected snapshot cache node, acquiring the disk segment data from a mirror center; and storing the disk segment data in the selected snapshot cache node.
An embodiment of a third aspect of the present application provides a system for reading snapshot data, including a block device storage cluster, a computation cluster, and a mirror center;
the mirror image center is used for storing a mirror image file of the disk;
the computing cluster is used for initiating a disk reading request during the delayed loading of a target disk, wherein the disk reading request is used for reading disk segment data in a disk snapshot corresponding to the target disk;
the block device storage cluster is used for receiving the disk reading request and selecting a snapshot cache node; if the selected snapshot cache node stores the disk segment data, acquiring the disk segment data from the snapshot cache node; and if the selected snapshot cache node does not store the disk segment data, acquiring the disk segment data from the mirror center, and storing the acquired disk segment data in the selected snapshot cache node.
An embodiment of a fourth aspect of the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the method of the first aspect.
An embodiment of a fifth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, the program being executable by a processor to implement the method of the first aspect.
The technical scheme provided in the embodiment of the application at least has the following technical effects or advantages:
in the embodiment of the application, for a disk snapshot with a read requirement during a data delayed loading period, a distributed cache corresponding to the disk snapshot is established in a block device storage cluster, each disk segment data can be cached on a plurality of storage nodes, the memory and network traffic of the storage nodes in the block device storage cluster are fully utilized, and the storage nodes in the block device storage cluster are utilized to support a disk read request during the data delayed loading period, so that a normal read performance can be immediately provided after a disk is cloned. Snapshot copies in different strip formats and encrypted snapshot copies corresponding to different keys are created based on the cached disk snapshots, and after the copy creation is completed, disks in different strip formats or encrypted disks with different keys can be cloned in batches directly through the copies, so that the efficiency and flexibility of batch disk cloning are improved.
Additional aspects and advantages of the present application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the present application.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to refer to like parts throughout the drawings.
In the drawings:
FIG. 1 is a schematic diagram illustrating a process of delayed disk loading according to an embodiment of the present application;
FIG. 2 illustrates an architectural diagram of cloud computing as provided by an embodiment of the present application;
FIG. 3 illustrates a schematic diagram of a distributed file system based log structure block facility provided by an embodiment of the present application;
FIG. 4 is a block diagram illustrating a partitioning of disk segment data provided by an embodiment of the present application;
FIG. 5 is a schematic diagram illustrating an implementation of disk fragment data according to an embodiment of the present application;
fig. 6 is a flowchart illustrating a snapshot data reading method according to an embodiment of the present application;
fig. 7 is another schematic flow chart illustrating a snapshot data reading method according to an embodiment of the present application;
FIG. 8 is a schematic diagram illustrating importing data to a disk according to an embodiment of the present application;
FIG. 9 illustrates a diagram of caching and multi-copy management in a snapshot batch clone provided by an embodiment of the present application;
fig. 10 is a schematic structural diagram illustrating a snapshot data reading apparatus according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 12 is a schematic diagram of a storage medium provided in an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
It is to be noted that, unless otherwise specified, technical or scientific terms used herein shall have the ordinary meaning as understood by those skilled in the art to which this application belongs.
A method, an apparatus, a system, a device, and a storage medium for reading snapshot data according to embodiments of the present application are described below with reference to the accompanying drawings.
The embodiment of the application provides a snapshot data reading method, which aims to improve the reading performance of a disk during the delayed loading. Fig. 1 illustrates a process of delayed disk loading, as shown in fig. 1, a mirror center stores an image file of a disk, and a disk is cloned according to the image file, where the disk does not store data and is an empty disk. A local snapshot is created by the snapshot service while an empty disk is being generated. The snapshot service downloads the image file from the image center into a local snapshot. And when all the data of the image file are downloaded, importing the data in the local snapshot into an empty disk by adopting a hard link technology. The period from the creation of the empty disk to the import of the data in the local snapshot to the empty disk is referred to as a data lazy load period.
During the data delay loading period, a computing node may request to read the data of the disk, and the computing node may include a container, a virtual machine or other device corresponding to the disk, which has completed booting, and the like. In the embodiment of the present application, a virtual machine is taken as an example for description, and in practical application, a device that requests to read disk data during a data delayed loading period may also be another device.
The virtual machine requests to read the disk data during the data delayed loading period, at the moment, the block service receives a request for reading the disk data by the virtual machine, the block service requests the snapshot service for the disk data during the data delayed loading period in the related technology, the snapshot service acquires the corresponding disk data from the mirror center and returns the disk data to the block service, and the block service sends the disk data to the virtual machine.
Since the related art acquires disk data from a mirror center, in an application scenario of cloning disks in bulk, there may be a large number of virtual machines requesting to read the same data during delayed loading of data. Especially for a user data disk with a large data volume, such as a cloud game, the capacity of the user data disk is far larger than that of a system disk, and a large flow of data reading needs to be generated during the delayed loading of data after the cloning of the cloud disk is completed. In these cases, the data is acquired from the mirror center, which causes great concurrent processing pressure of the mirror center, so that the disk reading request cannot be responded in time, and thus the disk reading performance during the data delay loading in the related art is not good.
Based on this, according to the reading method of snapshot data provided in the embodiment of the present application, during the delayed loading, all disk segment data of a disk snapshot are cached in a distributed manner in the block device storage cluster through the snapshot service. The distributed cache caches the disk segment data by using the memory of the storage node where the snapshot service is located. The disk reading request during the data delay loading period can preferentially acquire data from the distributed cache for responding, and the distributed cache can use the network flow of all storage nodes in the block device storage cluster, so that the disk reading request during the data delay loading period can timely obtain response, and the disk reading performance can be immediately provided after the disk is cloned.
Fig. 2 illustrates a cloud computing architecture on which the method provided by the embodiment of the present application is based, in which storage is separated from computing, and computing resources are provided in a computing cluster, and fig. 2 schematically illustrates two computing nodes, each of which includes N virtual machines from VM1 to VM N. The Block device storage cluster (EBS) is responsible for providing storage resources of the disk. Two storage nodes are schematically depicted in FIG. 2, each storage node including N disks from Disk1 through Disk N. The mirror center also includes a plurality of storage nodes for storing mirror images of disks, two storage nodes are schematically illustrated in fig. 2, and each storage node includes mirror images of M disks from Disk1 to Disk M. The computing cluster, the block device storage cluster and the mirror center are in communication connection through a switch.
The computing cluster is mainly responsible for providing computing resources, and the virtual machine can run on a computing node in the computing cluster. A compute node is a device with some computing power and may include components such as a processor, memory, and an ethernet controller. The computing nodes may include personal computers, desktop computers, servers, and the like. The computing nodes in a computing cluster may be implemented by the same type of device or different types of devices.
The block device storage cluster includes a plurality of storage nodes. A storage node is a device with certain storage capacity, and may include a processor, a system bus, and at least one physical storage medium such as a hard disk and a memory. The storage nodes may include servers, desktop computers, personal computers, cell phones, tablets, databases, and the like. The server may be a conventional server, a cloud host, a virtual center, or the like. The storage nodes in a storage cluster may be the same type of device or different types of devices.
Each storage node in the Block device storage cluster may be deployed with a Block service (Block Server) and a Snapshot service (Snapshot Server), where the Block service is used to process disk segment data, and the Snapshot service is used to process disk segment data. A block management service (BlockMaster) may also be deployed in the block device storage cluster, where the block management service is configured to manage LSBD (log structured block device) metadata (metadata), that is, manage the operation logic of all block services in the block device storage cluster. The block management service may be deployed on a storage management device independent of each storage node, or may be deployed on a certain storage node or certain storage nodes.
The block device storage cluster is mainly responsible for providing storage resources to the computing nodes in the computing cluster, such as providing disks for each virtual machine. That is, disks required by virtual machines running in a computing cluster are located in a block device storage cluster, so that a cloud computing architecture with separated storage and computing is realized.
The mirror image center is mainly responsible for storing a mirror image file corresponding to the disk, and the mirror image file is a disk snapshot corresponding to the disk. The mirror center may deploy an Object Storage Service (OSS) with a lower Storage cost, and store the disk snapshot by using the Object Storage Service.
In this embodiment of the present application, fig. 2 is only an example, in an actual application, each of the computation cluster, the block device storage cluster, and the mirror center may be one or more, and the number of computation nodes in the computation cluster, the number of storage nodes in the block device storage cluster, and the number of storage nodes in the mirror center may be deployed according to an actual requirement.
The disks in the block device storage cluster are constructed by using a log file (log structured block device) of LSBD (log structured block device). The log file is a distributed system file which can only be additionally written and cannot be overwritten. Disks are constructed based on log file.
Fig. 3 shows a log-structured block device based on a distributed file system, and a disk is implemented based on a log file of the distributed file system. The distributed file system guarantees the security and the availability of data by means of multiple copies of data. In an embodiment of the present application, one or more disks may share the same log file with a disk snapshot through a hard link (Hardlink) technique.
In the embodiment of the application, the disk snapshot is stored, transmitted and processed in a cloud computing system by taking disk segment data as a unit. Fig. 4 shows a partition diagram of disk segment data, and as shown in fig. 4, the cloud disk address space is partitioned into a plurality of segment groups, such as segment group 0, segment group 1, segment group 2, and … …. Each segment group is divided into a plurality of stripes, each stripe has the same size, and the size of the stripe can be in a range of 64 KB-2M. Segment group 0 is divided into a plurality of stripes numbered 0, 1, 2, 3 … … in sequence as in fig. 4. And traversing all the strips included in the segment group from the first strip, selecting a plurality of strips which are sequentially spaced by a preset number of strips, and forming the selected plurality of strips into one disk segment data. As shown in fig. 4, a plurality of stripes sequentially spaced by 3 stripes are selected to constitute disk segment data, that is, stripes with numbers of 0, 4, 8, and … … are selected to constitute disk segment data 0, stripes with numbers of 1, 5, 9, and … … are selected to constitute disk segment data 1, stripes with numbers of 2, 6, 10, and … … are selected to constitute disk segment data 2, and stripes with numbers of 3, 7, 11, and … … are selected to constitute disk segment data 3. Each of the disk segment data partitioned in fig. 4 has a size of 32GB, and the size of the disk segment data in practical application may be other sizes.
In the embodiment of the application, each piece of disk segment data is processed by one block service, the block management service is responsible for allocating each block service to process which piece of disk segment data, and if a certain block service fails, the block management service reallocates one block service to process the piece of disk segment data, so that the processing of the piece of disk segment data can be more orderly, and the LSBD system can easily achieve load balancing.
Fig. 5 shows a schematic diagram of an implementation of the disk segment Data, and as shown in fig. 5, the disk segment Data is composed of an Index file, a Data file, and a Txn file. These files are log files in the distributed file system, and can only be additionally written and cannot be overwritten. The Index file is responsible for recording the corresponding relation between the logical address interval of the disk and the physical address interval of the Data file. The Data file is responsible for storing the disk segment Data, and the Txn file is used for recording a processing Log (Transaction Log) for modifying the disk segment Data. When a write request for the disk segment Data is received, the Data is written in the Data file, the processing log is written in the Txn file, and the address corresponding relation in the Index map is updated.
After the cloud computing architecture, the log structure block device of the distributed file system, and the segmentation and implementation of the disk segment data are introduced, the method for reading the snapshot data provided by the embodiment of the present application is more helpful to understanding. Referring to fig. 6, the method specifically includes the following steps:
step 101: and receiving a disk reading request initiated during the delayed loading of the target disk, wherein the disk reading request is used for reading the disk segment data in the disk snapshot corresponding to the target disk.
In the process of cloning a disk based on a disk snapshot in a mirror center, an empty disk is firstly cloned, and at this time, the disk snapshot is not imported into the empty disk. The period from the creation of the empty disk to the import of the disk snapshot to the empty disk is referred to as a data deferred loading period in the embodiments of the present application.
During the delayed loading of the data, if the computing node needs to read the data in the disk, a disk reading request is initiated, and the disk reading request is used for reading the disk segment data in the disk snapshot corresponding to the target disk. The target disk is a disk corresponding to a computing node (e.g., a virtual machine).
After the computing node initiates the disk reading request, a block management service in the storage cluster of the block device receives the disk reading request, determines the disk segment data required to be read by the disk reading request, further determines a block service responsible for processing the disk segment data, and then forwards the disk reading request to the block service responsible for processing the disk segment data. The block service receives the read disc request.
In the application scenario of batch disk cloning, multiple disks may be cloned based on the same disk snapshot in a short time. In this case, it may happen that multiple compute nodes initiate a read disk request to the same disk during a data latency load. Similarly, the block management service in the block device storage cluster receives a disk reading request initiated by each computing node, and sends the multiple disk reading requests to the corresponding block services according to the disk segment data that needs to be read by each disk reading request.
Step 102: a snapshot cache node is selected from the block device storage cluster.
For the disk snapshots with disk reading requests during the delayed data loading, in the process of processing the disk reading requests, a distributed cache is constructed for the disk snapshots in the block device storage cluster, and the disk snapshots are cached by using the memory of the storage nodes in the block device storage cluster. And recording a distributed cache node set corresponding to the disk snapshot through the block management service, where the distributed cache node set is used to record a device identifier of each snapshot cache node in which the disk snapshot is stored, and the device identifier may be an IP address, an MAC address, a device serial number, and the like of the snapshot cache node. The snapshot cache node is a storage node in the block device storage cluster, where the disk snapshot is cached.
According to the embodiment of the application, only the disk snapshot with the disk reading request during the delayed data loading period is cached, and the disk snapshot without the disk reading request during the delayed data loading period is not cached, so that the caching space is saved. After the disk snapshot with the disk reading request is cached, if the disk reading request of the disk snapshot is received again, the disk snapshot can be directly obtained from the cache to respond, and the response speed is improved.
In step 101, after receiving a disk reading request for a target disk during a data delayed loading period, a block management service selects a snapshot cache node from a block device storage cluster.
Firstly, the block management service judges whether a distributed cache node set corresponding to a disk snapshot to be read is recorded. If so, the disk reading request for the disk snapshot is processed before the current disk reading request, and a distributed cache has been established for the disk snapshot in the block device service cluster. The snapshot cache node is therefore selected directly from the set of distributed cache nodes.
In one implementation, the block management service may randomly select a device identifier from the set of distributed cache nodes, and use the selected device identifier as the device identifier of the selected snapshot cache node.
In another implementation, the block management service may also select the device identifier of the snapshot cache node from the set of distributed cache nodes in a round robin manner.
If the block management service judges that the distributed cache node set corresponding to the disk snapshot required to be read by the disk reading request is not recorded at present, it indicates that the disk reading request aiming at the disk snapshot is not processed before the current disk reading request, and therefore the disk snapshot is not cached in the block device service cluster. In this case, the block management service selects a snapshot cache node from the block device storage cluster.
In some embodiments, the block management service may randomly select one storage node from all storage nodes included in the block device storage cluster as the selected snapshot cache node.
In other embodiments, the block management service may also select, as the selected snapshot cache node, a storage node with the largest remaining memory space from all storage nodes included in the block device storage cluster. Or, in some implementation manners, the block management service may further screen out storage nodes having a remaining memory space greater than a set threshold from all storage nodes included in the block device storage cluster, and then randomly select one storage node from the screened plurality of storage nodes as the selected snapshot cache node.
In an application scenario of batch disk cloning, it may occur that multiple compute nodes initiate a disk read request for the same target disk during data delayed loading. Thus, multiple disk read requests may be received in step 101. At this time, if the block management service judges that the distributed cache node set corresponding to the disk snapshot is not recorded, the block management service selects a snapshot cache node from the block device storage cluster for each disk reading request. If the block management service judges that the distributed cache node set corresponding to the disk snapshot is recorded, a snapshot cache node can be selected for each disk reading request from the distributed cache node set.
In other embodiments, in consideration of a scenario of cloning disks in batches, a request flow for requesting to read a target disk may be very large in a short time, each snapshot cache node in the distributed cache node set has a certain upper load limit, and when all snapshot cache nodes in the distributed node set reach the upper load limit, more disk reading requests cannot be responded in time. Based on this, the number of snapshot cache nodes included in the distributed cache node set can be automatically expanded according to the number of disk reading requests, so that the distributed cache node set can adapt to a disk reading request with a larger flow rate.
Specifically, a plurality of disk reading requests are received during the delayed data loading, and a distributed cache node set corresponding to a disk snapshot to be read is recorded, at this time, it is first determined whether the number of the plurality of disk reading requests is less than or equal to a load upper limit value corresponding to the distributed cache node set, where the load upper limit value may be the sum of load upper limits of each snapshot cache node in the distributed cache node set. The upper load limit of the snapshot cache node may be determined according to the network traffic of the snapshot cache node.
And if the number of the disk reading requests is less than or equal to the load upper limit value corresponding to the distributed cache node set, selecting snapshot cache nodes for each disk reading request from the distributed cache node set respectively. Different snapshot cache nodes can be allocated to each disk reading request, or the same snapshot cache node can be allocated to a small number of disk reading requests, and the number of disk reading requests corresponding to the snapshot cache node is less than or equal to the upper load limit of the snapshot cache node.
If the number of the disk reading requests is larger than the load upper limit value corresponding to the distributed cache node set, dividing the multiple disk reading requests into two parts, wherein one part is the disk reading requests with the load upper limit value corresponding to the distributed cache node set, and the other part is the disk reading requests with the difference between the number of the disk reading requests and the load upper limit value. The specific division of each disc read request into which portions can be determined randomly. And selecting snapshot cache nodes from the distributed cache node set for the load upper limit value disk reading requests respectively, wherein the snapshot cache nodes selected for the disk reading requests store disk segment data of disk snapshots. The method comprises the steps that snapshot cache nodes are selected for the rest disk reading requests from other storage nodes in a block device storage cluster except nodes included in a distributed cache node set, disk segment data of a disk snapshot are not stored in the snapshot cache nodes selected for the disk reading requests, and the corresponding disk segment data are stored in the snapshot cache nodes after the disk reading requests are processed according to the snapshot cache nodes corresponding to the disk reading requests, so that automatic expansion of the distributed cache node set corresponding to the disk snapshot is achieved.
In other embodiments of the present application, considering that the number of snapshot cache nodes is proportional to the number of disk read requests, a greater number of disk read requests requires more snapshot cache nodes. Therefore, a preset number ratio between a snapshot cache node and the disk reading request can be configured in advance, and if the ratio between the number of the current snapshot cache nodes and the number of the disk reading requests is greater than or equal to the preset number ratio, the snapshot cache node is directly selected for each disk reading request from the distributed cache node set. If the ratio of the number of the current snapshot cache nodes to the number of the disk reading requests is smaller than the preset number ratio, calculating the number of the disk reading requests which can be borne by the current distributed cache node set according to the number of the current snapshot cache nodes and the preset number ratio, and selecting snapshot cache nodes for the disk reading requests with the number from the distributed cache node set. And selecting snapshot cache nodes for the rest disk reading requests from other storage nodes except the nodes included in the distributed cache node set in the block device storage cluster.
When the snapshot cache node is selected for the remaining disk reading requests, a different snapshot cache node may be selected for each remaining disk reading request. The same snapshot cache node may also be selected for the remaining multiple disk read requests. And the number of disk reading requests corresponding to the selected snapshot cache node is less than or equal to the upper load limit of the snapshot cache node. And the sum of the number of the snapshot cache nodes selected for the remaining disk reading requests and the number of the snapshot cache nodes in the current distributed cache node set, wherein the ratio of the sum to the number of the current disk reading requests is required to be greater than or equal to a preset number ratio.
For example, assuming that the preset number ratio between the preconfigured snapshot cache nodes and the disk reading requests is 1/1000, the number of snapshot cache nodes included in the current distributed cache node set corresponding to the disk snapshot is 100, and 100500 disk reading requests for the disk snapshot are currently received. The ratio of the number of current snapshot buffer nodes to the number of disk read requests is 1/1005, which is less than the preset number ratio of 1/1000. According to the ratio of 100 to 1/1000 of the number of current snapshot cache nodes, the number of disk reading requests that the current distributed cache node set can bear is calculated to be 100000, and therefore, a snapshot cache node is selected for 100000 disk reading requests from the current distributed cache node set. For the remaining 500 disk-reading requests, snapshot cache nodes are selected for the 500 disk-reading requests from other storage nodes except the 100 current snapshot cache nodes in the block device storage cluster. If 50 snapshot cache nodes are selected for the remaining 500 disk read requests, the number of snapshot cache nodes included in the distributed cache node set of the subsequent disk snapshot is expanded to 150, and the ratio between the number of snapshot cache nodes after expansion and the number of disk read requests is 1/670.
And expanding the number of snapshot cache nodes in the distributed cache node set according to the number of disk reading requests, wherein the number of the snapshot cache nodes in the set can be expanded to be equal to the number of storage nodes in the block device storage cluster at most. That is, at most, all storage nodes in the block device storage cluster can be used as snapshot cache nodes, and the same disk segment data can be cached in all storage nodes, so that all storage nodes of the entire block device storage cluster can be used to support the disk reading requirement during the delayed loading of data, and thus, the disk can immediately provide normal reading performance after being cloned.
After selecting a snapshot cache node for a disk reading request through any of the above embodiments, the block management service sends the disk reading request of the disk reading request and the device identifier of the selected snapshot cache node to the block service responsible for processing the disk segment data corresponding to the disk reading request.
After receiving the disk reading request and the device identifier of the snapshot cache node, the block service sends an acquisition request for acquiring the disk segment data corresponding to the disk reading request to the snapshot cache node corresponding to the device identifier. After receiving the obtaining request, the snapshot cache node queries whether the disk segment data is cached by itself, and if the disk segment data is cached, the snapshot cache node continues to execute according to the operation of step 103. If the snapshot cache node does not cache the disk segment data, the execution is continued according to the operation of step 104.
Step 103: and if the selected snapshot cache node stores the disk segment data, acquiring the disk segment data from the snapshot cache node.
If the selected snapshot cache node stores the disk segment data, the snapshot cache node transmits the disk segment data to the block service, and the block service returns the disk segment data to the computing node initiating the disk reading request.
It should be noted that the storage node where the block service is located and the selected snapshot cache node may be the same physical node or different physical nodes.
According to the embodiment of the application, the distributed cache is established for the disk snapshot in the block device storage cluster, and when the disk reading request corresponding to the disk snapshot is received subsequently, the disk segment data can be directly obtained from the distributed cache to respond, so that the response speed is improved. And after the subsequent disk cloning based on the same disk snapclone is finished, the normal disk reading function can be realized.
Step 104: if the selected snapshot cache node does not store the disk segment data, acquiring the disk segment data from the mirror center; and storing the disk segment data in the selected snapshot cache node.
If the selected snapshot cache node determines that the selected snapshot cache node does not store the disk segment data, the snapshot cache node sends an acquisition request for acquiring the disk segment data to a snapshot service responsible for processing the disk segment data. After receiving the acquisition request, the snapshot service downloads the disk segment data from the mirror center, transmits the disk segment data to the snapshot cache node, returns the disk segment data to the block service, and returns the disk segment data to the computing node initiating the disk reading request. After the snapshot caching node acquires the disk segment data from the snapshot service, the disk segment data is also cached in a local cache.
In the process of caching the disk segment data, the snapshot cache node firstly determines whether the remaining cache space in the snapshot cache node is greater than or equal to the data volume of the disk segment data, and if so, directly stores the disk segment data in the remaining cache space of the snapshot cache node. If not, an LRU (Least Recently Used) algorithm is utilized to eliminate part of the cached disk fragment data. Specifically, the snapshot cache node may delete data that has not been read for the longest time in the cached data, so that the remaining cache space after the deletion operation is greater than or equal to the data amount of the current disk segment data. And then storing the disk segment data in the residual cache space of the snapshot cache node after the deletion operation.
By adopting the method, the data which are not read for a long time are eliminated, and more cache space is saved for storing the disk snapshots with larger reading amount. According to the practical situation that the disk snapshots are read by the computing nodes, the disk snapshots cached in the storage cluster of the block device are dynamically adjusted, the disk snapshots with high-flow reading requirements can be cached, and normal reading performance can be provided immediately after disk cloning based on batch cloning of the disk snapshots is completed.
It should be noted that, in this step, the storage node where the block service is located and the selected snapshot cache node may be the same physical node or different physical nodes. The selected snapshot caching node and the storage node where the snapshot service is located may be the same physical node or different physical nodes.
After the snapshot cache node obtains the disk segment data from the snapshot service and stores the disk segment data in the local cache, the block management service also adds the device identifier of the snapshot cache node to the distributed cache node set corresponding to the disk snapshot, so that when a disk reading request of the disk snapshot is received again in the following period, the disk segment data can be directly obtained from the snapshot cache node to respond to the disk reading request.
In other embodiments, the target disk may be an encrypted disk, and therefore, the disk segment data corresponding to the disk reading request is acquired in steps 103 and 104, and the disk segment data needs to be encrypted before being returned to the virtual machine. Specifically, after the disk segment data is obtained, a key corresponding to the target disk is obtained, the disk segment data is encrypted by using the key to obtain a disk segment ciphertext, and the disk segment ciphertext is returned to the computing node which initiates the disk reading request.
In order to facilitate understanding of the reading process of the above steps 101-104, the following description is made with reference to the accompanying drawings. As shown in fig. 7, compute node a includes compute nodes 1 and 2, compute node 1 includes virtual machines VM1 and VM2, and compute node 2 includes virtual machines VM3 and VM 4. The mirror center B includes disk snapshots 1 and 2, where disk snapshot 1 includes disk segment data segments 1 and 2, and disk snapshot 2 includes disk segment data segments 3 and 4. The block device storage cluster C includes a plurality of storage nodes, which are not shown in fig. 7, but block services 1, 2, 3, and 4, snapshot services 1 and 2, and snapshot caches 1 and 2 are shown. The block service and the snapshot service are deployed on storage nodes, and one storage node can have at least one block service and at least one snapshot service. The snapshot cache is also deployed on the storage node, and caches data of the disk snapshot by using the memory of the storage node.
As shown in fig. 7, the virtual machine VM1 issues a Read request for the disk segment data 1, the block service 1 receives the Read request of the VM1, and issues a Lazy load Read request (Lazy load Read) to the snapshot cache 1, and if the disk segment data 1 is cached in the snapshot cache 1, the disk segment data 1 is directly returned to the virtual machine VM1 through the block service 1. If the disk segment data 1 is not cached in the snapshot cache 1, the snapshot cache 1 sends an acquisition request to the snapshot service 1, and the snapshot service 1 acquires the disk segment data 1 from the mirror center B and returns the disk segment data 1 to the snapshot cache 1. Snapshot cache 1 returns disk segment data 1 to virtual machine VM1 through block service 1, and snapshot cache 1 also stores the disk segment data 1. The processing procedure of the disk read request initiated by the virtual machines VM2, VM3 and VM4 in fig. 7 is similar to that of the disk read request of the virtual machine VM1, and is not described in detail herein.
When a disk is cloned based on a disk snapshot of a mirror center, an empty disk is created, meanwhile, a local snapshot is created by a snapshot service, and data of the disk snapshot is downloaded from the mirror center and stored in the local snapshot by the snapshot service. After the snapshot service downloads all the disk segment data of the disk snapshot to the local snapshot, all the disk segment data of the disk snapshot is imported to the empty disk by adopting a hard link technology. This concludes the data delay load period.
When the snapshot service downloads the disk snapshot from the mirror center, the disk snapshot is downloaded by taking snapshot segment data as a unit, and the size of the snapshot segment data is smaller than that of the disk segment data in the stripe format of the disk. Each snapshot service is respectively responsible for downloading different snapshot segment data, the snapshot segment data with smaller data volume are downloaded in parallel through the plurality of snapshot services, and the snapshot segment data are imported into the disk after the downloading is finished, so that the parallel downloading speed of the disk snapshot can be increased, the downloading time length is shortened, and the delayed data loading period of the disk can be ended more quickly.
As shown in fig. 8, the snapshot service downloads a disk snapshot from the mirror center, which is divided into 4 snapshot segment data of snapshot segments 0, 1, 2, and 3. The 4 snapshot segments are downloaded in parallel and stored in the local snapshot. It can be seen from fig. 8 that only two segments, i.e. segment 0 and segment1, are divided in the disks 1 and 2, while the snapshot service is downloaded in 4 smaller segments, and the downloading speed is very fast. And importing snapshot segment data in the local snapshot into a disk by adopting a hard link technology, and importing a plurality of snapshot segment data into one disk segment. In fig. 8, snapshot segments 0 and 1 are imported into disk segment 0 of disks 1 and 2, and snapshot segments 2 and 3 are imported into disk segment1 of disks 1 and 2.
When the Data in the local snapshot is imported into the disk by adopting a hard link technology, the disk shares the Data File in the snapshot segment Data with the local snapshot through the hard link, no Data copying process is needed, the corresponding relation between the logical address in the Index File of the disk segment Data in the disk and the physical address of the Data File in the snapshot segment Data only needs to be modified, and a processing log is recorded in the Txn File.
Data sharing is carried out through a hard link technology, only one disk snapshot is downloaded from a mirror center, and one data can be shared through the hard link according to all disks cloned by the disk snapshot, so that the storage resources of a storage cluster of block equipment are greatly saved, the processing process of copying a lot of data is avoided, and the efficiency of cloning disks in batches is accelerated.
After the data in the local snapshot is imported into the target disk, the data delay loading period ends, and then the computing node can directly read the disk segment data from the target disk without the operation of steps 101 and 104 to obtain the disk segment data.
In some embodiments of the present application, in an application scenario in which a disk is cloned in a batch, the stripe format of the disk to be cloned may be many and different from the stripe format of the disk snapshot stored in the mirror center. For example, the stripe format of a disk snapshot stored in the mirror hub is 2MB 4, while the stripe format of a disk based on the disk snapshot clone may be 1MB 4, 64KB 4, etc. In order to accelerate the batch cloning efficiency of the disks with different strip formats, the embodiment of the application also creates snapshot copies with different strip formats based on the disk snapshots cached in the block device storage cluster, so that the disks with different strip formats can be quickly cloned in batches based on the snapshot copies.
If the block management service records the distributed cache node set corresponding to the disk snapshot, indicating that the disk snapshot is cached in the block device storage cluster, and creating snapshot copies in different strip formats corresponding to the disk snapshot according to the disk snapshot cached in the distributed cache node set. Specifically, each disk segment data of the cached disk snapshot is copied from the distributed cache node set, and the snapshot segment is re-divided for each copied disk segment data according to the first stripe format, so as to obtain a snapshot copy in the first stripe format corresponding to the disk snapshot. The first stripe format is any stripe format different from the stripe format of the cached disk snapshot.
For any other stripe format, snapshot copies of other stripe formats may be created separately in the manner described above.
After the snapshot copies in different strip formats are created, the disks in different strip formats can be cloned in batch based on the snapshot copies in different strip formats. At least one empty disk with a second stripe format is created, wherein the second stripe format is any one of different stripe formats corresponding to the created plurality of snapshot copies. And importing all the disk segment data in the snapshot copy in the second stripe format into the disk in the second stripe format by adopting a hard link technology.
By the mode of creating the snapshot copies in different strip formats, the cloning speed of the disks in different strip formats is improved. Only one disk snapshot with a fixed strip format is stored in the mirror image center, the snapshot service downloads one disk snapshot with the fixed format, and snapshot copies with different strip formats are created based on the downloaded disk snapshot, so that disks with different strip formats can be cloned in batches, and the efficiency and flexibility of disk cloning are greatly improved.
In other embodiments of the present application, in consideration of the requirement of cloning an encrypted disk in an actual application scenario, keys of different encrypted disks are different, so as to improve efficiency of cloning encrypted disks in bulk. The embodiment of the application can also generate the encrypted snapshot copies corresponding to different keys based on the disk snapshots cached in the block device storage cluster, so that the encrypted disks corresponding to different keys can be quickly cloned in batches based on the encrypted snapshot copies.
If the block management service records the distributed cache node set corresponding to the disk snapshot, the block management service indicates that the disk snapshot is cached in the block device storage cluster, and creates a plurality of encrypted snapshot copies corresponding to the disk snapshot according to the disk snapshot cached in the distributed cache node set, wherein the encrypted snapshot copies are obtained by encrypting with different keys. Specifically, each disk segment data of the cached disk snapshot is replicated from the set of distributed caching nodes. And encrypting each copied disk segment data by using the first key to obtain an encrypted snapshot copy corresponding to the first key.
For any other key, the encrypted snapshot copies corresponding to the other keys can be created respectively in the above manner.
After the encrypted snapshot copies corresponding to different keys are created, the encrypted disks can be cloned in batches based on the created multiple encrypted snapshot copies. Taking the encrypted snapshot copy corresponding to the first key as an example for explanation, at least one empty disk is created first, and then all data in the encrypted snapshot copy corresponding to the first key is imported into the created empty disk by using a hard link technology, so as to obtain at least one encrypted disk corresponding to the first key.
By the method for creating the encrypted snapshot copies corresponding to different keys, the cloning speed of the encrypted disks with different keys is improved. Only one non-encrypted disk snapshot is stored in the mirror image center, the snapshot service downloads one non-encrypted disk snapshot, and encrypted snapshot copies corresponding to different keys are created based on the downloaded disk snapshot, so that encrypted disks corresponding to different keys can be cloned in batches, and the efficiency and flexibility of cloning the encrypted disks are greatly improved.
In order to facilitate understanding of the reading process in step 101-104, creating snapshot copies in different strip formats, and creating encrypted snapshot copies corresponding to different keys, the following description is provided with reference to the accompanying drawings. As shown in fig. 9, a disk snapshot 1 is stored in the mirror center. Snapshot service SS5 downloads disk segment seg1 for disk snapshot 1 from the mirror center, and snapshot service SS6 downloads disk segment seg 2. Disk segments seg1 and seg2 are stored in a cache. An unencrypted disk and an encrypted disk are cloned based on the disk snapshot 1, when a virtual machine reads disk segments seg1 and seg2 in the unencrypted disk, a block service BS1 acquires seg1 from a cache, and a block service BS2 acquires seg2 from the cache. When the virtual machine reads the disk segments seg1 and 2 in the encrypted disk, the block service BS3 sends the key of the encrypted disk to the cache of the disk segment seg1, the cache encrypts the disk segment seg1 by using the key to obtain a ciphertext 1, and returns the ciphertext 1 to the block service BS 3. Similarly, the block service BS4 gives the key for encrypting the disk to the cache of the disk segment seg2, the cache encrypts the disk segment seg2 with the key to obtain the ciphertext 2, and returns the ciphertext 2 to the block service BS 4.
As shown in FIG. 9, disk segments data 1 and 2 are partitioned into snapshot copies in smaller stripe format. And encrypting the disk segment data 1 and 2 by using the key to obtain an encrypted snapshot copy corresponding to the key. Disks 1 and 2 in the smaller stripe format are cloned based on the snapshot copy in the smaller stripe format. And cloning the encrypted disk1 corresponding to the key according to the encrypted snapshot copy.
The creation of the snapshot copy and the encrypted snapshot copy in different strip formats and the cloning of the disk based on the copies are all completed in the background, so that the disk reading processing during the delayed loading of the data is not influenced. And before the data of the snapshot copy is imported to the cloned disk, disk reading requests of all the cloned disks are supported by the disk snapshots cached in the distributed cache node set.
In the embodiment of the application, for a disk snapshot with a read requirement during a data delayed loading period, a distributed cache corresponding to the disk snapshot is established in a block device storage cluster, each disk segment data can be cached on a plurality of storage nodes, the memory and network traffic of the storage nodes in the block device storage cluster are fully utilized, and the storage nodes in the block device storage cluster are utilized to support a disk read request during the data delayed loading period, so that a normal read performance can be immediately provided after a disk is cloned. Snapshot copies in different strip formats and encrypted snapshot copies corresponding to different keys are created based on the cached disk snapshots, and after the copy creation is completed, disks in different strip formats or encrypted disks with different keys can be cloned in batches directly through the copies, so that the efficiency and flexibility of batch disk cloning are improved.
The embodiment of the present application further provides a device for reading snapshot data, where the device is configured to execute the method for reading snapshot data provided in any of the embodiments. As shown in fig. 10, the apparatus includes:
a receiving module 201, configured to receive a disk reading request initiated during a delayed loading period of a target disk, where the disk reading request is used to read disk segment data in a disk snapshot corresponding to the target disk;
a selecting module 202, configured to select a snapshot cache node from a block device storage cluster;
the obtaining module 203 is configured to obtain the disk segment data from the snapshot cache node if the selected snapshot cache node stores the disk segment data; if the selected snapshot cache node does not store the disk segment data, acquiring the disk segment data from the mirror center; and storing the disk segment data in the selected snapshot cache node.
The selecting module 202 is specifically configured to select a snapshot cache node from a distributed cache node set if the block management service records a distributed cache node set corresponding to a disk snapshot; and if the distributed cache node set corresponding to the disk snapshot is not recorded by the block management service, selecting a snapshot cache node from the block device storage cluster.
A receiving module 201, configured to receive multiple disk reading requests; correspondingly, the selecting module 202 is further configured to determine whether the number of the multiple disk reading requests is less than or equal to the load upper limit value corresponding to the distributed cache node set if the distributed cache node set corresponding to the disk snapshot is recorded by the block management service; if the number of the disk reading requests is smaller than or equal to the upper limit value of the load, executing the operation of selecting snapshot cache nodes for the disk reading requests from the distributed cache node set; if the number of the disk reading requests is larger than the upper limit value of the load, selecting snapshot cache nodes from the distributed cache node set for the disk reading requests with the upper limit value of the load respectively; and selecting snapshot cache nodes for the rest disk reading requests from other storage nodes except the nodes included in the distributed cache node set in the block device storage cluster.
The obtaining module 203 further includes a storage unit, configured to store the disk segment data in the selected snapshot cache node.
The storage unit is specifically configured to store the disk segment data in the snapshot cache node if it is determined that the remaining cache space in the snapshot cache node is greater than or equal to the data size of the disk segment data; if the residual cache space in the snapshot cache node is smaller than the data volume of the disk segmented data, deleting the data which are not read for the longest time in the snapshot cache node; and storing the disk segment data in the snapshot cache node.
The device also includes: the adding module is used for adding the equipment identifier of the snapshot cache node into a distributed cache node set corresponding to the disk snapshot; the distributed cache node set is used for recording the device identifiers of all snapshot cache nodes storing disk snapshots.
The device also includes: the copy creating module is used for creating snapshot copies in different strip formats corresponding to the disk snapshots according to the disk snapshots cached in the distributed cache node sets if the distributed cache node sets corresponding to the disk snapshots are recorded by the block management service; and cloning the disks in different strip formats in batches based on the snapshot copies in different strip formats.
The copy creating module is used for copying each disk segment data of the cached disk snapshot from the distributed cache node set; the snapshot segmentation is divided again for each copied disk segment data according to the first strip format, and a snapshot copy of the first strip format corresponding to the disk snapshot is obtained; the first stripe format is an arbitrary stripe format different from the stripe format of the cached disk snapshots.
The copy creating module is used for creating at least one empty disk with a second stripe format, and the second stripe format is any one of different stripe formats; and importing all disk segment data in the snapshot copy in the second stripe format into the disk in the second stripe format by adopting a hard link technology.
The copy creating module is further used for creating a plurality of encrypted snapshot copies corresponding to the disk snapshot according to the disk snapshot cached in the distributed cache node set if the distributed cache node set corresponding to the disk snapshot is recorded by the block management service, wherein the plurality of encrypted snapshot copies are obtained by encrypting with different keys; and cloning the encrypted disks in batches based on the plurality of encrypted snapshot copies.
The copy creating module is used for copying each disk segment data of the cached disk snapshot from the distributed cache node set; encrypting each copied disk segment data by adopting a first key to obtain an encrypted snapshot copy corresponding to the first key; creating at least one empty disk; and importing all data in the encrypted snapshot copy corresponding to the first key into the created disk by adopting a hard link technology to obtain at least one encrypted disk corresponding to the first key.
The reading apparatus for snapshot data provided by the above embodiment of the present application and the reading method for snapshot data provided by the embodiment of the present application are based on the same inventive concept, and have the same beneficial effects as the method adopted, operated, or implemented by the application program stored in the reading apparatus.
The embodiment of the present application further provides a system for reading snapshot data, as shown in fig. 2 or 7, where the system includes a block device storage cluster, a computation cluster, and a mirror center;
the mirror image center is used for storing mirror image files of the disk;
the computing cluster is used for initiating a disk reading request during the delayed loading of the target disk, wherein the disk reading request is used for reading the disk segment data in the disk snapshot corresponding to the target disk;
the block device storage cluster is used for receiving a disk reading request and selecting a snapshot cache node; if the selected snapshot cache node stores the disk segment data, acquiring the disk segment data from the snapshot cache node; and if the selected snapshot cache node does not store the disk segment data, acquiring the disk segment data from the mirror center, and storing the acquired disk segment data in the selected snapshot cache node.
The snapshot data reading system provided by the above embodiment of the present application and the snapshot data reading method provided by the embodiment of the present application have the same inventive concept and have the same beneficial effects as the method adopted, operated or implemented by the application program stored in the snapshot data reading system.
The embodiment of the application also provides an electronic device, so as to execute the method for reading the snapshot data. Please refer to fig. 11, which illustrates a schematic diagram of an electronic device according to some embodiments of the present application. As shown in fig. 11, the electronic apparatus 4 includes: a processor 400, a memory 401, a bus 402 and a communication interface 403, wherein the processor 400, the communication interface 403 and the memory 401 are connected through the bus 402; the memory 401 stores a computer program that can be executed on the processor 400, and the processor 400 executes the method for reading snapshot data provided in any of the foregoing embodiments when executing the computer program.
The Memory 401 may include a high-speed Random Access Memory (RAM) and may further include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the apparatus and at least one other network element is realized through at least one communication interface 403 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, etc. may be used.
Bus 402 can be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 401 is configured to store a program, and the processor 400 executes the program after receiving an execution instruction, and the method for reading snapshot data disclosed in any embodiment of the present application may be applied to the processor 400, or implemented by the processor 400.
Processor 400 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 400. The Processor 400 may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 401, and the processor 400 reads the information in the memory 401 and completes the steps of the method in combination with the hardware.
The electronic device provided by the embodiment of the present application and the method for reading snapshot data provided by the embodiment of the present application have the same inventive concept, and have the same beneficial effects as the method adopted, operated or implemented by the electronic device.
Referring to fig. 12, the computer readable storage medium is an optical disc 30, and a computer program (i.e., a program product) is stored thereon, and when being executed by a processor, the computer program may execute the method for reading snapshot data provided in any of the foregoing embodiments.
It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory, or other optical and magnetic storage media, which are not described in detail herein.
The computer-readable storage medium provided by the above-mentioned embodiment of the present application and the method for reading snapshot data provided by the embodiment of the present application have the same beneficial effects as the method adopted, run, or implemented by the application program stored in the computer-readable storage medium.
It should be noted that:
in the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the application may be practiced without these specific details. In some instances, well-known structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the application, various features of the application are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the application and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted to reflect the following schematic diagram: this application is intended to cover such departures from the present disclosure as come within known or customary practice in the art to which this invention pertains. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this application.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the application and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The above description is only for the preferred embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present application should be covered within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (14)

1. A method for reading snapshot data, the method comprising:
receiving a disk reading request initiated during the delayed loading of a target disk, wherein the disk reading request is used for reading disk segment data in a disk snapshot corresponding to the target disk;
selecting a snapshot cache node from a block device storage cluster;
if the selected snapshot cache node stores the disk segment data, acquiring the disk segment data from the snapshot cache node;
if the disk segment data is not stored in the selected snapshot cache node, acquiring the disk segment data from a mirror center; and storing the disk segment data in the selected snapshot cache node.
2. The method of claim 1, wherein selecting a snapshot cache node from a block device storage cluster comprises:
if the block management service records a distributed cache node set corresponding to the disk snapshot, selecting a snapshot cache node from the distributed cache node set;
and if the distributed cache node set corresponding to the disk snapshot is not recorded by the block management service, selecting a snapshot cache node from the block device storage cluster.
3. The method of claim 2, wherein a plurality of the disk read requests are received, the method further comprising:
if the block management service records a distributed cache node set corresponding to the disk snapshot, determining whether the number of the disk reading requests is less than or equal to a load upper limit value corresponding to the distributed cache node set;
if the number of disk reading requests is less than or equal to the load upper limit value, executing the operation of selecting snapshot cache nodes from the distributed cache node set;
if the number of the disk reading requests is larger than the load upper limit value, selecting snapshot cache nodes from the distributed cache node set for the disk reading requests with the load upper limit value respectively; and selecting snapshot cache nodes for the rest disk reading requests from other storage nodes in the block device storage cluster except the nodes included in the distributed cache node set.
4. The method of claim 1, wherein storing the disk segment data in the selected snapshot cache node comprises:
if the residual cache space in the snapshot cache node is determined to be larger than or equal to the data volume of the disk segment data, storing the disk segment data in the snapshot cache node;
if the residual cache space in the snapshot cache node is determined to be smaller than the data volume of the disk segment data, deleting the data which are not read in the snapshot cache node for the longest time; and storing the disk segment data in the snapshot cache node.
5. The method of any of claims 1-4, wherein after storing the disk segment data in the selected snapshot cache node, further comprising:
adding the equipment identifier of the snapshot cache node into a distributed cache node set corresponding to the disk snapshot;
the distributed cache node set is used for recording the device identifiers of all snapshot cache nodes storing the disk snapshots.
6. The method according to any one of claims 1 to 4, wherein if the block management service records a distributed cache node set corresponding to the disk snapshot, the method further comprises:
according to the disk snapshots cached in the distributed cache node set, creating snapshot copies of different strip formats corresponding to the disk snapshots;
and cloning the disks in different strip formats in batches based on the snapshot copies in different strip formats.
7. The method according to claim 6, wherein the creating snapshot copies of different strip formats corresponding to the disk snapshots according to the disk snapshots cached in the distributed cache node set comprises:
copying each disk segment data of the cached disk snapshot from the set of distributed caching nodes;
the copied data of each disk segment is divided into snapshot segments again according to a first strip format, and a snapshot copy of the first strip format corresponding to the disk snapshot is obtained; the first stripe format is any stripe format different from the cached stripe format of the disk snapshot.
8. The method according to claim 6, wherein the batch cloning disks of different stripe formats based on the snapshot copy of different stripe formats comprises:
creating at least one empty disk of a second stripe format, wherein the second stripe format is any one of the different stripe formats;
and importing all disk segment data in the snapshot copy in the second stripe format into the disk in the second stripe format by adopting a hard link technology.
9. The method according to any one of claims 1 to 4, wherein if the block management service records the distributed cache node set corresponding to the disk snapshot, the method further comprises:
creating a plurality of encrypted snapshot copies corresponding to the disk snapshot according to the disk snapshot cached in the distributed cache node set, wherein the plurality of encrypted snapshot copies are obtained by encrypting with different keys;
and cloning the encrypted disks in batches based on the plurality of encrypted snapshot copies.
10. The method according to claim 9, wherein creating a plurality of copies of the encrypted snapshot corresponding to the disk snapshot according to the disk snapshot cached in the distributed cache node set, and cloning the encrypted disks in bulk based on the plurality of copies of the encrypted snapshot comprises:
copying each disk segment data of the cached disk snapshot from the set of distributed caching nodes;
encrypting the copied segmented data of each disk by adopting a first key to obtain an encrypted snapshot copy corresponding to the first key;
creating at least one empty disk;
and importing all data in the encrypted snapshot copy corresponding to the first key into the created empty disk by adopting a hard link technology to obtain at least one encrypted disk corresponding to the first key.
11. An apparatus for reading snapshot data, the apparatus comprising:
a receiving module, configured to receive a disk reading request initiated during a delayed loading period of a target disk, where the disk reading request is used to read disk segment data in a disk snapshot corresponding to the target disk;
the selection module is used for selecting a snapshot cache node from the block device storage cluster;
the acquisition module is used for acquiring the disk segment data from the snapshot cache node if the selected snapshot cache node stores the disk segment data; if the disk segment data is not stored in the selected snapshot cache node, acquiring the disk segment data from a mirror center; and storing the disk segment data in the selected snapshot cache node.
12. A snapshot data reading system is characterized by comprising a block device storage cluster, a computing cluster and a mirror image center;
the mirror image center is used for storing a mirror image file of the disk;
the computing cluster is used for initiating a disk reading request during the delayed loading of a target disk, wherein the disk reading request is used for reading disk segment data in a disk snapshot corresponding to the target disk;
the block device storage cluster is used for receiving the disk reading request and selecting a snapshot cache node; if the selected snapshot cache node stores the disk segment data, acquiring the disk segment data from the snapshot cache node; and if the selected snapshot cache node does not store the disk segment data, acquiring the disk segment data from the mirror center, and storing the acquired disk segment data in the selected snapshot cache node.
13. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the method of any one of claims 1-10.
14. A computer-readable storage medium, on which a computer program is stored, characterized in that the program is executed by a processor to implement the method of any of claims 1-10.
CN202210153442.4A 2022-02-18 2022-02-18 Snapshot data reading method, device, system, equipment and storage medium Pending CN114661232A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210153442.4A CN114661232A (en) 2022-02-18 2022-02-18 Snapshot data reading method, device, system, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210153442.4A CN114661232A (en) 2022-02-18 2022-02-18 Snapshot data reading method, device, system, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114661232A true CN114661232A (en) 2022-06-24

Family

ID=82028296

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210153442.4A Pending CN114661232A (en) 2022-02-18 2022-02-18 Snapshot data reading method, device, system, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114661232A (en)

Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102577241A (en) * 2009-12-31 2012-07-11 华为技术有限公司 Method, device and system for scheduling distributed buffer resources
US20140019769A1 (en) * 2012-07-16 2014-01-16 Compellent Technologies Encryption/decryption for data storage system with snapshot capability
CN103620580A (en) * 2011-04-28 2014-03-05 网络存储技术公司 System and method for migration of data clones
US20150066859A1 (en) * 2013-08-27 2015-03-05 Red Hat. Inc. Memory first live snapshot
US20150154084A1 (en) * 2013-12-02 2015-06-04 International Business Machines Corporation Flash copy for disaster recovery (dr) testing
WO2016122549A1 (en) * 2015-01-29 2016-08-04 Hewlett Packard Enterprise Development Lp Read only bufferpool
CN106649146A (en) * 2013-05-21 2017-05-10 青岛海信移动通信技术股份有限公司 Memory release method and apparatus
CN106776798A (en) * 2016-11-23 2017-05-31 深圳市中博睿存科技有限公司 A kind of cluster file system is client-based to propagate caching method
US20190012238A1 (en) * 2017-07-10 2019-01-10 International Business Machines Corporation Integrating resources at a backup site
CN109753340A (en) * 2017-11-08 2019-05-14 阿里巴巴集团控股有限公司 Virtual machine snapshot processing method, apparatus and system
CN110018879A (en) * 2018-01-09 2019-07-16 阿里巴巴集团控股有限公司 Delay loading method and device applied to distributed system
CN110018878A (en) * 2018-01-09 2019-07-16 阿里巴巴集团控股有限公司 A kind of distributed system data load method and device
CN110750325A (en) * 2019-02-25 2020-02-04 北京嘀嘀无限科技发展有限公司 Mirror image backup method and device of virtual machine, fault recovery method and device and electronic equipment
US20200167238A1 (en) * 2018-11-23 2020-05-28 Hewlett Packard Enterprise Development Lp Snapshot format for object-based storage
CN111324487A (en) * 2020-01-21 2020-06-23 北京市天元网络技术股份有限公司 Method and device for copying communication guarantee data
CN112052218A (en) * 2020-09-25 2020-12-08 杭州宏杉科技股份有限公司 Snapshot implementation method and distributed storage cluster
CN112748879A (en) * 2020-12-30 2021-05-04 中科曙光国际信息产业有限公司 Data acquisition method, system, device, computer equipment and storage medium
CN112995307A (en) * 2021-02-09 2021-06-18 中国工商银行股份有限公司 Log processing method, system, device, electronic equipment and storage medium

Patent Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102577241A (en) * 2009-12-31 2012-07-11 华为技术有限公司 Method, device and system for scheduling distributed buffer resources
CN103620580A (en) * 2011-04-28 2014-03-05 网络存储技术公司 System and method for migration of data clones
US20140019769A1 (en) * 2012-07-16 2014-01-16 Compellent Technologies Encryption/decryption for data storage system with snapshot capability
CN106649146A (en) * 2013-05-21 2017-05-10 青岛海信移动通信技术股份有限公司 Memory release method and apparatus
US20150066859A1 (en) * 2013-08-27 2015-03-05 Red Hat. Inc. Memory first live snapshot
US20150154084A1 (en) * 2013-12-02 2015-06-04 International Business Machines Corporation Flash copy for disaster recovery (dr) testing
WO2016122549A1 (en) * 2015-01-29 2016-08-04 Hewlett Packard Enterprise Development Lp Read only bufferpool
CN106776798A (en) * 2016-11-23 2017-05-31 深圳市中博睿存科技有限公司 A kind of cluster file system is client-based to propagate caching method
US20190012238A1 (en) * 2017-07-10 2019-01-10 International Business Machines Corporation Integrating resources at a backup site
CN109753340A (en) * 2017-11-08 2019-05-14 阿里巴巴集团控股有限公司 Virtual machine snapshot processing method, apparatus and system
CN110018879A (en) * 2018-01-09 2019-07-16 阿里巴巴集团控股有限公司 Delay loading method and device applied to distributed system
CN110018878A (en) * 2018-01-09 2019-07-16 阿里巴巴集团控股有限公司 A kind of distributed system data load method and device
US20200167238A1 (en) * 2018-11-23 2020-05-28 Hewlett Packard Enterprise Development Lp Snapshot format for object-based storage
CN110750325A (en) * 2019-02-25 2020-02-04 北京嘀嘀无限科技发展有限公司 Mirror image backup method and device of virtual machine, fault recovery method and device and electronic equipment
CN111324487A (en) * 2020-01-21 2020-06-23 北京市天元网络技术股份有限公司 Method and device for copying communication guarantee data
CN112052218A (en) * 2020-09-25 2020-12-08 杭州宏杉科技股份有限公司 Snapshot implementation method and distributed storage cluster
CN112748879A (en) * 2020-12-30 2021-05-04 中科曙光国际信息产业有限公司 Data acquisition method, system, device, computer equipment and storage medium
CN112995307A (en) * 2021-02-09 2021-06-18 中国工商银行股份有限公司 Log processing method, system, device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US11609884B2 (en) Intelligent file system with transparent storage tiering
US9052962B2 (en) Distributed storage of data in a cloud storage system
US10747673B2 (en) System and method for facilitating cluster-level cache and memory space
US8621196B2 (en) Booting from an encrypted ISO image
US11245774B2 (en) Cache storage for streaming data
US11693789B2 (en) System and method for mapping objects to regions
US11048591B1 (en) Efficient name space organization in a global name space cluster
US11861196B2 (en) Resource allocation method, storage device, and storage system
US20180167461A1 (en) Method and apparatus for load balancing
CN110018878B (en) Distributed system data loading method and device
US11550713B1 (en) Garbage collection in distributed systems using life cycled storage roots
CN109144406B (en) Metadata storage method, system and storage medium in distributed storage system
US11036535B2 (en) Data storage method and apparatus
WO2023169235A1 (en) Data access method and system, device, and storage medium
US11442927B1 (en) Storage performance-based distribution of deduplicated data to nodes within a clustered storage environment
CN107391033B (en) Data migration method and device, computing equipment and computer storage medium
CN108475201B (en) Data acquisition method in virtual machine starting process and cloud computing system
US11593270B1 (en) Fast distributed caching using erasure coded object parts
CN110018879B (en) Delay loading method and device applied to distributed system
CN106775846A (en) For the method and device of the online migration of physical server
CN114661232A (en) Snapshot data reading method, device, system, equipment and storage medium
EP4369170A1 (en) Method and apparatus for data storage in storage system
CN113590029B (en) Disk space allocation method, system, storage medium and equipment
US20190079875A1 (en) Efficient provisioning of virtual machines to endpoint computing environment
CN115827745A (en) Memory database cluster and implementation method and device thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination