| CPC G06F 16/134 (2019.01) [G06F 16/182 (2019.01)] | 16 Claims |

|
1. A method for local random readahead of a file in a distributed file system, comprising:
creating a readahead structure pointer in an operation handle of a file;
in response to reading of the file, accessing and updating information in the readahead structure pointer, and determining whether the reading is local random reading; and
performing readahead in a case where the reading is local random reading, the number of instances of continuous reading in the updated information is greater than 1, and a current reading position is greater than or equal to a readahead trigger position in the updated information;
wherein the information in the readahead structure pointer comprises: a last reading end position, a last readahead end position, a last readahead size, the number of instances of sequential reading, a data amount of sequential reading, a local random reading window, a maximum readahead size, and the readahead trigger position;
wherein in response to reading of the file, accessing and updating information in the readahead structure pointer comprises:
where a current reading position is the same as the last reading end position, adding 1 to the number of instances of sequential reading, and adding a preset length to the data amount of sequential reading;
wherein in response to reading of the file, determining whether the reading is local random reading comprises:
where the current reading position is different from the last reading end position, determining whether a data amount that differs between a current reading offset and the last reading end position is within one random window, the one random window being the local random reading window; and
in response to where the data amount that differs between the current reading offset and the last reading end position is within the one random window, determining the current reading to be local random reading.
|