Distributed system object storage repeated read acceleration method and device, equipment and medium
Through file segmentation and local caching mechanisms, it solves the network IO delay and cache consistency problems of remote object storage in repeated reading scenarios in distributed systems, achieving efficient file access acceleration and bandwidth saving.
Patent Information
- Application Number
- CN202411280638.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2024-10-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In distributed systems, remote object storage has network IO latency and cache consistency problems in repeated reading scenarios. Existing technologies cannot effectively solve these problems.
Through file segmentation, file slices are stored in remote object storage, and partial slices are cached locally. The local cache and file metadata index are dynamically maintained, and slices in the local cache are read first to speed up file access.
Significantly improves file access speed in repeated reading scenarios, saves network bandwidth, improves writing speed through concurrent writing and slice merging, and maintains cache consistency.
Smart Images

Figure CN118779296A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of file access acceleration in remote object storage in a distributed system, and in particular to a method, device, equipment and medium for accelerating repeated reads of object storage in a distributed system. Background Art
[0002] Remote object storage is a method of solving and processing discrete units, which can provide data storage services in the form of objects based on distributed systems. Remote object storage stores unstructured data and downloads files to local use through the API provided by the remote object storage. Commonly used open source remote object storages include: MinIO, FastDFS, Ceph, and OpenIO. In remote object storage, objects are considered to contain data. There is no longer a hierarchical structure in a layer structure. Each object is at the same level in a flat address space called a storage pool. By assigning each object a unique identifier and recording it in the metadata table related to the data contained in the object, users do not need to know the actual physical address of the data when accessing the object, thereby simplifying data storage and query.
[0003] The local application of the remote object storage is a RESTFUL API, which is accessed through the API local interface. This method works well in most scenarios. However, in some scenarios, such as the scenario where business and storage are separated, the business's read and write operations on files actually rely on network IO. Concurrent reading or writing can improve network throughput in some cases, but network IO delays caused by large file transfers are still unavoidable, especially in scenarios with repeated large-scale reads.
[0004] For scenarios with a large number of repeated reads, try to cache some hot files locally. After the first access to the remote object storage through the RESTFUL API, subsequent access to the same file will give priority to accessing the local cache file. When local IO is better than network transmission IO, the file access speed will be improved and network resources will be saved. Since the storage capacity of the business side is much smaller than that of the storage side in most scenarios, the size of the cache is limited, and a reasonable replacement strategy needs to be adopted to improve the utilization rate of the cache, while inevitably facing the problem of cache consistency.
[0005] The patent document with document number CN113326003B discloses a distributed storage system metadata access intelligent acceleration method, which relates to the field of computer storage technology. The application analyzes the relationship between metadata popularity, time, and head IP, distributes metadata intelligently, improves query efficiency and system reliability; at the same time, localized access to metadata reduces access latency. However, it also has the following problems: the file is not sliced, the data is stored slowly, there is no local cache, and the data reading speed is slow. Summary of the invention
[0006] In response to the above problems, the purpose of the present invention is to provide a method, device, equipment and medium for accelerating repeated reads of object storage in a distributed system, which establishes a local cache by file segmentation and dynamically maintains the local cache, thereby accelerating the access speed to remote object storage in a large number of repeated read scenarios.
[0007] The embodiments of the present invention provide a method, device, equipment and medium for accelerating repeated reads of object storage in a distributed system.
[0008] A first aspect: a distributed system object storage repeated read acceleration method, comprising: S1: When writing a file, the file is split into multiple slices and the slices are stored in the remote object storage; S2: When reading a file, cache some file slices into the local cache; S3, record or update the local cache slice storage information and remote object storage slice storage information to the file metadata index; S4. When reading files repeatedly, read the file slices in the local cache and the file slices in the remote object storage based on the file metadata index record information.
[0009] Optionally: when the shards in S1 are stored in the remote object storage, multiple slices are concurrently written to the remote object storage.
[0010] Optionally: when the single slice is changed and written, the data block size does not exceed the slice size.
[0011] Optionally: when there are multiple data block changes written in the single slice, the data is read in order from the newest to the oldest changes, and the multiple data blocks are merged at the same time.
[0012] Optionally: when a slice is expanded, the expanded slice is split again, and the storage information is added to the file metadata index; When a slice is deleted, the storage information is updated and added to the file metadata index.
[0013] Optionally: In S2, some slices of the file are cached in the local cache and cached according to the local cache strategy.
[0014] Optionally: when the file is read repeatedly in S4, when the local cache record information in the file metadata index becomes invalid, the invalid local cache file slice is asynchronously deleted or updated.
[0015] A second aspect: a distributed system object storage repeated read acceleration device, comprising: A remote object storage unit, used to store file slices; The local cache unit caches some file slices into the local cache according to the cache strategy; File metadata index unit; records or updates local cache slice storage information and remote object storage slice storage information.
[0016] A third aspect: An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method provided in the first aspect when executing the program.
[0017] A fourth aspect: A non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method provided in the first aspect.
[0018] Beneficial effects of the present invention: 1. The present invention combines the characteristics of separation between the business end and the remote object storage side in actual use, dynamically establishes a local cache by means of file segmentation, dynamically maintains file metadata index information, accelerates the access speed to the remote object storage in a large number of repeated reading scenarios, locally caches hot file fragments, and makes full use of local disk performance, thereby accelerating the access speed to files in repeated reading scenarios and saving network bandwidth.
[0019] 2. The file storage of the present invention adopts file slicing and slicing. The slice size is adjusted according to the actual application. Multiple slices can be written concurrently to improve the writing speed, and it is also convenient for the combined storage of slices during subsequent cache reading.
[0020] 3. The slice expansion of the present invention can split the slice again and write it to the object storage concurrently, thereby improving the writing speed of the slice. The expansion and deletion maintain the original slice size, which is conducive to modifying the file slice, synchronously updating the file metadata index information, and maintaining cache consistency.
[0021] 4. When the present invention writes multiple times, the changed data is read in the order from new to old (from top to bottom) to ensure the acquisition of the latest data. At the same time, merging is prioritized during reading to reduce the number of reads, and the data blocks are read after merging to improve the reading speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A schematic diagram of a flow chart of a method for accelerating repeated reads of object storage in a distributed system according to the present invention; Figure 2 A schematic diagram of file segmentation and storage into objects according to the present invention; Figure 3 This is a schematic diagram of first access and re-access reading of a file of the present invention; Figure 4 This is a schematic diagram of merging multiple slice writes in the present invention; Figure 5 This is a schematic diagram of the local cache synchronization update of the present invention; Figure 6 This is a schematic diagram of the comparison of slice amplification and slice division in the present invention; Figure 7 This is a schematic diagram of the comparison of the slice deletion of the present invention; Figure 8 This is a schematic diagram of the present invention reading a file for the first time and storing it in a local cache; Fig. 9 A schematic diagram of accessing local cache and remote object storage in the present invention; Fig.10 A schematic diagram of generating batches of small files for the invention document; Fig.11 A schematic diagram of randomly generating large files for the present invention; Fig.12 This is a schematic diagram of the test results of obtaining small files directly from object storage in the present invention; Fig.13 This is a schematic diagram of the test results of randomly obtaining small files using local cache in the present invention; Fig.14 A schematic diagram of storing and reading large files for the object of the present invention; Fig.15 This is a schematic diagram of the present invention using local cache to read large files; Fig.16 It is a schematic diagram of local replication of the present invention; Fig.17 A schematic diagram of a storage acceleration device for an object of the present invention; Fig.18 It is a schematic diagram of the electronic device of the present invention. DETAILED DESCRIPTION
[0023] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar symbols throughout represent the same or similar elements or elements with the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0024] File storage systems for remote object storage in distributed systems are usually designed with a computing-storage separation model, which improves bandwidth and throughput through concurrency. However, when the amount of data is particularly large and there are repeated reads, it will cause long-term network congestion and waste of resources.
[0025] In view of the above problems, the present invention provides a method for accelerating repeated reads of object storage in a distributed system. Figure 1 A schematic diagram of a distributed system object storage repeated read acceleration method provided by an embodiment of the present invention, the method comprising: S1. When writing a file, the file is split into multiple slices and the slices are stored in the remote object storage.
[0026] Sharded storage is to divide the file into multiple slices for storage. The advantages of this are: first, multiple slices can be written concurrently to increase the writing speed; second, it is convenient for the subsequent cache reading to combine the storage of slices; the reasonable size of the file slice can be adjusted according to the specific usage scenario.
[0027] For example, Figure 2 As shown, file A (FileA) is divided into multiple fragment files (Chunk01, Chunk02, Chunk03, ...), and these fragment files are stored in the remote object storage.
[0028] S2. When reading a file, cache some file slices into the local cache.
[0029] When a file is processed, it is divided into multiple slices according to the rules, and the slices are stored in the remote object storage. When reading the file, some file slices are cached in the local cache. Due to the size limit of the local cache storage, some slices in the cache are replaced according to the cache strategy.
[0030] S3. Record or update local cache slice storage information and remote object storage slice storage information to the file metadata index.
[0031] The construction of the entire cache mechanism is mainly divided into two parts, including file metadata maintenance and local cache data storage. File metadata records or updates local cache slice storage information and remote object storage slice storage information to the file metadata index.
[0032] S4. When reading files repeatedly, read the file slices in the local cache and the file slices in the remote object storage based on the file metadata index record information.
[0033] like Figure 3 As shown in the figure, when repeated reading is required, the file slices in the local cache and the file slices in the remote object storage are read according to the file metadata index record information. Due to the size limit of the local cache storage, the slices in the local cache are replaced according to the cache strategy. When the file is accessed again, the required slices are matched according to the file metadata index record information. The possible result is that some slices are directly obtained from the local cache, and the remaining slices are obtained from the remote object storage.
[0034] Furthermore, due to concurrent writing, after writing different data, it should be ensured that the obtained data is the latest. The file is sliced and divided according to the specified size. The size of the data block written to a single slice continuously each time cannot exceed the slice size (the data exceeding the size needs to be written to a new block). When there are multiple writes, the changed data should be read in order from new to old (from top to bottom). At the same time, in order to avoid too many write operations on a single slice, merging can be prioritized during reading to reduce the number of reads, and the data blocks can be merged before reading. Figure 4 As shown in the figure, when there are write operations w1, w2, and w3 on a slice, the business end reads w1'+w3+w2' after merging.
[0035] Furthermore, in order to maintain the consistency of local cache and remote object storage data, in a distributed system, when the file shards of the remote object storage are updated, the local cache file shards should be updated synchronously. In order to reduce the network delay of the update, the file metadata index information can be updated, such as Figure 5 As shown in the figure, when the metadata index pointing to the local cache slice fails, the expired local cache slice file can be asynchronously deleted or updated to re-acquire the slice file in the remote object storage to ensure the consistency of the local cache and remote object storage data.
[0036] Furthermore, when a slice is expanded, the expanded slice is sharded again, and the storage information is added to the file metadata index.
[0037] For example: Figure 6 As shown, Chunk01 is expanded, resulting in that the original Chunk01 can no longer store the newly added content. A new Chunk01' can be added to store the newly added content. The newly added content is stored in Chunk01'. The metadata index information of the original file FileA consists of Chunks01, 02, 03, ..., and after the addition, the metadata index information of the file FileA' consists of Chunks01, 01', 02, 03, ...
[0038] Similarly, if Figure 7 As shown, after deleting the slice Chunk02 in FileA, FileA'' is obtained, the file metadata index is updated, Chunk02 is deleted, and the metadata index information of FileA'' is updated to consist of Chunks01, 03, ...
[0039] The present invention adopts a distributed system, the business end and the object storage are separated, and they are remotely connected to each other through protocols such as HTTP or S3.
[0040] When accessing data, read the slices corresponding to the file from the object storage, and cache some slices into the local cache according to the cache strategy of the local cache, such as Figure 3 , 8 As shown, when accessing the file FileA for the first time, Chunks 01, 02, 03, ... are obtained from the remote object storage, where Chunks 01 and 02 are cached in the local cache.
[0041] When accessing the file again, the file metadata index information is queried to obtain the partial slices that make up the file and store them in the local cache. Only the remaining file slices need to be obtained from the remote object storage and merged into the complete file locally. Figure 3 , 9 As shown in the figure, file FileA is accessed again, where Chunks 01 and 02 are directly obtained from the local cache, and Chunks 03, ... are obtained from the remote object storage.
[0042] right Figure 8 and Fig. 9 Comparing the two cases, when not using local cache, the time spent on obtaining file FileA is t1+t2+t3+t4, while when using local cache, the time spent is t1'+t2'+t3+t4. The time spent on obtaining from remote object storage t1+t2 is greater than the time spent on directly obtaining data from local cache t1'+t2', and the entire reading process saves time.
[0043] Experimental data examples: Deploy the object storage Minio on one machine to simulate remote object storage, and test on another machine to download files using direct connection to Minio and download files through local cache combination.
[0044] Linux generates about 14806 small files in batches, such as Fig.10 As shown; randomly generate a large file of about 10G as Fig.11 As shown: Download temps small files in batches and get test results directly from object storage. Fig.12 As shown. 3412 files (about 7G) starting with randomfile_1710467 in temps are cached, and the same 14806 small files as above are tested. The results are as follows Fig.13 shown.
[0045] The above 14,806 small files, about 39 GB, were transferred without cache, with an average transfer rate of about 27 MB / s; when some files were cached, the average transfer rate was about 31 MB / s.
[0046] The test results for the large file bigfile (10G) obtained from the object storage are as follows Fig.14 As shown; after caching some slices of bigfile, the test results are as follows Fig.15 Show; local copy of large files such as Fig.16 Show.
[0047] The above results show that the combined search method of local cache and remote object storage improves the access speed of remote files in the scenario of reading small files and large files in large batches (continuous reading).
[0048] This is mainly because the local disk read speed is better than the network speed. The continuous read and write speed of the local cache disk is about 113MB / s, while the average speed of remote object storage access reading and local writing is about 91.42MB / s. It is precisely because of this performance difference that the access speed of some parts using local cache has been improved.
[0049] The present invention also provides a distributed system object storage repeated read acceleration device, which is applied to the above method, such as Fig.17 As shown, the device comprises: A remote object storage unit, used to store file slices; The local cache unit caches some file slices into the local cache according to the cache strategy; File metadata index unit; records or updates local cache slice storage information and remote object storage slice storage information.
[0050] The present invention also provides an electronic device, Fig.18 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Fig.18 As shown, the electronic device may include: a processor, a communications interface, a memory, and a communications bus, wherein the processor, the communications interface, and the memory communicate with each other via the communications bus. The processor may call the logic instructions in the memory to execute the following method: S1: When writing a file, the file is split into multiple slices and the slices are stored in the remote object storage; S2: When reading a file, cache some file slices into the local cache; S3, record or update the local cache slice storage information and remote object storage slice storage information to the file metadata index; S4. When reading files repeatedly, read the file slices in the local cache and the file slices in the remote object storage based on the file metadata index record information.
[0051] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0052] An embodiment of the present invention further provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method provided in each of the above embodiments is implemented, for example, including: S1: When writing a file, the file is split into multiple slices and the slices are stored in the remote object storage; S2: When reading a file, cache some file slices into the local cache; S3, record or update the local cache slice storage information and remote object storage slice storage information to the file metadata index; S4. When reading files repeatedly, read the file slices in the local cache and the file slices in the remote object storage based on the file metadata index record information.
[0053] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.
[0054] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0055] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for accelerating repeated reads of object storage in a distributed system, characterized in that: include: S1. When writing a file, the file is split into multiple slices and stored in the remote object storage; S2. When reading a file, cache some file slices into the local cache; S3. Record or update local cache slice storage information and remote object storage slice storage information to the file metadata index; S4. When reading files repeatedly, read the file slices in the local cache and the file slices in the remote object storage based on the file metadata index record information.
2. A distributed system object storage repeated read acceleration method according to claim 1, characterized in that: When the shards in S1 are stored in the remote object storage, multiple slices are written to the remote object storage concurrently.
3. A distributed system object storage repeated read acceleration method according to claim 2, characterized in that: When writing a single slice change, the data block size does not exceed the slice size.
4. A distributed system object storage repeated read acceleration method according to claim 3, characterized in that: When a single slice has multiple data block changes and writes, it is read in order from the newest to the oldest changes, and the multiple data blocks are merged at the same time.
5. The method for accelerating repeated reads of object storage in a distributed system according to claim 1, characterized in that: When a slice is expanded, the expanded slice is split again and the storage information is added to the file metadata index; When a slice is deleted, the storage information is updated and added to the file metadata index.
6. A distributed system object storage repeated read acceleration method according to claim 1, characterized in that: In S2, some slices of the file are cached in the local cache and cached according to the local cache strategy.
7. A distributed system object storage repeated read acceleration method according to claim 1, characterized in that: When the file is read repeatedly in S4, when the local cache record information in the file metadata index becomes invalid, the invalid local cache file slice is asynchronously deleted or updated.
8. A distributed system object storage repeated read acceleration device applied to the method according to any one of claims 1 to 7, characterized in that: The device comprises: A remote object storage unit, used to store file slices; The local cache unit caches some file slices into the local cache according to the cache strategy; File metadata index unit; records or updates local cache slice storage information and remote object storage slice storage information.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of a distributed system object storage repeated read acceleration method according to any one of claims 1 to 7 are implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of a distributed system object storage repeated read acceleration method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method and system for reading and writing files in IPTV system
CN101673288A
Data storage device and method and distributed data storage system
CN113868192A
Mass small file storage system and method based on index online splicing
CN117519612A
Managing host data placed in a container file system on a data storage array having multiple storage tiers
US9594514B1
Cited By
Video downloading method based on local index persistence and object storage direct connection
CN122496498A
