Distributed storage reading system and method
By dynamically selecting the target object storage device for read request processing in a distributed storage system, the performance degradation caused by the primary object storage device processing read requests is solved, resulting in faster read request response and lower latency.
Patent Information
- Application Number
- CN202010655869.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-09
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2040-07-09
AI Technical Summary
In a distributed storage system, when the primary object storage device handles a large number of read I/O requests, it leads to reduced read performance and increased I/O latency, making it impossible to effectively utilize the CPU and disk processing capabilities of the candidate object storage devices.
By dynamically selecting the target object storage device from multiple candidate object storage devices through the client to process read requests, the queuing on the main object storage device is avoided, and the CPU and disk capabilities of each candidate device are fully utilized.
It improves the response speed of read request commands, reduces read latency, avoids read requests accumulating in the queue of the main object storage device, and improves the system's read performance.
Smart Images

Figure CN113918380B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of distributed storage technology, and in particular to a distributed storage reading system and method. Background Technology
[0002] With the rapid development of cloud computing technology, data is growing explosively, and distributed storage systems are gradually being adopted to replace traditional centralized storage solutions in order to improve storage reliability and security.
[0003] Currently, distributed storage systems employ a multi-replica strategy, mapping a file object to a sequence of Object Storage Devices (OSDs). Each OSD stores a backup of the file object, ensuring data redundancy across the storage cluster. Typically, the first OSD in the sequence is selected as the primary OSD, which queues read I / O requests for processing. However, a large number of read I / O requests on the primary OSD can increase I / O latency in its queue, leading to decreased system read performance. Summary of the Invention
[0004] This invention provides a distributed storage reading system and method to achieve decentralized processing of read requests, improve the response speed of read request commands, and reduce read latency.
[0005] In a first aspect, embodiments of the present invention provide a distributed storage reading system, comprising: a client and at least two candidate object storage devices disposed on different storage nodes of a distributed storage cluster, wherein the at least two candidate object storage devices are divided into a primary object storage device and at least one secondary object storage device; wherein,
[0006] The client is configured to select a target object storage device from at least two candidate object storage devices; and to send a target file read request to the target object storage device; wherein each of the candidate object storage devices stores backup data of the target file;
[0007] The target object storage device is configured to read backup data of the target file corresponding to the target file read request from the local block storage space of the target object storage device; and to return the read backup data to the client.
[0008] Secondly, this invention also provides a distributed storage reading method, including:
[0009] The client selects a target object storage device from at least two candidate object storage devices; and sends a target file read request to the target object storage device; wherein each of the candidate object storage devices stores backup data of the target file; each of the candidate object storage devices is located on a different storage node of a distributed storage cluster, and the at least two candidate object storage devices are divided into a master object storage device and at least one slave object storage device;
[0010] The system reads backup data of the target file corresponding to the target file read request from the local block storage space of the target object storage device; and returns the read backup data to the client.
[0011] This invention provides a distributed storage reading system. A client can select either a primary or secondary object storage device from at least two candidate object storage devices located on different storage nodes of a distributed storage cluster as the target object storage device, and then send a target file read request to the target object storage device. The selected target object storage device then reads the backup data of the target file corresponding to the target file read request from its local block storage space and returns the read backup data to the client. By utilizing the multi-replica storage characteristics of each object storage device, the client no longer consistently sends read requests to the primary object storage device for data reading, avoiding the hotspot effect of always reading data through the primary object storage device. By selecting a suitable target object storage device from among the candidate object storage devices to execute the read request, the CPU and disk processing capabilities of each candidate can be fully utilized to execute the read request, avoiding a large number of read requests waiting on the primary object storage device and improving the response speed of replica read request commands.
[0012] The above description of the invention is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0013] Other features, objects, and advantages of the invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings. The drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0014] Figure 1 This is a structural block diagram of a distributed storage and retrieval system provided in an embodiment of the present invention;
[0015] Figure 2 This is a schematic diagram of the architecture of a distributed storage cluster provided in an embodiment of the present invention;
[0016] Figure 3 This is a schematic diagram of writing a target file to multiple copies, provided in an embodiment of the present invention;
[0017] Figure 4 This is a schematic diagram illustrating the reading of backup data from a target file written to multiple copies, provided in an embodiment of the present invention.
[0018] Figure 5 This is a schematic diagram illustrating another method for reading backup data of a target file written to multiple copies, provided in an embodiment of the present invention.
[0019] Figure 6 This is a schematic diagram illustrating another method for reading backup data of a target file written to multiple copies, provided in an embodiment of the present invention.
[0020] Figure 7 This is a flowchart of a distributed storage reading method provided in an embodiment of the present invention. Detailed Implementation
[0021] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.
[0022] Before discussing the exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the operations (or steps) as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but it may also have additional steps not included in the figures. The process may correspond to a method, function, procedure, subroutine, subroutine, etc.
[0023] Figure 1 This is a structural block diagram of a distributed storage reading system provided in an embodiment of the present invention. This embodiment is applicable to situations requiring fast reading of file data in a distributed storage system, particularly for fast reading of file data from distributed multi-copy storage. Figure 1 As shown, the distributed storage reading system in this embodiment may include: a client 110 and at least two candidate object storage devices 120 disposed on different storage nodes of the distributed storage cluster. Wherein:
[0024] The client configuration 110 is to select a target object storage device from at least two candidate object storage devices 120; and to send a target file read request to the target object storage device; wherein each candidate object storage device 120 stores backup data of the target file.
[0025] The target object storage device (OSD) is configured to read backup data of the target file corresponding to the target file read request from the local block storage space of the target object storage device (OSD); and to return the read backup data to the client 110.
[0026] In this embodiment, Figure 2 This is a schematic diagram of a distributed storage cluster architecture provided in an embodiment of the present invention. See also... Figure 2 Distributed storage systems utilize multiple storage devices (storage nodes) located in different locations to form a storage cluster, thereby distributing the storage load and ensuring data storage reliability and security. These storage devices can be distributed across different data centers or even different cities, and the storage nodes interact with each other via a network, providing storage services to the outside world through the public network. A distributed storage cluster can include multiple storage nodes (storage devices), and a storage node can have one or more object storage devices (OSDs). The OSDs can respond to client requests and return specific data.
[0027] In this embodiment, to ensure data redundancy in the storage cluster, a multi-replica strategy can be adopted when writing backup data of a target file to the distributed storage system. This involves mapping a target file to multiple candidate object storage devices (OSDs), ensuring that each candidate OSD writes a copy of the target file's backup data. Thus, both the primary and secondary OSDs of each candidate OSD store the backup data written to the target file, and the stored backup data is identical.
[0028] For example, Figure 3 This is a schematic diagram illustrating the writing of a target file to multiple copies, provided in an embodiment of the present invention. See also... Figure 3 For N-replica write scenarios, N candidate Object Storage Devices (OSDs) can be obtained from different storage nodes in the storage cluster. The first candidate OSD among these N OSDs is designated as the primary OSD. The primary OSD first writes a backup of the target file, then copies and distributes this backup to the other N-1 secondary OSDs for writing. In this way, both the primary and secondary OSDs of each candidate OSD store a backup of the target file.
[0029] In this embodiment, see Figure 2 and Figure 3 By configuring different fault domain policies, the candidate object storage devices (OSDs) used for writing target files can be distributed across different storage devices (storage nodes) in the distributed storage cluster, thus tolerating different levels of storage device failures. It is evident that after a successful multi-replica write to the target file, each candidate object storage device (OSD) on different storage nodes in the distributed storage cluster stores a backup of the target file, and all stored backups are identical. Furthermore, the candidate object storage devices (OSDs) used for the multi-replica write are divided into one primary object storage device (OSD) and at least one secondary object storage device (OSD).
[0030] In this embodiment, Figure 4 This is a schematic diagram illustrating the reading of backup data from a target file written to multiple copies, provided in an embodiment of the present invention. See also... Figure 4 When a client reads backup data of a target file from various candidate OSDs, it sends a read I / O request to the primary OSD, which then queues these requests. However, in practice, multiple clients may simultaneously read backup data of the same target file. If all client read requests are sent to the primary OSD for queuing, the limited I / O processing capacity of the primary OSD leads to increased I / O latency in the queue, resulting in decreased read performance of the distributed storage system. Furthermore, both disk I / O processing capacity and OSD CPU resources are limited. Concentrating read I / O requests on the primary OSD increases disk I / O pressure and CPU consumption, potentially creating a performance bottleneck. For example, if the disk response time for the primary OSD is long and the CPU of the node hosting the primary OSD is busy, receiving a large number of read requests further degrades read and write performance.
[0031] In this embodiment, the proposed solution optimizes the reading process of backup data written by multiple replicas in a distributed storage system. Utilizing the characteristic that each candidate object storage device (OSD) stores backup data of the target file, and that the stored backup data is identical, when reading the backup data of a target file written by multiple replicas, the target file read request command is no longer consistently sent to the primary object storage device (OSD) for queuing. Instead, the client selects the target object storage device from at least two candidate object storage devices (OSDs) indicated by the candidate object storage device (120) to process the target file read request, and then sends the target file read request to the target object storage device (OSD) for processing.
[0032] The above-described method in this embodiment can avoid the hotspot effect of using the primary object storage device (OSD) every time backup data is read. This ensures that read I / O request commands issued by each client are evenly distributed to each candidate object storage device (OSD). This prevents the queue of read I / O request commands from the primary OSD from piling up and causing increased read I / O latency due to multiple clients sending their target file read requests to the primary OSD. It is evident that by fully utilizing the CPU processing power and disk I / O processing power of each candidate object storage device (OSD), the response speed of target file read I / O request commands can be improved and I / O latency can be reduced.
[0033] In this embodiment, the object storage device (OSD) has an OSD process that responds to client read requests and returns specific data. Each OSD process manages the local block storage space of the OSD. When the target OSD receives a target file read request from the client, it reads the metadata management information of the target file corresponding to the read request from the key-value store database to locate the target file block used to store backup data of the target file in the local block storage space. The target OSD determines the read location of the backup data of the target file stored on the target file block based on the offset length information carried in the read request, then performs the read operation based on the backup data and returns the read backup data to the client 110.
[0034] This invention provides a distributed storage reading system. By utilizing the multi-replica storage characteristics of various object storage devices, the client no longer consistently sends read requests to the primary object storage device for data reading. Instead, it actively avoids the hotspot effect of always reading data through the primary object storage device. Instead, it selects a suitable target object storage device from among various candidate object storage devices to execute the read request. This fully utilizes the CPU and disk processing capabilities of each candidate device to execute the read request, avoiding the accumulation of read requests in the queue and increased read request latency caused by sending a large number of read requests to the same primary object storage device (OSD). This also prevents a large number of read requests from waiting on the primary object storage device, improving the response speed of replica read request commands.
[0035] In one optional embodiment, this implementation can be combined with various optional solutions from one or more of the above embodiments. See also Figure 1 In the distributed storage reading system provided by the technical solution of this application, the client 110 can be configured such that: if the target file read request is pre-configured to be sent to all candidate object storage devices (OSDs), then each candidate object storage device (OSD) is used as the target object storage device.
[0036] In this embodiment, for a target file read request to be sent by the client, it can be determined whether to configure the pre-configured read I / O request processing option to send the read I / O request command to all OSDs indicated by at least two candidate object storage device OSDs located on different storage nodes in the distributed storage cluster. If the pre-configuration sends the target file read request to all OSDs, then all candidate object storage device OSDs are used as the target object storage device OSD.
[0037] In the optional scheme of the above embodiment, when each candidate object storage device is in an idle state, all candidate object storage device OSDs can be allowed to perform the read operation corresponding to the target file read request. No matter which candidate object storage device OSD reads the backup data, it will feed back the read backup data to the client as soon as possible, ensuring the read rate of the target file read request.
[0038] In another optional embodiment, this implementation can be combined with various optional solutions in one or more of the above embodiments. See also Figure 1 In the distributed storage reading system provided by the technical solution of this application, the client 110 can be configured to: if the device where the client is located belongs to a storage node in the distributed storage cluster, it can determine whether there is a candidate object storage device among at least two candidate object storage devices that belongs to the storage node of the client's device; if so, the target object storage device is determined from the candidate object storage devices that belong to the storage node of the client's device.
[0039] In this embodiment, see Figure 2 The client can be installed on a storage node in the distributed storage cluster or on other non-storage nodes. Before issuing a target file read request, client 110 can first determine whether the device on which the client is installed belongs to a storage node in the distributed storage cluster. For example, it can determine whether the client's device is a storage node in the distributed storage cluster based on the device identifier or device name. If it is determined to be a storage node in the distributed storage cluster, it further determines whether there is a candidate object storage device OSD located on the storage node of the client's device among the at least two candidate object storage device OSDs mentioned above.
[0040] In this embodiment, if one of the at least two candidate object storage device OSDs is located on the storage node of the client's device, then one candidate object storage device OSD is preferentially selected from the candidate object storage device OSDs on the storage node of the client's device as the target object storage device OSD. For example, if one of the candidate object storage device OSDs in the OSD sequence acting = [OSD.1, OSD.2, OSD.3…OSD.N] is located on the storage node of the client's device, then the candidate object storage device OSD on the storage node of the client's device is preferentially read as the target object storage device OSD.
[0041] In the optional scheme of the above embodiment, since the storage nodes in the distributed storage cluster interact with each other through the network and provide storage services to the outside world through the public network, when the client device is located on a storage node of the storage cluster, it can be determined whether there is a candidate object storage device (OSD) on the storage node of the client device. If there is, a target object storage device (OSD) is selected from the candidate storage devices on the storage node of the client device to reduce the impact of network transmission on read performance.
[0042] In another optional embodiment, this implementation can be combined with various optional solutions from one or more of the above embodiments. See also Figure 1In the distributed storage reading system provided by the technical solution of this application, the client 110 can be configured to select and determine the target object storage device OSD from the at least two candidate object storage device OSDs if the device where the client is located is not a storage node in the distributed storage cluster, or if there is no candidate object storage device OSD among the at least two candidate object storage device OSDs located on the storage node of the device where the client is located. This is based on the random number obtained using a random function and the length of the OSD sequence composed of at least two candidate object storage device OSDs.
[0043] In this embodiment, for the client, there are two possibilities: the client's device is not a storage node in the distributed storage cluster; or the client's device is a storage node in the distributed storage cluster, but none of the candidate object storage devices (OSDs) are located on the storage node of the client's device. For both cases, a random number can be obtained using a random function. The value calculated by taking the remainder of the random number with the length (size) of the OSD sequence acting is denoted as p. Then, the OSD at position p (acting[p]) in the OSD sequence acting = [OSD.1, OSD.2, OSD.3…OSD.N] is selected as the target object storage device (OSD) for processing this target file read request.
[0044] In this embodiment, optionally, a target object storage device (OSD) for processing the current target file read request is selected from an OSD sequence acting = [OSD.1, OSD.2, OSD.3…OSD.N] composed of at least two candidate OSDs. This selection can be calculated using the following formula: randnum = rand(); size = acting.size(); p = randnum % size; OSD = acting[p]. Where randnum represents a random number obtained using the random function rand(), size represents the sequence length of the OSD sequence, and p represents the value obtained by taking the remainder between the random number (randnum) and the length of the OSD sequence acting (size).
[0045] In the optional scheme of the above embodiments, when selecting the target object storage device (OSD), it can be randomly selected from multiple candidate object storage devices (OSDs) to distribute the read requests of each client evenly to the appropriate candidate object storage device (OSD). In this way, the CPU capabilities and disk I / O processing capabilities of each candidate object storage device (OSD) can be fully utilized, thereby improving the response speed of copy read I / O request commands and reducing read I / O latency.
[0046] Figure 5This is a schematic diagram illustrating another method for reading backup data from a target file with multiple copies written, provided in this embodiment of the invention. (See also...) Figure 1 and Figure 5 In the distributed storage reading system provided by this application, the target object storage device (OSD) can be the slave object storage device (OSD) selected by the client 110 from at least two candidate object storage devices 120. Wherein:
[0047] Client 110 can also be configured to send a first read lock request to the primary object storage device (OSD) among at least two candidate object storage devices 120.
[0048] The primary object storage device (OSD) can be configured to perform a read lock operation on the backup data of the target file in the local block storage space of the primary object storage device (OSD) in response to a first read lock request.
[0049] Specifically, the target object storage device (OSD) can be configured to, upon successful acquisition of a read lock by the primary object storage device (OSD), respond to the target file read request sent by the client and read the backup data of the target file corresponding to the target file read request from the local block storage space of the target object storage device (OSD).
[0050] In this embodiment, when a target file read request is sent to the target object storage device OSD, a target file write request may also be sent to the primary object storage device OSD among the at least two candidate object storage devices 120. To ensure data read and write ordering, the client 110 may first send a first read lock request to the primary object storage device OSD, so that the primary object storage device OSD can acquire a read-write lock on the target file backup data corresponding to the target file read request stored in the local block storage space of the primary object storage device OSD according to the first read lock request.
[0051] In this embodiment, in response to the first read lock request, the primary object storage device (OSD) receives the read lock request command corresponding to the first read lock request from the client via the network module and adds it to a queue in the order of receipt for processing by a processing thread. Based on the first-in-first-out (FIFO) nature of the queue, multiple threads sequentially retrieve read lock request commands from the queue for processing. When processing the read lock request command corresponding to the first read lock request, the OSD can read the metadata management information of the backup data of the target file corresponding to the target file read request from the key-value storage database and save it to a cache. Then, it acquires a read lock on the backup data of the target file in the local block storage space of the OSD. After successful locking, it replies to the client with an ACK indicating successful read lock acquisition, i.e., it replies to the client with the successful lock acquisition message corresponding to the first read lock request.
[0052] By adopting the above-described solution in this embodiment, it is possible to avoid the situation where a write request from the primary object storage device OSD arrives at the secondary object storage device OSD to write data before the backup data is read from the OSD, which would result in the read data being the data written after the write request, causing a read error.
[0053] In one optional embodiment, this implementation can be combined with various optional solutions from one or more of the above embodiments. See also Figure 1 and Figure 5 In the case where the selected target object storage device OSD is a slave object storage device OSD, in the distributed storage reading system provided by the technical solution of this application, the client 110 can also be configured to send a second read lock request and a target file read request to the selected target object storage device OSD if the master object storage device OSD among at least two candidate object storage device OSDs successfully acquires a read lock.
[0054] Accordingly, the target object storage device (OSD) can be specifically configured to, in response to a second read lock request sent by the client, perform a read lock operation on the backup data of the target file in the local block storage space of the target object storage device (OSD); and, if the target object storage device (OSD) successfully performs a read lock in response to the second read lock request, respond to and process the target file read request sent by the client, so as to return the backup data read from the local block storage space to the client.
[0055] In this embodiment, after the client receives a successful read lock response from the primary object storage device (OSD) for the first read lock request, it can send a second read lock request and a target file read request to the selected target object storage device (OSD). In this way, the target object storage device (OSD) can, based on the second read lock request, acquire a read-write lock on the target file backup data corresponding to the target file read request stored in its local block storage space.
[0056] In this embodiment, in response to the second read lock request, the target object storage device (OSD) receives the read lock request command corresponding to the second read lock request from the client via the network module, and adds it to a queue in the order of receipt to await processing by the processing thread. Based on the first-in-first-out (FIFO) nature of the queue, multiple threads sequentially retrieve the read lock request commands from the queue for processing. When processing the read lock request command corresponding to the second read lock request, the OSD can read the metadata management information of the backup data of the target file corresponding to the target file read request from the key-value storage database and save it to the cache. Then, it acquires a read lock on the backup data of the target file in the local block storage space of the OSD. After successful locking, it replies to the client with an ACK indicating successful read lock acquisition, i.e., it replies to the client with the successful lock acquisition information corresponding to the second read lock request.
[0057] In this embodiment, if the read lock is successfully acquired in response to the second read lock request, the target object storage device (OSD) responds to and processes the target file read request sent by the client, and sends the backup data read from the local block storage space back to the client. Simultaneously, after the reading is complete, the backup data of the target file for which the read lock operation was performed in response to the second read lock request is unlocked, releasing the read-write lock.
[0058] In the above-mentioned optional solution of this embodiment, since the process of the target object storage device OSD may include multiple threads, and there may be target file write requests and target file read requests in multiple threads at the same time, in order to achieve read-write order preservation, it is necessary to add a read lock to the backup data of the target file to prevent the data read by the target object storage device OSD from being the data written after executing the write request for the backup data of the target file in the local block storage space, which would cause read errors.
[0059] In one optional embodiment, this implementation can be combined with various optional solutions from one or more of the above embodiments. See also Figure 1 and Figure 5 When the selected target object storage device OSD is a slave object storage device OSD, the client 110 can also be configured to send a request to release the read-write lock to the master object storage device among at least two candidate object storage device OSDs when the target object storage device successfully acquires a read lock.
[0060] Accordingly, the primary object storage device (OSD) in at least two candidate object storage devices (OSDs) can also be configured to unlock the backup data of the target file that has been acquired by acquiring a read lock in response to a request from the client to release the read-write lock.
[0061] In this embodiment, the primary object storage device (OSD) can add client requests to release read-write locks in a queue according to the order of receipt, allowing multiple threads to sequentially retrieve and process these requests based on the first-in-first-out (FIFO) nature of the queue. In response to a client's request to release a read-write lock, the OSD first reads the metadata management information of the target file in its local block storage space from the cache. Then, it unlocks the backup data of the target file in the OSD's local block storage space and releases the cache.
[0062] Using the above-mentioned optional solution in this embodiment, after receiving the read-write lock release request command, the primary object storage device (OSD) unlocks the backup data of the target file for which the read lock is acquired. This allows the OSD to process write operations of write I / O request commands for the backup data of the target file issued by other clients, thus avoiding the long-term occupation of the backup data of the target file in the local block storage space of the OSD, which would otherwise prevent write operations from being performed on it.
[0063] Figure 6 This is a schematic diagram illustrating another method for reading backup data of a target file written to multiple copies, provided in this embodiment of the invention. See also... Figure 1 and Figure 6 In the distributed storage reading system provided by this application, the target object storage device (OSD) can be the primary object storage device (OSD) selected from at least two candidate object storage devices 120. Wherein:
[0064] Client 110 can also be configured to send a third read lock request and a target file read request to the primary object storage device (OSD) in at least two candidate object storage devices.
[0065] The target object storage device (OSD) can be configured to perform a read lock operation on the backup data of the target file in the local block storage space of the primary object storage device (OSD) in response to a third read lock request.
[0066] The target object storage device (OSD) can also be configured to respond to and process the target file read request when the target object storage device (referring to the primary object storage device OSD) successfully acquires a read lock, and return the backup data of the target file read from the target object storage device (referring to the primary object storage device OSD) to the client 110; and to unlock the backup data of the target file for which a third read lock request was acquired, so as to release the read-write lock.
[0067] In this embodiment, the process of reading data from the local block storage space by the primary object storage device OSD is similar to the process of reading data from the local block storage space by the secondary object storage device OSD, and will not be described again here.
[0068] Figure 7 This is a flowchart illustrating a distributed storage reading method provided in an embodiment of the present invention. This embodiment is applicable to situations requiring rapid reading of file data in a distributed storage system, particularly for rapidly reading file data from distributed multi-copy storage. Figure 7 As shown, the distributed storage reading method in this application embodiment may include the following steps:
[0069] S710. Select a target object storage device from at least two candidate object storage devices through a client; and send a target file read request to the target object storage device; wherein each of the candidate object storage devices stores backup data of the target file; each of the candidate object storage devices is located on different storage nodes of the distributed storage cluster, and the at least two candidate object storage devices are divided into a master object storage device and at least one slave object storage device.
[0070] Based on the above embodiments, optionally, a target object storage device is selected from at least two candidate object storage devices, including:
[0071] If the target file read request is pre-configured to be sent to all candidate object storage devices, then each candidate object storage device will be used as the target object storage device.
[0072] Based on the above embodiments, optionally, a target object storage device is selected from at least two candidate object storage devices, including:
[0073] If the device where the client is located is a storage node in a distributed storage cluster, then determine whether there is a candidate object storage device among the at least two candidate object storage devices that belongs to the storage node of the device where the client is located;
[0074] If it exists, then the target object storage device is determined from the candidate object storage devices belonging to the storage node of the client's device; or,
[0075] If it does not exist, the target object storage device is determined from the at least two candidate object storage devices based on the random number obtained using a random function and the sequence length composed of the at least two candidate object storage devices.
[0076] S720: Read the backup data of the target file corresponding to the target file read request from the local block storage space of the target object storage device; and return the read backup data to the client.
[0077] Based on the above embodiments, optionally, the target object storage device is a slave object storage device among the at least two candidate object storage devices; correspondingly, reading the backup data of the target file corresponding to the target file read request from the local block storage space of the target object storage device includes:
[0078] The client sends a first read lock request to the primary object storage device among the at least two candidate object storage devices;
[0079] In response to the first read lock request, the primary object storage device performs a read lock operation on the backup data of the target file in the local block storage space of the primary object storage device.
[0080] If the primary object storage device successfully acquires a read lock, the target object storage device reads the backup data of the target file corresponding to the target file read request from the local block storage space of the target object storage device.
[0081] Based on the above embodiments, optionally, reading backup data of the target file corresponding to the target file read request from the local block storage space of the target object storage device includes:
[0082] If the read lock is successfully acquired on the primary object storage device, the client sends a second read lock request and the target file read request to the target object storage device.
[0083] In response to the second read lock request, the target object storage device performs a read lock operation on the backup data of the target file in the local block storage space of the target object storage device; and, if the read lock is successfully performed on the target object storage device, it responds to and processes the target file read request.
[0084] Optionally, based on the above embodiments, the method further includes:
[0085] If the read lock is successfully acquired on the target object storage device, the client sends a request to the main object storage device to release the read-write lock.
[0086] In response to the request to release the read-write lock, the primary object storage device unlocks the backup data of the target file that has already been acquired in response to the first read-lock request.
[0087] Based on the above embodiments, optionally, the target object storage device is the primary object storage device among the at least two candidate object storage devices; correspondingly, reading the backup data of the target file corresponding to the target file read request from the local block storage space of the target object storage device includes:
[0088] The client sends a third read lock request to the primary object storage device among the at least two candidate object storage devices;
[0089] In response to the third read lock request, the target object storage device performs a read lock operation on the backup data of the target file in the local block storage space of the main object storage device; if the target object storage device successfully performs the read lock, it responds to and processes the target file read request.
[0090] The distributed storage reading method provided in the embodiments of the present invention can be applied to the distributed storage reading system provided in any of the embodiments of the present invention above, and has the corresponding functions and beneficial effects of the distributed storage reading system. For technical details not described in detail in the above embodiments, please refer to the distributed storage reading system provided in any embodiment of this application.
[0091] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0092] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A distributed storage and retrieval system, characterized in that, include: The client and at least two candidate object storage devices located on different storage nodes in the distributed storage cluster, wherein the at least two candidate object storage devices are divided into one primary object storage device and at least one secondary object storage device; wherein, The client is configured to select a target object storage device from at least two candidate object storage devices; and send a target file read request to the target object storage device; wherein each of the candidate object storage devices stores backup data of the target file; wherein the client is further configured to: if the client's device belongs to a storage node in a distributed storage cluster, determine whether there is a candidate object storage device among the at least two candidate object storage devices that belongs to the storage node of the client's device; if so, determine the target object storage device from the candidate object storage devices belonging to the storage node of the client's device; if not, determine the target object storage device from the at least two candidate object storage devices based on a random number obtained using a random function and the length of the sequence composed of the at least two candidate object storage devices; The target object storage device is configured to read backup data of the target file corresponding to the target file read request from its local block storage space; and return the read backup data to the client; wherein the target object storage device is a slave object storage device among the at least two candidate object storage devices; the client is further configured to send a first read lock request to the master object storage device among the at least two candidate object storage devices; the master object storage device is configured to, in response to the first read lock request, perform a read lock operation on the backup data of the target file in its local block storage space; specifically, the target object storage device is configured to, if the master object storage device successfully performs the read lock, read the backup data of the target file corresponding to the target file read request from its local block storage space.
2. The system according to claim 1, characterized in that, The client is further configured as follows: If the target file read request is pre-configured to be sent to all candidate object storage devices, then each candidate object storage device will be used as the target object storage device.
3. The system according to claim 1, characterized in that, The client is also configured to send a second read lock request and the target file read request to the target object storage device if the read lock is successfully acquired on the primary object storage device. The target object storage device is specifically configured to, in response to the second read lock request, perform a read lock operation on the backup data of the target file in the local block storage space of the target object storage device; and, if the read lock is successfully performed on the target object storage device, respond to and process the target file read request.
4. The system according to claim 3, characterized in that, The client is also configured to send a request to the main object storage device to release the read-write lock if the read lock is successfully acquired on the target object storage device. The primary object storage device is further configured to, in response to the request to release the read-write lock, unlock the backup data of the target file that has already undergone a read-lock operation in response to the first read-lock request.
5. The system according to claim 1, characterized in that, The target object storage device is the primary object storage device among the at least two candidate object storage devices; The client is also configured to send a third read lock request to the primary object storage device among the at least two candidate object storage devices; The target object storage device is configured to perform a read lock operation on the backup data of the target file in the local block storage space of the main object storage device in response to the third read lock request. If the read lock is successfully acquired on the target object storage device, the target file read request is responded to and processed.
6. A distributed storage retrieval method, characterized in that, include: The target object storage device is selected from at least two candidate object storage devices by the client. And, send a target file read request to the target object storage device; wherein, each of the candidate object storage devices stores backup data of the target file; each of the candidate object storage devices is located on different storage nodes of the distributed storage cluster, and the at least two candidate object storage devices are divided into a master object storage device and at least one slave object storage device; wherein, selecting the target object storage device from the at least two candidate object storage devices includes: if the client's device belongs to a storage node in the distributed storage cluster, then determine whether there is a candidate object storage device among the at least two candidate object storage devices that belongs to the storage node of the client's device; if so, determine the target object storage device from the candidate object storage devices belonging to the storage node of the client's device; if not, determine the target object storage device from the at least two candidate object storage devices based on a random number obtained using a random function and the length of the sequence composed of the at least two candidate object storage devices; The system reads backup data of the target file corresponding to the target file read request from the local block storage space of the target object storage device; and returns the read backup data to the client; wherein the target object storage device is a slave object storage device among the at least two candidate object storage devices; the client is further configured to send a first read lock request to the master object storage device among the at least two candidate object storage devices; the master object storage device is configured to, in response to the first read lock request, perform a read lock operation on the backup data of the target file in the local block storage space of the master object storage device; specifically, the target object storage device is configured to, if the master object storage device successfully performs the read lock, read the backup data of the target file corresponding to the target file read request from the local block storage space of the target object storage device.
7. The method according to claim 6, characterized in that, The target object storage device is the slave object storage device among the at least two candidate object storage devices; Accordingly, reading backup data of the target file corresponding to the target file read request from the local block storage space of the target object storage device includes: The client sends a first read lock request to the primary object storage device among the at least two candidate object storage devices; In response to the first read lock request, the primary object storage device performs a read lock operation on the backup data of the target file in the local block storage space of the primary object storage device. If the primary object storage device successfully acquires a read lock, the target object storage device reads the backup data of the target file corresponding to the target file read request from the local block storage space of the target object storage device.
Citation Information
Patent Citations
Reading and writing method, device and related device for storing data
CN109254732A
A method and device for a distributed storage system to processing an operation request
CN109558079A