Performance monitoring method and device for virtual disk, equipment and storage medium
By running the virtual disk monitoring program on the host, obtaining the disk capacity data of the virtual disk, and calculating the written and read performance data, the problem of inaccurate virtual disk performance monitoring in the existing technology is solved, and more accurate performance monitoring is achieved.
Patent Information
- Application Number
- CN202411800067.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-03-28
AI Technical Summary
The monitoring of virtual disk performance in the prior art is not accurate enough, and the performance cannot be fully understood by monitoring the use of virtual disk size alone.
By running the virtual disk monitoring program on the host, the disk capacity data of the virtual disk is obtained, and when write and read operations occur, the virtual disk write and read performance data is calculated based on the amount of data written to the cache and read cache, including write rate, read rate, write performance indicators and read performance indicators.
Improves the accuracy of virtual disk performance monitoring, and provides more accurate performance data by comprehensively monitoring disk capacity usage and write and read performance.
Smart Images

Figure CN119718862A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of virtual machine technology, and in particular to a performance monitoring method, device, equipment and storage medium for a virtual disk. Background Art
[0002] With the development of cyberspace, cyber ranges have emerged in order to conduct in-depth research on how to build a cyberspace that is both secure and trustworthy, and easy to manage and control. Virtual machine technology plays a key role in cyber ranges, building virtual targets by simulating complete computer systems. As an important component of virtual targets, virtual disks store system data, and their performance and monitoring are crucial for testing and evaluation of cyber ranges.
[0003] In the prior art, an agent monitoring program is usually installed in a virtual machine to run a virtual target manager on a host machine to monitor the usage of the virtual disk size.
[0004] However, the performance of the virtual disk cannot be accurately monitored only through the usage of the virtual disk size, which leads to low accuracy of the monitoring result of the virtual disk. Summary of the invention
[0005] Based on the above problems, the present application provides a virtual disk performance monitoring method, device, equipment and storage medium, the purpose of which is to improve the accuracy of virtual disk performance monitoring.
[0006] The embodiments of the present application disclose the following technical solutions:
[0007] In a first aspect, the present application provides a performance monitoring method for a virtual disk, which is applied to a host machine, on which a virtual machine is running, and the virtual machine includes a virtualization front-end system, including:
[0008] Run the virtual disk monitoring program to obtain the disk capacity data of the virtual disk in the virtual machine;
[0009] In response to the write operation of the virtual machine, the monitor program in the virtualization front-end system determines the write performance data of the virtual disk based on the amount of write data in the write cache; the write performance data includes a write rate and a write performance index;
[0010] In response to the read operation of the virtual machine, the read performance data of the virtual disk is determined based on the amount of read data read from the cache through the monitoring program; the read performance data includes a read rate and a read performance index.
[0011] Optionally, the method as described above, in response to the write operation of the virtual machine, determines the write performance data of the virtual disk based on the amount of write data in the write cache through a monitoring program in the virtualization front-end system, including:
[0012] In response to the write operation of the virtual machine, a first monitoring program is run to count the amount of written data in the write cache through a first counter to obtain a total amount of written data and a first counting time;
[0013] Running a first monitoring program to count the number of times the write data is written into the cache by a second counter to obtain the number of writes and a second counting time;
[0014] Calculate the write rate of the virtual disk based on the first counting time and the total amount of written data;
[0015] Based on the second counting time and the number of write times, a write performance index of the virtual disk is calculated.
[0016] Optionally, the method as described above, in response to the write operation of the virtual machine, determines the read performance data of the virtual disk based on the amount of read data read from the cache through a monitoring program in the virtualization front-end system, including:
[0017] In response to the read operation of the virtual machine, the first monitoring program is run to count the amount of read data read from the cache by a third counter to obtain a total amount of read data and a third counting time;
[0018] Running the first monitoring program to count the number of times data is read from the cache by a fourth counter to obtain the number of reads and a fourth counting time;
[0019] Calculate the read rate of the virtual disk based on the third counting time and the total amount of read data;
[0020] Based on the fourth counting time and the number of reads, a read performance index of the virtual disk is calculated.
[0021] Optionally, in the method described above, the virtual machine includes a virtualized backend system, and the method further includes:
[0022] The preset write rate threshold and read rate threshold are transmitted to the monitoring program by using an inter-process communication method through a management program in a virtualized backend system;
[0023] The monitoring program compares the write rate to a write rate threshold and the read rate to a read rate threshold;
[0024] When it is determined that the write rate is greater than the write rate threshold or the read rate is greater than the read rate threshold, the write rate and the read rate are controlled.
[0025] Optionally, the method as described above further includes:
[0026] The preset write performance indicator threshold and the read performance indicator threshold are transmitted to the monitoring program by using an inter-process communication method through the management program;
[0027] The monitoring program compares the write performance indicator with the write performance indicator threshold, and compares the read performance indicator with the read performance indicator threshold;
[0028] When it is determined that the write performance index is greater than the write performance index threshold or the read performance index is greater than the read performance index threshold, the number of writes and the number of reads are controlled.
[0029] Optionally, in the method described above, the virtual machine includes a virtualized application system, and the method further includes:
[0030] Through the management program, the write performance data and read performance data of the virtual disk are displayed in the virtualization application system.
[0031] Optionally, the method as described above further includes:
[0032] Schedule physical resources through virtualization kernel program to build basic resources of virtual targets;
[0033] The IO device is simulated by the virtualized user-mode program, and the virtual target is run; the virtual target includes the virtual disk.
[0034] In a second aspect, the present application provides a performance monitoring device for a virtual disk, comprising:
[0035] The disk capacity monitoring module is used to run the virtual disk monitoring program to obtain the disk capacity data of the virtual disk in the virtual machine;
[0036] The disk write performance monitoring module is used to respond to the write operation of the virtual machine, determine the write performance data of the virtual disk based on the amount of write data in the write cache through the monitoring program in the virtualization front-end system; the write performance data includes the write rate and the write performance index;
[0037] The disk read performance monitoring module is used to respond to the read operation of the virtual machine and determine the read performance data of the virtual disk based on the amount of read data read from the cache through the monitoring program; the read performance data includes the read rate and the read performance index.
[0038] In a third aspect, the present application provides a host machine, on which a virtual machine runs, wherein the virtual machine includes a virtualization front-end system, a virtualization back-end system, and a virtualization application system;
[0039] Among them, the virtualization front-end system is used to run the monitoring program; the virtualization front-end system is used to run the management program.
[0040] In a fourth aspect, the present application provides an electronic device, the device comprising: a processor, and a memory communicatively connected to the processor;
[0041] Memory stores computer-executable instructions;
[0042] The processor executes the computer-executable instructions stored in the memory to implement the performance monitoring method of the virtual disk described in any one of the above embodiments.
[0043] In a fifth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the performance monitoring method of the virtual disk described in any of the above embodiments.
[0044] By running the virtual disk monitoring program, the disk capacity data of the virtual disk in the virtual machine is obtained to monitor the disk capacity usage of the virtual disk. When a write operation occurs, in response to the write operation of the virtual machine, the amount of write data in the write cache is monitored through the monitoring program in the virtualization front-end system, and then the write performance data of the virtual disk is determined to achieve write performance monitoring of the virtual disk; when a read operation occurs, in response to the read operation of the virtual machine, the amount of read data read from the cache is monitored through the monitoring program, and then the read performance data of the virtual disk is determined to achieve write performance monitoring of the virtual disk. Compared with the prior art, the method of the present application improves the accuracy of virtual disk performance monitoring by comprehensively monitoring the disk capacity usage and the write and read performance of the virtual disk. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0046] Figure 1 A flowchart of an embodiment of a method for monitoring performance of a virtual disk provided by the present application;
[0047] Figure 2 A flowchart of another embodiment of a method for monitoring performance of a virtual disk provided by the present application;
[0048] Figure 3 A flowchart of another embodiment of a method for monitoring performance of a virtual disk provided by the present application;
[0049] Figure 4A flowchart of another embodiment of a method for monitoring performance of a virtual disk provided by the present application;
[0050] Figure 5 A schematic diagram of the structure of an embodiment of a performance monitoring device for a virtual disk provided by the present application;
[0051] Figure 6 A schematic diagram of the structure of another embodiment of a performance monitoring device for a virtual disk provided by the present application;
[0052] Figure 7 A schematic diagram of the structure of an embodiment of an electronic device provided by the present application;
[0053] Figure 8 A schematic diagram of the structure of an embodiment of a host machine provided by the present application. DETAILED DESCRIPTION
[0054] As described above, currently, an agent monitoring program is usually installed in a virtual machine, and by running the agent monitoring program, a virtual target manager is run on a host machine to monitor the usage of the virtual disk size.
[0055] After research, the inventors have proposed a method, device, equipment and storage medium for monitoring the performance of a virtual disk to solve the technical problem of low accuracy in monitoring the performance of a virtual disk in the prior art.
[0056] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0057] The read / write performance indicator (Input / Output Operations Per Second, IOPS) refers to the number of read / write (I / O) operations per second, and is one of the main indicators for measuring disk performance.
[0058] See also Figure 1 , which is a flow chart of an embodiment of a performance monitoring method for a virtual disk provided by the present application. The method is applied to a host machine, a virtual machine is running on the host machine, and the virtual machine includes a virtualization front-end system, including:
[0059] S101: Run a virtual disk monitoring program to obtain disk capacity data of a virtual disk in a virtual machine.
[0060] In this embodiment, by running a virtual disk monitoring program on the host machine, the disk capacity data of the virtual disk in the virtual machine is monitored to obtain the disk capacity usage of the virtual disk, which may include the total capacity of the virtual disk, the used disk capacity and the available disk capacity.
[0061] S102: In response to the write operation of the virtual machine, the monitor program in the virtualization front-end system determines the write performance data of the virtual disk based on the amount of write data in the write cache.
[0062] Among them, write performance data includes write rate and write performance index
[0063] In this embodiment, in response to a write operation generated in a virtual machine, a first counter is created by running a first monitoring program in a virtualization front-end system to count the write data in the write cache, thereby obtaining the total number of write data and a first counting time, and calculating the write rate based on the first counting time and the total number of write data. At the same time, a second counter is created to count the number of times the write data is written into the cache, thereby obtaining the number of writes and a second counting time, and calculating the write IOPS based on the second counting time and the number of writes.
[0064] S103: In response to the read operation of the virtual machine, the monitoring program determines the read performance data of the virtual disk based on the amount of read data read from the cache.
[0065] The read performance data includes the read rate and the read performance index.
[0066] In this embodiment, in response to a read operation generated in the virtual machine, a third counter is created by running a first monitoring program in the virtualization front-end system to count the read data read from the cache, thereby obtaining the total number of read data and a third counting time, and calculating the read rate based on the third counting time and the total number of read data. At the same time, a fourth counter is created to count the number of times data is read from the cache, obtaining the number of reads and a fourth counting time, and calculating the read IOPS based on the counting time of the fourth counting time and the number of reads.
[0067] In this embodiment, by running a virtual disk monitoring program, the disk capacity data of the virtual disk in the virtual machine is obtained to monitor the disk capacity usage of the virtual disk. When a write operation occurs, in response to the write operation of the virtual machine, the amount of write data in the write cache is monitored through the monitoring program in the virtualization front-end system, and then the write performance data of the virtual disk is determined to achieve write performance monitoring of the virtual disk; when a read operation occurs, in response to the read operation of the virtual machine, the amount of read data read from the cache is monitored through the monitoring program, and then the read performance data of the virtual disk is determined to achieve read performance monitoring of the virtual disk. Compared with the prior art, the method of the present application improves the accuracy of virtual disk performance monitoring by comprehensively monitoring the disk capacity usage and the write and read performance of the virtual disk.
[0068] See also Figure 2 , which is a flow chart of another embodiment of a virtual disk performance monitoring method provided by the present application. Figure 1 , Figure 2 A specific implementation method of S102 "determining the write performance data of the virtual disk based on the amount of write data in the write cache by a monitoring program in the virtualization front-end system in response to the write operation of the virtual machine" is shown, specifically in combination with Figure 2 S1021-S1024 are introduced in.
[0069] S1021: In response to the write operation of the virtual machine, run a first monitoring program to count the amount of written data in the write cache through a first counter to obtain a total amount of written data and a first counting time.
[0070] In this embodiment, in response to the write operation of the virtual machine, the first monitoring program running in the virtual machine creates a first counter, and uses the first counter to count the amount of write data written into the cache corresponding to the write operation to obtain the total amount of write data and the first counting time.
[0071] It is understandable that when a write operation is generated in a virtual machine, the write data corresponding to the write operation is first sent to the cache of the virtualization front-end system and then transmitted to the virtualization back-end system through a shared memory. At the same time, in response to a data receiving request sent by the virtualization front-end system, the virtualization back-end system takes the write data from the cache and writes it to the virtual disk.
[0072] S1022: Run the first monitoring program to count the number of times the write data is written into the cache by using the second counter to obtain the number of writes and a second counting time.
[0073] In this embodiment, the first monitoring program running in the virtual machine creates a second counter, and uses the second counter to count the number of times the write data corresponding to the write operation is written into the cache to obtain the number of writes and the second counting time.
[0074] S1023: Calculate the write rate of the virtual disk based on the first counting time and the total amount of written data.
[0075] In this embodiment, based on the first counting time corresponding to the first timer and the total amount of written data, the amount of data written by the virtual disk within a unit time, ie, the write rate of the virtual disk, is calculated.
[0076] S1024: Calculate a write performance index of the virtual disk based on the second counting time and the number of writes.
[0077] In this embodiment, based on the counting time of the second counting time corresponding to the second timer and the number of write operations, the number of write operations completed by the virtual disk within a unit time, ie, the write IOPS of the virtual disk, is calculated.
[0078] In this embodiment, in response to the write operation of the virtual machine, the first monitoring program counts the amount of write data in the write cache through the first counter to obtain the total amount of write data and the first counting time, and can monitor the data write activity of the virtual disk in real time; counts the number of times the write data is written to the cache through the second counter to obtain the number of writes and the second counting time; based on the first counting time and the total amount of write data, the write rate of the virtual disk is calculated; based on the second counting time and the number of writes, the write performance index of the virtual disk is calculated, so as to realize the monitoring of the write performance of the virtual disk and improve the accuracy of the monitoring of the virtual disk.
[0079] Combination Figure 2 As shown, before executing S1021-S1024, refer to the previous embodiment and execute S101 to realize the disk capacity data of the virtual disk; after executing S1021-S1024, refer to the previous embodiment and execute S103 to realize the acquisition of the read performance data of the virtual disk.
[0080] See also Figure 3 , which is a flow chart of another embodiment of a virtual disk performance monitoring method provided by the present application. Figure 1 , Figure 3 A specific implementation method of S103 "determining the read performance data of the virtual disk based on the amount of read data read from the cache by a monitoring program in the virtualization front-end system in response to the write operation of the virtual machine" is shown, specifically in combination with Figure 3 S1031-S1034 are introduced in.
[0081] S1031: In response to a read operation of the virtual machine, a first monitoring program is run to count the amount of read data read from the cache by a third counter to obtain a total amount of read data and a third counting time.
[0082] In this embodiment, in response to the read operation of the virtual machine, the first monitoring program running in the virtual machine creates a third counter, and uses the third counter to count the amount of read data read from the cache to obtain the total amount of read data and the third counting time.
[0083] It is understandable that when a read operation occurs in a virtual machine, the virtual backend system writes the read data into the cache and transmits it to the virtualized frontend system via shared memory, and then the virtualized frontend system retrieves the read data from the cache.
[0084] S1032: Run the first monitoring program to count the number of times data is read from the cache using a fourth counter to obtain the number of reads and a fourth counting time.
[0085] In this embodiment, the first monitoring program running in the virtual machine creates a fourth timer, and uses the fourth timer to count the number of times data is read from the cache to obtain the number of times and a fourth counting time.
[0086] S1033: Calculate the read rate of the virtual disk based on the third counting time and the total amount of read data.
[0087] In this embodiment, based on the third counting time corresponding to the third timer and the total amount of read data, the amount of data read by the virtual disk within a unit time, ie, the read rate of the virtual disk, is calculated.
[0088] S1034: Calculate a read performance index of the virtual disk based on the fourth counting time and the number of reads.
[0089] In this embodiment, the number of read operations completed by the virtual disk within a unit time, ie, the read IOPS of the virtual disk, is calculated based on the counting time of the fourth counting time corresponding to the fourth timer and the number of read operations.
[0090] In this embodiment, in response to the read operation of the virtual machine, the first monitoring program counts the read data read from the cache through the third counter to obtain the total number of read data and the third counting time, and can monitor the data reading activity of the virtual disk in real time; counts the number of times data is read from the cache through the fourth counter to obtain the number of reads and the fourth counting time; calculates the read rate of the virtual disk based on the third counting time and the total number of read data; calculates the read performance index of the virtual disk based on the counting time and the number of reads of the fourth counting time, realizes the monitoring of the virtual disk read performance, and improves the accuracy of virtual disk monitoring.
[0091] Combination Figure 3 As shown, before executing S1031 - S1034 , referring to the previous embodiment, S101 - S102 are executed to obtain the disk capacity data and write performance data of the virtual disk.
[0092] See also Figure 4 , which is a flow chart of another embodiment of a virtual disk performance monitoring method provided by the present application. Figure 4 As shown, in a virtualized environment, multiple virtual machines may share the same physical storage device. If the read and write rate of the virtual disk corresponding to the current virtual machine is too high, it may occupy a large amount of resources, resulting in other virtual machines being unable to obtain sufficient resources, thereby affecting the performance and stability of the physical storage device. Therefore, it is necessary to control the read and write rate of the virtual disk based on the performance of the monitored virtual disk. Based on the above embodiment, the virtual machine also includes a virtualized backend system, and the method may also include:
[0093] S104: The preset write rate threshold and read rate threshold are transmitted to the monitoring program by using an inter-process communication method through the management program in the virtualized backend system.
[0094] In this embodiment, the management program running in the virtualized backend system adopts an inter-process communication method such as TCP or a local socket method to transmit the preset write rate threshold and read rate threshold to the monitoring program running in the virtualized frontend.
[0095] S105: The monitoring program compares the write rate with the write rate threshold, and compares the read rate with the read rate threshold.
[0096] In this embodiment, the monitoring program is run to compare the calculated write rate with the obtained write rate threshold, and to compare the calculated read rate with the obtained read rate threshold.
[0097] S106: When it is determined that the write rate is greater than the write rate threshold or the read rate is greater than the read rate threshold, control the write rate and the read rate.
[0098] In this embodiment, when it is determined that the write rate is greater than the write rate threshold or the read rate is greater than the read rate threshold, the write rate and the read rate are controlled. Specifically, controlling the write rate and the read rate may include controlling the virtual front-end system to reduce the speed of building a blank cache, thereby reducing the speed of writing data into the cache.
[0099] In this embodiment, based on the preset write rate threshold and read rate threshold, the threshold is transmitted to the monitoring program through the management program in the virtualized backend system by using the inter-process communication method. The monitoring program compares the first counter value with the write rate threshold, and compares the third counter value with the read rate threshold to ensure that the performance of the virtual disk will not be degraded due to excessively high rate when processing data; when it is determined that the first counter value is greater than the write rate threshold or the third counter value is greater than the read rate threshold, the write rate and the read rate are controlled, thereby improving the operating performance of the virtual disk and avoiding overload of physical storage device resources.
[0100] Furthermore, based on the above embodiment, the method may further include:
[0101] The preset write performance indicator threshold and read performance indicator threshold are transmitted to the monitoring program through the management program by using the inter-process communication method.
[0102] In this embodiment, the management program running in the virtualized backend system adopts an inter-process communication method such as TCP or a local socket method to transmit the preset write IOPS threshold and read IOPS threshold to the monitoring program running in the virtualized frontend.
[0103] The monitoring program compares the write performance indicator to the write performance indicator threshold and compares the read performance indicator to the read performance indicator threshold.
[0104] In this embodiment, the monitoring program is run to compare the calculated write IOPS with the obtained write IOPS threshold, and to compare the calculated read IOPS with the obtained read IOPS threshold.
[0105] When it is determined that the write performance index is greater than the write performance index threshold or the read performance index is greater than the read performance index threshold, the number of writes and the number of reads are controlled.
[0106] In this embodiment, when it is determined that the write IOPS is greater than the write IOPS threshold or the read IOPS is greater than the read IOPS threshold, the number of writes and the number of reads are controlled. Specifically, controlling the number of writes and the number of reads may include controlling the virtual front-end system to reduce the number of blank caches constructed to temporarily store data and reduce the number of times data is read from the cache, and controlling the number of times the virtualized back-end system writes the data to be read into the cache.
[0107] In this embodiment, based on the preset write performance index threshold and read performance index threshold, the threshold is transmitted to the monitoring program through the management program in the virtualized backend system by using the inter-process communication method. The monitoring program compares the second counter value with the write performance index threshold, and compares the fourth counter value with the read performance index threshold to ensure that the virtual disk does not cause performance degradation due to the high number of times when processing data; when it is determined that the second counter value is greater than the write performance index threshold or the fourth counter value is greater than the read performance index threshold, the number of writes and the number of reads are controlled, thereby improving the operating performance of the virtual disk and avoiding overload of physical storage device resources.
[0108] Further, based on the above embodiment, the virtual machine may further include a virtualized application system, and the method may further include:
[0109] Through the management program, the write performance data and read performance data of the virtual disk are displayed in the virtualization application system.
[0110] In this embodiment, the obtained virtual disk performance data can be sent to a virtualization application system, such as a cloud computing management platform, a virtualization monitoring platform, etc., for display through the management program, so that users can view and manage the virtual disk performance data in the interface of the virtualization application system.
[0111] In this embodiment, the write performance data and the read performance data of the virtual disk are displayed in the virtualization application system through the management program, so that the user can timely discover potential problems of the virtual disk and improve the performance of the virtual disk.
[0112] Further, based on the above embodiment, before S101 “running the virtual disk monitoring program to obtain disk capacity data of the virtual disk in the virtual machine”, the method may further include:
[0113] Physical resources are scheduled through the virtualization kernel program to build the basic resources of the virtual target.
[0114] In this embodiment, for example, according to the required physical resources, including CPU, memory, storage device and network device, etc., a virtualization kernel program is installed on the host machine, and the physical resources are abstracted into virtual resources, such as virtual CPU, virtual memory, virtual storage and virtual network, etc., through virtualization technology. Then, according to the resource requirements of the virtual target, the virtualization kernel program is used to schedule and allocate resources, so as to utilize the allocated virtual resources to build the basic resources required by the virtual target.
[0115] The IO device is simulated by the virtualized user-mode program, and the virtual target is run; the virtual target includes the virtual disk.
[0116] In this embodiment, for example, the virtualized user state program can use QEMU, KVM, etc. to simulate IO devices. Through the virtualized user state program, the IO devices required by the virtual target, such as virtual network cards, virtual disks, etc., are simulated. Taking the virtual disk as an example, the capacity, read and write speed and other parameters of the virtual disk are configured to ensure that its performance meets the requirements of the virtual target. When the deployment and configuration of the virtual target are completed in the virtual environment, the virtual target is run.
[0117] In this embodiment, physical resources are scheduled by the virtualized kernel program to build the basic resources of the virtual target, and then the IO device is simulated by the virtualized user-mode program and the virtual target is run. This can build a test environment similar to the real environment, which helps to perform various complex tests and simulations in the virtual target and improve the security of the real system.
[0118] See also Figure 5 , which is a schematic diagram of the structure of an embodiment of a performance monitoring device for a virtual disk provided by the present application. Figure 5 As shown, the device 50 includes a disk capacity monitoring module 51 , a disk write performance monitoring module 52 and a disk read performance monitoring module 53 .
[0119] The disk capacity monitoring module 51 is used to run a virtual disk monitoring program to obtain disk capacity data of a virtual disk in a virtual machine;
[0120] The disk write performance monitoring module 52 is used to respond to the write operation of the virtual machine, and determine the write performance data of the virtual disk based on the amount of write data in the write cache through the monitoring program in the virtualization front-end system; the write performance data includes the write rate and the write performance index;
[0121] The disk read performance monitoring module 53 is used to respond to the read operation of the virtual machine and determine the read performance data of the virtual disk based on the amount of read data read from the cache through the monitoring program; the read performance data includes the read rate and the read performance index.
[0122] A performance monitoring device for a virtual disk provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0123] Further, based on the above embodiments, the disk write performance monitoring module 52 is specifically used to respond to the write operation of the virtual machine, run the first monitoring program to count the amount of write data in the write cache through the first counter, and obtain the total amount of write data and the first counting time; run the first monitoring program to count the number of times the write data is written to the cache through the second counter, and obtain the number of writes and the second counting time; calculate the write rate of the virtual disk based on the first counting time and the total amount of write data; calculate the write performance index of the virtual disk based on the second counting time and the number of writes.
[0124] A performance monitoring device for a virtual disk provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0125] Further, based on the above embodiments, the disk read performance monitoring module 53 is specifically used to respond to the read operation of the virtual machine, run the first monitoring program to count the amount of read data read from the cache through the third counter, and obtain the total amount of read data and the third counting time; run the first monitoring program to count the number of times data is read from the cache through the fourth counter, and obtain the number of reads and the fourth counting time; calculate the read rate of the virtual disk based on the third counting time and the total amount of read data; calculate the read performance index of the virtual disk based on the fourth counting time and the number of reads.
[0126] A performance monitoring device for a virtual disk provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0127] See also Figure 6 , which is a structural diagram of another embodiment of a virtual disk performance monitoring device provided by the present application. Figure 6 As shown, based on the above embodiment, the device 50 may further include a virtual disk management module 54 .
[0128] The virtual disk management module 54 is used to transmit the preset write rate threshold and read rate threshold to the monitoring program through the management program in the virtualization backend system by using inter-process communication; the monitoring program compares the write rate with the write rate threshold, and compares the read rate with the read rate threshold; when it is determined that the write rate is greater than the write rate threshold or the read rate is greater than the read rate threshold, the write rate and the read rate are controlled.
[0129] A performance monitoring device for a virtual disk provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0130] Further, based on the above embodiments, the virtual disk management module 54 can also be used to transmit the preset write performance indicator threshold and read performance indicator threshold to the monitoring program through the management program using inter-process communication; the monitoring program compares the write performance indicator with the write performance indicator threshold, and compares the read performance indicator with the read performance indicator threshold; when it is determined that the write performance indicator is greater than the write performance indicator threshold or the read performance indicator is greater than the read performance indicator threshold, the number of writes and the number of reads are controlled.
[0131] A performance monitoring device for a virtual disk provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0132] Furthermore, based on the above embodiment, the virtual disk management module 54 can also be used to display the write performance data and the read performance data of the virtual disk in the virtualization application system through the management program.
[0133] A performance monitoring device for a virtual disk provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0134] Furthermore, based on the above-mentioned embodiments, the disk capacity monitoring module 51 can be used to schedule physical resources through a virtualization kernel program to build basic resources of a virtual target before being used to run a virtual disk monitoring program to obtain disk capacity data of a virtual disk in a virtual machine; simulate IO devices through a virtualization user state program and run a virtual target; and the virtual target includes a virtual disk.
[0135] A performance monitoring device for a virtual disk provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0136] See also Figure 7 , which is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. The electronic device 70 may include: a processor 71 and a memory 72.
[0137] The processor 71 is in communication with the memory 72 , and the memory 72 is used to store computer-executable instructions. The processor 71 is configured to execute the technical solution in any of the aforementioned method embodiments by executing the computer-executable instructions stored in the memory 72 .
[0138] Optionally, the memory 72 may be independent or integrated with the processor 71. Optionally, when the memory 72 is a device independent of the processor 71, the electronic device 70 may further include: a bus for connecting the above devices.
[0139] The electronic device is used to execute the technical solution in any of the aforementioned method embodiments, and its implementation principle and technical effect are similar and will not be repeated here.
[0140] See also Figure 8 , which is a schematic diagram of a structure of an embodiment of a host machine provided by an embodiment of the present application. A virtual machine 81 is run on the host machine 80, and the virtual machine 81 includes a virtualized front-end system 811, a virtualized back-end system 812 and a virtualized application system 813.
[0141] The virtualization front-end system 811 is used to run the monitoring program; the virtualization front-end system 812 is used to run the management program.
[0142] A host machine provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0143] An embodiment of the present application also provides a computer-readable storage medium, which stores computer execution instructions. When the computer execution instructions are executed by a processor, they are used to implement the above-mentioned method. The implementation principle and technical effect are similar and will not be repeated here.
[0144] It should be noted that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely schematic, in which the unit described as a separate component may or may not be physically separated, and the component prompted as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[0145] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A performance monitoring method for a virtual disk, characterized in that: Applied to a host machine, the host machine runs a virtual machine, and the virtual machine includes a virtualization front-end system, including: Running a virtual disk monitoring program to obtain disk capacity data of the virtual disk in the virtual machine; In response to the write operation of the virtual machine, the monitor program in the virtualization front-end system determines the write performance data of the virtual disk based on the amount of write data in the write cache; the write performance data includes a write rate and a write performance index; In response to the read operation of the virtual machine, the monitoring program determines the read performance data of the virtual disk based on the amount of read data read from the cache; the read performance data includes a read rate and a read performance index.
2. The method according to claim 1, characterized in that The step of determining the write performance data of the virtual disk based on the amount of write data in the write cache by a monitoring program in the virtualization front-end system in response to the write operation of the virtual machine includes: In response to the write operation of the virtual machine, the first monitoring program is run to count the amount of written data in the write cache by using a first counter to obtain a total amount of written data and a first counting time; Running a first monitoring program to count the number of times the write data is written into the cache by a second counter to obtain the number of writes and a second counting time; Calculating a write rate of the virtual disk based on the first counting time and the total amount of written data; A write performance index of the virtual disk is calculated based on the second counting time and the number of writes.
3. The method according to claim 1, characterized in that The step of determining the read performance data of the virtual disk based on the amount of read data read from the cache by a monitoring program in the virtualization front-end system in response to the write operation of the virtual machine includes: In response to the read operation of the virtual machine, the first monitoring program is run to count the amount of read data read from the cache by a third counter to obtain a total amount of read data and a third counting time; Running a first monitoring program to count the number of times data is read from the cache by a fourth counter to obtain the number of reads and a fourth counting time; Calculating a read rate of the virtual disk based on the third counting time and the total amount of read data; A read performance index of the virtual disk is calculated based on the counting time of the fourth counting time and the number of reads.
4. The method according to any one of claims 1 to 3, characterized in that The virtual machine includes a virtualized backend system, and the method further includes: The preset write rate threshold and read rate threshold are transmitted to the monitoring program by an inter-process communication method through a management program in the virtualized back-end system; The monitoring program compares the write rate with the write rate threshold, and compares the read rate with the read rate threshold; When it is determined that the write rate is greater than the write rate threshold or the read rate is greater than the read rate threshold, the write rate and the read rate are controlled.
5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: The preset write performance indicator threshold and read performance indicator threshold are transmitted to the monitoring program by using the inter-process communication method through the management program; The monitoring program compares the write performance indicator with the write performance indicator threshold, and compares the read performance indicator with the read performance indicator threshold; When it is determined that the write performance indicator is greater than the write performance indicator threshold or the read performance indicator is greater than the read performance indicator threshold, the number of writes and the number of reads are controlled.
6. The method according to claim 1, characterized in that The virtual machine includes a virtualized application system, and the method further includes: The write performance data and the read performance data of the virtual disk are displayed in the virtualized application system through the management program.
7. The method according to claim 1, characterized in that The method further comprises: Schedule physical resources through virtualization kernel program to build basic resources of virtual targets; The IO device is simulated by a virtualized user state program, and the virtual target is run; the virtual target includes a virtual disk.
8. A performance monitoring device for a virtual disk, characterized in that: include: A disk capacity monitoring module, used for running a virtual disk monitoring program to obtain disk capacity data of a virtual disk in the virtual machine; A disk write performance monitoring module, for responding to the write operation of the virtual machine, and determining the write performance data of the virtual disk based on the amount of write data in the write cache through the monitoring program in the virtualization front-end system; the write performance data includes a write rate and a write performance index; The disk read performance monitoring module is used to respond to the read operation of the virtual machine and determine the read performance data of the virtual disk based on the amount of read data read from the cache through the monitoring program; the read performance data includes a read rate and a read performance index.
9. A host machine, characterized in that: The host machine runs a virtual machine, wherein the virtual machine includes a virtualization front-end system, a virtualization back-end system and a virtualization application system; Wherein, the virtualization front-end system is used to run the monitoring program; the virtualization front-end system is used to run the management program.
10. An electronic device, characterized in that: The device comprises: a processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.