I / o operation latency monitoring method, apparatus, and electronic device
Patent Information
- Application Number
- CN202310317328.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-28
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2043-03-28
AI Technical Summary
但无法精确统计每次IO操作的时延,不利于精准监控异常IO操作
[0033]本申请实施例的IO操作时延监控方法,通过文件系统基于页帧构建块IO结构,并确定所述页帧所请求执行的IO操作的起始时间;基于所述块IO结构请求块设备层执行IO操作,并配置与所述块IO结构相对应的回调函数;通过所述回调函数响应所述块设备层反馈的与所述块IO结构相对应的反馈信息,确定所述IO操作的结束时间,基于所述起始时间和所述结束时间确定所述IO操作的时延。如此,通过文件系统能够精准监控每次IO操作的起始时间、结束时间及时延,为IO操作的时延监控提供了一种可行的实现方式,为系统稳定性监控及故障监控提供了精准的数据基础。
Smart Images

Figure CN116450452B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of system monitoring technology, and in particular to an I / O operation latency monitoring method, I / O operation latency monitoring device, and electronic device. Background Technology
[0002] With the rapid development of cloud computing, more and more enterprises and individual users are migrating their data to the cloud. User-space processes access data stored on the disk by initiating read and write operations. Each read and write operation can be called an I / O operation, and latency is the time elapsed from sending an operation request to receiving feedback information, which is an important indicator of system stability.
[0003] Typically, data related to I / O operations on the disk is obtained through a disk statistics interface (diskstats). The total time consumed by multiple I / O operations is divided by the number of I / O operations to obtain the average latency of I / O operations over a period of time. However, this method cannot accurately measure the latency of each I / O operation, which is not conducive to accurately monitoring abnormal I / O operations. Summary of the Invention
[0004] This application provides an I / O operation latency monitoring method, I / O operation latency monitoring device, and electronic device. The technical solutions adopted in the embodiments of this application are as follows.
[0005] The first aspect of this application provides a method for monitoring I / O operation latency, including:
[0006] In response to the file system building block I / O structure based on page frames, the start time of the I / O operation requested by the page frame is determined;
[0007] Based on the block I / O structure, request the block device layer to perform I / O operations and configure a callback function corresponding to the block I / O structure;
[0008] The callback function responds to the feedback information corresponding to the block I / O structure from the block device layer, determines the end time of the I / O operation, and determines the latency of the I / O operation based on the start time and the end time.
[0009] In some embodiments, the step of responding to feedback information corresponding to the block I / O structure from the block device layer via the callback function, determining the end time of the I / O operation, and determining the latency of the I / O operation based on the start time and the end time includes:
[0010] The callback function responds to the feedback information corresponding to the block I / O structure fed back by the block device layer, and the current time is used as the end time of the I / O operation;
[0011] The latency of the I / O operation is determined based on the start time and the end time.
[0012] In some embodiments, in response to the file system building block I / O structure based on the page frame, determining the start time of the I / O operation requested by the page frame includes:
[0013] In response to the construction of the block I / O structure, the construction time of the block I / O structure is used as the start time of the I / O operation;
[0014] Obtain the configuration information of the block I / O structure, the configuration information including at least the process information of the process that triggered the I / O operation.
[0015] In some embodiments, the step of responding to feedback information corresponding to the block I / O structure from the block device layer via the callback function, determining the end time of the I / O operation, and determining the latency of the I / O operation based on the start time and the end time, further includes:
[0016] If the latency of the IO operation meets the first threshold, a monitoring record is generated based on the start time, the end time, and the configuration information.
[0017] In some embodiments, if the latency of the IO operation meets a first threshold, a monitoring record is generated based on the start time, the end time, and the configuration information, including:
[0018] The latency of the I / O operation is compared with a first threshold; wherein the first threshold is stored in the superblock of the file system;
[0019] If the latency of the IO operation is less than the first threshold, the start time, the end time, and the configuration information are added to the latency list in the superblock to generate the monitoring record.
[0020] In some embodiments, the method further includes:
[0021] The first threshold is set through the communication interface connecting the application layer and the file system; or
[0022] The monitoring records can be read or modified through the communication interface connecting the application layer and the file system.
[0023] In some embodiments, determining the start time of the I / O operation requested by the page frame in response to the file system building block I / O structure based on the page frame further includes:
[0024] A target field is added to the page frame obtained from the page cache layer by the file system, the target field containing the file name corresponding to the IO operation;
[0025] Based on the page frame containing the target field, construct the block I / O structure.
[0026] In some embodiments, obtaining the configuration information of the block I / O structure includes:
[0027] Based on the block I / O structure, the file name, the process information, and the address information of the memory pointed to by the I / O operation are obtained as the configuration information.
[0028] A second aspect of this application provides an I / O operation latency monitoring device, comprising:
[0029] The response module is used to determine the start time of the I / O operation requested by the page frame in response to the file system's page frame building block I / O structure;
[0030] The request module is used to request the block device layer to perform IO operations based on the block IO structure, and to set a callback function corresponding to the block IO structure;
[0031] The determination module is used to respond to the feedback information corresponding to the block I / O structure fed back by the block device layer through the callback function, determine the end time of the I / O operation, and determine the delay of the I / O operation based on the start time and the end time.
[0032] A third aspect of this application provides an electronic device, including at least a memory and a processor, wherein the memory stores a program, and the processor implements the method described above when executing the program in the memory.
[0033] The I / O operation latency monitoring method of this application embodiment constructs a block I / O structure based on page frames through a file system and determines the start time of the I / O operation requested by the page frame; it requests the block device layer to execute the I / O operation based on the block I / O structure and configures a callback function corresponding to the block I / O structure; it determines the end time of the I / O operation by responding to the feedback information corresponding to the block I / O structure from the block device layer through the callback function, and determines the latency of the I / O operation based on the start time and the end time. In this way, the file system can accurately monitor the start time, end time, and latency of each I / O operation, providing a feasible implementation method for I / O operation latency monitoring and providing an accurate data foundation for system stability monitoring and fault monitoring. Attached Figure Description
[0034] Figure 1 This is a flowchart of the I / O operation latency monitoring method according to the first embodiment of this application;
[0035] Figure 2This is a data flow diagram of the I / O operation latency monitoring method according to the second embodiment of this application;
[0036] Figure 3 This is a structural block diagram of the IO operation latency monitoring device according to the third embodiment of this application;
[0037] Figure 4 This is a block diagram of an electronic device according to the fourth embodiment of this application. Detailed Implementation
[0038] Various embodiments and features of this application are described herein with reference to the accompanying drawings.
[0039] It should be understood that various modifications can be made to the embodiments described herein. Therefore, the above description should not be considered as limiting, but merely as an example of embodiments. Other modifications within the scope and spirit of this application will be apparent to those skilled in the art.
[0040] The accompanying drawings, which are included in and form part of this specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.
[0041] These and other features of this application will become apparent from the following description of preferred forms of embodiments given as non-limiting examples, with reference to the accompanying drawings.
[0042] It should also be understood that although this application has been described with reference to some specific examples, those skilled in the art can certainly implement many other equivalent forms of this application, which have the features described in the claims and are therefore all within the scope of protection defined herein.
[0043] The above and other aspects, features and advantages of this application will become more apparent when taken in conjunction with the accompanying drawings and in view of the following detailed description.
[0044] Specific embodiments of this application are described thereafter with reference to the accompanying drawings; however, it should be understood that the claimed embodiments are merely examples of this application, which can be implemented in various ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that could obscure the application. Therefore, the specific structural and functional details claimed herein are not intended to be limiting, but merely serve as the basis and representative basis for the claims to teach those skilled in the art to use this application in a variety of substantially any suitable detailed structures.
[0045] This specification may use the phrases “in one embodiment,” “in another embodiment,” “in yet another embodiment,” or “in other embodiments,” all of which may refer to one or more of the same or different embodiments according to this application.
[0046] The first embodiment of this application provides a method for monitoring I / O operation latency. Figure 1 This is a flowchart of the IO operation latency monitoring method according to the first embodiment of this application. See also... Figure 1 As shown, the IO operation latency monitoring method of the first embodiment of this application may specifically include the following steps.
[0047] S110, in response to the file system building block IO structure based on page frames, determine the start time of the IO operation requested by the page frame.
[0048] Optionally, when the application layer (userspace) needs to perform read / write operations, it can send a read / write request to the operating system kernel (kernelspace). Upon receiving the read / write request, the operating system kernel's page cache layer can generate a page frame based on the request and send the page frame to the file system. The page frame is used to request the file system to perform I / O operations.
[0049] The file system obtains the page frame and can construct a block I / O (BIO) structure based on the page frame. In response to constructing the BIO structure based on the page frame, the file system also determines the start time of the I / O operation. Optionally, the file system can use the construction time of the BIO structure as the start time of the I / O operation, or it can use the current time of the operating system as the start time of the I / O operation. For example, the file system can obtain the construction time of the BIO structure at the microsecond level and use this microsecond-level construction time as the start time of the I / O operation. Optionally, the file system can allocate memory space to temporarily store the start time of the I / O operation.
[0050] S120, based on the block I / O structure, request the block device layer to perform I / O operations, and configure a callback function corresponding to the block I / O structure.
[0051] Optionally, once the block I / O structure is constructed, the file system can distribute the block I / O structure to the block device layer. For example, the file system can distribute the block I / O structure to the block device driver at the block device layer.
[0052] Optionally, the file system can configure a bi_end_io callback function corresponding to the block I / O structure. For example, the file system can obtain the parameters of the block I / O structure or the handle of the I / O operation. The file system can also obtain a pointer to a target function or target program, which can be used to determine the end time and latency of the I / O operation. Then, the parameters of the block I / O structure or the handle of the I / O operation, as well as the pointer, can be added to the bi_end_io callback function, so that the feedback information of the block I / O structure can trigger the bi_end_io callback function, and the target function or target program can be called through the callback function.
[0053] S130, respond to the feedback information corresponding to the block IO structure fed back by the block device layer through the callback function, determine the end time of the IO operation, and determine the delay of the IO operation based on the start time and the end time.
[0054] Optionally, the block device layer, upon obtaining the block I / O structure, can merge the block I / O structures into a request structure. For example, the block device layer can perform a merging operation on the block I / O structures according to the elevator algorithm, merging them into a request structure. Then, the block device layer can send the request structure to the hard disk, requesting the hard disk to perform I / O operations based on the request structure. The hard disk can perform I / O operations based on the request structure, obtain feedback information, and send the feedback information back to the block device layer. Of course, in specific implementations, other algorithms can also be used to construct the request structure.
[0055] The block device layer feeds back the feedback information to the file system. Feeding back the feedback information to the file system triggers the callback function, which invokes the target function or program to determine the end time of the I / O operation. For example, the millisecond-level time when the file system receives the feedback information can be used as the end time of the I / O operation, or the current operating system time can be used. Furthermore, the file system can also determine the latency of the I / O operation based on the start time and the end time. For example, the file system can obtain the start time from the requested memory space and determine the latency of the I / O operation based on the time difference between the end time and the start time.
[0056] The I / O operation latency monitoring method of this application embodiment constructs a block I / O structure based on page frames through a file system and determines the start time of the I / O operation requested by the page frame; it requests the block device layer to execute the I / O operation based on the block I / O structure and configures a callback function corresponding to the block I / O structure; it determines the end time of the I / O operation by responding to the feedback information corresponding to the block I / O structure from the block device layer through the callback function, and determines the latency of the I / O operation based on the start time and the end time. In this way, the file system can accurately monitor the start time, end time, and latency of each I / O operation, providing a feasible implementation method for I / O operation latency monitoring and providing an accurate data foundation for system stability monitoring and fault monitoring.
[0057] The second embodiment of this application provides a method for monitoring I / O operation latency. Figure 2 For a data flow diagram of the IO operation latency monitoring method according to the second embodiment of this application, see [link to relevant documentation]. Figure 2 As shown, the IO operation latency monitoring method of the second embodiment of this application may specifically include the following steps.
[0058] S210, obtain a page frame from the page cache layer through the file system, the page frame being used to request the file system to perform an I / O operation.
[0059] Optionally, when the application layer (userspace) needs to perform read / write operations, it can send a read / write request to the operating system kernel (kernelspace). Upon receiving the read / write request, the operating system kernel's page cache layer can generate a page frame based on the request and send the page frame to the file system. The page frame is used to request the file system to perform I / O operations.
[0060] S220, construct a block I / O structure based on the page frame through the file system.
[0061] S230, in response to the construction of the block IO structure, the construction time of the block IO structure is used as the start time of the IO operation.
[0062] For example, the file system can obtain the construction time of the block I / O structure at the microsecond level and use the microsecond-level construction time as the start time of the I / O operation.
[0063] S240, obtain the configuration information of the block I / O structure, the configuration information including at least the process information of the process that triggered the I / O operation.
[0064] Optionally, the file system can obtain the configuration information from the private data (bi_private) of the block I / O structure. The configuration information includes, but is not limited to, process information of the process that triggered the I / O operation, the address information of the memory where the I / O operation is performed, etc. For example, the process name and the disk address of the I / O operation can be obtained.
[0065] Optionally, the file system may request memory space to temporarily store the start time, process information, and address information.
[0066] S250, based on the block I / O structure, request the block device layer to perform I / O operations, and configure a callback function corresponding to the block I / O structure.
[0067] Optionally, once the block I / O structure is constructed, the file system can distribute the block I / O structure to the block device layer. For example, the file system can distribute the block I / O structure to the block device driver at the block device layer.
[0068] Optionally, the file system can configure a bi_end_io callback function corresponding to the block I / O structure. For example, the file system can obtain the parameters of the block I / O structure or the handle of the I / O operation. The file system can also obtain a pointer to a target function or target program, which can be used to determine the end time and latency of the I / O operation. Then, the parameters of the block I / O structure or the handle of the I / O operation, as well as the pointer, can be added to the bi_end_io callback function, so that the feedback information of the block I / O structure can trigger the bi_end_io callback function, and the target function or target program can be called through the callback function.
[0069] S260, responding to the feedback information corresponding to the block I / O structure fed back by the block device layer through the callback function, determining the end time of the I / O operation, and determining the delay of the I / O operation based on the start time and the end time.
[0070] Optionally, the block device layer, upon obtaining the block I / O structure, can merge the block I / O structures into a request structure. For example, the block device layer can perform a merging operation on the block I / O structures according to the elevator algorithm, merging them into a request structure. Then, the block device layer can send the request structure to the hard disk, requesting the hard disk to perform I / O operations based on the request structure. The hard disk can perform I / O operations based on the request structure, obtain feedback information, and send the feedback information to the block device layer.
[0071] The block device layer feeds back the feedback information to the file system. This feedback to the file system triggers a callback function to determine the end time of the I / O operation. For example, the millisecond time it takes for the file system to receive the feedback information can be used as the end time of the I / O operation, or the current operating system time can be used. Furthermore, the file system can determine the latency of the I / O operation based on the start and end times. For example, the file system can obtain the start time from the allocated memory space and determine the latency of the I / O operation based on the time difference between the end and start times.
[0072] S270, if the latency of the IO operation meets the first threshold, a monitoring record is generated based on the start time, the end time, and the configuration information.
[0073] Optionally, the first threshold can be used to characterize the need to record the start time, the end time, and the configuration information. The first threshold can be a lower limit threshold, an upper limit threshold, or a range threshold. For example, the first threshold can be used to characterize latency anomalies in the I / O operation; the first threshold can be a lower limit threshold. When the latency of the I / O operation is greater than or equal to the first threshold, it can be determined that the latency of the I / O operation meets the first threshold.
[0074] Based on the determined latency of the I / O operation, the file system can determine whether the latency of the I / O operation meets a first threshold. If yes, a monitoring record is generated based on the start time, the end time, and the configuration information. If no, the start time, the end time, and the configuration information can be discarded.
[0075] The IO operation latency monitoring method of this application can monitor the latency of IO operations by obtaining the start and end times of the IO operation; by obtaining the configuration information of the block IO structure, and determining whether the latency of the IO operation meets a first threshold, a monitoring record is generated based on the start time, the end time, and the configuration information. In this way, not only can latency-related information of IO operations be recorded purposefully to save storage space, but the correlation between IO operation latency and processes can also be determined. For example, when the latency of an IO operation is abnormal, the process that triggered the IO operation can be determined based on the monitoring record, providing a data foundation for system monitoring and analysis.
[0076] In some embodiments, step S220, which involves constructing a block I / O structure based on the page frame using the file system, may include the following steps.
[0077] S221, a target field is added to the page frame obtained by the file system from the page cache layer, the target field containing the file name corresponding to the IO operation.
[0078] S222, construct a block I / O structure based on a page frame having the target field.
[0079] Step S240, obtaining the configuration information of the block I / O structure, may include the following steps.
[0080] Based on the block I / O structure, the file name, the process information, and the address information of the memory pointed to by the I / O operation are obtained as the configuration information.
[0081] Optionally, after the file system receives the page frame issued by the page cache layer, it can add a target field to the page frame to record the filename corresponding to the I / O operation. For example, the target field can record the filename of the file being read or the file being written. The block I / O structure built based on this page frame with the target field also includes the filename corresponding to the I / O operation. Based on this block I / O structure, not only can the process information of the process that triggered the I / O operation and the address information of the memory pointed to by the I / O operation be obtained, but the filename corresponding to the I / O operation can also be obtained, providing a data basis for determining the correlation between the latency of the I / O operation and the file. For example, when the latency of the I / O operation is abnormal, the file corresponding to the I / O operation with abnormal latency can be determined based on the monitoring records, and then it can be analyzed whether the latency abnormality of the I / O operation is related to the file.
[0082] In some embodiments, step S270, generating a monitoring record based on the start time, the end time, and the configuration information when the latency of the IO operation meets a first threshold, may include the following steps.
[0083] S271, determine whether the latency of the IO operation meets a first threshold. The first threshold is stored in the superblock of the file system.
[0084] S272, if the latency of the IO operation meets the first threshold, the start time, the end time, and the configuration information are added to the latency list in the superblock to generate the monitoring record.
[0085] Optionally, a latency list and a first threshold can be pre-set in the file system's superblock for recording monitoring data. The latency list can be used to record start time, filename, process name, address information, and end time.
[0086] After determining the latency of an I / O operation, the file system can retrieve the first threshold from the superblock and compare whether the latency of the I / O operation meets the first threshold. If it does, a monitoring record is generated in the latency linked list based on the start time, filename, process name, address information, and end time, and the data in the memory space is deleted. If not, the relevant information for this I / O operation is discarded. In this way, by reusing the superblock structure, the purpose of recording latency-related information is simply and easily achieved.
[0087] In some embodiments, the method may further include: setting the first threshold through a communication interface connecting the application layer and the file system; or reading or modifying the monitoring records through the communication interface connecting the application layer and the file system. Thus, users can adjust the first threshold to filter I / O operations within a specified latency range, retrieve monitoring records from the latency list, and delete monitoring records from the latency list, facilitating user management of the monitoring records. Optionally, the communication interface may be formed, for example, through a virtual file system (i.e., a proc file interface).
[0088] See Figure 3 As shown, a third embodiment of this application provides an I / O operation latency monitoring device, including:
[0089] The response module 301 is used to determine the start time of the I / O operation requested by the page frame in response to the file system building block I / O structure based on the page frame;
[0090] The request module 302 is used to request the block device layer to perform IO operations based on the block IO structure, and to set a callback function corresponding to the block IO structure;
[0091] The determination module 303 is used to respond to the feedback information corresponding to the block I / O structure fed back by the block device layer through the callback function, determine the end time of the I / O operation, and determine the delay of the I / O operation based on the start time and the end time.
[0092] In some embodiments, the determining module 303 is specifically used for:
[0093] The callback function responds to the feedback information corresponding to the block I / O structure fed back by the block device layer, and the current time is used as the end time of the I / O operation;
[0094] The latency of the I / O operation is determined based on the start time and the end time.
[0095] In some embodiments, the response module 301 is specifically used for:
[0096] In response to the construction of the block I / O structure, the construction time of the block I / O structure is used as the start time of the I / O operation;
[0097] Obtain the configuration information of the block I / O structure, the configuration information including at least the process information of the process that triggered the I / O operation.
[0098] In some embodiments, the determining module 303 is further configured to:
[0099] If the latency of the IO operation meets the first threshold, a monitoring record is generated based on the start time, the end time, and the configuration information.
[0100] In some embodiments, the determining module 303 is specifically used for:
[0101] The latency of the I / O operation is compared with a first threshold; wherein the first threshold is stored in the superblock of the file system;
[0102] If the latency of the IO operation is less than the first threshold, the start time, the end time, and the configuration information are added to the latency list in the superblock to generate the monitoring record.
[0103] In some embodiments, the determining module 303 is further configured to:
[0104] The first threshold is set through the communication interface connecting the application layer and the file system; or
[0105] The monitoring records can be read or modified through the communication interface connecting the application layer and the file system.
[0106] In some embodiments, the response module 301 is further configured to:
[0107] A target field is added to the page frame obtained from the page cache layer by the file system, the target field containing the file name corresponding to the IO operation;
[0108] Based on the page frame containing the target field, construct the block I / O structure.
[0109] In some embodiments, the response module 301 is specifically used for:
[0110] Based on the block I / O structure, the file name, the process information, and the address information of the memory pointed to by the I / O operation are obtained as the configuration information.
[0111] See Figure 4 As shown, the fourth embodiment of this application provides an electronic device, which includes at least a memory 401 and a processor 402. The memory 401 stores a program, and the processor 402 implements the method described in any of the above embodiments when executing the program on the memory 401.
[0112] The fifth embodiment of this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed, implement the method described in any of the above embodiments.
[0113] Those skilled in the art will understand that embodiments of this application can be provided as methods, electronic devices, computer-readable storage media, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware. Furthermore, this application can take the form of a computer program product implemented on one or more computer-readable storage media containing computer-readable program code. When implemented in software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium.
[0114] The aforementioned processor can be a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The aforementioned PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0115] The aforementioned memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0116] The aforementioned readable storage medium may be a magnetic disk, optical disk, DVD, USB, read-only memory (ROM) or random access memory (RAM), etc. This application does not limit the specific form of storage medium.
[0117] The above embodiments are merely exemplary embodiments of this application and are not intended to limit this application. The scope of protection of this application is defined by the claims. Those skilled in the art can make various modifications or equivalent substitutions to this application within its substance and scope of protection, and such modifications or equivalent substitutions should also be considered to fall within the scope of protection of this application.
Claims
1. A method for monitoring I / O operation latency, comprising: In response to the file system building block I / O structure based on page frames, the start time of the I / O operation requested by the page frame is determined; Based on the block I / O structure, request the block device layer to perform I / O operations and configure a callback function corresponding to the block I / O structure; The callback function responds to the feedback information corresponding to the block I / O structure fed back by the block device layer, determines the end time of the I / O operation, and determines the latency of the I / O operation based on the start time and the end time; Specifically, in response to the file system constructing a block I / O structure based on page frames, determining the start time of the I / O operation requested by the page frame includes: In response to the construction of the block I / O structure, the construction time of the block I / O structure is used as the start time of the I / O operation; Obtain the configuration information of the block I / O structure, wherein the configuration information includes at least the process information that triggered the I / O operation; A time-delay list and a first threshold are pre-set in the superblock of the file system for recording monitoring records. The time-delay list is used to record the start time, file name, process name, address information and end time. After determining the latency of an I / O operation, the file system obtains the first threshold from the superblock and compares whether the latency of the I / O operation meets the first threshold. If it does, a monitoring record is generated in the latency linked list based on the start time, file name, process name, address information, and end time, and the data in the memory space is deleted. If not, the relevant information of this I / O operation is discarded.
2. The method according to claim 1, wherein, The step of responding to feedback information corresponding to the block I / O structure from the block device layer via the callback function, determining the end time of the I / O operation, and determining the latency of the I / O operation based on the start time and the end time includes: The callback function responds to the feedback information corresponding to the block I / O structure fed back by the block device layer, and the current time is used as the end time of the I / O operation; The latency of the I / O operation is determined based on the start time and the end time.
3. The method according to claim 1, wherein, The step of responding to feedback information corresponding to the block I / O structure from the block device layer via the callback function, determining the end time of the I / O operation, and determining the latency of the I / O operation based on the start time and the end time, further includes: If the latency of the IO operation meets the first threshold, a monitoring record is generated based on the start time, the end time, and the configuration information.
4. The method according to claim 3, wherein, If the latency of the IO operation meets a first threshold, a monitoring record is generated based on the start time, the end time, and the configuration information, including: The latency of the I / O operation is compared with a first threshold; wherein the first threshold is stored in the superblock of the file system; If the latency of the IO operation meets the first threshold, the start time, the end time, and the configuration information are added to the latency list in the superblock to generate the monitoring record.
5. The method according to claim 4, wherein, The method further includes: The first threshold is set through the communication interface connecting the application layer and the file system; or The monitoring records can be read or modified through the communication interface connecting the application layer and the file system.
6. The method according to claim 1, wherein, The step of determining the start time of the I / O operation requested by the page frame in response to the file system building block I / O structure based on the page frame further includes: A target field is added to the page frame obtained from the page cache layer by the file system, the target field containing the file name corresponding to the IO operation; Based on the page frame containing the target field, construct the block I / O structure.
7. The method according to claim 6, wherein, The step of obtaining the configuration information of the block I / O structure includes: Based on the block I / O structure, the file name, the process information, and the address information of the memory pointed to by the I / O operation are obtained as the configuration information.
8. An I / O operation latency monitoring device, comprising: The response module is used to determine the start time of the I / O operation requested by the page frame in response to the file system's page frame building block I / O structure; The request module is used to request the block device layer to perform IO operations based on the block IO structure, and to set a callback function corresponding to the block IO structure; The determination module is used to respond to the feedback information corresponding to the block I / O structure fed back by the block device layer through the callback function, determine the end time of the I / O operation, and determine the latency of the I / O operation based on the start time and the end time; The response module is further configured to, in response to the construction of the block I / O structure, use the construction time of the block I / O structure as the start time of the I / O operation; Obtain the configuration information of the block I / O structure, wherein the configuration information includes at least the process information that triggered the I / O operation; A time-delay list and a first threshold are pre-set in the superblock of the file system for recording monitoring records. The time-delay list is used to record the start time, file name, process name, address information and end time. After determining the latency of an I / O operation, the file system obtains the first threshold from the superblock and compares whether the latency of the I / O operation meets the first threshold. If yes, generate a monitoring record in the latency list based on the start time, file name, process name, address information, and end time, and delete the data in the memory space; if no, discard the relevant information of this IO operation.
9. An electronic device comprising at least a memory and a processor, wherein the memory stores a program, and the processor, when executing the program in the memory, implements the method as described in any one of claims 1-7.
Citation Information
Patent Citations
IO request monitoring method and device, storage medium and electronic equipment
CN115756732A