Data reading method and system
Through the collaborative work between the metadata server and the storage server, RDMA technology is used to reduce the number of communications and resource occupation during the data reading process in the distributed storage system, and solve the problem of limited data reading speed in the distributed storage system. problem and improve system performance.
Patent Information
- Application Number
- CN202010317466.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-21
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2040-04-21
AI Technical Summary
Distributed storage systems have limited data reading speed due to multiple communications and high transmission overhead, which affects system performance.
Receive the client's data read request through the metadata server, obtain the location information of the data to be read, and send the location information to the storage server to request the data. The storage server obtains and sends the data to be read to the client based on the location information, using RDMA Technology enables remote direct data access, reducing the number of data interactions and resource usage.
It greatly reduces the transmission overhead in the data reading process, improves the data reading speed, reduces the resource occupation and processing complexity of the client and metadata server, and is applicable to a wider range of scenarios.
Smart Images

Figure CN113535068B
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage, and in particular to a data reading method and system. Background Art
[0002] With the continuous development of science and technology, people have higher and higher requirements for the performance of network storage systems. Traditional network storage systems use centralized storage servers to store all data, making the performance of storage servers a bottleneck of system performance and unable to meet the needs of large-scale storage applications. Therefore, distributed storage systems came into being. Distributed storage systems refer to storing data in multiple independent devices, using multiple storage servers to share the storage load, and using metadata servers to locate the location information of stored data. Compared with traditional network storage systems, distributed storage systems not only improve system reliability, availability and access efficiency, but are also easy to expand.
[0003] However, since distributed storage systems use multiple storage servers to share the storage load, they need to use metadata servers to locate the location information of stored data. Therefore, each time a user uses a client to read data, multiple communications are required between the client and the metadata server, between the metadata server and the storage server, and between the storage server and the client, resulting in a large amount of communication overhead, which limits the data reading speed of the distributed system. Summary of the invention
[0004] The present application provides a data reading method and system for solving the problem of limited data reading speed in the above-mentioned distributed system.
[0005] In a first aspect, a data reading method is provided, which is applied to a storage system, wherein the storage system includes a metadata server and a storage server, and the method includes:
[0006] The metadata server receives a data read request sent by the client, wherein the data read request is used to read the data to be read in the storage server;
[0007] The metadata server obtains the location information of the data to be read according to the data reading request;
[0008] The metadata server sends the location information to the storage server to request the data;
[0009] The storage server obtains the data to be read according to the location information;
[0010] The storage server sends the data to be read to the client.
[0011] It can be understood that in the above data reading process, the number of data interactions between the client, metadata server and storage server is only 3 times, only one communication is required between the client and the metadata server, only one communication is required between the metadata server and the storage server, and only one communication is required between the storage server and the client, which greatly reduces the transmission overhead in the data reading process and improves the data reading speed.
[0012] In one embodiment, a data read request includes address information of a client memory, a storage server includes a remote direct data access network card RNIC and a storage medium, and the storage server obtains the data to be read according to the location information, including: the RNIC of the storage server obtains the data to be read from the storage medium according to the location information; the storage server sends the data to be read to the client, including: the RNIC of the storage server writes the data to be read into the client memory corresponding to the address information through a remote direct data access RDMA method according to the address information of the client memory.
[0013] It can be understood that the RNIC of the storage server can specifically write the data to be read into the client memory through the RDMA unilateral write operation. The RDMA unilateral write operation only requires the sender to clarify the source and destination addresses of the information, and the receiving end does not need to be aware of the communication. The writing of data is completed between the RNIC and the client memory (Buffer) through RDMA. The client no longer needs to allocate additional resources to process the sending and receiving processes, which greatly reduces the client's resource usage, reduces the complexity of client implementation, and reduces the client's performance requirements, thereby making the method provided in this application more applicable to a wider range of scenarios.
[0014] In one embodiment, the location information includes location information of multiple copies of the data to be read, and the metadata server sends the location information to the storage server to request data, including: the metadata server sends the location information of one of the multiple copies of the data to the storage server corresponding to the location information of one of the multiple copies of the data to request data. It can be understood that if the storage system uses a copy strategy for data storage, because the storage disk granularity needs to be aligned and the data is partitioned, after determining the location information of the data to be read, the metadata server needs to determine the valid data that can be read from the multiple copies of the data to be read, and then return the location information of the valid copy of the data to the client 110. The metadata only corresponds to one designated storage server. Among them, the valid data can be a complete copy of the data randomly selected from the multiple copies of the data. If the client A happens to be on a certain storage server, the valid data can also be the copy of the data stored in the storage server where the client A is located. This application does not make specific limitations.
[0015] It should be noted that when the metadata server sends location information to the storage server to request data, it can also request data by sending a read request for replica data to the storage server. The read request for replica data can be obtained by modifying and repackaging some parameters in the data read request sent by the client. For example, the data read request sent by the client includes the source address, data length, and data ID of the data to be read, etc. After obtaining the location information of the valid data in the replica data, the metadata server can modify the data length in the data read request from the length of the data to be read required by the customer to the length of the valid data, and then replace the data ID of the data to be read with the location information of the valid data, thereby obtaining the read request for the replica data, and then sending the read request for the replica data to the storage server. It can be understood that the data read request for replica data can also be obtained by modifying and packaging the data request sent by the client in other ways, and the present application does not limit the specific method of obtaining the data read request for replica data.
[0016] In one embodiment, the location information includes location information of multiple shard data of data to be read, and the metadata server sends the location information to the storage server to request data, including: the metadata server sends the location information of the shard data to the storage server corresponding to the location information of each shard data in the multiple shard data to obtain the shard data; the storage server obtains the data to be read according to the location information, including: the storage server obtains the shard data according to the location information of the shard data; the storage server sends the data to be read to the client, including: the storage server sends the shard data to the client, so that the client obtains the data to be read according to the received multiple shard data.
[0017] It is understandable that if the storage system uses the Erasure Coding (EC) strategy for data storage, multiple storage servers (multiple storage servers corresponding to multiple shard data) will receive the location information of the shard data, and multiple storage servers can only read multiple shard data of the data to be read, but cannot directly read the data to be read. Therefore, the metadata server can send the location information of each shard data to the corresponding storage server for it to read the shard data, and then write the read shard data into the client's memory. In the embodiment of the present application, the metadata server is only responsible for querying the location information of the data to be stored and confirming the valid data in multiple copies of the data, without the need for additional processing such as EC reverse encoding and other operations, which greatly reduces the processing pressure of the metadata server. The failure of the metadata server will not cause too much impact on the entire data reading process, and also reduces the complexity of the business logic of the metadata server, and improves the processing efficiency of the metadata server.
[0018] It should be noted that when the metadata server sends location information to the storage server to request data, it can also request data by sending a read request for sharded data to the storage server. The read request for sharded data can be obtained by modifying and repackaging some parameters in the data read request sent by the client. For example, the data read request sent by the client includes the source address, data length, and data ID of the data to be read, etc. After obtaining the location information of multiple sharded data, the metadata server can modify the data length in the data read request from the length of the data to be read required by the customer to the length of the sharded data, and then replace the data ID of the data to be read with the location information of the sharded data, thereby obtaining a read request for each sharded data, and then sending the read request for the sharded data to the corresponding storage server. It can be understood that the data read request for sharded data can also be obtained by modifying and packaging the data request sent by the client in other ways, and the present application does not limit the specific method of obtaining the data read request for sharded data.
[0019] In one embodiment, the RNIC of the storage server obtains the data to be read from the storage medium according to the location information, including: the RNIC of the storage server reads the storage data corresponding to the location information from the storage medium according to the location information; the RNIC of the storage server decompresses and decompresses the storage data to obtain the data to be read.
[0020] It is understandable that the data stored in the storage server is generally processed according to granularity alignment, such as data aligned according to 512B granularity, and in order to reduce storage costs, the storage data in the storage server generally undergoes data compression and data compaction operations, so the RNIC of the storage server can perform data decompression and decompression operations on the storage data after reading the storage data in the storage medium, thereby obtaining the data to be read. The data decompression and decompression operations performed by the RNIC of the storage server can reduce the resource usage of the client and the metadata server, improve the processing efficiency of the client and the metadata server, and reduce the performance requirements of the client and the metadata server, thereby making the applicable scenarios of the method provided in this application more extensive.
[0021] In a specific implementation, for a storage system that uses the EC strategy for data storage, the stored data is divided into multiple shards and stored in different storage servers, and the data that each user actually wants to read may only be a part of each sharded original data. For example, the length of the sharded original data A is 12K in total, and is stored in the storage system in the form of 2 4K data blocks and 1 4K check block, but the data A0 that the user only wants to read is only the first 2K content of the sharded original data A. Therefore, at step S420, the metadata server can also first confirm the location information of the sharded original data A where the user's data A0 to be read is located, and then put the corresponding relationship between the data A0 to be read and the original data A (i.e., which part of the original data the data to be read is, such as the first 2K, the middle 2K-4K, the last 4K, etc.) into the location information, and then transmit it to the storage server. At step S440, the RNIC of the storage server can write all the shard data of the original data A into the client memory, and send the corresponding relationship between the user's data to be read A0 and the original data A to the client at the same time. Taking the above example, the storage server can write 2 4K data blocks and 1 4K check block into the client's memory, and send the corresponding relationship between the data A0 that the user actually needs to read and the original data A (that is, the data to be read is the first 2k of data A) to the client. After the client receives the complete 12K data, it first calculates the original data A0 through EC reverse encoding, and then extracts the first 2K of the original data A and returns it to the user. It can be understood that the present application maps the corresponding relationship between the user's data to be read and the sharded original data, and combines the RDMA unilateral writing technology, so that the client only needs to perform EC reverse encoding on the shard data, without the need to allocate additional resources to process the sending and receiving process, so that the resource occupation of the client is greatly reduced, the complexity of the client implementation is reduced, and the client performance requirements are reduced, thereby making the method provided by the present application more widely applicable.
[0022] In a second aspect, a data reading method is provided, which is applied to a storage system, the storage system including a metadata server and a storage server, the method including:
[0023] The metadata server receives a data read request sent by a client, where the data read request is used to read the data to be read in the storage server;
[0024] The metadata server obtains the location information of the data to be read according to the data read request;
[0025] The metadata server sends the data read request and the location information to the storage server corresponding to the location information based on the location information, so that the storage server obtains the data to be read based on the data read request and the location information, and writes the data to be read into the memory of the client.
[0026] It can be understood that when using the metadata service provided by the present application, when reading data in the storage system, the number of data interactions between the client metadata server and the storage server is only 3 times, including 2 transmissions of read requests and 1 data transmission. The transmission overhead is greatly reduced and the data reading speed is greatly improved.
[0027] In one embodiment, the location information includes location information of multiple copies of the data to be read, and the metadata server sends the data read request and the location information to the storage server corresponding to the data to be read based on the location information. The location information includes: the metadata server determines a valid data among the multiple copies of the data; the metadata server sends the data read request and the location information to the storage server corresponding to the location information of the valid data.
[0028] It is understandable that if the storage system uses a copy strategy for data storage, because the storage disk granularity needs to be aligned and the data is partitioned, after determining the location information of the data to be read, the metadata server needs to determine the valid data that can be read from the multiple copies of the data to be read, and then return the location information of the valid copy data to the client 110. The metadata only corresponds to one designated storage server. Among them, the valid data can be a good copy data randomly selected from multiple copies of data. If client A happens to be on a certain storage server, then the valid data can also be the copy data stored in the storage server where client A is located, which is not specifically limited in this application.
[0029] In one embodiment, the location information includes location information of multiple shard data of the data to be read, and the metadata server sends the data read request and the location information to the storage server corresponding to the data to be read based on the location information, including: the metadata server sends the data read request and the location information to the multiple storage servers corresponding to the location information of the multiple shard data based on the location information, so that the storage server obtains the multiple shard data according to the data read request, and writes the shard data into the memory of the client, so that the client can obtain the data to be read based on the multiple shard data, wherein one location information of the shard data corresponds to one storage server.
[0030] It is understandable that if the storage system uses the Erasure Coding (EC) strategy for data storage, multiple storage servers (multiple storage servers corresponding to multiple shard data) will receive data read requests and location information. Multiple storage servers can only read multiple shard data of the data to be read, but cannot directly read the data to be read. Therefore, the metadata server can send the data read request and location information to the storage server corresponding to each shard data for it to read the shard data, and then write the read shard data into the client's memory. In the embodiment of the present application, the metadata server is only responsible for querying the location information of the data to be stored and confirming the valid data in multiple copies of the data, without the need for additional processing such as EC reverse encoding and other operations, which greatly reduces the processing pressure of the metadata server. The failure of the metadata server will not cause too much impact on the entire data reading process, and also reduces the complexity of the business logic of the metadata server, and improves the processing efficiency of the metadata server.
[0031] In the above embodiment, the metadata server is only responsible for the two steps of querying the location information according to the data reading request sent by the client, and confirming the valid data in multiple copies of data, without the need for additional processing such as EC de-encoding and other operations, which greatly reduces the processing pressure of the metadata server. Failure of the metadata server will not cause too much impact on the entire data reading process. At the same time, it also reduces the complexity of the business logic of the metadata server and improves the processing efficiency of the metadata server.
[0032] In a third aspect, a data reading method is provided, which is applied to a storage system, wherein the storage system includes a metadata server and a storage server, and the method includes:
[0033] The storage server receives a data read request and location information sent by a metadata server, wherein the data read request is a data read request sent by a client and received by the metadata server, and the location information is location information of data to be read obtained by the metadata server according to the data read request;
[0034] The storage server obtains the data to be read according to the data read request and the location information;
[0035] The storage server writes the data to be read into the memory of the client.
[0036] It can be understood that when using the storage server provided by the present application, when reading data in the storage system, the number of data interactions between the client, metadata server and storage server is only 3 times, including 2 transmissions of read requests and 1 data transmission. The transmission overhead is greatly reduced and the data reading speed is greatly improved.
[0037] In one embodiment, the data read request includes address information of the client's memory, the storage server includes a remote direct data access network card RNIC and a storage medium, and the storage server obtains the data to be read according to the data read request and the location information, including: the RNIC of the storage server obtains the data to be read from the storage medium according to the data read request and the location information; the storage server writes the data to be read into the client's memory, including: the RNIC of the storage server writes the data to be read into the client's memory corresponding to the address information through a remote direct data access RDMA unilateral writing method according to the address information of the client's memory.
[0038] It can be understood that the RDMA unilateral write operation only requires the sender to clarify the source and destination addresses of the information, and the receiving end does not need to be aware of the communication. The writing of data is completed between the RNIC and the client memory (Buffer) through RDMA. The client no longer needs to allocate additional resources to handle the sending and receiving processes, which greatly reduces the client's resource usage, reduces the complexity of client implementation, and reduces the client's performance requirements, thereby making the method provided in this application more applicable to a wider range of scenarios.
[0039] In one embodiment, the location information is location information of a valid data among a plurality of copies of the data to be read.
[0040] It is understandable that if the storage system uses a copy strategy for data storage, because the storage disk granularity needs to be aligned and the data is partitioned, after determining the location information of the data to be read, the metadata server needs to determine the valid data that can be read from the multiple copies of the data to be read, and then return the location information of the valid copy data to the client 110. The metadata only corresponds to one designated storage server. Among them, the valid data can be a good copy data randomly selected from multiple copies of data. If client A happens to be on a certain storage server, then the valid data can also be the copy data stored in the storage server where client A is located, which is not specifically limited in this application.
[0041] In one embodiment, the location information is location information of multiple shard data of the data to be read, wherein the location information of one shard data corresponds to a storage server, and the storage server obtains the data to be read according to the data read request and the location information, including: the storage server obtains the shard data according to the data read request; the storage server writes the data to be read into the memory of the client, including: the storage server writes the shard data into the memory of the client, so that the client obtains the data to be read according to the multiple shard data written by multiple storage servers.
[0042] It is understandable that if the storage system uses the Erasure Coding (EC) strategy for data storage, multiple storage servers (multiple storage servers corresponding to multiple shard data) will receive data read requests and location information. Multiple storage servers can only read multiple shard data of the data to be read, but cannot directly read the data to be read. Therefore, the metadata server can send the data read request and location information to the storage server corresponding to each shard data for it to read the shard data, and then write the read shard data into the client's memory. In the embodiment of the present application, the metadata server is only responsible for querying the location information of the data to be stored and confirming the valid data in multiple copies of the data, without the need for additional processing such as EC reverse encoding and other operations, which greatly reduces the processing pressure of the metadata server. The failure of the metadata server will not cause too much impact on the entire data reading process, and also reduces the complexity of the business logic of the metadata server, and improves the processing efficiency of the metadata server.
[0043] In one embodiment, the RNIC of the storage server obtains the data to be read from the storage medium according to the data read request and the location information, including: the RNIC of the storage server reads the storage data corresponding to the location information from the storage medium according to the data read request and the location information; the RNIC of the storage server decompresses and decompresses the storage data to obtain the data to be read.
[0044] It is understandable that the data stored in the storage server is generally processed according to granularity alignment, such as data aligned according to 512B granularity, and in order to reduce storage costs, the storage data in the storage server generally undergoes data compression and data compaction operations, so the RNIC of the storage server can perform data decompression and decompression operations on the storage data after reading the storage data in the storage medium, thereby obtaining the data to be read. The data decompression and decompression operations performed by the RNIC of the storage server can reduce the resource usage of the client and the metadata server, improve the processing efficiency of the client and the metadata server, and reduce the performance requirements of the client and the metadata server, thereby making the applicable scenarios of the method provided in this application more extensive.
[0045] In a fourth aspect, a metadata server is provided, which is applied to a storage system. The storage system includes a metadata server and a storage server. The metadata server includes:
[0046] A receiving unit, configured to receive a data reading request sent by a client, wherein the data reading request is used to read the data to be read in the storage server;
[0047] An acquiring unit, configured to acquire location information of the data to be read according to the data reading request;
[0048] A sending unit is used to send the data reading request and the location information to the storage server corresponding to the location information according to the location information, so that the storage server obtains the data to be read according to the data reading request and the location information, and writes the data to be read into the memory of the client.
[0049] In one embodiment, the location information includes location information of multiple copies of the data to be read, and the sending unit is used to determine a valid data among the multiple copies of the data; the sending unit is used to send the data read request and the location information to the storage server corresponding to the location information of the valid data.
[0050] In one embodiment, the location information includes location information of multiple shard data of the data to be read, and the sending unit is used to send the data read request and the location information to multiple storage servers corresponding to the location information of the multiple shard data according to the location information, so that the storage server obtains the multiple shard data according to the data read request, and writes the shard data into the memory of the client, so that the client can obtain the data to be read according to the multiple shard data, wherein one location information of the shard data corresponds to one storage server.
[0051] In a fifth aspect, a storage server is provided, which is applied to a storage system. The storage system includes a metadata server and a storage server. The storage server includes:
[0052] A receiving unit, configured to receive a data read request and location information sent by a metadata server, wherein the data read request is a data read request sent by a client and received by the metadata server, and the location information is location information of data to be read obtained by the metadata server according to the data read request;
[0053] An acquiring unit, configured to acquire the data to be read according to the data read request and the location information;
[0054] The writing unit is used to write the data to be read into the memory of the client.
[0055] In one embodiment, the data read request includes address information of the client memory, the storage server includes a remote direct data access network card RNIC and a storage medium, the acquisition unit is used to obtain the data to be read from the storage medium through the RNIC according to the data read request and the location information; the writing unit is used to write the data to be read into the client memory corresponding to the address information through the RNIC using a remote direct data access RDMA unilateral writing method according to the address information of the client memory.
[0056] In one embodiment, the location information is location information of a valid data among a plurality of copies of the data to be read.
[0057] In one embodiment, the location information is the location information of multiple shard data of the data to be read, wherein the location information of one shard data corresponds to one storage server, and the acquisition unit is used to acquire the shard data according to the data read request; the writing unit is used to write the shard data into the memory of the client, so that the client obtains the data to be read based on the multiple shard data written by multiple storage servers.
[0058] In one embodiment, the acquisition unit is used to read the storage data corresponding to the location information from the storage medium through the RNIC according to the data read request and the location information; the acquisition unit is used to decompress and decompress the storage data through the RNIC to obtain the data to be read.
[0059] In a sixth aspect, a data reading system is provided, comprising:
[0060] The metadata server is used to receive a data read request sent by a client, wherein the data read request is used to read the data to be read in the storage server;
[0061] The metadata server is further configured to obtain location information of the data to be read according to the data read request;
[0062] The metadata server is further configured to send the location information to the storage server to request data;
[0063] A storage server, configured to obtain the data to be read according to the location information;
[0064] The storage server is further configured to send the data to be read to the client.
[0065] In one embodiment, the data read request includes address information of the client memory, the storage server includes a remote direct data access network card RNIC and a storage medium, the RNIC of the storage server is used to obtain the data to be read from the storage medium according to the location information; the RNIC of the storage server is used to write the data to be read into the client memory corresponding to the address information through a remote direct data access RDMA method according to the address information of the client memory.
[0066] In one embodiment, the location information includes location information of multiple copies of the data to be read, and the metadata server is used to send the location information of one of the multiple copies of the data to a storage server corresponding to the location information of one of the multiple copies of the data to request data.
[0067] In one embodiment, the location information includes location information of multiple shard data of the data to be read, and the metadata server is used to send the location information of the shard data to the storage server corresponding to the location information of each shard data in the multiple shard data to obtain the shard data; the storage server is used to obtain the shard data according to the location information of the shard data; the storage server is used to send the shard data to the client, so that the client obtains the data to be read based on the received multiple shard data.
[0068] In one embodiment, the RNIC of the storage server is used to read the storage data corresponding to the location information from the storage medium according to the location information; the RNIC of the storage server is used to decompress and decompress the storage data to obtain the data to be read.
[0069] In a seventh aspect, a computer program product is provided. When the computer program product is read and executed by a computing device, the method described in the first aspect, the second aspect and the third aspect is implemented.
[0070] In an eighth aspect, a computer non-volatile storage medium is provided, comprising instructions, which, when executed on a computing device, enable the computing device to implement the methods described in the first, second and third aspects.
[0071] In a ninth aspect, an electronic device is provided, comprising a processor and a memory, wherein when the processor executes the code in the memory, the method described in the first aspect, the second aspect and the third aspect is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0073] Figure 1 It is a schematic diagram of the structure of a storage system;
[0074] Figure 2 It is a flowchart diagram of a data reading method;
[0075] Figure 3 It is a flowchart of another data reading method;
[0076] Figure 4 It is a flow chart of a data reading method provided by the present application;
[0077] Figure 5 This is a flow chart of a data reading method provided by the present application in an application scenario;
[0078] Figure 6 It is a structural diagram of a metadata server provided by this application;
[0079] Figure 7 It is a structural diagram of a storage server provided by the present application;
[0080] Figure 8 It is a structural schematic diagram of an electronic device provided by this application. DETAILED DESCRIPTION
[0081] The technical solutions in the embodiments of the present invention will be described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0082] In order to facilitate understanding of the embodiments of the present application, first, the application scenarios involved in the present application are briefly described.
[0083] The modern Internet has entered the era of big data. Tens of thousands of data are generated every day. The scale of these data is so large that traditional single-machine storage has long been stretched to its limits and cannot meet the requirements of big data multi-storage systems at all. Therefore, distributed storage systems came into being.
[0084] Distributed storage system refers to the storage of data on multiple independent devices. Traditional network storage systems use centralized storage servers to store all data, making the performance of storage servers a bottleneck of system performance and unable to meet the needs of large-scale storage applications. Therefore, distributed storage systems came into being. Distributed storage systems refer to the storage of data on multiple independent devices, using multiple storage servers to share the storage load, and using metadata servers to locate the location information of stored data. Compared with traditional network storage systems, distributed storage systems not only improve system reliability, availability and access efficiency, but are also easy to expand. The following is a brief description of the structure of the distributed storage system.
[0085] Figure 1 is a schematic diagram of the structure of a storage system 100. Figure 1 As shown, the storage system 100 may include a client 110, a metadata server 120, and a storage server 130, wherein the number of the metadata server 120, the storage server 130, and the client may be one or more. It should be understood that Figure 1 The number of the client 110, metadata server 120 and storage server 130 is only for example and does not constitute a specific limitation.
[0086] The client 110 is used to provide an interactive interface for the user. The user can input instructions through the client, and the client translates it into the user's read request and sends it to the metadata server, so that the metadata server 120 can query the metadata of the data to be read according to the user's read data request. Among them, the specific form of the client can be a web browser or an application running locally, which is not specifically limited in this application. In addition, the deployment of the client 110 is very flexible. It can be deployed on any metadata server 120, or on any storage server 130, or on an independent server or terminal. The server is neither a metadata server 120 nor a storage server 130, which is not specifically limited in this application.
[0087] The metadata server 120 is used to store metadata (Metadata). Metadata here refers to data (Data About Data) describing the storage data in the storage server 130, mainly describing the property information (Property) of the storage data, and is used to support functions such as indicating storage location, historical data, resource search, file records, etc. Specifically, the metadata of the storage data A0 may include: the access rights of the storage data A0, the file owner, and the location information of the data, etc., wherein the location information may also include the specific location on the disk where the storage data A0 is located, the specific location of the storage server corresponding to the disk, etc. In short, if a user needs to operate a file in a storage system server, then the user must first obtain the metadata of the file before locating the location of the file.
[0088] In a specific implementation, the metadata server 120 can be a physical device or a virtual device. When the metadata server is a physical device, the metadata server can have a processor, a hard disk, a memory, a network card, a system bus, and the like. When the metadata server is a virtual device, the metadata server can simulate a computing device with complete hardware system functions and running in a completely isolated environment through software. For example, the metadata server can be a virtual machine virtualized on a server. The virtual machine is an application running on a computer, which can simulate a standard PC environment based on x86. This environment is the same as a real computer, and has one or more devices including a chipset, CPU, memory, graphics card, sound card, network card, floppy drive, hard disk, optical drive, serial port, parallel port, USB controller, Small Computer System Interface (SCSI) controller, and the like.
[0089] The storage server 130 is used to store data. Specifically, the storage server may include multiple Figure 1The storage medium shown in the figure can be any carrier for storing data, such as a floppy disk, an optical disk, a hard disk, a flash memory, a magnetic disk, a memory stick, etc., which is not specifically limited in this application. In the distributed cloud storage application scenario, the storage server can also be a storage device in a storage area network (SAN) in a data center. The storage device in the SAN is an intelligent device, such as an array of independent disk copies (RAID, RAID), which can also be called an object-based storage device (OSD). Each OSD has its own storage controller / processor, cache, and network system, and can provide an OSD object interface, so that the storage server can communicate with the metadata server 120 and the client 110 through the OSD object interface to provide them with data storage and business access functions.
[0090] It should be noted that in some application scenarios, the metadata server 120 and the storage server may exist in other forms. For example, in a data storage scenario suitable for an enterprise, the storage server 130 may exist in the form of a storage array or a hard disk frame, and the metadata server may also exist in the form of a controller that controls the storage array or hard disk cabinet. The controller is also used to store the above-mentioned metadata, and this application does not make any specific limitations.
[0091] It should be understood that in order to ensure the reliability of massive data, the storage system 100 generally prevents data loss through redundant storage strategies, wherein the redundant storage strategies include copy strategies and erasure coding (EC) strategies. In simple terms, the copy strategy refers to mirroring the data to be stored to obtain multiple mirror files, and then storing the original data and the multiple mirror files in different storage servers respectively. The EC strategy refers to dividing the storage data to be stored into multiple shard data according to a certain EC coding logic. The shard data includes data blocks and check blocks. The data block is part of the data in the original storage data. When the data block is lost, the check block can be used to recalculate the lost data block. These shard data are stored in different storage servers respectively. For example, a hash value can be calculated based on a certain data feature of the shard data (such as a shard ID), and a mapping relationship can be established between the hash value and multiple storage servers 130, so that the shard data with different hash values are distributed to different storage servers. The shard data with key [1,10000] can also be placed on storage server 1, and the shard data with key [100001,20000] can be placed on storage server 2, and so on. It should be understood that the above examples are only for illustration, and this application does not limit the EC encoding logic in the specific implementation.
[0092] Therefore, the stored data in the storage system 100 is mostly shard data or replica data. In this way, each time the storage server 130 receives a data read request, it will first obtain the shard data or replica data, and then process the shard data or replica data before obtaining the data to be read. Specifically, if the storage server 130 uses a replica strategy for storage, then after receiving a data read request, the storage server 130 will first obtain multiple replica data, and then obtain valid data from the multiple replica data and return it to the client. If the distributed storage system uses an EC strategy for storage, then after receiving a data read request, the storage server 130 needs to first obtain multiple shard data, and then use the corresponding EC inverse encoding logic according to the EC encoding logic used during storage to complete the assembly of the shard data, and return the assembled data to the client.
[0093] The following will explain the two methods of reading data in the distributed storage system 100. Figure 2 In the embodiment, the data fragments are assembled by the client. Figure 3 In the embodiment, the data fragments are assembled through the metadata server.
[0094] Figure 2 The following is a flow chart of a method for reading data in a distributed storage system. Figure 2 As shown, Figure 2 The data reading method shown may include the following steps:
[0095] Step 11: The client 110 sends a data read request for data A0 to the metadata server 120, and the data read request may include the data ID or attribute information of the data A0, so that the metadata server 120 can query the metadata of the data A0 according to the data ID or attribute information, etc. It can be understood that the metadata server 120 includes at least one metadata server, so the client 110 can send the read request for data A0 to a metadata server X in the metadata servers, such as the default metadata server, or the metadata server closest to the geographical location of the client A, or a random metadata server, which is not specifically limited in this application.
[0096] Step 12: The metadata server 120 returns the metadata of the data A0 to the client 110 .
[0097] It can be understood that each metadata server in the metadata server is responsible for different storage resource metadata management due to load balancing, reliability, etc., that is, each metadata server 120 can maintain a metadata database. After metadata server X receives the read request for data A0 sent by client 110 in step S210, metadata server X will query its own metadata database. If its own metadata database contains metadata information of data A0, metadata server X can directly return the metadata information of data A0 to client 110; if its own metadata database does not contain metadata information of data A0, metadata server X needs to query which metadata server the metadata of data A0 is stored on, and forward the read request for data A0 to the metadata server for metadata query.
[0098] For example, assuming that the metadata of data A0 is stored in metadata server Y, after metadata server X receives the data read request of data A0 in step S12, it can determine the address of metadata server Y where the metadata of data A0 is located, and forward the data read request to metadata server Y. After metadata server Y obtains the metadata of data A0 through query, metadata server Y can return the metadata of data A0 to client 110. It should be understood that the above examples are for illustration only and do not constitute specific limitations.
[0099] In a specific implementation, metadata server X can determine metadata service Y that stores metadata of data A0 by taking the modulus of the data ID in the data read request and the total number of metadata servers. It is understandable that when a user needs to read a certain data A0, he needs to enter some information related to data A0 in order to query the data A0 to be read, such as the data ID of data A0. Then the metadata server can determine which metadata server the metadata of data A0 is stored in by taking the modulus between the data ID of data A0 in the data read information and the total number of metadata servers. Among them, modulus refers to the remainder obtained after dividing two numbers. For example, assuming that there are a total of 3 metadata servers, the metadata servers are numbered 0, 1, and 2 respectively, and the ID of data A0 is 90, then data A0 can be stored on the metadata server numbered 0. If the data ID of data A0 is 88, then data A0 can be stored on the metadata server numbered 1. When the metadata server receives a data read request, it can query the number of the metadata server storing the data according to the data number in the data read request. Each metadata server can store the network address corresponding to each metadata server number, so that metadata server X needs to query which metadata server the metadata of data A0 is stored, and forward the read request of data A0 to the metadata server for metadata query.
[0100] Metadata server X can also determine the metadata service Y that stores the metadata of data A0 by querying the index. The index contains multiple routing information, each of which includes a data ID (which can be a number or a string) and a corresponding storage address. When the metadata of data A0 is written to metadata server Y, metadata server Y can create a route A' in the index it maintains. The route A' records the address information corresponding to the data ID "A0" as the address information of metadata server Y, and then metadata server Y synchronizes the route A' to the index maintained by each metadata server in the cluster. In this way, when any metadata server receives a data query request containing the data ID "A0", each metadata server can obtain the address information corresponding to "data A0", that is, the address information of metadata server Y, based on the information recorded in route A' in the index. It should be noted that the above two methods for determining the metadata server Y that stores the metadata of data A0 are only used for example, and this application does not limit the specific way in which metadata server X determines the metadata server Y that stores data A0.
[0101] In a specific implementation, the metadata of data A0 may include the location information of data A0. The location information may specifically include the storage server address, partition information, the starting position on the disk, and the data length, etc. For details, please refer to the aforementioned content and will not be elaborated here.
[0102] It should be noted that if the storage system uses a copy strategy for data storage, because the storage disk granularity needs to be aligned and the data is partitioned, after determining the metadata of data A0, the metadata server needs to determine one valid data that can be read from multiple copies of data, and then return the metadata of the valid copy of data to the client 110. At this time, the location information only corresponds to one designated storage server. Among them, the valid data can be a good copy of data randomly selected from multiple copies of data. If client A happens to be on a certain storage server, then the valid data can also be the copy of data stored on the storage server where client A is located, and this application does not make specific limitations.
[0103] It should be noted that if the storage system uses the EC strategy for data storage, since the data is divided into multiple shards and stored in different storage servers, the metadata of data A0 will include the location information of the multiple shards, which correspond to different designated storage servers.
[0104] Step 13: The client 110 accesses the designated storage server according to the metadata of the data A0.
[0105] Referring to step 12, it can be seen that when the storage system uses a copy strategy for storage, the metadata of data A0 only includes the location information of a valid copy of the data. Therefore, at step 13, the client 110 only needs to access one storage server corresponding to the metadata; when the distributed storage system uses an EC strategy for storage, the metadata of data A0 includes the location information of multiple redundant data. Therefore, the client 110 can access multiple designated storage servers corresponding to the location information one by one according to the location information, and obtain multiple shard data of data A0 from the designated storage servers.
[0106] Step 14: The designated storage server returns data A0 or multiple fragments of data A0 to the client 110 .
[0107] It is understandable that if the distributed storage system uses the copy strategy for storage, then step 14 returns valid data in the copy data, that is, complete data A0, and data reading is completed. However, if the distributed storage system uses the EC strategy for storage, then step 14 returns multiple shard data, and step 15 needs to be continued.
[0108] Step 15: The client 110 assembles multiple fragmented data to obtain data A0 that needs to be read.
[0109] In a specific implementation, if the distributed storage system uses the EC strategy to divide the data into multiple shards for storage, the client 110 can use the corresponding EC reverse coding logic to assemble the shard data, thereby obtaining the data A0 to be read. The EC reverse coding logic used by the client can be obtained from the metadata server 120 after the storage system 110 is built, that is, after the system is built, the storage system 110 will notify the client connected to the system of the EC coding storage logic and EC reverse coding logic used by the storage system 110.
[0110] It can be understood that in the above data reading process, there are a total of 4 data interactions between the client 110, the metadata server 120 and the storage server 130, including 3 transmissions of read requests and 1 data transmission. The number of network interactions is relatively large, and excessive transmission overhead leads to a bottleneck in the data reading speed.
[0111] Figure 3 This is a flow chart of another distributed storage system data reading method. Figure 3 As shown, Figure 3 The data reading method shown may include the following steps:
[0112] Step 21: The client 110 sends a read request for data A0 to the metadata server 120. For details, please refer to step 11, which will not be described in detail here.
[0113] Step 22: The metadata server 120 obtains the metadata of data A0 according to the read request of data A0. Referring to step 12, it can be seen that different metadata servers are responsible for different storage resource metadata management. Therefore, after receiving the read request of data A0, metadata server X will obtain the address of metadata server Y where the metadata of the data to be read is located by taking the modulus of the data ID in the data read request or querying the locally maintained index, and then send the read request of data A0 to the metadata server Y so that it can query and obtain the metadata of data A0.
[0114] Step 23: The metadata server 120 accesses the designated storage server according to the metadata information.
[0115] In the specific implementation, after obtaining the metadata of data A0, the metadata server Y responsible for managing data A0 directly sends a data read request to one or more designated storage servers corresponding to the location information based on the location information in the metadata of data A0. The specific description of the location information can be referred to step 12 in the aforementioned content, which will not be elaborated here.
[0116] It should be noted that if the distributed storage system uses a copy strategy for data storage, then after determining the metadata of data A0, metadata server Y needs to determine the valid data that can be read from multiple copies of data, and then access the corresponding storage server based on the location information of the valid data. If the distributed storage system uses the EC strategy for data storage, since the data is divided into multiple shards through EC encoding operations and stored in different storage servers, the metadata of data A0 will include the location information of multiple shards, which correspond to different designated storage servers respectively, and metadata server Y will access the designated storage server corresponding to each shard respectively.
[0117] Step 24: The metadata server 120 receives data A0 or multiple fragments of data A0 returned by the designated storage server.
[0118] In a specific implementation, multiple designated storage servers can complete the data reading operation according to the read request, and return the data to the metadata service Y that initiated the read request, so that the metadata server Y can receive data A0 or multiple shards of data A0. Among them, when the distributed storage system is stored according to the copy strategy, the metadata server Y will receive the data A0, and the metadata server Y can directly execute step 26; when the distributed storage system is stored according to the EC strategy, the metadata server Y will receive multiple shards of data A0, so it is also necessary to execute step 25 to assemble the shard data before executing step S26.
[0119] Step 25: The metadata server 120 assembles the fragmented data of data A0 to obtain data A0. For details, please refer to step S15 in the above content, that is, assembling the received multiple fragmented data through EC reverse encoding operation to obtain complete data A0, which will not be elaborated here.
[0120] Step 26 : The metadata server 120 sends data A0 to the client 120 .
[0121] It is understandable that there are many disadvantages in the above data reading process. First, there are a total of 4 data interactions between the client 110, the metadata server 120 and the storage server 130, including 2 transmissions of read requests and 2 data transmissions. The number of network interactions is relatively large, and excessive transmission overhead leads to a bottleneck in the data reading speed. Secondly, the metadata server also needs to process the data according to the storage strategy (EC or copy) of the distributed storage system. In the case of the copy strategy, the metadata server needs to obtain valid data from multiple copies of data. In the case of the EC strategy, the metadata server also needs to complete the assembly of data shards, which increases the complexity of the business logic of the metadata server 110 and results in low processing efficiency of the metadata server 110. Thirdly, since most of the data processing process is performed by the metadata server, if the metadata server fails during the data reading process, many steps of the process cannot be performed, and it is necessary to wait for the metadata server to recover before continuing to complete the data reading operation, which increases the client's data reading delay, reduces the user experience, and causes poor stability of the entire data reading process.
[0122] In summary, since the distributed storage system uses multiple storage servers to share the storage load, it needs to use the metadata server to locate the location information of the stored data. In order to improve the reliability of the data, the replication strategy and EC strategy are used for data storage. Each storage data corresponds to multiple replica data and / or shard data, which results in the user using the client to read the data. Figure 2 The data reading method of the embodiment assembles the fragmented data at the client, or Figure 3 The data reading method of the embodiment assembles sharded data on the metadata server, which requires multiple communications between the metadata server and the storage server, generating a large amount of communication overhead. It also brings huge processing pressure to the client or metadata server, limiting the data reading speed of the distributed system and causing a large delay in the client reading data.
[0123] In order to solve the problem that the data reading speed of the above distributed storage system is limited, the present application provides a data storage method. The method is applied to Figure 1 In the storage system shown, the storage system includes at least one client, at least one metadata server and at least one storage server. Figure 4 As shown, the method comprises the following steps:
[0124] S410: The metadata server receives a data reading request sent by a client.
[0125] In a specific implementation, the client may send a data read request to one of the at least one metadata servers. The data read request may include keyword information such as a data ID of the data to be read that may be used by the metadata server to query metadata information, so that the metadata server X may obtain the address of the metadata server Y where the metadata of the data to be read is located by taking a modulus of the data ID in the data read request or by querying a locally maintained index, and forward the data read request to the metadata server Y. This process may refer to steps 11-12 and steps 21-22 in the aforementioned content, and will not be described in detail here.
[0126] In one embodiment, the data read request includes the address information of the client memory, and the address information may include the address, length, and other information of the client memory. In simple terms, before the client sends a read request to the metadata server, it may also apply for a cache space (buffer) in the client memory for writing the data to be read, and then encapsulate the address, length, and other information of the cache space into the data read request. It should be understood that the address information will be sent to the metadata server and the storage server in sequence along with the data read request. In this way, when the metadata server sends the data read request to the storage server, the storage server can directly write the data to be read into the client memory according to the address information of the client memory contained in the data read request.
[0127] S420: The metadata server 120 obtains the location information of the data to be read according to the data read request.
[0128] Among them, the location information can be the metadata in the aforementioned content, and the metadata server 120 can maintain a location information database (i.e., metadata database). If the storage system 100 uses a copy strategy for data storage, then the location information may include the location information of multiple copies of the data to be read. If the storage system 100 uses an EC strategy for data storage, then the location information may include the location information of multiple shards of the data to be read.
[0129] S430: The metadata server sends location information to the storage server to request data.
[0130] In one embodiment, if the storage system 100 uses a copy strategy for data storage, the metadata server can select a valid data from multiple copies of data, and then send a data read request and location information to the storage server corresponding to the location information of the valid data, that is, the location information includes the location information of multiple copies of data to be read, and the metadata server sends the location information to the storage server to request data, including: the metadata server sends the location information of one of the multiple copies of data to the storage server corresponding to the location information of one of the multiple copies of data to request data. The selection process of valid data can refer to step 12 of the aforementioned content, which will not be elaborated here.
[0131] It should be noted that when the metadata server sends location information to the storage server to request data, it can also request data by sending a read request for replica data to the storage server. The read request for replica data can be obtained by modifying and repackaging some parameters in the data read request sent by the client. For example, the data read request sent by the client includes the source address, data length, and data ID of the data to be read, etc. After obtaining the location information of the valid data in the replica data, the metadata server can modify the data length in the data read request from the length of the data to be read required by the customer to the length of the valid data, and then replace the data ID of the data to be read with the location information of the valid data, thereby obtaining the read request for the replica data, and then sending the read request for the replica data to the storage server. It can be understood that the data read request for replica data can also be obtained by modifying and packaging the data request sent by the client in other ways, and the present application does not limit the specific method of obtaining the data read request for replica data.
[0132] In one embodiment, if the storage system 100 uses the EC policy for data storage, the metadata server can send data read requests and location information to the storage servers corresponding to the multiple shard data one by one. That is, the location information includes the location information of the multiple shard data of the data to be read, and the metadata server sends the location information to the storage server to request data, including: the metadata server sends the location information of the shard data to the storage server corresponding to the location information of each shard data in the multiple shard data to obtain the shard data.
[0133] It should be noted that when the metadata server sends location information to the storage server to request data, it can also request data by sending a read request for sharded data to the storage server. The read request for sharded data can be obtained by modifying and repackaging some parameters in the data read request sent by the client. For example, the data read request sent by the client includes the source address, data length, and data ID of the data to be read, etc. After obtaining the location information of multiple sharded data, the metadata server can modify the data length in the data read request from the length of the data to be read required by the customer to the length of the sharded data, and then replace the data ID of the data to be read with the location information of the sharded data, thereby obtaining a read request for each sharded data, and then sending the read request for the sharded data to the corresponding storage server. It can be understood that the data read request for sharded data can also be obtained by modifying and packaging the data request sent by the client in other ways, and the present application does not limit the specific method of obtaining the data read request for sharded data.
[0134] It can be understood that in the embodiment of the present application, the metadata server is only responsible for querying the location information of the data to be stored and confirming the valid data in multiple copies of data. Figure 3 The data reading method described in the embodiment greatly reduces the processing pressure of the metadata server, and a failure of the metadata server will not cause much impact on the entire data reading process. It also reduces the complexity of the business logic of the metadata server and improves the processing efficiency of the metadata server.
[0135] S440: The storage server obtains the data to be read according to the location information.
[0136] In a specific implementation, if the storage system 100 uses a replica strategy for data storage, only one storage server (i.e., the storage server for valid data) will receive a read request for the replica data, which includes the location information of a valid data among multiple replica data. Therefore, after the storage server receives the read request for the above replica data, the storage server can directly read the valid data based on the location information of the valid data, and then write it into the client's memory.
[0137] However, if the storage system 100 uses the EC strategy for data storage, multiple storage servers (multiple storage servers corresponding to multiple shard data) will receive a read request for shard data, and the request contains the location information of a shard data. Each storage server that receives the read request for shard data can only read its own shard data, and cannot directly read the complete data to be read. Therefore, at step S450, after each storage server writes the read shard data to the client, the client can perform EC reverse encoding on the multiple shard data to obtain the data to be read. In other words, the storage server obtains the data to be read according to the location information, including: the storage server obtains the shard data according to the location information of the shard data; the storage server sends the data to be read to the client, including: the storage server sends the shard data to the client, so that the client obtains the data to be read according to the received multiple shard data.
[0138] In one embodiment, if Figure 4 As shown, the storage server includes a remote direct data access network card RNIC and a storage medium, and the storage server obtains the data to be read according to the location information, including: the RNIC of the storage server obtains the data to be read from the storage medium according to the location information. The definition of storage medium can refer to Figure 1 The content in the embodiment may specifically be a hard disk, a storage chip, a smart disk, etc., which will not be described in detail here; RNIC (RDMA enabled NIC) is a network card (NIC) with remote direct memory access (RDMA) function. RNIC can quickly move the data to be read from the storage server to the memory of the remote client through the network through RDMA unilateral write operation without causing any impact on the client's operating system. It can be understood that the storage server directly writes the data to be read to the client through the RDMA unilateral write operation, which greatly reduces the client's resource usage, thereby improving the client's processing efficiency.
[0139] S450: The storage server sends the data to be read to the client.
[0140] In one embodiment, the storage server sends the data to be read to the client, including: the RNIC of the storage server writes the data to be read into the client memory corresponding to the address information of the client memory through the remote direct data access RDMA method according to the address information of the client memory. Specifically, the RNIC can write the data to be read into the client memory corresponding to the address information through the RDMA unilateral write method. It should be understood that the RDMA unilateral write operation only requires the sender to clarify the source and destination addresses of the information, and the receiving end does not need to perceive the communication. The writing of data is completed between the RNIC and the client memory (Buffer) through RDMA. Figure 2 In the embodiment, the processing pressure of the client is greatly reduced, and the speed of data reading is improved. In a specific implementation, the network card of the client is also an RNIC, so that the client can be compatible with the RDMA operation of the storage server.
[0141] In one embodiment, the data stored in the storage medium of the storage server is generally data processed according to granularity alignment, such as data aligned according to a 512B granularity, and in order to reduce storage costs, the data stored in the storage medium is generally subjected to data compression (Data Compression) and data compaction (Data Compaction) operations. Therefore, after reading the storage data in the storage medium, the RNIC of the storage server can perform data decompression and decompression operations on the storage data to obtain the data to be read. That is, the RNIC of the storage server obtains the data to be read from the storage medium according to the location information, including: the RNIC of the storage server reads the storage data corresponding to the location information from the storage medium according to the location information; the RNIC of the storage server decompresses and decompresses the storage data to obtain the data to be read. It can be understood that this step is performed by the RNIC of the storage server, which can reduce the resource usage of the client, compared with Figure 2 Embodiment, the client processing efficiency is improved, the client performance requirements are reduced, and thus the applicable scenarios of the method provided by the present application are more extensive. Figure 3 In the embodiment, the processing efficiency of the metadata server is improved and the performance requirements of the client are reduced, thereby making the method provided in the present application applicable to a wider range of scenarios.
[0142] In a specific implementation, for a storage system that uses the EC strategy for storage, the stored data is divided into multiple shards and stored in different storage servers, and the data that each user actually wants to read may only be a part of each sharded original data. For example, the length of the sharded original data A is 12K in total, and is stored in the storage system in the form of 2 4K data blocks and 1 4K check block, but the data A0 that the user only wants to read is only the first 2K content of the sharded original data A. Therefore, at step S420, the metadata server can also first confirm the location information of the sharded original data A where the user's data A0 to be read is located, and then put the corresponding relationship between the data A0 to be read and the original data A (i.e., which part of the original data the data to be read is, such as the first 2K, the middle 2K-4K, the last 4K, etc.) into the location information, and then encapsulate it into a read request for the sharded data, and transmit the read request for the sharded data to the storage server. At step S440, the RNIC of the storage server can write all the shard data of the original data A into the client memory, and send the corresponding relationship between the user's data to be read A0 and the original data A to the client at the same time. Taking the above example, the storage server can write 2 4K data blocks and 1 4K check block into the client's memory, and send the corresponding relationship between the data A0 that the user actually needs to read and the original data A (that is, the data to be read is the first 2k of data A) to the client. After the client receives the complete 12K data, it first calculates the original data A0 through EC reverse encoding, and then extracts the first 2K of the original data A and returns it to the user. It can be understood that the present application maps the corresponding relationship between the user's data to be read and the sharded original data, and combines the RDMA unilateral writing technology, so that the client only needs to perform EC reverse encoding on the shard data, without the need to allocate additional resources to process the sending and receiving process, so that the resource occupation of the client is greatly reduced, the complexity of the client implementation is reduced, and the client performance requirements are reduced, thereby making the method provided by the present application more widely applicable.
[0143] In summary, the above content Figure 2 The data reading method described in the embodiment requires 4 interactions, including 3 transmissions of read requests and 1 transmission of data. Figure 3 The data reading method described in the embodiment requires 4 interactions, including 2 transmissions of read requests and 2 data transmissions. In the entire process of the data reading method provided by the present application, Figure 4 As shown, the number of data interactions between the client 110, the metadata server 120 and the storage server 130 is only 3 times, including 2 transmissions of read requests and 1 transmission of data. Figure 2 and Figure 3The data reading method described in the embodiment greatly reduces transmission overhead and greatly improves data reading speed.
[0144] The following uses the EC2+1 redundancy mode as an example to illustrate the data reading method provided by the present application. EC2+1 means that the data in the storage system will be divided into 3 shards for storage through EC encoding, and the 3 shards include 2 data blocks and 1 check block. Figure 5 As shown, the data reading method provided by the present application may include the following steps:
[0145] Step 1: The client applies for a cache space in the memory space and sends a data read request for data A0 to the metadata server X, wherein the data read request includes the address information of the memory space. For details, please refer to the aforementioned step S410 and its optional steps, which will not be elaborated here.
[0146] Step 2: Metadata server X obtains the address of metadata server Y where the metadata of the data to be read is located by taking a modulus of the data ID in the data read request or by querying a locally maintained index, and forwards the data read request to metadata server Y, which receives the data read request. Metadata server X may be a metadata server randomly selected by the client, or may be the metadata server closest to the client, or may be the default metadata server of the storage system, which is not specifically limited in this application, and may refer to step S410, step 12, step 22 and optional steps in the aforementioned content for details, which will not be elaborated here.
[0147] Step 3. Metadata server Y confirms that data A0 is the first 2K data of storage data A, and then confirms the location information of multiple shard data of storage data A, and sends a read request for the shard data to the storage server corresponding to each shard data. Among them, the stored data A includes 3 shard data, shard data 1 (data block 1) is stored in storage server 1, shard data 2 (data block 2) is stored in storage server 4, and shard data 3 (check block 1) is stored in storage server 5. Therefore, metadata server Y can send a read request for shard data 1 to storage server 1, and the request includes the location information and data length of shard data 1, the correspondence between A0 that the user needs to read and the stored data A (data A0 is the first 2K data of data A), the write address of client A and other information; send a read request for shard data 2 to storage server 2, and the request includes the location information and data length of shard data 2, the correspondence between A0 that the user needs to read and the stored data A (data A0 is the first 2K data of data A), the write address of client A and other information; send a read request for shard data 3 to storage server 3, and the request includes the location information and data length of shard data 3, the correspondence between A0 that the user needs to read and the stored data A (data A0 is the first 2K data of data A), the write address of client A and other information. For details, please refer to step S420, step S430 and optional steps in the aforementioned content, which will not be elaborated here.
[0148] Step 4, the RNIC of the storage server reads the slice data from the storage medium managed by the server according to the received slice data read request. For example, the storage server 1 can read the data according to the location information of the slice data 1, and then decompress and decompress the storage data corresponding to the location information, so as to obtain the slice data 1. Similarly, the RNIC of the storage server 4 can obtain the slice data 2, and the RNIC of the storage server 5 can obtain the slice data 3. Of course, if the storage server disk has not been previously subjected to granular alignment and compression, the storage server can directly read and obtain the slice data according to the location information. For details, please refer to the aforementioned step S440 and its optional steps, which will not be elaborated here.
[0149] Step 5: The RNIC of the storage server writes the shard data into the client memory corresponding to the address information of the client memory space in the received read request of the shard data through an RDMA unilateral write operation. The RNIC of storage server 1 writes shard data 1 into the client memory, the RNIC of storage server 2 writes shard data 2 into the client memory, and the RNIC of storage server 3 writes shard data 3 into the client memory. For details, please refer to step S450 and its optional steps in the aforementioned content, which will not be elaborated here.
[0150] Step 6: The client assembles the fragment data 1, fragment data 2 and fragment data 3 into the storage data A through the EC reverse encoding operation, and determines the data A0 to be read according to the correspondence between the data A0 to be read and the storage data A. For details, please refer to the steps S450, 15, 25 and the optional steps in the above content, which will not be elaborated here.
[0151] Step 7: The client returns the data A0 to be read to the user.
[0152] In summary, the above content Figure 2 The data reading method described in the embodiment requires 4 interactions, including 3 transmissions of read requests and 1 transmission of data. Figure 3 The data reading method described in the embodiment requires 4 interactions, including 2 transmissions of read requests and 2 data transmissions. In the entire process of the data reading method provided by the present application, Figure 4 As shown, the number of data interactions between the client 110, the metadata server 120 and the storage server 130 is only 3 times, including 2 transmissions of read requests and 1 transmission of data. Figure 2 and Figure 3 The data reading method described in the embodiment greatly reduces transmission overhead and greatly improves data reading speed.
[0153] The method of the embodiment of the present application is described in detail above. In order to facilitate better implementation of the above scheme of the embodiment of the present application, correspondingly, related equipment for cooperating in implementing the above scheme is also provided below.
[0154] Figure 6 600 is a schematic diagram of the structure of a metadata server 600 provided in the present application. The metadata server 600 may be the metadata server 120 in the aforementioned content, such as Figure 6 As shown, the metadata server 600 includes a receiving unit 610 , an acquiring unit 620 , a sending unit 630 and a location information database 640 .
[0155] A receiving unit 610 is configured to receive a data read request sent by a client, wherein the data read request is used to read the data to be read in the storage server;
[0156] The acquisition unit 620 is used to obtain the location information of the data to be read according to the data read request. Specifically, the location information of the data to be read can be obtained from the location information database 640 maintained by the metadata server 600.
[0157] The sending unit 630 is used to send the data reading request and the location information to the storage server corresponding to the location information according to the location information, so that the storage server obtains the data to be read according to the data reading request and the location information, and writes the data to be read into the memory of the client.
[0158] In one embodiment, the location information includes location information of multiple copies of the data to be read, and the sending unit 630 is used to determine a valid data among the multiple copies of the data; the sending unit 630 is used to send the data reading request and the location information to the storage server corresponding to the location information of the valid data.
[0159] In one embodiment, the location information includes location information of multiple shard data of the data to be read, and the sending unit 630 is used to send the data read request and the location information to multiple storage servers corresponding to the location information of the multiple shard data according to the location information, so that the storage server obtains the multiple shard data according to the data read request, and writes the shard data into the memory of the client, so that the client can obtain the data to be read according to the multiple shard data, wherein the location information of one shard data corresponds to one storage server.
[0160] It can be understood that when using the metadata service 600 provided by the present application, when data is read in the storage system 100, the number of data interactions between the client 110, the metadata server 120 and the storage server 130 is only 3 times, including 2 transmissions of read requests and 1 transmission of data. Figure 2 and Figure 3 In this embodiment, the transmission overhead is greatly reduced and the data reading speed is greatly improved. In addition, since the metadata server 600 is only responsible for querying the location information according to the data reading request sent by the client and confirming the valid data in multiple copies of data, compared with Figure 3 The data reading method described in the embodiment greatly reduces the processing pressure of the metadata server, and a failure of the metadata server will not cause much impact on the entire data reading process. It also reduces the complexity of the business logic of the metadata server and improves the processing efficiency of the metadata server.
[0161] Figure 7 700 is a schematic diagram of the structure of a storage server 700 provided in the present application. The storage server 700 may be the storage server 130 in the aforementioned content, such as Figure 7As shown, the storage server 700 includes an RNIC 710 and a storage medium 720 , wherein the RNIC 710 includes a receiving unit 711 , an acquiring unit 712 , and a writing unit 713 .
[0162] The receiving unit 711 is used to receive a data read request and location information sent by a metadata server, wherein the data read request is a data read request sent by a client and received by the metadata server, and the location information is location information of data to be read obtained by the metadata server according to the data read request;
[0163] An acquiring unit 712, configured to acquire the to-be-read data from the storage medium 720 according to the data read request and the location information;
[0164] The writing unit 713 is used to write the data to be read into the memory of the client.
[0165] In one embodiment, the data read request includes address information of the client memory, the storage server includes a remote direct data access network card RNIC710 and a storage medium 720, and the acquisition unit 712 is used to obtain the data to be read from the storage medium 720 through the RNIC according to the data read request and the location information; the writing unit 713 is used to write the data to be read into the client memory corresponding to the address information through the RNIC using a remote direct data access RDMA unilateral writing method according to the address information of the client memory.
[0166] In one embodiment, the location information is location information of a valid data among a plurality of copies of the data to be read.
[0167] In one embodiment, the location information is the location information of multiple shard data of the data to be read, wherein the location information of one shard data corresponds to one storage server, and the acquisition unit 712 is used to acquire the shard data according to the data read request; the writing unit 713 is used to write the shard data into the memory of the client, so that the client obtains the data to be read based on the multiple shard data written by multiple storage servers.
[0168] In one embodiment, the acquisition unit 712 is used to read the storage data corresponding to the location information from the storage medium through the RNIC according to the data read request and the location information; the acquisition unit 713 is used to decompress and decompress the storage data through the RNIC to obtain the data to be read.
[0169] It can be understood that when using the storage server 700 provided by the present application, when data is read in the storage system, the number of data interactions between the client, the metadata server and the storage server is only 3 times, including 2 transmissions of read requests and 1 transmission of data. Figure 2 and Figure 3 In the embodiment, the transmission overhead is greatly reduced and the data reading speed is greatly improved. In addition, the RNIC of the storage server is combined with the RDMA unilateral writing technology, so that the client only needs to perform EC reverse encoding on the shard data without additionally allocating resources to process the sending and receiving process, which greatly reduces the resource usage of the client and reduces the complexity of the client implementation, thereby making the method provided by the present application more widely applicable.
[0170] Figure 8 Schematic diagram of the structure of an electronic device 800 provided in an embodiment of the present application. The electronic device 800 may be the metadata server 600 or the storage server 700 in the above content. Figure 8 As shown, the electronic device 800 includes: a processor 810, a communication interface 820 and a memory 830. The processor 810, the communication interface 820 and the memory 830 can be interconnected through an internal bus 840, and can also communicate through other means such as wireless transmission. The embodiment of the present application takes the connection through the bus 840 as an example. The bus 840 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 840 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0171] The processor 810 may be composed of at least one general-purpose processor, such as a central processing unit (CPU), or a combination of a CPU and a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. The processor 810 executes various types of digital storage instructions, such as software or firmware programs stored in the memory 830, which enables the electronic device 800 to provide a wide variety of services.
[0172] In the case where the electronic device 800 is the metadata server 600 in the aforementioned content, the memory 830 is used to store program codes and is controlled and executed by the processor 810 to execute the above Figure 4 or Figure 5 The processing steps of the metadata server in any embodiment.
[0173] The program code may include one or more software modules. The one or more software modules may be Figure 6 The software modules provided in the illustrated embodiment (in this embodiment, each software module, such as the receiving unit, the acquiring unit and the sending unit, is a software module). For example, the receiving unit can be used to receive a data read request sent by a client; the acquiring unit can be used to obtain the location information of the data to be read according to the data read request; the sending unit can be used to send a data read request and the location information to a storage server corresponding to the location information according to the location information, so that the storage server obtains the data to be read according to the data read request and the location information, and writes the data to be read into the client's memory. Specifically, it can be used to execute steps S410-step S440, steps 1-step 3 and their optional steps of the aforementioned method, and can also be used to execute Figure 4 or Figure 5 The other steps described in the embodiment will not be described in detail here.
[0174] It should be noted that this embodiment can be implemented by a general physical server, for example, a physical server such as an X86 server, etc., or a virtual machine (VM) based on a general physical server combined with network function virtualization (NFV) technology, wherein the virtual machine refers to a complete computer system with complete hardware system functions simulated by software and running in a completely isolated environment. This application does not make specific limitations.
[0175] In the case where the electronic device 800 is the storage server 700 in the aforementioned content, the memory 830 is used to store program codes and is controlled and executed by the processor 810 to execute the aforementioned Figure 4 or Figure 6 The processing steps of the storage server in any embodiment.
[0176] The program code may include one or more software modules. The one or more software modules may be Figure 6 The software modules provided in the illustrated embodiment (in this embodiment, each software module, such as the receiving unit, the acquiring unit, and the writing unit, is a software module). For example, the receiving unit can be used to receive a data read request and location information sent by a metadata server, the acquiring unit can be used to acquire the data to be read according to the data read request and the location information, and the writing unit can be used to write the data to be read into the memory of the client. Specifically, it can be used to execute S430-step S450, step 3-step 6 and its optional steps of the aforementioned method, and can also be used to execute Figure 2-Figure 5 The other steps described in the embodiment will not be described in detail here.
[0177] It should be noted that this embodiment can be implemented by a general physical server, for example, a physical server such as an X86 server, etc., or a virtual machine (VM) based on a general physical server combined with network function virtualization (NFV) technology, wherein the virtual machine refers to a complete computer system with complete hardware system functions simulated by software and running in a completely isolated environment. This application does not make specific limitations.
[0178] The memory 830 may include a volatile memory, such as a random access memory (RAM); the memory 830 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); the memory 830 may also include a combination of the above types. The memory 830 may store program codes, specifically including a program code for executing Figure 4 or Figure 5 The program codes of other steps described in the embodiment will not be described in detail here.
[0179] The communication interface 820 can be a wired interface (such as an Ethernet interface), an internal interface (such as a high-speed serial computer expansion bus (Peripheral Component Interconnect express, PCIe) bus interface), a wired interface (such as an Ethernet interface) or a wireless interface (such as a cellular network interface or a wireless local area network interface) for communicating with other devices or modules.
[0180] Need to explain, Figure 8 This is only a possible implementation of the embodiment of the present application. In practical applications, the electronic device may also include more or fewer components, which is not limited here. Figure 4 or Figure 5 The relevant explanations in the embodiments are not repeated here.
[0181] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a processor, Figure 4 or Figure 5 The method flow shown is realized.
[0182] The present application also provides a computer program product. When the computer program product is run on a processor, Figure 4 or Figure 5 The method flow shown is realized.
[0183] The above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented by software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes at least one computer instruction. When the computer program instruction is loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (Digital Subscriber Line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center containing at least one available medium set. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a high-density digital video disc (DVD), or a semiconductor medium. The semiconductor medium may be an SSD.
[0184] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A data reading method, characterized in that: Applied to a storage system, the storage system includes a metadata server and a storage server, the storage server includes a remote direct data access network card RNIC and a storage medium, the method includes: The metadata server receives a data read request sent by a client, wherein the data read request is used to read the to-be-read data in the storage server, and the data read request includes address information of the client memory; The metadata server obtains the location information of the data to be read according to the data reading request, wherein the location information also includes the corresponding relationship between the data to be read and the fragmented original data where the data to be read is located; The metadata server sends the location information and the address information of the client memory to the storage server to request data; The RNIC of the storage server reads the original data corresponding to the location information from the storage medium according to the location information, and performs decompression and decompression operations on the original data to obtain the data after the decompression and decompression operations; The RNIC of the storage server writes the decompressed and decompressed data and the corresponding relationship into the client memory corresponding to the address information of the client memory through the remote direct data access RDMA method, so that the client can determine the data to be read based on the decompressed and decompressed data and the corresponding relationship.
2. The method according to claim 1, characterized in that The location information includes location information of multiple copies of the data to be read, and the metadata server sends the location information to the storage server to request data, including: The metadata server sends the location information of one of the plurality of replica data to a storage server corresponding to the location information of one of the plurality of replica data to request data.
3. The method according to claim 1, characterized in that The location information includes location information of multiple shard data of the data to be read, and the metadata server sends the location information to the storage server to request data, including: The metadata server sends the location information of each shard data in the plurality of shard data to a storage server corresponding to the location information of the shard data to obtain the shard data; The storage server acquiring the data to be read according to the location information includes: The storage server obtains the shard data according to the location information of the shard data; The storage server sending the to-be-read data to the client comprises: The storage server sends the shard data to the client, so that the client obtains the data to be read according to the received multiple shard data.
4. A data reading system, characterized in that: include: The metadata server is used to receive a data read request sent by a client, wherein the data read request is used to read the to-be-read data in the storage server, and the data read request includes address information of the client memory; The metadata server is further configured to obtain location information of the data to be read according to the data read request, wherein the location information also includes a correspondence between the data to be read and the sharded original data where the data to be read is located; The metadata server is further used to send the location information and the address information of the client memory to the storage server to request data; A storage server, comprising a remote direct data access network card RNIC and a storage medium, wherein the storage server is used to read the original data corresponding to the location information from the storage medium according to the location information of the RNIC of the storage server, decompress and decompress the original data, and obtain the data after the decompression and decompression operation; The RNIC of the storage server writes the decompressed and decompressed data and the corresponding relationship into the client memory corresponding to the address information through the remote direct data access RDMA method according to the address information of the client memory, so that the client can determine the data to be read based on the decompressed and decompressed data and the corresponding relationship.
5. The system according to claim 4, characterized in that The location information includes location information of multiple copies of the data to be read, and the metadata server is used to send the location information of one of the multiple copies of the data to a storage server corresponding to the location information of one of the multiple copies of the data to request data.
6. The system according to claim 4, characterized in that The location information includes location information of multiple fragments of the data to be read. The metadata server is used to send the location information of each shard data in the multiple shard data to the storage server corresponding to the location information of the shard data, so as to obtain the shard data; The storage server is used to obtain the shard data according to the location information of the shard data; The storage server is used to send the shard data to the client, so that the client obtains the data to be read according to the received multiple shard data.
