Method, device and equipment for disk pre-reading, medium and program product

By adjusting the amount of pre-read data of the disk, based on the load information and read and write request frequency, the problem of degradation of disk performance under high load is solved, and stable response and efficient performance to the Linux system is achieved.

CN119987672APending Publication Date: 2025-05-13镁佳(北京)科技有限公司
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510109246.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-23
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

Under high operating system load, a large number of requests arrive at the disk at the same time may cause the disk to fail to respond to all read and write requests in time, resulting in a significant decline in the performance of the Linux operating system.

Method used

By obtaining the load information of the disk and the read and write request frequency, adjusting the amount of pre-read data of the disk to optimize the read and write operations of the disk. The specific steps include obtaining load information, detecting the frequency of read and write requests, and adjusting the amount of read-pre-data based on this information to control the read and write operations of the disk.

Benefits of technology

Effectively control the read and write frequency of the disk, reduce the impact of high load on disk performance, ensure that the Linux system can respond to read and write requests in a timely manner, and improve the stability and efficiency of the disk under various load conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119987672A_ABST
    Figure CN119987672A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of disk optimization, and discloses a disk pre-reading method, device and equipment, a medium and a program product, and the method comprises the steps: obtaining the load information of a disk, and adjusting the pre-reading data volume of the disk based on the load information; the read-write request frequency of the disk is detected, and the pre-read data volume is adjusted again based on the read-write request frequency; and controlling the read-write operation of the disk based on the adjusted pre-read data volume. According to the method, the pre-read data volume of the disk is adjusted for the first time through the load information of the disk, the read-write request frequency of the disk is detected, and the pre-read data volume of the disk is adjusted again through the read-write request frequency, so that the pre-read data volume is optimized, the read-write frequency of the disk can be effectively controlled, and the influence of high load on the performance of the disk is reduced; according to the method, the read-write request of the linux system can be responded in time, the problem that the performance of the disk is reduced under high load is effectively solved, and the stability and the high efficiency of the disk under various load conditions in the linux system are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of disk optimization, and in particular to a method, device, equipment, medium and program product for disk pre-reading. Background Art

[0002] In the Linux operating system environment, the disk pre-reading method can be to predict the data that the application may access in the future and load the predicted data into the memory in advance, thereby improving the overall response speed and performance of the Linux operating system. The pre-reading mechanism in the Linux operating system kernel, such as Readahead, can be used to reasonably schedule disk read operations by analyzing the file access pattern and history.

[0003] However, this pre-reading method may face some problems under high load. When the operating system is under high load, a large number of requests arrive at the disk at the same time, which may cause the disk to be unable to respond to all read and write requests in time, which may cause a significant drop in the performance of the Linux operating system. Summary of the invention

[0004] In view of this, the present invention provides a method, apparatus, device, medium and program product for disk pre-reading to solve the problem that when the operating system is under high load, a large number of requests arrive at the disk at the same time, which may cause the disk to be unable to respond to all read and write requests in time, and may cause the performance of the Linux operating system to be significantly reduced.

[0005] In a first aspect, the present invention provides a method for disk pre-reading, the method comprising: obtaining disk load information, and adjusting the amount of pre-read data of the disk based on the load information; detecting the read and write request frequency of the disk, and adjusting the amount of pre-read data again based on the read and write request frequency; and controlling the read and write operations of the disk based on the adjusted amount of pre-read data.

[0006] In an optional embodiment, obtaining the load information of the disk includes: obtaining the read and write request queue length and the read and write request processing time of the disk; determining the load index of the disk based on the read and write request queue length and the read and write request processing time, and the load information includes the load index; if the load index is higher than a first load threshold and the load index is lower than a second load threshold, determining that the disk is at a second load level.

[0007] In an optional embodiment, obtaining the read / write request queue length and read / write request processing time of the disk includes: obtaining the read / write request data of the disk within a preset time range; calculating the read / write request queue length and the read / write request processing time based on the read / write request data; if the sampling number of obtaining the read / write request data is greater than a preset sampling threshold, and the average value of the read / write request queue length is greater than a queue length threshold, increasing the frequency of obtaining the read / write request queue length or the read / write request processing time.

[0008] In an optional embodiment, the aforementioned method for disk pre-reading also includes: recording the read and write request queue length and the read and write request processing time in a log file; generating a load change trend of the disk based on the content recorded in the log file; and adjusting the amount of data in the disk buffer based on the load change trend.

[0009] In an optional embodiment, the method comprises: obtaining the load information of the disk, adjusting the pre-read data amount of the disk based on the load information; detecting the read and write request frequency of the disk, and adjusting the pre-read data amount again based on the read and write request frequency, including: if the load information indicates that the disk is at a first load level, increasing the pre-read data amount; if the load information indicates that the disk is at a third load level, reducing the pre-read data amount; after adjusting the pre-read data amount based on the load information, if the read and write request frequency is greater than a preset read and write request frequency threshold, reducing the pre-read data amount.

[0010] In an optional implementation, controlling the read and write operations of the disk based on the adjusted pre-read data amount includes: if the adjusted pre-read data amount indicates that the disk is at a third load level, controlling the disk to process high priority read and write requests.

[0011] In a second aspect, the present invention provides a device for disk pre-reading, the device comprising: a first adjustment module, used to obtain disk load information, and adjust the pre-read data volume of the disk based on the load information; a second adjustment module, used to detect the read and write request frequency of the disk, and adjust the pre-read data volume again based on the read and write request frequency; a processing module, used to control the read and write operations of the disk based on the adjusted pre-read data volume.

[0012] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the method for disk pre-reading of the above-mentioned first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0013] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method for disk pre-reading of the first aspect or any corresponding embodiment thereof.

[0014] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the method for disk pre-reading of the first aspect or any corresponding embodiment thereof.

[0015] Through the disk load information, the disk pre-read data volume is initially adjusted, the disk read and write request frequency is detected, and the disk pre-read data volume is adjusted again according to the read and write request frequency to optimize the pre-read data volume. This can effectively control the disk read and write frequency and reduce the impact of high load on disk performance. It can respond to the read and write requests of the Linux system in a timely manner, effectively solving the problem of disk performance degradation under high load, and significantly improving the stability and efficiency of the disk under various load conditions in the Linux system. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0017] Figure 1 A schematic diagram of a process flow for disk pre-reading according to an embodiment of the present invention is shown;

[0018] Figure 2 A schematic structural diagram of a device for disk pre-reading according to an embodiment of the present invention is shown;

[0019] Figure 3 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0020] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0021] The pre-reading method in the related art may face some problems under high load. When the operating system is under high load, a large number of requests arrive at the disk at the same time, which may cause the disk to be unable to respond to all read and write requests in time, which may cause the performance of the Linux operating system to drop significantly.

[0022] According to an embodiment of the present invention, a method embodiment for disk pre-reading is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0023] In this embodiment, a method for disk pre-reading is provided, which can be used in various terminals, such as desktop computers, notebook computers, or tablet computers. Figure 1 FIG. 4 shows a schematic diagram of a process for disk pre-reading according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0024] Step S101, obtaining disk load information, and adjusting the disk pre-read data amount based on the load information.

[0025] In this step, the disk is a medium for storing data, and a mechanical hard disk (HDD) is a specific type of device that uses a disk for data storage. The method for disk pre-reading provided by the present invention can also be applied to a mechanical hard disk. A disk is a mechanical device for storing data. It consists of a plurality of circular metal disks, each of which has a plurality of concentric tracks, and each track is composed of a plurality of sectors. The reading and writing process of the disk involves the rotation of the disk, the positioning of the head, and the management of the physical storage unit. The head is responsible for reading or writing data, and is moved on the surface of the disk by a mechanical arm to be positioned on the correct track. When the disk rotates, the head accesses the data through the cycle of the disk rotation.

[0026] A mechanical hard disk (HDD) is a storage device that uses this disk technology. It usually consists of a disk, a magnetic head, a disk spindle, a control motor, a magnetic head controller, a data converter, an interface, and a cache. In a mechanical hard disk, all the disks are fixed on a rotating shaft, which is the disk spindle. The disk rotates at a speed of thousands to tens of thousands of revolutions per minute, and the magnetic head can read and write data at a specified location on the disk. Mechanical hard disks are logically divided into tracks, cylinders, and sectors to organize and manage data.

[0027] Obtaining disk load information includes obtaining disk performance data over a period of time, such as input and output delays, read and write request data queue lengths, and the amount of uncompleted read and write request data. Based on these performance data, the current disk load status can be determined, such as low load status, medium load status, or high load status.

[0028] If the disk is under low load, the amount of pre-read data can be appropriately increased to improve the efficiency of subsequent reading; if the disk is under high load, the amount of pre-read data can be reduced to avoid wasting resources due to excessive pre-read operations, which in turn increases the burden on the disk. For example, when it is detected that the disk input and output waiting time exceeds 10 milliseconds and the number of unfinished read and write requests is greater than 50, the disk is considered to be under high load and the amount of pre-read data is reduced from 4MB to 2MB.

[0029] Step S102, detecting the read and write request frequency of the disk, and adjusting the pre-read data amount again based on the read and write request frequency.

[0030] In this step, the read and write request frequency of the disk can be the number of read and write requests sent to the disk per unit time. High-frequency read and write requests represent higher load pressure. The aforementioned load information and read and write request frequency information can be obtained by calling the Linux kernel interface.

[0031] Specifically, the current number of read and write requests can be obtained every 1 second to calculate the average read and write request frequency per unit time. If the number of read and write requests per second exceeds 200, the amount of pre-read data can be reduced again to ensure that the disk can maintain a stable response speed under high load.

[0032] The optimization of the amount of pre-read data depends not only on the current load status, but also on the actual needs of the application. The data blocks required later can be predicted based on historical data and the current load status, and the data can be pre-read into the memory cache. For example, in a file system, if multiple consecutive requests are sequentially reading the same large file, it can be inferred that the user may be processing part of the file, so the subsequent part of the file can be pre-read in advance to reduce the waiting time for future actual requests.

[0033] Step S103, controlling the read and write operations of the disk based on the adjusted pre-read data amount.

[0034] In this step, based on the adjusted pre-read data amount, the disk read and write operations are controlled, including predicting the data blocks that may be needed and reading the required data blocks from the disk to the cache when the pre-read operation is triggered. When a read or write request arrives, the data is searched from the cache. If the cache hits, the data is directly returned to the requester. If the cache misses, the disk input and output operations are performed and the cache is updated.

[0035] The method for disk pre-reading provided in this embodiment performs an initial adjustment of the disk pre-read data volume through disk load information, detects the read and write request frequency of the disk, and adjusts the disk pre-read data volume again through the read and write request frequency to optimize the pre-read data volume. This can effectively control the disk read and write frequency, reduce the impact of high load on disk performance, and respond to the read and write requests of the Linux system in a timely manner, effectively solving the problem of disk performance degradation under high load, and significantly improving the stability and efficiency of the disk under various load conditions in the Linux system.

[0036] In some optional implementations, obtaining the load information of the disk includes: obtaining the read and write request queue length and the read and write request processing time of the disk; determining the load index of the disk based on the read and write request queue length and the read and write request processing time, the load information including the load index; if the load index is higher than a first load threshold and the load index is lower than a second load threshold, determining that the disk is at a second load level.

[0037] In this embodiment, the load index E can be calculated by the following formula:

[0038] E=Q*T

[0039] The average length of the read and write request queue is Q, and the average read and write request processing time is T. If the load index E is higher than the first load threshold E0, and the load index E is lower than the second load threshold E1, it is determined that the disk is at the second load level, E0 is the low load threshold, and E1 is the high load threshold.

[0040] Based on the load index, the load level of the disk can be divided into: the first load level L0, the second load level L1 and the third load level L2. Specifically, if the load index of the target disk is less than or equal to the first load threshold E0, the target disk is at the first load level L0; if the load index of the target disk is higher than the first load threshold E0, and lower than or equal to the second load threshold E1, the target disk is at the second load level L1; if the load index of the target disk is higher than the second load threshold E1, the target disk is at the third load level L2. This hierarchical load level division method can more finely manage the amount of pre-read data under different load conditions.

[0041] If the load level L≥Lmax, the amount of pre-read data can be reduced, where Lmax represents the set load level threshold. By reducing the pre-read parameter, the additional burden on the disk under high load conditions can be reduced, thereby effectively alleviating the problem of disk performance degradation.

[0042] In this way, the current load of the disk can be accurately determined, thereby providing a reliable basis for the subsequent adjustment of the pre-read data volume. The accuracy of the pre-read data volume adjustment can be improved.

[0043] In some optional implementations, the aforementioned method for disk pre-reading further includes: calculating the difference between the current load index E and the boundary value of the preset range δ1=E-E0, δ2=E-E1; determining the load level based on the absolute values ​​of the difference |δ1| and |δ2|; determining the priority of the load level based on the minimum difference; if |δ1|<|δ2| and |δ1|≤ε, the load level is the closer one of L0 or L1, where ε represents the error tolerance. This can improve the accuracy of load level division and avoid the instability caused by critical values.

[0044] In some optional embodiments, the step of determining the load level based on the absolute values ​​of the gaps |δ1| and |δ2| further includes: comparing the sizes of |δ1| and |δ2|; selecting the load level corresponding to the smallest gap as the preliminary result; and further confirming whether there is a boundary condition, if E=E0, or, if E=E0 and |δ1|=0, directly determining it as the first load level L0, otherwise determining the level according to the normal judgment rules. In this way, critical situations can be better handled to ensure the accuracy and reliability of the classification results.

[0045] In some optional implementations, obtaining the read / write request queue length and read / write request processing time of the disk includes: obtaining the read / write request data of the disk within a preset time range; calculating the read / write request queue length and the read / write request processing time based on the read / write request data; if the sampling number of obtaining the read / write request data is greater than a preset sampling threshold, and the average value of the read / write request queue length is greater than the queue length threshold, increasing the frequency of obtaining the read / write request queue length and the read / write request processing time.

[0046] In this embodiment, the preset time range may be a period of time before the current time, for example, the read and write request data of the disk in the previous hour or the previous day may be obtained. The read and write request data of the most recent N times may also be obtained. The read and write request queue length may be the sum of the queue lengths of the N data requests S1, and the read and write request processing time may be the total processing time S2 of the N data requests.

[0047] The average value Q of the read and write request queue length can be calculated by the following formula:

[0048]

[0049] Where N represents the number of times read and write request data is obtained. The average read and write request processing time T can be calculated by the following formula:

[0050]

[0051] The preset sampling threshold may be set to a minimum sampling threshold M, and the queue length threshold may be set to K1. Specific values ​​may be determined based on actual application scenarios.

[0052] You can traverse N read and write request data, accumulate the queue length of each read and write request, and sum up to get S1; accumulate the processing time of each read and write request, and sum up to get S2. Calculate Q and T based on the sum result. In the case of S1>S1max and S2>S2max, trigger an emergency warning, where S1max represents the maximum tolerable value of the total length of the read and write request queue, and S2max represents the maximum tolerable value of the total processing time of the data read and write request. In extreme cases, you can promptly discover and handle exceptions to ensure the stable operation of the Linux system.

[0053] In this way, when the sampling times for obtaining read and write request data is greater than the preset sampling threshold and the average value of the read and write request queue length is greater than the queue length threshold, the frequency of obtaining the read and write request queue length or the read and write request processing time is increased. In the case of high load, the disk status can be monitored more frequently, which can improve the response speed of the Linux system.

[0054] In some optional embodiments, the aforementioned method for disk pre-reading also includes: recording the read and write request queue length and the read and write request processing time in a log file; generating a disk load change trend based on the content recorded in the log file; and adjusting the disk buffer data volume based on the load change trend.

[0055] In this embodiment, the content recorded in the log file can be analyzed regularly, and the load change trend of the disk can be generated based on the content recorded in the log file. The log file can be read based on the preset time interval T0, and the average value Q of the read and write request queue length and the average read and write request processing time T in the log file can be counted. Based on the average value Q of the read and write request queue length and the average read and write request processing time T in the log file, a load change curve is drawn, and the load trend is determined based on the load change curve.

[0056] If the average value Q of the read / write request queue length is greater than the average value threshold of the read / write request queue length in C consecutive detections, or the average read / write request processing time T is greater than the average value threshold of the read / write request processing time in C consecutive detections, adjust the disk load policy.

[0057] Specifically, if the load trend is rising and exceeds the preset slope k, the disk buffer size is increased in advance. By dynamically adjusting the disk buffer size, more cache resources can be provided before the load increases, alleviating possible future Linux system performance degradation.

[0058] In this way, by analyzing the logs including the read and write request queue length and the read and write request processing time, we can better understand the long-term load of the disk and optimize the load management strategy.

[0059] In some optional implementations, the load information of the disk is obtained, and the pre-read data amount of the disk is adjusted based on the load information; the read and write request frequency of the disk is detected, and the pre-read data amount is adjusted again based on the read and write request frequency, including: if the load information indicates that the disk is at a first load level, the pre-read data amount is increased; if the load information indicates that the disk is at a third load level, the pre-read data amount is reduced; after adjusting the pre-read data amount based on the load information, if the read and write request frequency is greater than a preset read and write request frequency threshold, the pre-read data amount is reduced.

[0060] In this embodiment, the amount of pre-read data can be dynamically adjusted by real-time monitoring and detection of the current load of the disk. A load detection module can be introduced into the Linux operating system kernel, and the load detection module can collect and analyze the number of read and write requests and response time of the disk regularly or in real time according to a trigger event, so as to obtain the load of the disk. According to different load conditions, the amount of pre-read data can be intelligently adjusted to ensure efficient operation under different load conditions.

[0061] You can also detect the frequency of disk read and write requests. By introducing a frequency detection module, the frequency detection module monitors and records the frequency of disk read and write requests in real time, further refining the understanding of disk load. The frequency detection module can identify the occurrence of a large number of read and write requests in a short period of time, as well as the changing trend of the interval time between read and write requests. It provides accurate data support for subsequent optimization.

[0062] According to the above detection results, the amount of pre-read data is optimized. Specifically, when the disk load is detected to be light, the disk reading efficiency can be improved by increasing the amount of pre-read data and reducing the waiting time; when the disk load is detected to be high, the amount of pre-read data will be appropriately reduced to avoid excessive pre-read requests that increase the disk burden. This dynamic adjustment mechanism can ensure system performance while making reasonable use of hard disk resources.

[0063] In some optional implementations, based on the adjusted pre-read data amount, controlling the read and write operations of the disk includes: if the adjusted pre-read data amount indicates that the disk is at a third load level, controlling the disk to process high priority read and write requests.

[0064] In this embodiment, the performance degradation under high load can be further reduced by controlling the disk read and write operations. When the disk is detected to be in a high load state, the disk read and write pressure can be reduced by reducing the amount of pre-read data, adjusting the priority and order of read and write requests, etc., thereby effectively alleviating the performance degradation problem under high load. Other technical means, such as caching mechanism and task scheduling optimization, can also be combined to further improve the overall performance of the system.

[0065] Performance issues caused by high loads can be further alleviated through fine-grained control of disk read and write operations. Overall performance can be optimized by adjusting the input or output (I / O) scheduling algorithm and adjusting the input or output priority of the process. For example, when the disk load is high, high-priority read and write requests can be processed first, while some requests that can be postponed can be placed in the queue and processed after the load is reduced. In addition, technical means such as write caching can be enabled to reduce the number of direct writes to the disk and improve write efficiency by submitting data in batches.

[0066] For example, system administrators find that the disk load of the server often reaches a bottleneck during peak hours, resulting in slow application response. After the method of the present invention is introduced, pre-reading adjustment can be performed according to the real-time load situation, effectively reducing the IO waiting time and improving the overall throughput of the system and user experience.

[0067] In this embodiment, a device for disk pre-reading is also provided, and the device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made are not repeated here. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0068] This embodiment provides a device for disk pre-reading. Figure 2 FIG. 4 shows a schematic diagram of a structure of a device for disk pre-reading according to an embodiment of the present invention. Figure 2 As shown, including:

[0069] The first adjustment module 201 is used to obtain disk load information and adjust the amount of pre-read data of the disk based on the load information.

[0070] The second adjustment module 202 is used to detect the read and write request frequency of the disk, and adjust the pre-read data amount again based on the read and write request frequency.

[0071] The processing module 203 is used to control the read and write operations of the disk based on the adjusted pre-read data amount.

[0072] In some optional implementations, the first adjustment module 201 includes:

[0073] The first unit of the first adjustment module is used to obtain the read and write request queue length and the read and write request processing time of the disk; based on the read and write request queue length and the read and write request processing time, determine the load index of the disk, the load information includes the load index; if the load index is higher than the first load threshold and the load index is lower than the second load threshold, determine that the disk is at a second load level.

[0074] In some optional implementations, the first unit of the first adjustment module includes:

[0075] The first sub-unit of the first unit of the first adjustment module is used to obtain the read and write request data of the disk within a preset time range; based on the read and write request data, calculate the read and write request queue length and the read and write request processing time; if the sampling number of obtaining the read and write request data is greater than the preset sampling threshold, and the average value of the read and write request queue length is greater than the queue length threshold, increase the frequency of obtaining the read and write request queue length or the read and write request processing time.

[0076] In some optional implementations, the aforementioned device for disk pre-reading further includes:

[0077] The third adjustment module is used to record the read and write request queue length and the read and write request processing time in the log file; generate the disk load change trend based on the content recorded in the log file; and adjust the disk buffer data volume based on the load change trend.

[0078] In some optional implementations, the first adjustment module is further configured to increase the amount of pre-read data if the load information indicates that the disk is at a first load level; and reduce the amount of pre-read data if the load information indicates that the disk is at a third load level.

[0079] In some optional implementations, the second adjustment module is further configured to reduce the amount of pre-read data if the read / write request frequency is greater than a preset read / write request frequency threshold after adjusting the amount of pre-read data based on the load information.

[0080] In some optional implementations, the processing module 203 includes:

[0081] The first unit of the processing module is used to control the disk to process a high priority read / write request if the adjusted pre-read data amount indicates that the disk is at a third load level.

[0082] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0083] The device for disk pre-reading in this embodiment is presented in the form of a functional unit, where the unit refers to an application specific integrated circuit (ASIC) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0084] The device for disk pre-reading provided by the embodiment of the present invention performs the initial adjustment of the disk pre-read data volume through the disk load information, detects the read and write request frequency of the disk, and adjusts the disk pre-read data volume again through the read and write request frequency to optimize the pre-read data volume. It can effectively control the read and write frequency of the disk, reduce the impact of high load on disk performance, respond to the read and write requests of the Linux system in time, effectively solve the problem of disk performance degradation under high load, and significantly improve the stability and efficiency of the disk under various load conditions in the Linux system.

[0085] The embodiment of the present invention also provides a computer device having the above Figure 2 The device for disk pre-reading is shown.

[0086] See also Figure 3 , Figure 3 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 3 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the computer device, including instructions stored in or on the memory to display graphical information of a graphical user interface on an external input / output device (such as a display device coupled to an interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 3 A processor 10 is taken as an example.

[0087] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0088] The aforementioned memory 20 stores instructions executable by at least one processor 10, so that the aforementioned at least one processor 10 executes the method shown in the above embodiment.

[0089] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0090] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0091] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 3 The example of connecting through bus is taken in the following.

[0092] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (such as a light emitting diode) and a tactile feedback device (such as a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0093] The computer device provided by the embodiment of the present invention performs an initial adjustment of the disk pre-read data volume through the disk load information, detects the read and write request frequency of the disk, and adjusts the disk pre-read data volume again through the read and write request frequency to optimize the pre-read data volume. This can effectively control the disk read and write frequency, reduce the impact of high load on disk performance, and can respond to the read and write requests of the Linux system in a timely manner, effectively solving the problem of disk performance degradation under high load, and significantly improving the stability and efficiency of the disk under various load conditions in the Linux system.

[0094] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0095] The computer-readable storage medium provided by the embodiment of the present invention performs an initial adjustment of the disk pre-read data volume through the disk load information, detects the read and write request frequency of the disk, and adjusts the disk pre-read data volume again through the read and write request frequency to optimize the pre-read data volume. This can effectively control the disk read and write frequency, reduce the impact of high load on disk performance, and can respond to the read and write requests of the Linux system in a timely manner, effectively solving the problem of disk performance degradation under high load, and significantly improving the stability and efficiency of the disk under various load conditions in the Linux system.

[0096] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0097] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for disk pre-reading, characterized in that: The method comprises: Acquire load information of the disk, and adjust the amount of pre-read data of the disk based on the load information; Detecting the read and write request frequency of the disk, and adjusting the pre-read data amount again based on the read and write request frequency; Based on the adjusted pre-read data amount, the read and write operations of the disk are controlled.

2. The method according to claim 1, characterized in that The obtaining of disk load information includes: Obtaining the read / write request queue length and read / write request processing time of the disk; Determining a load index of the disk based on the read / write request queue length and the read / write request processing time, wherein the load information includes the load index; If the load index is higher than a first load threshold and the load index is lower than a second load threshold, it is determined that the disk is at a second load level.

3. The method according to claim 2, characterized in that The obtaining of the read / write request queue length and the read / write request processing time of the disk includes: Obtaining read and write request data of the disk within a preset time range; Based on the read / write request data, calculating the read / write request queue length and the read / write request processing time; If the sampling times for obtaining the read / write request data is greater than a preset sampling threshold, and the average value of the read / write request queue length is greater than a queue length threshold, the frequency of obtaining the read / write request queue length or the read / write request processing time is increased.

4. The method according to claim 3, characterized in that The method further comprises: Record the read / write request queue length and the read / write request processing time in a log file; Based on the content recorded in the log file, generate a load change trend of the disk; Based on the load change trend, the data volume of the buffer of the disk is adjusted.

5. The method according to claim 1, characterized in that The step of obtaining load information of the disk and adjusting the amount of pre-read data of the disk based on the load information; Detecting the read and write request frequency of the disk, and adjusting the pre-read data amount again based on the read and write request frequency, including: If the load information indicates that the disk is at a first load level, increasing the pre-read data amount; If the load information indicates that the disk is at a third load level, reducing the amount of pre-read data; After the pre-read data amount is adjusted based on the load information, if the read / write request frequency is greater than a preset read / write request frequency threshold, the pre-read data amount is reduced.

6. The method according to claim 1, characterized in that The controlling the read and write operations of the disk based on the adjusted pre-read data amount includes: If the adjusted pre-read data amount indicates that the disk is at a third load level, the disk is controlled to process high priority read and write requests.

7. A device for disk pre-reading, characterized in that The device comprises: A first adjustment module, configured to obtain load information of a disk and adjust the amount of pre-read data of the disk based on the load information; A second adjustment module is used to detect the read and write request frequency of the disk, and adjust the pre-read data amount again based on the read and write request frequency; The processing module is used to control the read and write operations of the disk based on the adjusted pre-read data amount.

8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for disk pre-reading according to any one of claims 1 to 6 by executing the computer instructions.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method for disk pre-reading according to any one of claims 1 to 6.

10. A computer program product, characterized in that The method comprises computer instructions for causing a computer to execute the method for disk pre-reading according to any one of claims 1 to 6.

Citation Information

Cited By

  • Remote disk equipment access method and device, computer equipment, medium and product

    CN120803376A