A method, apparatus, and medium for identifying sequentially accessed intervals

By identifying and sliding sequential access intervals, the problem of inaccurate access position in mixed random and sequential read scenarios in block devices is solved, achieving efficient data pre-reading and improved access performance.

CN114995761BActive Publication Date: 2026-02-17JINAN INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210612204.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-31
Publication Date
2026-02-17
Estimated Expiration
2042-05-31

AI Technical Summary

Technical Problem

Existing technologies cannot accurately identify subsequent access locations in block devices, especially in scenarios involving a mix of random and sequential reads, resulting in low access efficiency.

Method used

By identifying sequential access intervals, establishing and sliding sequential access intervals, pre-reading data in block devices, and using weighted calculation and merging mechanisms to process multiple access intervals, random read requests are filtered out.

Benefits of technology

It improves the efficiency of block device access, especially in mixed read request scenarios, and enables accurate pre-reading of multiple sequential reads, reducing the consumption of storage system resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114995761B_ABST
    Figure CN114995761B_ABST
Patent Text Reader

Abstract

The application discloses a method and device for identifying sequential access intervals and a medium, and is applied to the field of data storage. After a storage system obtains a storage interval corresponding to a read request in a block device, the sequential access interval and the storage interval corresponding to the read request are compared. If there is no intersection between the current sequential access interval and the storage interval corresponding to the read request, a new sequential access interval is established according to the storage interval corresponding to the read request to pre-read data in the new sequential access interval. If there is an intersection between the current sequential access interval and the storage interval corresponding to the read request, the corresponding sequential access interval is sequentially slid to pre-read data in the sequential access interval after the sliding. The sequential access interval is a storage interval in the block device. When there is a mixed service scenario of random reading and sequential reading, the sequential access interval is slid to pre-read the sequential reading related data, and the sequential reading is not affected by the random reading.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of data storage, and particularly relates to a method and device for identifying a sequential access interval and a medium. BACKGROUND

[0002] A block device is a type of input / output (I / O) device, which stores information in fixed-size blocks, and each block has its own address, and a certain length of data can be read at any position of the block device, for example, a U disk and an SD card belong to a block device, and a disk is the most common block device. Operations on a block device include random read / write and sequential read / write. Taking a disk as an example, read / write operations on continuous space of the disk are sequential read / write; and correspondingly, a head constantly adjusts the position of a track to read / write data at different positions, which is random read / write. In applications, for sequential read operations on data in a block device, a storage system can perform pre-reading and the like to improve the access performance of a sequential read request. Pre-reading is a technology for improving the performance of sequential read, which is used to narrow the efficiency gap between a storage device and an application program. After receiving a sequential read request, the storage system can pre-store data to be read subsequently in a memory, that is, data in a corresponding interval of the block device is read and temporarily stored in the memory, and then when a request for accessing the data arrives, the related data is directly provided from the memory. Pre-reading improves the access rate of a sequential read request. When implementing pre-reading, the storage system needs to accurately identify the next position to be read. At present, based on the sequential read identification of a block device, the basic method is to determine a single sequential access point according to whether the positions of IO requests occurring before and after are continuous, that is, a sequential read access request of a client is obtained, and then data in a corresponding position is pre-read according to the access order of the sequential read.

[0003] However, this method cannot cope with a mixed business scenario of random read and sequential read, that is, when a client accesses data of a block device, if not only a sequential read access, but also a variety of mixed situations, the current solution cannot accurately identify the subsequent access position, resulting in low access efficiency.

[0004] Therefore, how to accurately identify the subsequent access position to improve the access efficiency is a problem to be solved by those skilled in the art. SUMMARY

[0005] The present application aims to provide a method and device for identifying a sequential access interval and a medium, to accurately identify the subsequent access position and improve the access efficiency.

[0006] To solve the above technical problems, the present application provides a method for identifying a sequential access interval, comprising:

[0007] obtaining a corresponding storage interval in the block device corresponding to the read request;

[0008] If there is no intersection between the sequential access interval and the storage interval corresponding to the read request at present, a new sequential access interval is established according to the storage interval corresponding to the read request to pre-read data in the new sequential access interval; wherein the sequential access interval is a storage interval in the block device;

[0009] If there is an intersection between the sequential access interval and the storage interval corresponding to the read request at present, the corresponding sequential access interval is sequentially slid to pre-read data in the sequential access interval after sliding.

[0010] Preferably, before the sequential sliding of the corresponding sequential access interval to pre-read data in the sequential access interval after sliding, the method further comprises:

[0011] obtaining a first intermediate position of the sequential access interval and a second intermediate position of the storage interval corresponding to the read request;

[0012] weighting the first intermediate position and the second intermediate position by a preset weighting value to obtain a weighted intermediate position;

[0013] The sequential sliding of the corresponding sequential access interval to pre-read data in the sequential access interval after sliding comprises:

[0014] sliding the corresponding sequential access interval according to the weighted intermediate position to take the weighted intermediate position as the intermediate position of the corresponding sequential access interval.

[0015] Preferably, if there is no intersection between the sequential access interval and the storage interval corresponding to the read request at present, the method further comprises:

[0016] If there is no intersection between the sequential access interval and the storage interval corresponding to the read request at present, a new sequential access interval is established according to the storage interval corresponding to the read request to pre-read data in the new sequential access interval; wherein the sequential access interval is a storage interval in the block device;

[0017] sliding the estimated sequential access interval according to the new read request;

[0018] If the estimated sequential access interval is sequentially slid in the storage interval of the block device, the estimated sequential access interval is taken as the real sequential access interval.

[0019] Preferably, the method further comprises: if there is no intersection between the sequential access interval and the storage interval corresponding to the read request, establishing a new sequential access interval according to the storage interval corresponding to the read request to pre-read data in the new sequential access interval; and if there is an intersection between the sequential access interval and the storage interval corresponding to the read request, sliding the corresponding sequential access interval in sequence to pre-read data in the sequential access interval after sliding.

[0020] When multiple independent sequential access intervals intersect and the proportion of the intersection reaches a certain threshold, the multiple corresponding sequential access intervals are merged.

[0021] Preferably, the method further comprises: if there is no intersection between the sequential access interval and the storage interval corresponding to the read request, establishing a new sequential access interval according to the storage interval corresponding to the read request to pre-read data in the new sequential access interval; and if there is an intersection between the sequential access interval and the storage interval corresponding to the read request, sliding the corresponding sequential access interval in sequence to pre-read data in the sequential access interval after sliding.

[0022] If the sequential access interval has not been slid for a preset time period from the last activity time of the sequential access interval, the corresponding sequential access interval is deleted; wherein the last activity time is generated when the sequential access interval is established, and the last activity time is updated with the current time of sliding after the sequential access interval is slid.

[0023] Preferably, if there is no intersection between the sequential access interval and the storage interval corresponding to the read request, the establishing a predicted sequential access interval comprises:

[0024] The predicted sequential access interval is established according to a middle position of the storage interval corresponding to the read request, so that the middle position of the predicted sequential access interval is the middle position of the storage interval corresponding to the read request.

[0025] Preferably, the weighted calculation of the first middle position and the second middle position with a preset weighting value to obtain a weighted middle position comprises:

[0026] The middle position of the first middle position and the second middle position is taken as the weighted middle position.

[0027] To solve the above technical problems, the application further provides a sequential access interval identification device, comprising:

[0028] A first acquisition module is configured to acquire a storage interval corresponding to a read request in a block device.

[0029] The establishing module is configured to, if there is no intersection between the sequential access interval and the storage interval corresponding to the read request, establish a new sequential access interval according to the storage interval corresponding to the read request to pre-read data in the new sequential access interval; wherein the sequential access interval is a storage interval in the block device.

[0030] The sliding module is configured to, if there is an intersection between the sequential access interval and the storage interval corresponding to the read request, sequentially slide the corresponding sequential access interval to pre-read data in the sequential access interval after the sliding.

[0031] Preferably, the sequential access interval identification device further comprises:

[0032] The second obtaining module is configured to, before the sequential sliding of the corresponding sequential access interval to pre-read data in the sequential access interval after the sliding, obtain a first intermediate position of the sequential access interval and a second intermediate position of the storage interval corresponding to the read request.

[0033] The weighting module is configured to perform a weighted calculation on the first intermediate position and the second intermediate position by using a preset weighting value to obtain a weighted intermediate position; and the sequential sliding of the corresponding sequential access interval to pre-read data in the sequential access interval after the sliding comprises sliding the corresponding sequential access interval according to the weighted intermediate position to take the weighted intermediate position as the intermediate position of the corresponding sequential access interval.

[0034] Preferably, the sequential access interval identification device further comprises:

[0035] The merging module is configured to, after the establishing of the new sequential access interval to pre-read data in the new sequential access interval if there is no intersection between the sequential access interval and the storage interval corresponding to the read request, and the sequential sliding of the corresponding sequential access interval to pre-read data in the sequential access interval after the sliding if there is an intersection between the sequential access interval and the storage interval corresponding to the read request, merge a plurality of corresponding sequential access intervals when the plurality of independent sequential access intervals intersect and the proportion of the intersecting part reaches a certain threshold.

[0036] The deleting module is configured to: if there is no intersection between the sequential access interval and the storage interval corresponding to the read request, establish a new sequential access interval according to the storage interval corresponding to the read request to pre-read data in the new sequential access interval; and if there is an intersection between the sequential access interval and the storage interval corresponding to the read request, sequentially slide the corresponding sequential access interval to pre-read data in the sequential access interval after the sliding, and then delete the corresponding sequential access interval if the sequential access interval is not slid within a preset time length from a last active time of the sequential access interval. The last active time is generated when the sequential access interval is established, and is updated to a current time of the sliding after the sequential access interval is slid.

[0037] To solve the above technical problems, the application further provides a sequential access interval identification device, comprising: a memory for storing a computer program;

[0038] A processor is configured to execute the computer program to implement the steps of the sequential access interval identification method.

[0039] To solve the above technical problems, the application further provides a computer readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the steps of the sequential access interval identification method.

[0040] The sequential access interval identification method provided by the application can be used to send a read request to access data in a corresponding storage interval of a block device by a client. After the storage system obtains the storage interval corresponding to the read request in the block device, the sequential access interval and the storage interval corresponding to the read request are compared. If there is no intersection between the sequential access interval and the storage interval corresponding to the read request, a new sequential access interval is established according to the storage interval corresponding to the read request to pre-read data in the new sequential access interval. If there is an intersection between the sequential access interval and the storage interval corresponding to the read request, the corresponding sequential access interval is sequentially slid to pre-read data in the sequential access interval after the sliding. The sequential access interval is a storage interval in the block device. When there is a mixed business scenario of random reading and sequential reading, the sequential access interval can be slid to pre-read data related to sequential reading, and the pre-reading is not affected by random reading. In addition, by establishing multiple sequential access intervals, multiple sequential readings can be simultaneously implemented.

[0041] The application further provides a sequential access interval identification device and a computer readable storage medium, which correspond to the above method and have the same beneficial effects as the above method. BRIEF DESCRIPTION OF DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present application, the drawings required to be used in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.

[0043] Figure 1 A flow chart of a sequential access interval identification method provided by an embodiment of the present application;

[0044] Figure 2 A schematic diagram of sequential access interval sliding provided by an embodiment of the present application;

[0045] Figure 3 A structural diagram of a sequential access interval identification device provided by an embodiment of the present application;

[0046] Figure 4 A structural diagram of a sequential access interval identification device provided by another embodiment of the present application. DETAILED DESCRIPTION

[0047] The technical solutions in the embodiments of the present application will be described clearly and completely in the following with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without any creative effort fall within the protection scope of the present application.

[0048] The core of the present application is to provide a sequential access interval identification method, device and medium to accurately identify the subsequent access position and improve the access efficiency.

[0049] A block device stores information in fixed-size blocks, and each block has its own address. Also, a certain length of data can be read at any position of the block device, such as a U disk, an SD card, a disk, etc. The operation on the block device includes random read and write and sequential read and write. Taking a disk as an example, the read and write operation on the continuous space of the disk is sequential read and write. The stored data occupies space in the disk. For a new disk, the operating system will write data files into the disk in sequence. When some data is deleted, the storage space originally occupied by the data will be emptied. Over time, with the continuous writing and deleting of data, a large number of scattered storage spaces will be generated, and a large data file will be placed on many discontinuous storage spaces. When reading and writing some of this data, it is random read and write. When starting up, starting a large program, the computer needs to read a large number of small files, and these files are not stored continuously, which also belongs to the range of random read.

[0050] In an application, for the sequential read operation of data in a block device, the storage system can perform pre-reading and the like to improve the access performance of the sequential read request. Pre-reading is a technology for improving the performance of sequential reading proposed for sequential reading, which is used to narrow the huge efficiency gap between the storage device and the application program. After receiving the request of the sequential read, the storage system can pre-store the data to be read in the block device into the memory, that is, the data in the corresponding interval of the block device is read and temporarily stored in the memory, and then the related data is provided from the memory when the request for accessing the data comes. Pre-reading improves the access rate of the sequential read request. When implementing pre-reading, the storage system needs to accurately identify the next position to be read. At present, based on the sequential read identification of the block device, the basic method is to determine a single sequential access point according to whether the positions of the IO requests occurring before and after are continuous, that is, for the sequential read access of the block device, the data of the corresponding position is pre-read according to the access order of the sequential read.

[0051] However, this method cannot cope with the mixed business scenario of random read and sequential read, because random read cannot be predicted, so the next access position cannot be known; the current scheme cannot identify multiple sequential read access points; and in the scenario of multi-path access to the storage system, the order of the sequential requests of the client arriving at the storage system will change, which will also cause the subsequent access position to be unable to be identified. That is, when the client accesses the data of the block device, if it is not simply a single sequential read, but a mixture of multiple situations, the current scheme will not be able to accurately identify the subsequent access position, resulting in low access efficiency.

[0052] To solve this problem, the present application provides a sequential access interval identification method. When the client accesses the data saved in the block device of the storage system, the method provided by the present application can identify multiple sequential access intervals of the block device. Based on the identified sequential access interval, the storage system can perform pre-reading and the like to improve the access performance of the sequential read request. The client includes but is not limited to various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things device can be a smart speaker, a smart television, a smart air conditioner, a smart vehicle device, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc. The server can be implemented by an independent server or a server cluster composed of multiple servers.

[0053] In order for those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the drawings and specific embodiments.

[0054] Based on the above problems, the application provides a block device sequential read access recognition method based on a sliding interval mode. The method discards specific IO request association, divides IO access positions statistically, recognizes sequential access points, and then slides in an interval form. The method can support recognition of multiple sequential read access points, has no strict requirement on the sequential order of sequential requests, can be applied to a sequential read and random read mixed business scenario, and greatly reduces the influence on the storage system performance due to the statistical recognition.

[0055] Figure 1 A flowchart of a sequential access interval recognition method provided by an embodiment of the application is shown in FIG. 1. The method includes the following steps. Figure 1

[0056] S10: Obtain a storage interval corresponding to a read request in a block device.

[0057] The application manages read access information of a storage system virtual block device. When a client accesses data in a block device, the client sends a read request. The storage system obtains a storage interval corresponding to the read request sent by the client in the block device. The storage interval of the block device is continuous. When the client sends a sequential read request, the storage interval where the data to be read by the client is predicted, and then pre-reading is performed. The data in the corresponding storage interval is saved in the memory of the storage system. When the client reads the corresponding data, the client does not need to access the block device (reading data from the block device is slow and needs to wait), thereby speeding up the entire access process.

[0058] S11: Determine whether a sequential access interval intersects with a storage interval corresponding to a read request. If no, go to step S12. If yes, go to step S13.

[0059] S12: Establish a new sequential access interval according to the storage interval corresponding to the read request to pre-read data in the new sequential access interval.

[0060] S13: Slide the corresponding sequential access interval in sequence to pre-read data in the sequential access interval after sliding.

[0061] ​The sequential access interval is a storage interval in the block device. For the read request information to be processed, if the storage interval corresponding to the read request is contained in the existing sequential access interval, the read request is merged into the existing sequential access interval, that is, the sequential access interval corresponding to the read request and the sequential access interval intersect with each other. Then, the position of the sequential access interval is slid to perform the next pre-reading, that is, pre-reading is performed once after each sliding, and then the read request of the same sequential reading accesses again, and the sequential access interval is slid again. Generally, the set sequential access interval is greater than the storage interval corresponding to the read request, but the specific size of each interval is not limited, and the sliding distance of the sequential access interval is also not limited. The sliding distance can be set to a fixed distance, and in the specific implementation, the sliding distance can also be set according to the center position of the storage interval corresponding to the read request and the center position of the sequential access interval. In addition, when two independent sequential access intervals intersect due to sliding and the proportion of the intersection part reaches a certain threshold, the two sequential access intervals can be merged, and then the whole is slid.

[0062] The following provides an example of sliding a sequential access interval, which is defined by SEQ(off, LEN), where off is the starting position of the interval, and LEN is the length of the sequential access interval. The length LEN is fixed, and off is slid with the update of the sequential access interval. The storage interval corresponding to the read request is defined by R(off, len), where off is the starting position of the interval, and len is the length of the interval. When a read request accesses information R(off, len) and intersects with an existing sequential access interval SEQ(off, LEN), it is considered that the read request belongs to the sequential access interval. The middle value Rc of R(off, len) is taken, the middle value SEQc of SEQ(off, LEN) is taken, the weighted middle value of Rc and SEQc is calculated as the middle value of the sequential access interval after sliding, and a new SEQ1(off, LEN) is calculated. Here, the weighting value can be set according to the actual situation, and then the distance between the middle values Rc and SEQc is weighted calculated with the set weighting value to obtain the weighted middle value. One of the simpler ways is to take the middle value of Rc and SEQc as the middle value of the sequential access interval after sliding. In addition, for each sequential access interval, the sampling values of the latest N center points are recorded at a certain period. When the latest N center point sampling values of a sequential access interval are sequentially increased, it is determined that the sequential access interval is in an effective state (a real sequential access interval), otherwise it is determined to be in a recognition state (a pre-estimated sequential access interval).

[0063] Figure 2 A schematic diagram of the sequential access interval sliding provided for the embodiments of the present application; Figure 2The identification process of the sequential access interval is embodied, and each access point of the read request is recorded in the block device 10. The random access points (access point 1, access point 2, access point 4, access point 3) generated by random reading are not updated with relevant access information, that is, the access point generated by the new read request does not have a corresponding relationship with the access point, so the access point will only be recorded for a short time and cannot form a real sequential access interval. For a sequential access interval (sequential access interval 1, sequential access interval 2) generated by a sequential read, a large number of read requests will be updated (the access point of the new read request is included in the sequential access interval) in a short time, and the corresponding sequential access interval will exist and slide with the sliding of the sequential read request.

[0064] If there is no sequential access interval containing the storage interval corresponding to the read request at present, it means that the read request is a random read or a new sequential read. If it is a new sequential read, a new sequential access interval needs to be created according to the read request information, and then the relevant data of the new sequential read is pre-read. If the read request is a random read, it needs to be filtered. The filtering method is not limited, and whether the data amount of a single read request is large enough can be judged. Generally, the data amount of a random read is small, while the data amount of a sequential read is large, so a threshold value can be set. If the access data amount of the read request is less than the threshold value, the read request is not processed, that is, pre-reading is not performed. The above example is to judge the data amount accessed by a word read request. Another example is as follows. If there is no intersection between the sequential access interval and the storage interval corresponding to the read request at present, an estimated sequential access interval is established, and then the estimated sequential access interval is slid according to the new read request. If the estimated sequential access interval slides in order in the storage interval of the block device, the estimated sequential access interval is regarded as a real sequential access interval. This example is to judge the storage intervals corresponding to multiple read requests. If the storage intervals corresponding to the read requests slide in order in the block device, it is judged that these read requests belong to the same sequential read, and the estimated sequential access interval is regarded as a real sequential access interval. After that, pre-reading can be started. Specifically, the center point of the estimated sequential access interval can be recorded at a certain period. When multiple center points show sequential growth, it is considered to be an effective sequential access interval. It should be noted that the number of times the estimated sequential access interval slides in order before being regarded as a real sequential access interval is not limited here, and can be set according to the actual situation. In a specific implementation, when the R(off, len) corresponding to a read request access information does not intersect with all existing sequential access intervals SEQ(off, LEN), the middle value Rc of R(off, len) is taken as the middle value, and a new SEQ(off, LEN) is generated by taking Rc as the middle value, which is used as a new sequential access interval for tracking.

[0065] In addition, when a sequential access interval is not updated for a long time, the information of the sequential access interval can be cleared. The method provided by the application is based on volume access information management and effective sequential access interval identification process. The sequential read identification process is a statistical analysis process of volume access information in a short time. When a volume is accessed, corresponding volume access information is established. The volume access information structure contains the identification of the volume and records the sequential access interval information of the volume being identified. The sequential access interval information is statistical information in a short time. When a sequential access interval is not updated with new read request information for a certain time, the interval is invalid, and the corresponding sequential access interval is destroyed. When all sequential access intervals in a volume are destroyed and the volume is not accessed for a certain time, the tracking is stopped, and the corresponding volume access information is destroyed. The key point of the application is to identify the effective sequential access interval by limiting the life cycle of the sequential access interval (clearing the sequential access interval when it is not updated for a long time), dynamically sliding the sequential access interval, and sequentially judging the sampling values of multiple center points. Through this method, the order of the read request reaching the storage system from the client can be independent, and the mixed scenario of sequential read and random read can be supported. Multiple sequential access intervals can be identified. Since it is a sequential identification in a statistical sense, the consumption of storage system resources can be reduced. The method can also be applied to the scenario where the client uses multiple paths.

[0066] The sequential access interval identification method provided by the embodiment of the application is that the client sends a read request to access the data of the corresponding storage interval in the block device. After the storage system obtains the storage interval corresponding to the read request in the block device, the sequential access interval and the storage interval corresponding to the read request are compared. If there is no intersection between the current sequential access interval and the storage interval corresponding to the read request, a new sequential access interval is established according to the storage interval corresponding to the read request to pre-read the data in the new sequential access interval. If there is an intersection between the current sequential access interval and the storage interval corresponding to the read request, the corresponding sequential access interval is sequentially slid to pre-read the data in the sequential access interval after sliding. The sequential access interval is a storage interval in the block device. The identification method provided by the embodiment of the application can pre-read the data related to sequential read by sliding the sequential access interval when there is a mixed business scenario of random read and sequential read, and is not affected by random read. In addition, by establishing multiple sequential access intervals, multiple sequential reads can also be implemented at the same time.

[0067] The sliding distance of the sequential access interval is not limited in the above embodiments. The embodiments of the present application provide a solution. If the sequential access interval currently intersects the storage interval corresponding to the read request, the corresponding sequential access interval is sequentially slid to pre-read the data in the sequential access interval after sliding, and before that, the solution further comprises: obtaining a first intermediate position of the sequential access interval and a second intermediate position of the storage interval corresponding to the read request; and performing weighted calculation on the first intermediate position and the second intermediate position by using a preset weighting value to obtain a weighted intermediate position. If the sequential access interval currently intersects the storage interval corresponding to the read request, the corresponding sequential access interval is sequentially slid to pre-read the data in the sequential access interval after sliding, which comprises: sliding the corresponding sequential access interval according to the weighted intermediate position to take the weighted intermediate position as the intermediate position of the corresponding sequential access interval. In addition, as a preferred embodiment, the weighted calculation on the first intermediate position and the second intermediate position by using the preset weighting value to obtain the weighted intermediate position comprises: taking the intermediate position of the first intermediate position and the second intermediate position as the weighted intermediate position.

[0068] That is, the sequential access interval is defined by SEQ(off, LEN), and the storage interval corresponding to the read request is defined by R(off, len). When the information R(off, len) accessed by a read request intersects an already existing sequential access interval SEQ(off, LEN), the read request is considered to belong to the sequential access interval, the middle value SEQc (the first intermediate position) of SEQ(off, LEN) is taken, the middle value Rc (the second intermediate position) of R(off, len) is taken, the weighted middle value of Rc and SEQc is calculated as the middle value of the sequential access interval after sliding, and a new SEQ1(off, LEN) is calculated. The weighting value can be set according to actual conditions, and then the distance between the middle values Rc and SEQc is weighted calculated by using the set weighting value to obtain the weighted middle value. In one relatively simple way, the middle value of Rc and SEQc is taken as the middle value of the sequential access interval after sliding.

[0069] The solution provided by the embodiments of the present application calculates the middle position of the sequential access interval after sliding by using the first intermediate position of the sequential access interval and the second intermediate position of the storage interval corresponding to the read request. For example, the middle value of Rc and SEQc is directly taken as the middle value of the sequential access interval after sliding. The sequential access interval can be slid relatively smoothly on the basis of adapting to the storage interval corresponding to the read request.

[0070] To filter out random read access requests, the embodiment of the present application provides a solution. If there is no intersection between the current sequential access interval and the storage interval corresponding to the read request, a new sequential access interval is established according to the storage interval corresponding to the read request to pre-read the data in the new sequential access interval. The solution includes: if there is no intersection between the current sequential access interval and the storage interval corresponding to the read request, a predicted sequential access interval is established; the predicted sequential access interval is slid according to the new read request; and if the predicted sequential access interval is sequentially slid in the storage interval of the block device, the predicted sequential access interval is taken as the real sequential access interval. In the embodiment, when there is no intersection between the current sequential access interval and the storage interval corresponding to the read request, only one predicted sequential access interval is established. At this time, no pre-reading is performed. If the predicted sequential access interval is sequentially slid in the storage interval of the block device after the predicted sequential access interval is updated according to the new read request, it is indicated that the series of read requests are sequential reads, and the data in the sequential access interval can be pre-read.

[0071] As a preferred embodiment, if there is no intersection between the current sequential access interval and the storage interval corresponding to the read request, the establishment of the predicted sequential access interval includes: the predicted sequential access interval is established according to the middle position of the storage interval corresponding to the read request, so that the middle position of the predicted sequential access interval is the middle position of the storage interval corresponding to the read request. That is, when the R(off, len) corresponding to the information accessed by a read request does not intersect with all existing sequential access intervals SEQ(off, LEN), the middle value Rc of R(off, len) is taken as the middle value to calculate and generate the predicted sequential access interval.

[0072] In applications, multiple sequential access intervals may intersect. When pre-reading, the intersecting part is repeatedly read. Therefore, if there is no intersection between the current sequential access interval and the storage interval corresponding to the read request, a new sequential access interval is established according to the storage interval corresponding to the read request to pre-read the data in the new sequential access interval; and if there is an intersection between the current sequential access interval and the storage interval corresponding to the read request, the corresponding sequential access interval is sequentially slid to pre-read the data in the sequentially slid sequential access interval, the solution further includes: when multiple independent sequential access intervals intersect and the proportion of the intersecting part reaches a certain threshold, the multiple corresponding sequential access intervals are merged. Merging multiple repeated sequential access intervals can avoid repeated pre-reading of a storage interval in the block device.

[0073] When a sequential access interval has not been slid for a long time, it indicates that the sequential read has been completed, and the corresponding sequential access interval needs to be deleted. Therefore, if there is no sequential access interval intersecting the storage interval corresponding to the read request at present, a new sequential access interval is established according to the storage interval corresponding to the read request to pre-read the data in the new sequential access interval; and if there is a sequential access interval intersecting the storage interval corresponding to the read request at present, the corresponding sequential access interval is slid in sequence to pre-read the data in the sequential access interval after sliding, and then the following steps are further included: if the sequential access interval has not been slid for a preset time length since the last activity time of the sequential access interval, the corresponding sequential access interval is deleted; wherein the last activity time is generated when the sequential access interval is established, and the last activity time is updated with the current time of sliding after the sequential access interval is slid. That is, the last activity time of the sequential access interval needs to be updated when the sequential access interval is generated and updated and slid.

[0074] In the above embodiment, the identification method of the sequential access interval is described in detail, and the application further provides an embodiment of an identification device of the sequential access interval. It should be noted that the embodiments of the device part are described from two angles, one is based on the functional module angle, and the other is based on the hardware angle.

[0075] Based on the functional module angle, the embodiment provides an identification device of a sequential access interval, Figure 3 The structural diagram of the identification device of the sequential access interval provided by the embodiment of the application is shown in Figure 3 As shown in the figure, the device includes:

[0076] The first acquisition module 11 is configured to acquire the storage interval corresponding to the read request in the block device;

[0077] The establishment module 12 is configured to, if there is no sequential access interval intersecting the storage interval corresponding to the read request at present, establish a new sequential access interval according to the storage interval corresponding to the read request to pre-read the data in the new sequential access interval; wherein the sequential access interval is a storage interval in the block device.

[0078] The sliding module 13 is configured to, if there is a sequential access interval intersecting the storage interval corresponding to the read request at present, slide the corresponding sequential access interval in sequence to pre-read the data in the sequential access interval after sliding.

[0079] Since the embodiments of the device part correspond to the embodiments of the method part, the embodiments of the device part are described with reference to the description of the embodiments of the method part, which will not be described here.

[0080] As a preferred implementation, the identification device of the sequential access interval further includes:

[0081] The second obtaining module is configured to, if the current sequential access interval intersects with the storage interval corresponding to the read request, obtain a first intermediate position of the sequential access interval and a second intermediate position of the storage interval corresponding to the read request before sequentially sliding the corresponding sequential access interval to pre-read data in the sequentially slid sequential access interval.

[0082] The weighting module is configured to perform weighting calculation on the first intermediate position and the second intermediate position by using a preset weighting value to obtain a weighted intermediate position.

[0083] The merging module is configured to, if the current sequential access interval does not intersect with the storage interval corresponding to the read request, establish a new sequential access interval according to the storage interval corresponding to the read request to pre-read data in the new sequential access interval, and if the current sequential access interval intersects with the storage interval corresponding to the read request, sequentially slide the corresponding sequential access interval to pre-read data in the sequentially slid sequential access interval, and then, when a plurality of independent sequential access intervals intersect and a proportion of the intersecting part reaches a certain threshold, merge the corresponding plurality of sequential access intervals.

[0084] The deleting module is configured to, if the current sequential access interval does not intersect with the storage interval corresponding to the read request, establish a new sequential access interval according to the storage interval corresponding to the read request to pre-read data in the new sequential access interval, and if the current sequential access interval intersects with the storage interval corresponding to the read request, sequentially slide the corresponding sequential access interval to pre-read data in the sequentially slid sequential access interval, and then, if the sequential access interval is not slid within a preset time period from a last activity time of the sequential access interval, delete the corresponding sequential access interval, where the last activity time is generated when the sequential access interval is established, and is updated to a current time of the sliding after the sequential access interval is slid.

[0085] The sequential access interval identification device provided in the embodiment has the same beneficial effects as the method.

[0086] From the perspective of hardware, the embodiment provides another sequential access interval identification device, Figure 4 The structural diagram of the sequential access interval identification device provided in another embodiment of the application is shown in Figure 4 The sequential access interval identification device includes a memory 20 configured to store a computer program.

[0087] The processor 21 is configured to implement the steps of the method for identifying the sequential access section when executing the computer program.

[0088] The apparatus for identifying the sequential access section can include, but is not limited to, a smartphone, a tablet computer, a notebook computer, a desktop computer, and the like.

[0089] The processor 21 can include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 21 can be implemented in at least one of a hardware form of a Digital Signal Processor (DSP), a Field-Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), and the like. The processor 21 can also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a Central Processing Unit (CPU). The coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 21 can be integrated with a Graphics Processing Unit (GPU) for rendering and drawing content to be displayed on the display screen. In some embodiments, the processor 21 can further include an Artificial Intelligence (AI) processor for processing machine learning-related computing operations.

[0090] The memory 20 can include one or more computer-readable storage media that can be non-transitory. The memory 20 can further include a high-speed random access memory, and a nonvolatile memory such as one or more disk storage devices, flash storage devices. In the present embodiment, the memory 20 is at least used to store the following computer program 201, wherein the computer program is loaded and executed by the processor 21, and can implement the related steps of the method for identifying the sequential access section disclosed in any of the preceding embodiments. In addition, the resources stored by the memory 20 can further include an operating system 202 and data 203, and the like, and the storage mode can be temporary storage or permanent storage. The operating system 202 can include Windows, Unix, Linux, and the like. The data 203 can include, but is not limited to, data related to the method for identifying the sequential access section, and the like.

[0091] In some embodiments, the apparatus for identifying the sequential access section can further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.

[0092] Those skilled in the art can understand that the structure shown in the figure does not constitute a limitation on the identification device of the sequential access interval, and can include more or fewer components than the figure.

[0093] The identification device of the sequential access interval provided by the embodiment of the present application comprises a memory and a processor. When the processor executes the program stored in the memory, the following method can be realized: the sequential access interval identification method.

[0094] The identification device of the sequential access interval provided by the embodiment corresponds to the above method, and therefore has the same beneficial effects as the above method.

[0095] Finally, the present application also provides an embodiment corresponding to a computer readable storage medium. The computer readable storage medium stores a computer program. When the computer program is executed by a processor, the steps described in the above method embodiment are realized.

[0096] It can be understood that if the method in the above embodiment is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and executes all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0097] The computer readable storage medium provided by the embodiment corresponds to the above method, and therefore has the same beneficial effects as the above method.

[0098] The sequential access interval identification method, device and medium provided by the present application are described in detail above. The embodiments in the specification are described in a progressive manner, and each embodiment mainly describes the differences from other embodiments. The same or similar parts of each embodiment can be referred to. For the device disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the related parts can be referred to the method part. It should be pointed out that, for ordinary skilled in the art, without departing from the principles of the present application, some improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.

[0099] It also needs to be explained that in the present specification, the relational terms such as first and second and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the aforesaid element.

Claims

1. A method of identifying sequential access extents, characterized by, include: Retrieve the storage range in the block device corresponding to the read request; If there is no current sequential access interval that intersects with the storage interval corresponding to the read request, then a new sequential access interval is established based on the storage interval corresponding to the read request to pre-read the data in the new sequential access interval; wherein, the sequential access interval is a storage interval in the block device; If there is an intersection between the current sequential access interval and the storage interval corresponding to the read request, then the corresponding sequential access interval is slid sequentially to pre-read the data in the slid sequential access interval; The step of, if there is currently an intersection between the sequential access interval and the storage interval corresponding to the read request, and before sliding the corresponding sequential access interval in order to pre-read the data in the sequential access interval after sliding, further includes: obtaining the first intermediate position of the sequential access interval and the second intermediate position of the storage interval corresponding to the read request; and performing a weighted calculation on the first intermediate position and the second intermediate position with a preset weighting value to obtain a weighted intermediate position. If there is currently an intersection between the sequential access interval and the storage interval corresponding to the read request, then sliding the corresponding sequential access interval in sequence to pre-read the data in the sequential access interval after sliding includes: sliding the corresponding sequential access interval according to the weighted middle position to take the weighted middle position as the middle position of the corresponding sequential access interval; Specifically, the most recent N center point sampling values ​​of the sequential access interval are recorded at a certain period; when the most recent N center point sampling values ​​of the sequential access interval increase sequentially, the sequential access interval is determined to be in a valid state; otherwise, it is determined to be in a state of recognition.

2. The method of claim 1, wherein If there is currently no sequential access interval intersecting with the storage interval corresponding to the read request, then establishing a new sequential access interval based on the storage interval corresponding to the read request to pre-read data in the new sequential access interval includes: If there is no intersection between the current sequential access interval and the storage interval corresponding to the read request, then an estimated sequential access interval is established; Slide the estimated order access interval according to the new read request; If the estimated sequential access interval slides sequentially within the storage range of the block device, then the estimated sequential access interval is taken as the actual sequential access interval.

3. The method of claim 1 or 2, wherein If no sequential access interval intersects with the storage interval corresponding to the read request, a new sequential access interval is established based on the storage interval corresponding to the read request to pre-read data in the new sequential access interval; and if a sequential access interval intersects with the storage interval corresponding to the read request, the corresponding sequential access interval is slid sequentially to pre-read data in the slid sequential access interval, the method further includes: When multiple independent sequential access intervals intersect and the proportion of the intersecting portion reaches a certain threshold, the corresponding multiple sequential access intervals are merged.

4. The method of claim 3, wherein the new sequential access interval is established according to the storage interval corresponding to the read request to pre-read data in the new sequential access interval; and the sequential access interval corresponding to the read request intersects with the storage interval corresponding to the read request, the sequential access interval corresponding to the read request is sequentially slid to pre-read data in the sequential access interval after the sliding, and the method further comprises: if the sequential access interval is not slid within a preset time length from a last active time of the sequential access interval, the sequential access interval corresponding to the read request is deleted, wherein the last active time is generated when the sequential access interval is established, and the last active time is updated with a current time of the sliding after the sequential access interval is slid.

5. The method of claim 2, wherein the establishing the estimated sequential access interval if the sequential access interval does not currently intersect with the storage interval corresponding to the read request comprises: the estimated sequential access interval is established according to a middle position of the storage interval corresponding to the read request, so that the middle position of the estimated sequential access interval is the middle position of the storage interval corresponding to the read request.

6. The method of claim 1, wherein the weighted middle position is obtained by weighting the first middle position and the second middle position with a preset weighting value, and the obtaining the weighted middle position comprises: the weighted middle position is obtained by weighting the first middle position and the second middle position with a preset weighting value, and the obtaining the weighted middle position comprises:

7. An identification device for sequentially accessing intervals, characterized in that the weighted middle position is obtained by weighting the first middle position and the second middle position with a preset weighting value, and the obtaining the weighted middle position comprises: a first obtaining module, configured to obtain a storage interval corresponding to a read request in a block device; the sequential access interval is established according to the storage interval corresponding to the read request to pre-read data in the new sequential access interval; and the sequential access interval corresponding to the read request intersects with the storage interval corresponding to the read request, the sequential access interval corresponding to the read request is sequentially slid to pre-read data in the sequential access interval after the sliding, and the method further comprises: the sequential access interval corresponding to the read request is sequentially slid according to the weighted middle position to take the weighted middle position as a middle position of the sequential access interval corresponding to the read request; and the sequential access interval corresponding to the read request is sequentially slid according to the weighted middle position to take the weighted middle position as a middle position of the sequential access interval corresponding to the read request; and ​ The latest N times of center point sampling values are recorded in the sequential access interval according to a certain period; when the latest N times of center point sampling values of the sequential access interval are sequentially increased, the sequential access interval is determined as an effective state, otherwise, the sequential access interval is determined as a recognition state.

8. An identification device for sequentially accessing intervals, characterized in that The computer program is stored in the memory and executed by the processor. The processor is configured to execute the computer program to implement the steps of the sequential access interval recognition method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer program is stored in the computer readable storage medium and executed by the processor to implement the steps of the sequential access interval recognition method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Distributed cluster volume pre-reading method, system and device and computer medium

    CN109976679A

  • Adaptive readahead cache manager based on detected active streams of read commands

    US20200285582A1