Method, apparatus, device and medium for processing distributed file
Abstract
Embodiments of the present disclosure provide a method, apparatus, device and medium for processing a distributed file. The method comprises: receiving a read request sent by a user, wherein a file is distributedly written into a magnetic disk array in a sliced data form; querying a pre-read chain list in a memory according to the read request, wherein each file node in the pre-read chain list comprises at least one chain of ordered data blocks; in a case that a pre-read condition is satisfied, reading sliced data from the magnetic disk array according to a pre-read policy and the read request to generate ordered pre-read data, to store the pre-read data into a file node of the pre-read chain list in an ordered manner in the data block form, and to send a read response containing the target data to the user.
Interactive Citation Constellation Global Citation Ranking
Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 5 · Forward citations: 0.
Claims (20 — 3 Independent, 17 Dependent)
- Claim 1Independent Claim
A method for processing a distributed file, comprising: receiving a read request sent by a user, wherein the read request comprises an identifier of a file to which target data to be read belongs, and an identifier of a position of the target data in the file, and wherein the file is distributedly written into a magnetic disk array in a sliced data form, the file is divided into a plurality of sliced data, and the magnetic disk array comprises a plurality of object-based storage devices each of which stores at least one of the plurality of sliced data; querying a pre-read chain list in a memory according to the read request, wherein the pre-read chain list comprises at least one file node, each file node comprises at least one chain of ordered data blocks, and each data block stores pre-read data corresponding to the file node; in a case that a file node matching the identifier of the file is not found in the pre-read chain list in the querying, determining whether the read request satisfies a sequential read behavior according to the identifier of the position, and whether a currently-recorded number of times of the sequential read behavior satisfies a sequential read threshold, wherein the sequential read behavior indicates that the target data is continuous with historical data corresponding to a previous request; and in a case that the sequential read behavior and the sequential read threshold are satisfied, reading sliced data from the magnetic disk array according to a pre-read policy and the read request to generate ordered pre-read data comprising the target data, to store the pre-read data into a file node of the pre-read chain list in an ordered manner and in a data block form, and to send a read response containing the target data to the user.
- Claim 2Depends on #1
The method according to claim 1, wherein each file node comprising at least one chain of ordered data blocks comprises: each said file node comprising at least one segment node, each segment node corresponding to one chain of sequential data blocks, the segment node being configured to indicate a position of pre-read data stored in the data blocks in the file by a number in the chain of data blocks, wherein chains of data blocks, among different segment nodes, are not sequentially connected.
- Claim 3Depends on #2
The method according to claim 2, wherein before determining whether the read request satisfies the sequential read behavior according to the identifier of the position, and whether the currently-recorded number of times of the sequential read behavior satisfies the sequential read threshold, the method further comprises: in a case that a target file node matching the identifier of the file is found in the pre-read chain list in the querying, but a segment node matching the identifier of the position is not found in the querying, determining whether the read request satisfies the sequential read behavior according to the identifier of the position, and whether the currently-recorded number of times of the sequential read behavior satisfies the sequential read threshold.
- Claim 4Depends on #1
The method according to claim 1, wherein determining whether the read request satisfies the sequential read behavior according to the identifier of the position comprises: determining a starting position for reading the file according to the identifier of the file and the identifier of the position; obtaining a previous ending position pre-recorded for a pre-read mode; and determining whether the read request is the sequential read behavior according to the starting position and the previous ending position.
- Claim 5Depends on #4
The method according to claim 4, wherein after determining whether the read request is the sequential read behavior according to the starting position and the previous ending position, the method further comprises: in a case that it is determined to be a non-sequential behavior, sending a failed read response to the user to instruct to directly read the target data from the magnetic disk array by the user, and increasing a number of times of non-sequential read by one; in a case that it is determined that a current number of times of the non-sequential read reaches a random read threshold, determining that a switching condition of the pre-read mode is satisfied, and setting relevant parameters recorded in the pre-read mode to be zero; and in a case that it is determined that the current number of times of the non-sequential read does not reach the random read threshold, determining that the switching condition of the pre-read mode is not satisfied.
- Claim 6Depends on #1
The method according to claim 1, wherein reading sliced data from the magnetic disk array according to the pre-read policy and the read request to generate ordered pre-read data comprises: querying a preset first data block pre-read mapping relationship, to obtain a number of first pre-read data blocks corresponding to the number of times of the sequential read behavior; determining a sliced data starting position on the magnetic disk array according to the identifier of the file and the identifier of the position; and reading corresponding sliced data from the sliced data starting position of the magnetic disk array to generate ordered pre-read data, according to the number of the first pre-read data blocks and a preset data block size.
- Claim 7Depends on #1
The method according to claim 1, wherein after determining whether the read request satisfies the sequential read behavior according to the identifier of the position, and whether the currently-recorded number of times of the sequential read behavior satisfies the sequential read threshold, the method further comprises: in a case that the sequential read behavior is satisfied but the sequential read threshold is not satisfied, or in a case that the sequential read behavior is not satisfied, sending a failed read response to the user to instruct to read the target data directly from the magnetic disk array by the user.
- Claim 8Depends on #1
The method according to claim 1, wherein before determining whether the read request satisfies the sequential read behavior according to the identifier of the position, and whether the currently-recorded number of times of the sequential read behavior satisfies the sequential read threshold, the method further comprises: querying a pre-read flag in the pre-read chain list, to determine whether the memory is currently pre-reading data from the magnetic disk array; in a case that it is determined by the querying that the pre-read flag indicates the memory being currently pre-reading, determining whether data information currently pre-read contains the target data; and in a case that it is determined that the data information currently pre-read contains the target data, waiting until a completion of the pre-reading, to send the read response containing the target data to the user.
- Claim 9Depends on #8
The method according to claim 8, wherein determining whether the read request satisfies the sequential read behavior according to the identifier of the position, and whether the currently-recorded number of times of the sequential read behavior satisfies the sequential read threshold comprises: in a case that it is determined that the data information currently pre-read does not contain the target data, performing the determining whether the read request satisfies the sequential read behavior according to the identifier of the position, and whether the currently-recorded number of times of the sequential read behavior satisfies the sequential read threshold.
- Claim 10Depends on #2
The method according to claim 2, further comprising: querying a target file node matching the identifier of the file in the pre-read chain list, and a target segment node containing the target data in the target file node according to the identifier of the position; determining a read starting position of a data block and a read ending position of the data block, in the target segment node, according to the identifier of the position; and obtaining the target data from a corresponding data block section according to the read starting position and the read ending position, to send the reading response containing the target data to the user.
- Claim 11Depends on #10
The method according to claim 10, wherein obtaining the target data from the corresponding data block section according to the read starting position and the read ending position comprises: querying whether a pre-marked current version number corresponding to the data block section is valid; in a case that it is determined from the querying that the current version number is valid, obtaining the target data from the corresponding data block section according to the read starting position and the read ending position; and in a case that it is determined from the querying that the current version number is invalid, sending a failed read response to the user to instruct to directly read the target data from the magnetic disk array by the user.
- Claim 12Depends on #10
The method according to claim 10, further comprising: obtaining a last data block ending position in the target segment node; obtaining a pre-read data margin between the read ending position and the last data block ending position; and determining whether the pre-read data margin is less than a pre-read threshold, and in a case that it is determined that the pre-read data margin is less than the pre-read threshold, reading corresponding sliced data from the magnetic disk array to obtain pre-read data, to store the pre-read data in the pre-read chain list in the data block form.
- Claim 13Depends on #12
The method according to claim 12, wherein the reading corresponding sliced data from the magnetic disk array to obtain pre-read data comprises: querying a preset second data block pre-read mapping relationship, to obtain a number of second pre-read data blocks corresponding to the pre-read data margin; and reading corresponding sliced data from the magnetic disk array according to the last data block ending position, the number of the second pre-read data blocks and a preset data block size, to obtain ordered pre-read data.
- Claim 14Depends on #10
The method according to claim 10, further comprising: in a case of detecting that a reading for target data block in the target segment node is completed, detecting whether there are other data blocks previous to the target data block; in a case that there are the other data blocks, deleting a part of the data blocks previous to the target data block according to a preset interval number.
- Claim 15Depends on #1
The method according to claim 1, further comprising: querying a latest read request time recorded in each file node in the pre-read chain list according to a preset period; and detecting whether a time difference between the latest read request time and a current time is greater than a preset time threshold, to delete, from the pre-read chain list, the file node with the time difference greater than the time threshold.
- Claim 16Independent Claim
An electronic device, comprising: a processor; and a memory configured to store an instruction executable by the processor, wherein the processor is configured to read the executable instruction from the memory, and execute the instruction to: receive a read request sent by a user, wherein the read request comprises an identifier of a file to which target data to be read belongs, and an identifier of a position of the target data in the file, and wherein the file is distributedly written into a magnetic disk array in a sliced data form, the file is divided into a plurality of sliced data, and the magnetic disk array comprises a plurality of object-based storage devices each of which stores at least one of the plurality of sliced data; query a pre-read chain list in a memory according to the read request, wherein the pre-read chain list comprises at least one file node, each file node comprises at least one chain of ordered data blocks, and each data block stores pre-read data corresponding to the file node; in a case that a file node matching the identifier of the file is not found in the pre-read chain list in the querying, determine whether the read request satisfies a sequential read behavior according to the identifier of the position, and whether a currently-recorded number of times of the sequential read behavior satisfies a sequential read threshold, wherein the sequential read behavior indicates that the target data is continuous with historical data corresponding to a previous request; and in a case that the sequential read behavior and the sequential read threshold are satisfied, read sliced data from the magnetic disk array according to a pre-read policy and the read request to generate ordered pre-read data comprising the target data, to store the pre-read data into a file node of the pre-read chain list in an ordered manner and in a data block form, and to send a read response containing the target data to the user.
- Claim 17Depends on #16
The electronic device according to claim 16, wherein each file node comprising at least one chain of ordered data blocks comprises: each said file node comprising at least one segment node, each segment node corresponding to one chain of sequential data blocks, the segment node being configured to indicate a position of pre-read data stored in the data blocks in the file by a number in the chain of data blocks, wherein chains of data blocks, among different segment nodes, are not sequentially connected.
- Claim 18Depends on #17
The electronic device according to claim 17, wherein the processor is further configured to read the executable instruction from the memory, and execute the instruction to: in a case that a target file node matching the identifier of the file is found in the pre-read chain list in the querying, but a segment node matching the identifier of the position is not found in the querying, determine whether the read request satisfies the sequential read behavior according to the identifier of the position, and whether the currently-recorded number of times of the sequential read behavior satisfies the sequential read threshold.
- Claim 19Depends on #16
The electronic device according to claim 16, wherein the processor is further configured to: determine a starting position for reading the file according to the identifier of the file and the identifier of the position; obtain a previous ending position pre-recorded for a pre-read mode; and determine whether the read request is the sequential read behavior according to the starting position and the previous ending position.
- Claim 20Independent Claim
A non-transitory computer-readable storage medium stored with a computer program which, when executed in a computer, causes the computer to: receive a read request sent by a user, wherein the read request comprises an identifier of a file to which target data to be read belongs, and an identifier of a position of the target data in the file, and wherein the file is distributedly written into a magnetic disk array in a sliced data form, the file is divided into a plurality of sliced data, and the magnetic disk array comprises a plurality of object-based storage devices each of which stores at least one of the plurality of sliced data; query a pre-read chain list in a memory according to the read request, wherein the pre-read chain list comprises at least one file node, each file node comprises at least one chain of ordered data blocks, and each data block stores pre-read data corresponding to the file node; in a case that a file node matching the identifier of the file is not found in the pre-read chain list in the querying, determine whether the read request satisfies a sequential read behavior according to the identifier of the position, and whether a currently-recorded number of times of the sequential read behavior satisfies a sequential read threshold, wherein the sequential read behavior indicates that the target data is continuous with historical data corresponding to a previous request; and in a case that the sequential read behavior and the sequential read threshold are satisfied, read sliced data from the magnetic disk array according to a pre-read policy and the read request to generate ordered pre-read data comprising the target data, to store the pre-read data into a file node of the pre-read chain list in an ordered manner and in a data block form, and to send a read response containing the target data to the user.
Technical Overview & Description
CROSS-REFERENCE TO RELATED APPLICATION(S) This application claims priority to Chinese Application No. 202310671910.1 filed in Jun. 7, 2023, the disclosures of which are incorporated herein by reference in their entities. FIELD The present disclosure relates to a technical field of data processing, and particularly to a method, apparatus, device and medium for processing a distributed file. BACKGROUND Where a magnetic disk serves as a part for data persistence for an electronic device, a read speed of the magnetic disk is often a painful point of delay. The read speed of the magnetic disk is limited by the Input/Output Per Second (IOPS) (or the number of reads/writes) of the magnetic disk. In the related art, a related file is stored in the magnetic disk with a file granularity to improve the read speed of the file, a data end position of the currently-read data is determined. Before the next data reading request is obtained, the data end position of the currently-read data is taken as a starting position of the data that might need to be read next time. The related file is read in advance in the magnetic disk to obtain the data that might need to be read next time, and the read data is stored in a cache. For example, referring to FIG. 1 , the current file A contains 2048K data, and the file A with 2048K data is entirely stored in the magnetic disk. In a case that the data end position of the current read data is 0-128K of the file A, 128K-256K of data is read in advance in the magnetic disk and stored in the memory, so as to directly read 128K-256K of data of file A in the memory, thereby improving data reading efficiency. However, in the above data pre-reading manner, an applicable scenario is a scenario in which data storage is performed with a file granularity. However, with the popularity of the storage mode of a distributed system, the same file may be split into multiple sliced data for storage. Therefore, the above pre-reading manner is no longer applicable,
Cited By — Indexed Forward Citations (0 of 0 total)
No indexed citing patents in this generation yet. Ingest USPTO/PatentsView bulk citation tables via patents-ingest to expand the local forward citation graph.
References Cited — Backward Prior Art (5)
| Patent | Title | Year | Citations |
|---|
Non-Patent Literature (10)
- Extended European Search Report for European Patent Application No. 24180503.5, mailed Oct. 29, 2024, 12 pages.
- Hartman J.H.,
- “
- The Zebra Striped Network File System,
- ”
- PHD Thesis, University of California at Berkeley, Retrieved from the Internet URL: http://www.cl.cam.ac.uk/research/srg/netos/plana/dump/zebra.pdf, Jan. 1, 1994, 148 pages.
- Nagle D., et al.,
- “
- The Panasas ActiveScale Storage Cluster
- —