Virtual machine interrupt distribution system and method based on dynamic load awareness

By adopting dynamic load awareness and interrupt prediction technologies in a virtualized environment, dynamically allocating virtual machine interruptions to the lightest load vCPU, solving the performance bottleneck of virtual machines under high load conditions and achieving load balancing and optimization of virtual machine performance.

CN119829219APending Publication Date: 2025-04-15709TH RESEARCH INSTITUTE CHINA STATE SHIPBUILDING CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510025180.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-08
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

In a virtualized environment, it is difficult for the existing technology to achieve efficient management and interrupt allocation of virtual machine performance, resulting in a bottleneck in virtual machine performance under high load conditions and affecting the overall system performance.

Method used

A virtual machine interrupt allocation system based on dynamic load awareness is adopted, which includes a load-aware module, a load prediction module, an interrupt allocation module and a feedback optimization module. By monitoring the CPU load of the virtual machine vCPU in real time, combining historical load information, using a linear regression algorithm to predict future loads, dynamically allocate interrupts to the lightest load vCPU, and continuously adjust the interrupt allocation strategy through the feedback optimization module.

Benefits of technology

It realizes load balancing and performance optimization of virtual machine performance, avoids performance bottlenecks caused by overload of virtual machines, ensures that the system maintains good performance under high load conditions, and improves efficient resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829219A_ABST
    Figure CN119829219A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of computer systems and virtualization, and particularly discloses a virtual machine interrupt distribution system and method based on dynamic load awareness, and the system comprises a load awareness module which is used for obtaining the current load information of each vCPU based on a load awareness thread; the load prediction module is used for receiving the current load information, predicting future load information of each vCPU by using a linear regression algorithm in combination with historical load information, and obtaining a prediction result; the interrupt distribution module is used for performing interrupt distribution according to the prediction result, dynamically distributing interrupt to the vCPU with the lightest load, and generating interrupt distribution information to realize load balancing and performance optimization of the performance of the virtual machine; and the feedback optimization module is used for receiving the interrupt distribution information of the interrupt distribution module and optimizing an interrupt distribution strategy in combination with the current load information. According to the method and the device, the balance between the overall system load performance and the complexity of the virtual machine can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer systems and virtualization technology, and more specifically, to a virtual machine interrupt allocation system and method based on dynamic load perception. Background Art

[0002] Virtualization technology has become an indispensable part of modern computer systems and is widely used in cloud computing, data centers, and enterprise IT infrastructure. Through virtualization, multiple virtual machines (VMs) can share the same physical hardware resources, improving resource utilization and reducing costs. However, in a virtualized environment, how to efficiently manage and allocate system resources, especially how to handle interrupts to ensure the performance and response speed of virtual machines, remains an important research topic.

[0003] In traditional virtualization systems, interrupts are usually statically assigned to a certain vCPU (vCPU). This static allocation method may cause some vCPUs to become performance bottlenecks under high load conditions, thereby affecting the performance of the virtual machine and the entire system. To overcome this shortcoming, researchers have proposed various dynamic load balancing technologies, attempting to optimize system performance by real-time monitoring and adjusting resource allocation. However, existing methods often lack accurate perception of the internal load conditions of the virtual machine, making it difficult to achieve true dynamic optimization.

[0004] Some existing methods attempt to optimize by directly monitoring the load inside the virtual machine, such as CPU usage, memory usage, and I / O load. This usually requires installing and running additional monitoring software inside the virtual machine, increasing the complexity of the system.

[0005] Therefore, how to achieve a balance between the system performance and complexity of virtual machines is a technical problem that needs to be solved urgently. Summary of the invention

[0006] In view of the defects of the prior art, the purpose of the present application is to provide a virtual machine interrupt allocation system and method based on dynamic load perception, aiming to solve the problem in the prior art that it is difficult to improve system performance while reducing system complexity.

[0007] To achieve the above objectives, the present application provides a virtual machine interrupt allocation system based on dynamic load perception, comprising:

[0008] A load sensing module is used to monitor the CPU load of the virtual machine vCPU thread in real time to indirectly sense the internal load of the virtual machine, manage the vCPU load sensing thread according to the creation or destruction event of KVM, and obtain the current load information of each vCPU based on the load sensing thread;

[0009] A load prediction module is used to receive the current load information, combine the historical load information, and use a linear regression algorithm to predict the future load information of each vCPU to obtain a prediction result;

[0010] An interrupt allocation module is used to allocate interrupts according to the prediction results, dynamically allocate interrupts to the vCPU with the lightest load, and generate interrupt allocation information to achieve load balancing and performance optimization of virtual machine performance;

[0011] The feedback optimization module is used to receive the interrupt allocation information of the interrupt allocation module, and optimize the interrupt allocation strategy in combination with the current load information to achieve load balancing and performance optimization of the virtual machine.

[0012] Optionally, the load sensing module includes a task management unit, a load detection task interface and a load information transmission unit;

[0013] A task management unit, used to create or delete a vCPU load detection task of a corresponding virtual machine according to a message notification of creating or destroying a virtual machine;

[0014] Load detection task interface, used to periodically query and calculate the current load information of each vCPU;

[0015] The load information transmission unit is used to transmit the current load information to the load prediction module and the feedback optimization module through the task management unit.

[0016] Optionally, the load prediction module is specifically used to:

[0017] Calling the load detection task interface through KVM and determining whether KVM creates or destroys a virtual machine;

[0018] When KVM creates a virtual machine, call the virtual machine load detection task creation interface, pass the virtual machine name and vCPU thread identifier to start the virtual machine load detection task, and query the vCPU load of the virtual machine regularly;

[0019] When KVM destroys a virtual machine, it calls the virtual machine load detection task deletion interface and passes the virtual machine name and vCPU thread identifier to delete the corresponding load detection task.

[0020] Maintain a VM-vCPU load relationship table based on the creation or destruction of VMs.

[0021] Optionally, the load detection task interface is specifically used to:

[0022] According to the virtual machine process ID and the vCPU thread ID on the physical machine, read the target file to obtain the status information of the current thread;

[0023] Determine, according to the state information, a first time point of the user state running time and a second time point of the kernel state running time at the current moment, as well as a third time point of the user state running time and a fourth time point of the kernel state running time recorded at the last measurement point;

[0024] Determine a first running time difference of the user state running time according to the first time point and the third time point, and determine a second running time difference of the kernel state running time according to the second time point and the fourth time point;

[0025] Obtaining a total running time difference of the thread according to the first running time difference and the second running time difference;

[0026] The measurement time difference between the current moment and the last measurement point is calculated, and the virtual machine vCPU utilization in the most recent time period is determined according to the measurement time difference and the total running time difference, and the current load information is determined according to the vCPU utilization.

[0027] Optionally, the load prediction module is specifically used to:

[0028] Receive current load information from the load sensing module and feedback information from the feedback optimization module;

[0029] The current load information is stored in the historical load information, the historical load information is used as training data, and the feedback information is used as input to update the weight parameters of the linear regression algorithm model until the linear regression algorithm model adapts to the new data distribution;

[0030] The updated linear regression algorithm model is used to predict the future load information of each vCPU, and the prediction results are obtained and stored.

[0031] Optionally, the load prediction module includes a load prediction data interface, a model parameter management unit, a data storage unit and an algorithm unit;

[0032] Load prediction data interface, used to receive current load information from the load sensing module and feedback information from the feedback optimization module;

[0033] A model parameter management unit, used to update the model according to feedback information;

[0034] An algorithm unit, used for predicting the future load information of each vCPU based on the updated model to obtain a prediction result;

[0035] The data storage unit is used to store current load information, historical load information and prediction results of future load information.

[0036] Optionally, the interrupt distribution module includes a predicted load collection unit, a policy collection unit, a vCPU selection unit, an interrupt injection unit and a recording unit;

[0037] A load prediction acquisition unit is used to call the load prediction module and obtain the prediction result;

[0038] A strategy acquisition unit, used to call the feedback optimization module and obtain the interrupt allocation strategy;

[0039] A vCPU selection unit, for selecting a vCPU with the lightest load and suitable for processing the current interrupt as a target vCPU according to load prediction information and optimization strategy;

[0040] An interrupt injection unit, used to distribute interrupts to the selected target vCPU;

[0041] The recording unit is used to record the interruption allocation information and historical data, and transmit the interruption allocation information to the feedback optimization module.

[0042] Optionally, the feedback optimization module includes a data collection unit, a data recording unit, an effect evaluation unit, a trend analysis unit and a strategy adjustment unit;

[0043] A data collection unit, used to obtain the current load information of the vCPU of the load sensing module and the interrupt allocation information of the interrupt allocation module, and save them to the data recording unit;

[0044] A data recording unit, used for storing the current load information and interruption allocation information obtained from the data collection unit for subsequent analysis;

[0045] An effect evaluation unit, used to analyze historical interruption allocation information and evaluate the response time index and processing delay index of each interruption allocation;

[0046] Trend analysis unit, used to analyze the changing trend of load data, identify the periodicity and regularity of load fluctuations and the long-term trend of interruption allocation strategy;

[0047] The strategy adjustment unit is used to adjust the interruption allocation strategy according to the effect evaluation result and the trend analysis result.

[0048] The present application also provides a virtual machine interrupt allocation method based on dynamic load perception, comprising:

[0049] Monitor the CPU load of the virtual machine vCPU thread in real time through the load sensing module to indirectly sense the internal load of the virtual machine, manage the vCPU load sensing thread according to the creation or destruction event of KVM, and obtain the current load information of each vCPU based on the load sensing thread;

[0050] The load prediction module receives the current load information, combines the historical load information, and uses a linear regression algorithm to predict the future load information of each vCPU to obtain a prediction result;

[0051] The interrupt allocation module performs interrupt allocation according to the prediction result, dynamically allocates interrupts to the vCPU with the lightest load, and generates interrupt allocation information to achieve load balancing and performance optimization of virtual machine performance;

[0052] The interrupt allocation information of the interrupt allocation module is received through the feedback optimization module, and the interrupt allocation strategy is optimized in combination with the current load information to achieve load balancing and performance optimization of the virtual machine.

[0053] In a third aspect, the present application provides an electronic device comprising: at least one memory for storing programs; and at least one processor for executing the programs stored in the memory. When the program stored in the memory is executed, the processor is used to execute the method described in the first aspect or any possible implementation of the first aspect.

[0054] In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a processor, the processor executes the method described in the first aspect or any possible implementation of the first aspect.

[0055] In a fifth aspect, the present application provides a computer program product. When the computer program product runs on a processor, the processor executes the method described in the first aspect or any possible implementation of the first aspect.

[0056] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.

[0057] In general, the above technical solutions conceived by this application have the following beneficial effects compared with the prior art:

[0058] (1) This application achieves efficient response through real-time data monitoring and prediction algorithms without adding too much system burden; it avoids concentrating resources on a few vCPUs in dynamic interrupt allocation, and through prediction and timely adjustment, it can intelligently allocate interrupts according to real-time load conditions, thereby improving the processing capacity of virtual machines and ensuring that the system can maintain good performance under high load conditions; it uses load prediction and dynamic interrupt allocation mechanisms to ensure efficient use of resources and avoid performance bottlenecks caused by overloading of certain vCPUs, thereby achieving a balance between overall load performance and system complexity.

[0059] (2) This application provides a basis for dynamically adjusting interrupt allocation through real-time load information, so that the system can timely understand the load status of each vCPU; combined with historical load data, linear regression and other algorithms are used to predict the load. By predicting future loads, the interrupt allocation module can more accurately determine which vCPUs will have lower loads in the future, thereby reasonably allocating interrupts, thereby maximizing the utilization of CPU resources and improving the efficiency of virtual machines in processing requests.

[0060] (3) Through real-time load perception and dynamic interrupt allocation strategy, the system can effectively disperse the load and ensure that all virtual machines are evenly distributed on physical resources, thereby enhancing the stability and reliability of the overall system; through performance optimization, the system can achieve higher response speed and throughput, ensuring that the service quality can be maintained under high load conditions. Through intelligent interrupt allocation, the system enables each CPU core to maximize its capabilities and reduce ineffective resource waste. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 is a structural diagram of a virtual machine interruption allocation system based on dynamic load perception provided in an embodiment of the present application;

[0062] Figure 2 is a structural diagram of a load sensing module provided in an embodiment of the present application;

[0063] Figure 3 is a flowchart of the load sensing module provided in an embodiment of the present application;

[0064] Figure 4 is a structural diagram of a load prediction module provided in an embodiment of the present application;

[0065] Figure 5 is a workflow diagram of a load prediction module provided in an embodiment of the present application;

[0066] Figure 6 is a structural diagram of an interrupt allocation module provided in an embodiment of the present application;

[0067] Figure 7 It is a flowchart of the interrupt allocation module provided in the embodiment of the present application;

[0068] Figure 8 It is a structural diagram of the feedback optimization module provided in the embodiment of the present application;

[0069] Fig. 9 is a workflow diagram of the feedback optimization module provided in the embodiment of the present application;

[0070] Fig.10 It is a flowchart of a method for allocating virtual machine interruptions based on dynamic load perception provided in an embodiment of the present application;

[0071] Fig.11 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0072] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0073] The term "and / or" in this article is a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The symbol " / " in this article indicates that the associated objects are in an or relationship, for example, A / B means A or B.

[0074] The terms "first" and "second" in the specification and claims herein are used to distinguish different objects rather than to describe a specific order of the objects. For example, a first response message and a second response message are used to distinguish different response messages rather than to describe a specific order of the response messages.

[0075] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0076] In the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more than two. For example, multiple processing units refer to two or more processing units, etc.; multiple elements refer to two or more elements, etc.

[0077] Next, the technical solutions provided in the embodiments of the present application are introduced.

[0078] The present application provides a virtual machine interrupt allocation system based on dynamic load perception, which is characterized by comprising:

[0079] A load sensing module is used to monitor the CPU load of the virtual machine vCPU thread in real time to indirectly sense the internal load of the virtual machine, manage the vCPU load sensing thread according to the creation or destruction event of KVM, and obtain the current load information of each vCPU based on the load sensing thread;

[0080] A load prediction module is used to receive the current load information, combine the historical load information, and use a linear regression algorithm to predict the future load information of each vCPU to obtain a prediction result;

[0081] An interrupt allocation module is used to allocate interrupts according to the prediction results, dynamically allocate interrupts to the vCPU with the lightest load, and generate interrupt allocation information to achieve load balancing and performance optimization of virtual machine performance;

[0082] The feedback optimization module is used to receive the interrupt allocation information of the interrupt allocation module, and optimize the interrupt allocation strategy in combination with the current load information to achieve load balancing and performance optimization of the virtual machine.

[0083] Specifically, refer to Figure 1 The virtual machine interrupt allocation system provided in the embodiment of the present application is composed of four modules: load perception, load prediction, interrupt allocation and feedback optimization. The load perception module monitors the load conditions of each virtual CPU in the virtual machine and transmits the load information obtained in real time to the load prediction module and the feedback optimization module. The load prediction module uses a prediction algorithm to predict the load of each virtual CPU in the future based on the received load information, and passes the prediction result to the interrupt allocation module. The interrupt allocation module dynamically allocates interrupts to the virtual CPU with the lightest load based on the prediction result and the interrupt allocation strategy provided by the feedback optimization module. At the same time, the feedback optimization module evaluates and adjusts the interrupt allocation strategy by collecting historical data and monitoring the system status in real time to continuously optimize the performance and efficiency of the system.

[0084] In the embodiment of the present application, the load sensing module can obtain system load data by sampling the utilization of CPU cycles by tracking the CPU usage of each virtual CPU (vCPU) thread in real time. By monitoring the CPU load of the vCPU, the application and process load inside the virtual machine can be inferred, and the overall performance of the VM can be indirectly understood.

[0085] In a KVM (Kernel-based Virtual Machine) environment, when a virtual machine is created or destroyed, the load-aware thread of the vCPU is adjusted accordingly to ensure that the load of the virtual machine is always effectively monitored during its life cycle. Based on the load-aware thread, the current load information of all vCPUs is regularly collected to provide necessary data support for subsequent load prediction and interrupt allocation.

[0086] Secondly, the load sensing module receives the current load information of each vCPU, combines the historical load data with the current load information, performs data analysis, builds a dynamic model of the vCPU load, uses a linear regression algorithm to analyze the trend of load changes, and predicts the load of each vCPU in the future.

[0087] This embodiment calculates the trend of each vCPU load change based on historical data, and completes the prediction of future load based on relevant mathematical models. The online regression algorithm model uses historical data as training data to train the model, and continuously adjusts the model weight parameters until the model converges when the linear regression algorithm model adapts to the new data distribution, and uses the converged model to predict future load information.

[0088] Furthermore, based on the future load information provided by the load prediction module, the interrupts are intelligently allocated to the vCPU with the lightest load, thereby achieving load balancing of each vCPU of the virtual machine and maximizing resource utilization. The generated interrupt allocation strategy information is fed back to the system, enabling the operating system to effectively manage CPU interrupts and optimize overall performance.

[0089] When implementing the interrupt allocation strategy, priority rules can be used to flexibly allocate interrupts according to the load status of the vCPU. A scheduling algorithm, such as the least load priority strategy, is used to intelligently allocate interrupts based on real-time load information, and obtain the current interrupt allocation information from the interrupt allocation module.

[0090] Finally, the feedback optimization module uses the current load situation provided by the load sensing module to monitor and optimize the interruption allocation strategy in real time. The interruption allocation strategy is adjusted according to the actual operation effect to ensure that the system can always maintain the best operation status under different load conditions.

[0091] This application achieves efficient response through real-time data monitoring and prediction algorithms without adding too much system burden; it avoids concentrating resources on a few vCPUs in dynamic interrupt allocation, and through prediction and timely adjustment, it can intelligently allocate interrupts according to real-time load conditions, thereby improving the processing capacity of virtual machines and ensuring that the system can maintain good performance under high load conditions; it uses load prediction and dynamic interrupt allocation mechanisms to ensure efficient use of resources and avoid performance bottlenecks caused by overloading of certain vCPUs, thereby achieving a balance between overall load performance and system complexity.

[0092] Optionally, the embodiment of the present application can evaluate the interruption allocation effect regularly or on demand, and provide feedback and optimization by comparing the load balancing effects of different time periods. Relevant algorithms can be introduced to improve the intelligence of the feedback mechanism, self-adjust and learn according to historical feedback data, and then optimize the interruption allocation strategy.

[0093] The process of the embodiment of this application is as follows:

[0094] Load monitoring: The load sensing module continuously monitors the vCPU load in the system and collects data.

[0095] Data prediction: The load prediction module obtains the current load and combines historical data to predict future load.

[0096] Dynamic allocation: The interrupt allocation module dynamically allocates interrupts to vCPUs with lighter loads based on prediction results.

[0097] Policy optimization: The feedback optimization module uses the information flow between modules to continuously improve the interrupt distribution strategy to achieve load balancing and performance optimization.

[0098] The embodiments of the present application achieve efficient response through real-time data monitoring and prediction algorithms without adding too much system burden; avoid concentrating resources on a few vCPUs in dynamic interrupt allocation, and through prediction and timely adjustment, intelligently allocate interrupts according to real-time load conditions, thereby improving the processing capacity of virtual machines and ensuring that the system can maintain good performance under high load conditions; utilize load prediction and dynamic interrupt allocation mechanisms to ensure efficient use of resources and avoid performance bottlenecks caused by overloading of certain vCPUs, thereby achieving a balance between overall load performance and system complexity.

[0099] Reference Figure 2 , the load sensing module includes a task management unit, a load detection task interface and a load information transmission unit;

[0100] A task management unit, namely a virtual machine load detection task management unit, is used to create or delete a vCPU load detection task of a corresponding virtual machine according to a message notification of creating or destroying a virtual machine;

[0101] The load detection task interface, i.e. the virtual machine load detection task interface, is used to periodically query and calculate the current load information of each vCPU;

[0102] The load information transmission unit is used to transmit the current load information to the load prediction module and the feedback optimization module through the task management unit.

[0103] Specifically, in the virtual machine interruption allocation system, the load sensing module is responsible for real-time monitoring of the load of each vCPU of each virtual machine. When KVM creates or destroys a virtual machine, the virtual machine load detection task management unit creates or deletes the vCPU load detection task of the corresponding virtual machine according to the message notification. The load detection task periodically queries and calculates the current load of each vCPU, and passes this load information to the load prediction module and feedback optimization module through the virtual machine load detection task management unit for further analysis and optimization.

[0104] Furthermore, the load prediction module is specifically used to:

[0105] Calling the load detection task interface through KVM and determining whether KVM creates or destroys a virtual machine;

[0106] When KVM creates a virtual machine, call the virtual machine load detection task creation interface, pass the virtual machine name and vCPU thread identifier to start the virtual machine load detection task, and query the vCPU load of the virtual machine regularly;

[0107] When KVM destroys a virtual machine, it calls the virtual machine load detection task deletion interface and passes the virtual machine name and vCPU thread identifier to delete the corresponding load detection task.

[0108] Maintain a VM-vCPU load relationship table based on the creation or destruction of VMs.

[0109] Specifically, refer to Figure 3 The load sensing module is scheduled by the KVM module and provides it with a virtual machine load detection task interface. When the KVM module creates or destroys a virtual machine, it calls the interface of the load sensing module to perform corresponding operations. When KVM creates a virtual machine, it calls the create virtual machine load detection task interface of the load sensing module, passing the virtual machine name and the identifier (TID) of the virtual machine vCPU thread, thereby starting the virtual machine load detection task and starting to query the vCPU load of the virtual machine at regular intervals. When KVM destroys a virtual machine, it calls the delete virtual machine load detection task interface of the load sensing module, passing the virtual machine name and the identifier (TID) of the vCPU thread, and the task management unit of the load sensing module will delete the corresponding load detection task. The load sensing module maintains a virtual machine-vCPU load relationship table based on the creation and destruction of virtual machines by KVM.

[0110] It should be noted that maintaining the virtual machine-vCPU load relationship table in the embodiment of the present application includes creating, updating, deleting and querying the relationship table.

[0111] Optionally, the load detection task interface is specifically used to:

[0112] According to the virtual machine process ID and the vCPU thread ID on the physical machine, read the target file to obtain the status information of the current thread;

[0113] Determine, according to the state information, a first time point of the user state running time and a second time point of the kernel state running time at the current moment, as well as a third time point of the user state running time and a fourth time point of the kernel state running time recorded at the last measurement point;

[0114] Determine a first running time difference of the user state running time according to the first time point and the third time point, and determine a second running time difference of the kernel state running time according to the second time point and the fourth time point;

[0115] Obtaining a total running time difference of the thread according to the first running time difference and the second running time difference;

[0116] The measurement time difference between the current moment and the last measurement point is calculated, and the virtual machine vCPU utilization in the most recent time period is determined according to the measurement time difference and the total running time difference, and the current load information is determined according to the vCPU utilization.

[0117] Specifically, the load sensing module in the embodiment of the present application indirectly senses the internal load of the virtual machine by querying the CPU load of the virtual machine vCPU thread on the physical machine. Specifically, the virtual machine load detection task is based on the virtual machine process ID (PID) and the vCPU thread ID (TID) on the physical machine by reading / proc / <pid> / task / <tid> / stat file to obtain the thread status information, including user state running time (utime) and kernel state running time (stime). By reading the values ​​of the utime and stime fields at two time points and calculating their difference, the running time difference of the virtual machine vCPU thread at these two time points can be obtained, and then divided by the total time of the time period to obtain the virtual machine vCPU utilization rate in the most recent time period.

[0118] The specific steps are as follows:

[0119] 1. At the current moment, record the values ​​of utime and stime as the first time point utime_now and the second time point stime_now.

[0120] 2. The values ​​of utime and stime recorded at the last measurement point are the third time point utime_prev and the fourth time point stime_prev.

[0121] 3. Calculate the running time difference between two time points:

[0122] First running time difference utime_diff=utime_now-utime_prev

[0123] Second running time difference stime_diff=stime_now-stime_prev

[0124] 4. Add the first running time difference utime_diff and the second running time difference stime_diff to get the total running time difference of the thread during this period:

[0125] Total running time difference total_time_diff = utime_diff + stime_diff

[0126] 5. Calculate the time difference between the two measurements, total_duration.

[0127] 6. Calculate the virtual machine vCPU utilization in the recent time period:

[0128] vCPU utilization = (total_time_diff / total_duration)*100%

[0129] The load sensing module passes the calculated virtual machine vCPU load information to the load prediction module and the feedback optimization module for further analysis and application.

[0130] Optionally, the load prediction module is specifically used to:

[0131] Receive current load information from the load sensing module and feedback information from the feedback optimization module;

[0132] The current load information is stored in the historical load information, the historical load information is used as training data, and the feedback information is used as input to update the weight parameters of the linear regression algorithm model until the linear regression algorithm model adapts to the new data distribution;

[0133] The updated linear regression algorithm model is used to predict the future load information of each vCPU, and the prediction results are obtained and stored.

[0134] Specifically, refer to Figure 4 ,The load prediction module is initialized when the system starts up, including: creating a structure for storing ,historical load data, initializing the parameters of the ,online linear regression model, setting the prediction time window and ,update frequency.

[0135] The load sensing module periodically passes the calculated load information of each vCPU to the load prediction module. After receiving this information, the load prediction module performs the following operations: Store the current load information into the historical data structure to ensure that the historical data structure only stores data within a fixed time window to reduce storage overhead.

[0136] The load prediction module uses an online linear regression algorithm to perform load prediction. The steps are as follows:

[0137] 1. Data preparation:

[0138] Use historical load data as training data, including features such as vCPU utilization and timestamps. Use new load data as input to update the model.

[0139] 2. Model update:

[0140] According to the new load data received, the weight parameters are updated in the linear regression model. Online linear regression can gradually adapt the model to the new data distribution and improve the prediction accuracy by gradually adjusting the weights.

[0141] 3. Load Forecasting:

[0142] The updated model is used to predict the load of each vCPU in the future, and the prediction results are stored and provided to the interrupt allocation module when needed.

[0143] The load prediction module can receive feedback information provided by the feedback optimization module, including: the error between the actual load data and the predicted value, and the trend of load change after interruption distribution.

[0144] Through feedback information, the online linear regression model can further adjust parameters and optimize the prediction results.

[0145] Reference Figure 5 , the load prediction module includes a load prediction data interface, a model parameter management unit, a data storage unit and an algorithm unit;

[0146] Load prediction data interface, used to receive current load information from the load sensing module and feedback information from the feedback optimization module;

[0147] A model parameter management unit, used to update the model according to feedback information;

[0148] An algorithm unit, used for predicting the future load information of each vCPU based on the updated model to obtain a prediction result;

[0149] The data storage unit is used to store current load information, historical load information and prediction results of future load information.

[0150] The load prediction module is responsible for receiving the virtual machine vCPU load information provided by the load perception module, and based on this information, predicting the load of each vCPU in the future. This module uses an online linear regression algorithm to continuously update the model parameters through the feedback information of the feedback optimization module to improve the prediction accuracy. Finally, the load prediction result is returned according to the request of the interrupt allocation module.

[0151] Optionally, the interrupt distribution module includes a predicted load collection unit, a policy collection unit, a vCPU selection unit, an interrupt injection unit and a recording unit;

[0152] A load prediction acquisition unit is used to call the load prediction module and obtain the prediction result;

[0153] A strategy acquisition unit, used to call the feedback optimization module and obtain the interrupt allocation strategy;

[0154] A vCPU selection unit, for selecting a vCPU with the lightest load and suitable for processing the current interrupt as a target vCPU according to load prediction information and optimization strategy;

[0155] An interrupt injection unit, used to distribute interrupts to the selected target vCPU;

[0156] The recording unit is used to record the interruption allocation information and historical data, and transmit the interruption allocation information to the feedback optimization module.

[0157] Specifically, refer to Figure 6 In the embodiment of the present application, when an interrupt needs to be passed to a virtual machine, the interrupt receiving unit responds and notifies the predicted load collection unit and the policy collection unit. The predicted load collection unit and the policy collection unit respectively call the load prediction module and the feedback optimization module to obtain the predicted load information and the interrupt allocation strategy. The vCPU selection unit selects the vCPU with the lightest load and suitable for processing the current interrupt based on the load prediction information and the optimization strategy. The interrupt injection unit allocates the interrupt to the selected target vCPU, and the recording unit records the interrupt allocation information and historical data, and passes the interrupt allocation information to the feedback optimization module.

[0158] Specifically, refer to Figure 7 , the interrupt receiving unit receives an external interrupt signal, triggers the interrupt processing flow, and notifies the predicted load collection unit and the policy collection unit. The predicted load collection unit calls the load prediction module, obtains the load prediction information of each vCPU from the load prediction module, and passes the predicted load information to the vCPU selection unit. The policy collection unit calls the feedback optimization module, obtains the currently optimized interrupt allocation policy from the feedback optimization module, and passes the allocation policy to the vCPU selection unit. The vCPU selection unit receives the predicted load information and the interrupt allocation policy, identifies the current load status of each vCPU based on the load prediction information, applies the interrupt allocation policy, and selects the vCPU with the lightest load and suitable for processing the current interrupt. The interrupt injection unit receives the decision result of the vCPU selection unit and injects the interrupt into the selected target vCPU. The recording unit records the detailed information of the interrupt allocation, including time, target vCPU, interrupt type, etc., and saves the historical data for use by the feedback optimization module.

[0159] Optionally, the feedback optimization module includes a data collection unit, a data recording unit, an effect evaluation unit, a trend analysis unit and a strategy adjustment unit;

[0160] A data collection unit, used to obtain the current load information of the vCPU of the load sensing module and the interrupt allocation information of the interrupt allocation module, and save them to the data recording unit;

[0161] A data recording unit, used for storing the current load information and interruption allocation information obtained from the data collection unit for subsequent analysis;

[0162] An effect evaluation unit, used to analyze historical interruption allocation information and evaluate the response time index and processing delay index of each interruption allocation;

[0163] Trend analysis unit, used to analyze the changing trend of load data, identify the periodicity and regularity of load fluctuations and the long-term trend of interruption allocation strategy;

[0164] The strategy adjustment unit is used to adjust the interruption allocation strategy according to the effect evaluation result and the trend analysis result.

[0165] Specifically, refer to Figure 8 ,The feedback optimization module includes data collection, data recording, effect evaluation, trend analysis and policy adjustment functional units. The data collection unit is responsible for obtaining the vCPU load information of the load sensing module and the interrupt allocation information of the interrupt allocation module, and saving it to the data recording unit. The effect evaluation unit analyzes the historical interrupt allocation information and evaluates the effect of each interrupt allocation, including response time, processing delay, etc. The trend analysis unit analyzes the changing trend of load data, identifies the periodicity and regularity of load fluctuations, and the long-term trend of the interrupt allocation strategy. The policy adjustment unit adjusts the interrupt allocation strategy according to the effect evaluation and trend analysis results, including optimizing the interrupt allocation algorithm, adjusting the priority of interrupt allocation, etc.

[0166] Specifically, refer to Fig. 9 , the data collection unit periodically obtains the load information and interrupt allocation information of the virtual machine vCPU and passes it to the data recording unit. The data recording unit saves the received data into the historical record database for subsequent analysis and backtracking. The effect evaluation unit analyzes the historical interrupt allocation information and counts the response time, processing delay and other indicators of each interrupt allocation. According to the evaluation results, the problems and improvement space in the interrupt allocation are identified. The trend analysis unit monitors the changing trend of the load data, including short-term fluctuations and long-term trends. According to the trend analysis results, the periodic changes and regularity of the load are found, which provides a basis for the adjustment of the interrupt allocation strategy. The policy adjustment unit adjusts the interrupt allocation strategy according to the results of the effect evaluation and trend analysis. This includes optimizing the interrupt allocation algorithm, adjusting the priority of interrupt allocation, etc., to ensure the performance and efficiency of the system. The feedback optimization module monitors the system status in real time, adjusts the interrupt allocation strategy in real time according to the data analysis results, and regularly updates the optimization model and parameters to adapt to the changes and evolution of the system operating environment.

[0167] Reference Fig.10 The present application also provides a method for allocating virtual machine interrupts based on dynamic load perception, comprising:

[0168] S101. Monitor the CPU load of the virtual machine vCPU thread in real time through the load sensing module to indirectly sense the internal load of the virtual machine, manage the vCPU load sensing thread according to the creation or destruction event of KVM, and obtain the current load information of each vCPU based on the load sensing thread;

[0169] S102. The load prediction module receives the current load information, combines the historical load information, and uses the linear regression algorithm to predict the future load information of each vCPU to obtain the prediction result;

[0170] S103. The interrupt allocation module performs interrupt allocation according to the prediction result, dynamically allocates interrupts to the vCPU with the lightest load, and generates interrupt allocation information to achieve load balancing and performance optimization of virtual machine performance;

[0171] S104. Receive the interrupt allocation information of the interrupt allocation module through the feedback optimization module, and optimize the interrupt allocation strategy in combination with the current load information to achieve load balancing and performance optimization of the virtual machine.

[0172] Optionally, the load sensing module includes a task management unit, a load detection task interface and a load information transmission unit;

[0173] A task management unit, used to create or delete a vCPU load detection task of a corresponding virtual machine according to a message notification of creating or destroying a virtual machine;

[0174] Load detection task interface, used to periodically query and calculate the current load information of each vCPU;

[0175] The load information transmission unit is used to transmit the current load information to the load prediction module and the feedback optimization module through the task management unit.

[0176] Optionally, the load prediction module is specifically used to:

[0177] Calling the load detection task interface through KVM and determining whether KVM creates or destroys a virtual machine;

[0178] When KVM creates a virtual machine, call the virtual machine load detection task creation interface, pass the virtual machine name and vCPU thread identifier to start the virtual machine load detection task, and query the vCPU load of the virtual machine regularly;

[0179] When KVM destroys a virtual machine, it calls the virtual machine load detection task deletion interface and passes the virtual machine name and vCPU thread identifier to delete the corresponding load detection task.

[0180] Maintain a VM-vCPU load relationship table based on the creation or destruction of VMs.

[0181] Optionally, the load detection task interface is specifically used to:

[0182] According to the virtual machine process ID and the vCPU thread ID on the physical machine, read the target file to obtain the status information of the current thread;

[0183] Determine, according to the state information, a first time point of the user state running time and a second time point of the kernel state running time at the current moment, as well as a third time period of the user state running time and a fourth time point of the kernel state running time recorded at the last measurement point;

[0184] Determine a first running time difference of the user state running time according to the first time point and the third time point, and determine a second running time difference of the kernel state running time according to the second time point and the fourth time point;

[0185] Obtaining a total running time difference of the thread according to the first running time difference and the second running time difference;

[0186] The measurement time difference between the current moment and the last measurement point is calculated, and the virtual machine vCPU utilization in the most recent time period is determined according to the measurement time difference and the total running time difference, and the current load information is determined according to the vCPU utilization.

[0187] Optionally, the load prediction module is specifically used to:

[0188] Receive current load information from the load sensing module and feedback information from the feedback optimization module;

[0189] The current load information is stored in the historical load information, the historical load information is used as training data, and the feedback information is used as input to update the weight parameters of the linear regression algorithm model until the linear regression algorithm model adapts to the new data distribution;

[0190] The updated linear regression algorithm model is used to predict the future load information of each vCPU, and the prediction results are obtained and stored.

[0191] Optionally, the load prediction module includes a load prediction data interface, a model parameter management unit, a data storage unit and an algorithm unit;

[0192] Load prediction data interface, used to receive current load information from the load sensing module and feedback information from the feedback optimization module;

[0193] A model parameter management unit, used to update the model according to feedback information;

[0194] An algorithm unit, used for predicting the future load information of each vCPU based on the updated model to obtain a prediction result;

[0195] The data storage unit is used to store current load information, historical load information and prediction results of future load information.

[0196] Optionally, the interrupt distribution module includes a predicted load collection unit, a policy collection unit, a vCPU selection unit, an interrupt injection unit and a recording unit;

[0197] A load prediction acquisition unit is used to call the load prediction module and obtain the prediction result;

[0198] A strategy acquisition unit, used to call the feedback optimization module and obtain the interrupt allocation strategy;

[0199] A vCPU selection unit, for selecting a vCPU with the lightest load and suitable for processing the current interrupt as a target vCPU according to load prediction information and optimization strategy;

[0200] An interrupt injection unit, used to distribute interrupts to the selected target vCPU;

[0201] The recording unit is used to record the interruption allocation information and historical data, and transmit the interruption allocation information to the feedback optimization module.

[0202] Optionally, the feedback optimization module includes a data collection unit, a data recording unit, an effect evaluation unit, a trend analysis unit and a strategy adjustment unit;

[0203] A data collection unit, used to obtain the current load information of the vCPU of the load sensing module and the interrupt allocation information of the interrupt allocation module, and save them to the data recording unit;

[0204] A data recording unit, used for storing the current load information and interruption allocation information obtained from the data collection unit for subsequent analysis;

[0205] An effect evaluation unit, used to analyze historical interruption allocation information and evaluate the response time index and processing delay index of each interruption allocation;

[0206] Trend analysis unit, used to analyze the changing trend of load data, identify the periodicity and regularity of load fluctuations and the long-term trend of interruption allocation strategy;

[0207] The strategy adjustment unit is used to adjust the interruption allocation strategy according to the effect evaluation result and the trend analysis result.

[0208] Reference Fig.11 Based on the method in the above embodiment, the embodiment of the present application provides an electronic device, which may include: a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112 and the memory 113 communicate with each other through the communication bus 114. The processor 111 may call the logic instructions in the memory 113 to execute the method in the above embodiment.

[0209] In addition, the logic instructions in the above-mentioned memory 113 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application.

[0210] Based on the method in the above embodiment, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a processor, the processor executes the method in the above embodiment.

[0211] Based on the method in the above embodiment, an embodiment of the present application provides a computer program product. When the computer program product runs on a processor, the processor executes the method in the above embodiment.

[0212] It is understandable that the processor in the embodiment of the present application can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor can be a microprocessor or any conventional processor.

[0213] The method steps in the embodiments of the present application can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.

[0214] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions may be transmitted from a website site, a computer, a server or a data center to another website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.

[0215] It should be understood that the various numerical numbers involved in the embodiments of the present application are only used for the convenience of description and are not used to limit the scope of the embodiments of the present application.

[0216] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application shall be included in the scope of protection of the present application.< / tid> < / pid>

Claims

1. A virtual machine interrupt allocation system based on dynamic load perception, characterized in that: include: A load sensing module is used to monitor the CPU load of the virtual machine vCPU thread in real time to indirectly sense the internal load of the virtual machine, manage the vCPU load sensing thread according to the creation or destruction event of KVM, and obtain the current load information of each vCPU based on the load sensing thread; A load prediction module is used to receive the current load information, combine the historical load information, and use a linear regression algorithm to predict the future load information of each vCPU to obtain a prediction result; An interrupt allocation module is used to allocate interrupts according to the prediction results, dynamically allocate interrupts to the vCPU with the lightest load, and generate interrupt allocation information to achieve load balancing and performance optimization of virtual machine performance; The feedback optimization module is used to receive the interrupt allocation information of the interrupt allocation module, and optimize the interrupt allocation strategy in combination with the current load information to achieve load balancing and performance optimization of the virtual machine.

2. The virtual machine interrupt allocation system according to claim 1, characterized in that: The load sensing module includes a task management unit, a load detection task interface and a load information transmission unit; A task management unit, used to create or delete a vCPU load detection task of a corresponding virtual machine according to a message notification of creating or destroying a virtual machine; Load detection task interface, used to periodically query and calculate the current load information of each vCPU; The load information transmission unit is used to transmit the current load information to the load prediction module and the feedback optimization module through the task management unit.

3. The virtual machine interrupt allocation system according to claim 2, characterized in that: The load prediction module is specifically used for: Calling the load detection task interface through KVM and determining whether KVM creates or destroys a virtual machine; When KVM creates a virtual machine, call the virtual machine load detection task creation interface, pass the virtual machine name and vCPU thread identifier to start the virtual machine load detection task, and query the vCPU load of the virtual machine regularly; When KVM destroys a virtual machine, it calls the virtual machine load detection task deletion interface and passes the virtual machine name and vCPU thread identifier to delete the corresponding load detection task. Maintain a VM-vCPU load relationship table based on the creation or destruction of VMs.

4. The virtual machine interrupt allocation system according to claim 2 or 3, characterized in that: The load detection task interface is specifically used for: According to the virtual machine process ID and the vCPU thread ID on the physical machine, read the target file to obtain the status information of the current thread; Determine, according to the state information, a first time point of the user state running time and a second time point of the kernel state running time at the current moment, as well as a third time point of the user state running time and a fourth time point of the kernel state running time recorded at the last measurement point; Determine a first running time difference of the user state running time according to the first time point and the third time point, and determine a second running time difference of the kernel state running time according to the second time point and the fourth time point; Obtaining a total running time difference of the thread according to the first running time difference and the second running time difference; The measurement time difference between the current moment and the last measurement point is calculated, and the virtual machine vCPU utilization in the most recent time period is determined according to the measurement time difference and the total running time difference, and the current load information is determined according to the vCPU utilization.

5. The virtual machine interrupt allocation system according to claim 1, characterized in that: The load prediction module is specifically used for: Receive current load information from the load sensing module and feedback information from the feedback optimization module; The current load information is stored in the historical load information, the historical load information is used as training data, and the feedback information is used as input to update the weight parameters of the linear regression algorithm model until the linear regression algorithm model adapts to the new data distribution; The updated linear regression algorithm model is used to predict the future load information of each vCPU, and the prediction results are obtained and stored.

6. The virtual machine interrupt allocation system according to claim 1, characterized in that: The load prediction module includes a load prediction data interface, a model parameter management unit, a data storage unit and an algorithm unit; Load prediction data interface, used to receive current load information from the load sensing module and feedback information from the feedback optimization module; A model parameter management unit, used to update the model according to feedback information; An algorithm unit, used for predicting the future load information of each vCPU based on the updated model to obtain a prediction result; The data storage unit is used to store current load information, historical load information and prediction results of future load information.

7. The virtual machine interrupt allocation system according to claim 1, characterized in that: The interrupt distribution module includes a predicted load collection unit, a strategy collection unit, a vCPU selection unit, an interrupt injection unit and a recording unit; A load prediction acquisition unit is used to call the load prediction module and obtain the prediction result; A strategy acquisition unit, used to call the feedback optimization module and obtain the interrupt allocation strategy; A vCPU selection unit, for selecting a vCPU with the lightest load and suitable for processing the current interrupt as a target vCPU according to load prediction information and optimization strategy; An interrupt injection unit, used to distribute interrupts to the selected target vCPU; The recording unit is used to record the interruption allocation information and historical data, and transmit the interruption allocation information to the feedback optimization module.

8. The virtual machine interrupt allocation system according to claim 1, characterized in that: The feedback optimization module includes a data collection unit, a data recording unit, an effect evaluation unit, a trend analysis unit and a strategy adjustment unit; A data collection unit, used to obtain the current load information of the vCPU of the load sensing module and the interrupt allocation information of the interrupt allocation module, and save them to the data recording unit; A data recording unit, used for storing the current load information and interruption allocation information obtained from the data collection unit for subsequent analysis; An effect evaluation unit, used to analyze historical interruption allocation information and evaluate the response time index and processing delay index of each interruption allocation; Trend analysis unit, used to analyze the changing trend of load data, identify the periodicity and regularity of load fluctuations and the long-term trend of interruption allocation strategy; The strategy adjustment unit is used to adjust the interruption allocation strategy according to the effect evaluation result and the trend analysis result.

9. A method for allocating virtual machine interrupts based on dynamic load perception implemented by the virtual machine interrupt allocation system according to any one of claims 1 to 8, characterized in that: include: Monitor the CPU load of the virtual machine vCPU thread in real time through the load sensing module to indirectly sense the internal load of the virtual machine, manage the vCPU load sensing thread according to the creation or destruction event of KVM, and obtain the current load information of each vCPU based on the load sensing thread; The load prediction module receives the current load information, combines the historical load information, and uses a linear regression algorithm to predict the future load information of each vCPU to obtain a prediction result; The interrupt allocation module performs interrupt allocation according to the prediction result, dynamically allocates interrupts to the vCPU with the lightest load, and generates interrupt allocation information to achieve load balancing and performance optimization of virtual machine performance; The interrupt allocation information of the interrupt allocation module is received through the feedback optimization module, and the interrupt allocation strategy is optimized in combination with the current load information to achieve load balancing and performance optimization of the virtual machine.

10. An electronic device, characterized in that: include: at least one memory for storing a computer program; At least one processor is used to execute the program stored in the memory, and when the program stored in the memory is executed, the processor is used to execute the method according to claim 9.