Virtual machine optimization method and server

By analyzing the resource usage of virtual machines and converting them into containers, the system resource waste caused by virtual machines hosting services is solved, and resource utilization and server performance are improved.

CN119127386APending Publication Date: 2024-12-13XFUSION DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411018134.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

In existing virtualization/hyperconvergence scenarios, the virtual machine is responsible for wasting system resources and cannot effectively utilize server resources.

Method used

By analyzing the resource usage of business processes within the virtual machine, selecting a virtual machine suitable for conversion to a container, and converting it into a container, reducing the overhead of non-business-related processes, thereby saving resources to host more businesses.

Benefits of technology

It improves the resource utilization rate of hyperconverged clusters, reduces the overhead of non-business-related processes carried by the virtual machine, and optimizes the overall resource utilization of the server system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127386A_ABST
    Figure CN119127386A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a virtual machine optimization method and a server, and relates to the field of servers. The method comprises the following steps: acquiring a system resource utilization rate of a service process on each of a plurality of virtual machines deployed on the server; determining at least one target virtual machine from the plurality of virtual machines according to the system resource utilization rate of the business process on each virtual machine in the plurality of virtual machines, and adding an optimization label to the target virtual machine, the optimization label being used for identifying that the virtual machine needs to be optimized; and converting the target virtual machine carrying the optimization label into a container. By dynamically tracking and analyzing the resource use conditions of different processes in the virtual machine, the virtual machine suitable for being converted into the container is selected and converted into the container, so that the overhead of non-business-related processes in a server system is reduced, and more resources are saved for bearing more businesses.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of server technology, and in particular to a virtual machine optimization method and a server. Background Art

[0002] In existing virtualization / hyper-convergence scenarios, virtual machines are usually used to carry services. Generally, a virtual machine can carry one service, and each virtual machine requires an independent GuestOS system. However, during the actual operation of the virtual machine, there are many system processes on the host where the virtual machine is located that are irrelevant or not directly related to the services carried. As a result, it is necessary to repeatedly create OS for different services, resulting in a waste of system resources.

[0003] In order to solve the waste of system resources caused by carrying services through virtual machines, the services that some virtual machines need to carry can be implemented through containers. However, how to select business virtual machines suitable for carrying through containers from multiple virtual machines deployed on the servers of the hyper-converged cluster and convert the business virtual machines into containers to reduce unnecessary overhead and improve the overall resource utilization of the hyper-converged cluster is a problem that needs to be solved urgently. Summary of the invention

[0004] The embodiments of the present application provide a virtual machine optimization method and server, which analyzes the resource usage of business processes within the virtual machine, selects virtual machines suitable for conversion into containers, and converts them into containers, thereby reducing the overhead of non-business-related processes in the server system, thereby saving more resources for carrying more business.

[0005] In a first aspect, an embodiment of the present application provides a virtual machine optimization method, which is applied to a server, and the method includes: obtaining the system resource usage rate of a business process on each of a plurality of virtual machines deployed on the server; determining at least one target virtual machine from the plurality of virtual machines based on the system resource usage rate of the business process on each of the plurality of virtual machines, and adding an optimization tag to the target virtual machine, the optimization tag being used to identify that the target virtual machine needs to be optimized; and converting the virtual machine carrying the optimization tag into a container.

[0006] That is to say, by analyzing the system resource usage of the business processes on each of the multiple virtual machines deployed on the server, it is possible to screen out virtual machines suitable for conversion to containers (e.g., virtual machines with low system resource usage of business processes running on them). By adding optimization tags to virtual machines suitable for conversion to containers and uniformly converting virtual machines with optimization tags to containers, it is possible to reduce the overhead of non-business-related processes on the server, thereby saving more resources for carrying more businesses.

[0007] In one possible implementation, obtaining the system resource usage of a business process on each of the multiple virtual machines deployed on the server includes: periodically obtaining the system resource usage of a business process on each of the multiple virtual machines deployed on the server, and saving it in a database of the server.

[0008] That is to say, when obtaining the system resource utilization rate of the business process on the virtual machine, it can be obtained periodically. After each time the system resource utilization rate of the business process on the virtual machine is obtained, the obtained system resource utilization rate of the business process on the virtual machine can be saved in the database, so that when it is subsequently determined whether the virtual machine is suitable for conversion into a container, historical data analysis can be performed on the data stored in the database.

[0009] In one possible implementation, at least one target virtual machine is determined from the multiple virtual machines based on the system resource utilization of the business process on each of the multiple virtual machines, and before the optimization tag is added to the target virtual machine, the method further includes: calculating the variance of the system resource utilization of the business process on each of the multiple virtual machines within multiple data acquisition cycles; comparing the variance of the resource utilization of the business process on each of the multiple virtual machines with a preset variance value, and adding the virtual machines with a variance value less than the preset variance value to the set of virtual machines to be converted, so as to optimize the virtual machines in the set of virtual machines to be converted.

[0010] That is to say, before determining the virtual machines suitable for conversion into containers based on the system resource utilization rates of business processes on the virtual machines obtained during multiple data acquisition cycles, it is also possible to remove virtual machines whose system resource utilization rates of business processes fluctuate greatly based on the variance of the system resource utilization rates of business processes on the virtual machines obtained during multiple data acquisition cycles, so as to avoid the situation where the system resource utilization rates of business processes on the virtual machines change due to accidental factors.

[0011] In one possible implementation, at least one target virtual machine is determined from the multiple virtual machines based on the system resource utilization of the business process on each of the multiple virtual machines, and an optimization tag is added to the target virtual machine, including: if the system resource utilization of the business process on the virtual machine obtained in multiple consecutive data acquisition cycles is less than a preset utilization threshold, the virtual machine is added to a set of idle virtual machines; at least one target virtual machine is determined from the set of idle virtual machines, and an optimization tag is added to the target virtual machine.

[0012] That is to say, when determining a virtual machine suitable for conversion into a container based on the system resource usage of the business process on the virtual machine obtained in multiple data acquisition cycles, for each virtual machine, the system resource usage of the business process obtained in multiple data acquisition cycles of the virtual machine can be analyzed. If the system resource usage of the business process of a certain virtual machine obtained in n consecutive data acquisition cycles is lower than the preset usage threshold, it indicates that the system resource usage of the business process on the virtual machine is continuously low. Only when the system resource usage of the business process obtained in multiple consecutive data acquisition cycles is lower than the preset usage threshold, the virtual machine is added to the idle virtual machine set, avoiding the situation where the system resource usage of the business process on the virtual machine changes due to accidental factors.

[0013] In one possible implementation, at least one target virtual machine is determined from the multiple virtual machines based on the system resource usage of the business process on each of the multiple virtual machines, and an optimization tag is added to the target virtual machine, including: sorting the sum of the system resource usage of the business processes on the virtual machines obtained in multiple data acquisition cycles in descending order; adding multiple virtual machines with the lowest sum of system resource usage of the business processes to a set of idle virtual machines; determining at least one target virtual machine from the set of idle virtual machines, and adding an optimization tag to the target virtual machine.

[0014] That is to say, when determining the virtual machines suitable for conversion to containers based on the system resource usage rates of the business processes on the virtual machines obtained in multiple data acquisition cycles, the sum of the business process resource usage rates of multiple virtual machines obtained in multiple data acquisition cycles can also be sorted, and the m virtual machines with the lowest sum of the business process system resource usage rates are selected to be added to the idle virtual machine set. Only the multiple virtual machines with the lowest sum of the system resource usage rates of the business processes will be added to the set for conversion, and the virtual machines with higher sums of the system resource usage rates of the business processes will be retained, which is conducive to achieving a balance between factors such as server performance and conversion costs. In addition, by using the sum of the system resource usage rates of the business processes obtained in multiple data acquisition cycles to screen virtual machines, it is avoided that the system resource usage rates of the business processes on the virtual machines change due to accidental factors in a single data acquisition cycle.

[0015] In one possible implementation, converting a virtual machine carrying an optimization tag into a container includes: converting a target virtual machine carrying the optimization tag into a container within a preset time period; or receiving an optimization request input by a user, the optimization request is used to instruct a server to convert a target virtual machine carrying the optimization tag into a container, and converting the target virtual machine carrying the optimization tag into a container in response to the optimization request input by the user.

[0016] That is, when converting a virtual machine carrying an optimization tag into a container, automatic conversion or manual conversion can be set.

[0017] In one possible implementation, converting the virtual machine carrying the optimization label into a container includes: obtaining business process information of the target virtual machine carrying the optimization label, the business process information including at least a database, environment variables, configuration files and / or mounted storage volumes on which the business process depends; creating a corresponding container image through a preset script or program according to the business process information; and converting the container image into the container.

[0018] That is to say, in the process of converting a virtual machine with an optimization tag into a container, the server can create a container suitable for the business to run based on the environment variables, configuration files, mounted storage and other dependency information of the business process on the target virtual machine, thereby realizing the migration of the virtual machine to the container.

[0019] In one possible implementation, after converting the virtual machine carrying the optimization tag into a container, the method includes: mounting the container to the disk mounted on the target virtual machine; running the container and shutting down the target virtual machine, so as to prevent non-business-related processes on the target virtual machine from continuing to occupy server resources after completing the migration of the business process.

[0020] In a possible implementation, the method further includes: receiving first information input by a user, the first information carrying an optimization strategy, the optimization strategy being used to select a target virtual machine suitable for conversion into a container from a plurality of virtual machines deployed on the server.

[0021] That is to say, in the embodiment of the present application, the user is supported to pre-configure an optimization strategy for converting multiple virtual machines deployed on the server into containers.

[0022] In a possible implementation, the optimization strategy includes at least one of: a conversion type, a measurement factor, a strategy triggering threshold, a detection cycle, and a data acquisition cycle.

[0023] In a possible implementation, the method further includes: binding the optimization policy to multiple virtual machines deployed on the server, so that the server can select a virtual machine that needs to be converted into a container from the multiple virtual machines based on the optimization policy and convert it.

[0024] That is to say, after the user sets the optimization strategy, the service also needs to bind the optimization strategy set by the user to multiple virtual machines deployed on the server, so that the server can select a virtual machine suitable for conversion to a container from multiple virtual machines according to the optimization strategy.

[0025] In one possible implementation, after receiving the first information input by the user, the method also includes: for any one of the multiple virtual machines, determining whether the virtual machine has a data acquisition tool installed, the data acquisition tool is used to obtain resource usage information on the virtual machine; and / or, for any one of the multiple virtual machines, determining whether the business process of the virtual machine meets the conditions for running in a container (for example, whether there are special job requirements, etc.); for any one of the multiple virtual machines, if the virtual machine has a data acquisition tool installed and / or the business process of the virtual machine meets the conditions for running in a container, binding the optimization strategy to the virtual machine.

[0026] That is, when the server binds the optimization policy to the virtual machine deployed on the server, the server needs to perform a precondition check on the virtual machine on the server. The purpose of performing the precondition check on the virtual machine is mainly to determine whether the virtual machine can be converted into a container.

[0027] In the second aspect, an embodiment of the present application provides a virtual machine optimization device, which is applied to a server. The device may include: an acquisition module, which is used to obtain the system resource usage rate of a business process on each of a plurality of virtual machines deployed on the server; a processing module, which is used to determine at least one target virtual machine from a plurality of virtual machines based on the system resource usage rate of the business process on each of the plurality of virtual machines, and add an optimization label to the target virtual machine, wherein the optimization label is used to identify that the target virtual machine needs to be optimized; the processing module is also used to convert a virtual machine carrying the optimization label into a container.

[0028] In a possible implementation, the acquisition module is specifically used to periodically acquire the system resource usage rate of a business process on each of a plurality of virtual machines deployed on the server, and save the system resource usage rate in a database of the server.

[0029] In one possible implementation, the processing module can also be used to: calculate the variance of system resource utilization of a business process on each of a plurality of virtual machines during a plurality of data acquisition cycles; compare the variance of resource utilization of a business process on each of a plurality of virtual machines with a preset variance value, and add a virtual machine with a variance value less than the preset variance value to a set of virtual machines to be converted, so as to optimize the virtual machines in the set of virtual machines to be converted.

[0030] In one possible implementation, the processing module can be specifically used to: if the system resource utilization rate of the business process on the virtual machine obtained in multiple consecutive data acquisition cycles is less than a preset utilization threshold, then add the virtual machine to the idle virtual machine set; determine at least one target virtual machine from the idle virtual machine set, and add an optimization tag to the target virtual machine.

[0031] In one possible implementation, the processing module can be specifically used to: sort the sum of system resource utilization rates of business processes on virtual machines obtained during multiple data acquisition cycles in descending order; add the m virtual machines with the lowest sum of system resource utilization rates of business processes to a set of idle virtual machines; determine at least one target virtual machine from the set of idle virtual machines, and add an optimization tag to the target virtual machine.

[0032] In one possible implementation, the processing module can be specifically used to: convert a target virtual machine carrying an optimization tag into a container within a preset time period; or receive an optimization request input by a user, the optimization request is used to instruct the server to convert a target virtual machine carrying an optimization tag into a container, and in response to the optimization request input by the user, convert the target virtual machine carrying the optimization tag into a container.

[0033] In one possible implementation, the processing module can be specifically used to: obtain business process information of the target virtual machine carrying the optimization label, the business process information including at least the database, environment variables, configuration files and mounted storage volumes on which the business process depends; create a corresponding container image through a preset script or program according to the business process information; and convert the container image into the container.

[0034] In one possible implementation, the processing module can also be used to: mount the container to the disk mounted on the target virtual machine; run the container and shut down the target virtual machine, so as to prevent non-business-related processes on the target virtual machine from continuing to occupy server resources after completing the migration of the business process.

[0035] In a possible implementation, the acquisition module may also be used to: receive first information input by a user, the first information carrying an optimization strategy, and the optimization strategy is used to select a target virtual machine suitable for conversion into a container from multiple virtual machines deployed on the server.

[0036] In a possible implementation, the optimization strategy includes at least one of: a conversion type, a measurement factor, a strategy triggering threshold, a detection cycle, and a data acquisition cycle.

[0037] In a possible implementation, the processing module may be specifically used to: bind the optimization policy to multiple virtual machines deployed on the server, so that the server can select and convert the virtual machine to be converted into a container from the multiple virtual machines based on the optimization policy.

[0038] In one possible implementation, the processing module can be specifically used to: for any one of the multiple virtual machines, determine whether the virtual machine has a data acquisition tool installed, the data acquisition tool is used to obtain resource usage information on the virtual machine; and / or, for any one of the multiple virtual machines, determine whether the business process of the virtual machine meets the conditions for running in a container (for example, whether there are special job requirements, etc.); for any one of the multiple virtual machines, if the virtual machine has a data acquisition tool installed and / or the business process of the virtual machine meets the conditions for running in a container, bind the optimization strategy to the virtual machine.

[0039] In a third aspect, an embodiment of the present application provides a server, including:

[0040] at least one memory for storing a program;

[0041] At least one processor is used to execute the program 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 manner of the first aspect.

[0042] In a fourth aspect, an embodiment of the present application provides a computer storage medium, in which instructions are stored. When the instructions are executed on a computer, the computer executes the method described in the first aspect or any possible implementation of the first aspect.

[0043] In a fifth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the method described in the first aspect or any possible implementation of the first aspect.

[0044] 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. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0046] Figure 1 A schematic diagram of the architecture of a server provided in an embodiment of the present application;

[0047] Figure 2 A schematic diagram of a process of converting a virtual machine on a server into a container provided in an embodiment of the present application;

[0048] Figure 3 A schematic diagram of a process of converting a virtual machine on a server into a container provided in an embodiment of the present application;

[0049] Figure 4 A flow chart of a virtual machine optimization method provided in an embodiment of the present application;

[0050] Figure 5 A flow chart of a virtual machine optimization method provided in an embodiment of the present application;

[0051] Figure 6 A flow chart of the structure of a virtual machine optimization device provided in an embodiment of the present application;

[0052] Figure 7 A schematic diagram of the structure of a server provided in an embodiment of the present application;

[0053] Figure 8 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0055] In the description of the embodiments of the present application, any embodiment or design scheme of "exemplary", "for example" or "for example" should not be understood as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary", "for example" or "for example" is intended to present related concepts in a specific way.

[0056] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprises", "has" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.

[0057] The embodiment of the present application provides a method for optimizing virtual machines, by obtaining the system resource usage of the business processes in each virtual machine deployed on the server, determining a set of idle virtual machines, and adding optimization tags to the virtual machines in the set of idle virtual machines. Then, the virtual machines with optimization tags are periodically converted into containers, thereby reducing the overhead of non-business-related processes on the server. In an embodiment of the present application, by identifying virtual machines whose resource occupancy rates of business processes on the server are higher than a preset threshold, and converting such virtual machines into containers, the overhead generated by the system processes not related to the business carried by the virtual machine is reduced, thereby optimizing the overall resource occupancy rate of the server system.

[0058] For example, Figure 1 FIG. 1 shows a schematic diagram of the architecture of a server provided in an embodiment of the present application. Figure 1 The server 100 shown includes: a physical hardware layer, an operating system (OS), a hypervisor, a container management engine, at least one virtual machine (VM), and at least one container. The hardware and software included in the server 100 are described in detail below.

[0059] The physical hardware layer of the server 100 may include hardware devices such as a central processing unit (CPU), memory, storage device, and network interface card. Among them, the CPU is the core component of the server 100, responsible for executing calculations and instruction operations, and the server 100 may use a multi-core processor to provide higher processing power and concurrency. The memory may include a hard disk drive (HDD) and a solid-state drive (SSD), which provide persistent storage and fast data access. The network interface card is a key component of the server 100 and the network communication, and is used to connect the server 100 and the local area network or the wide area network. The server 100 is usually equipped with multiple network interface cards to support high-speed network interfaces and concurrent data transmission.

[0060] The operating system is used to control and manage the hardware and software resources on the server 100, and reasonably organize and schedule the work and resource allocation of the server 100 to provide a convenient interface and environment for users and other software.

[0061] The virtual machine monitor is an intermediate layer software running between the physical server and the operating system. The virtual machine monitor can allow multiple virtual machines (virtual machine operating systems) to run simultaneously on a server 100, while ensuring that each virtual machine can run independently without interfering with each other.

[0062] Virtual machines VM1, 2, ... are complete computer systems that are simulated by software and have complete hardware system functions and run in a completely isolated environment. Virtual machines can simulate a complete set of hardware (including: CPU, memory, network interface and storage, etc.). For each virtual machine VM1, 2, ... running on the server 100, there is a corresponding operating system (GuestOS). In a possible example, a data acquisition tool needs to be deployed on each virtual machine VM1, 2, ... running on the server 100, such as Figure 1 The VMTools tool shown in the figure can obtain the resource usage information of the processes on the virtual machines VM1, 2, ... by using the data acquisition tool pre-deployed on the virtual machines VM1, 2, ...

[0063] The container management engine is software for performing complete container lifecycle management running on the server 100. Common container management engines may include: docker, containerd, etc.

[0064] The container provides a complete runtime environment for the application, including the application code, related configuration files, libraries, and dependencies required to run the application.

[0065] It is understandable that in Figure 1 In the schematic diagram of the server 100 shown, virtual machines VM1, 2, ... and containers can be deployed on the server 100 at the same time. Figure 1 The number of virtual machines VM1, 2, ... and containers shown in the figure is for illustrative purposes only and is not intended to be a limitation on the embodiments of the present application. In some cases, the virtual machines VM1, 2, ... deployed on the server 100 can be converted into containers through the container management engine. For example, when the system resource usage of the business process on the virtual machine VM1, 2, ... is lower than a preset threshold, an optimization label can be added to the virtual machine VM1, 2, .... Then, the virtual machine carrying the optimization label is converted into a container through the container management engine, thereby reducing the overhead generated by the system processes on the server 100 that are not related to the business and optimizing the overall resource occupancy of the server system.

[0066] In one possible example, an analysis system can be pre-deployed in the service system, and the analysis system can be used to obtain the process resource usage information of each virtual machine VM1, 2, ... deployed on the server 100, and analyze the resource usage rate of the business process in the virtual machine VM1, 2, ... according to the obtained process resource usage information, and add optimization tags to the virtual machines with low business process usage rates. In one possible example, the analysis system can be deployed in a virtual machine monitor and implemented as a function of the virtual machine monitor. In another possible example, the analysis system can be deployed separately in the server system and can exchange information with the virtual machine monitor.

[0067] In one possible example, based on Figure 1 The server architecture shown, Figure 2 The process of converting a virtual machine on a server into a container is shown in FIG. 1 . The virtual machines and containers configured on the server can be Figure 2 As shown in ac. Figure 2 As shown in a, when the server 100 is initially started, only virtual machines VM1, 2, ... may be deployed on the server 100. During the operation of the server 100, the virtual machine monitor may collect the system resource usage information of the business process inside each virtual machine VM1, 2, ... through the data acquisition tool deployed on the virtual machine VM1, 2, ..., and then transmit this information to the analysis system, which determines the system resource usage rate of the business process inside each virtual machine VM1, 2, ... based on this information. Figure 2 As shown in b, for each virtual machine VM1, 2, ... running on the server 100, if the resource usage rate of the business process on the virtual machine VM1, 2, ... is lower than the preset threshold, taking the virtual machine VM5 as an example, an optimization tag can be added to the virtual machine VM5. Figure 2 As shown in c, for the virtual machine VM5 with the optimization tag added to the server 100, the virtual machine VM5 with the optimization tag added can be converted into a container through the container management engine deployed on the server 100.

[0068] Next, based on Figure 1 The architecture of the server 100 shown in FIG. 1 is used to introduce the process of converting the virtual machines VM1, 2, ... on the server 100 into containers. Figure 3 As shown, three processes may be included: (1) configuring optimization strategies; (2) determining service idle virtual machines; and (3) converting service idle virtual machines into containers.

[0069] (1) Configuration optimization strategy

[0070] Users can pre-configure policy information for converting virtual machines to containers. Figure 3As shown, the user can configure the optimization strategy on the display interface 110 of the display device of the server 100. The optimization strategy may include: conversion type, measurement factors, strategy triggering threshold, data acquisition cycle, data analysis cycle and other information.

[0071] The conversion types include automatic conversion and manual conversion. If the conversion type configured by the user in the optimization policy is automatic conversion, the user also needs to set the automatic conversion time. The server will trigger the container management engine to convert the virtual machine with the optimization label into a container within the automatic conversion time set by the user. If the conversion type configured by the user in the optimization policy is manual conversion, the server needs to respond to the user's trigger operation and trigger the container management engine to convert the virtual machine with the optimization label into a container.

[0072] The measurement factor refers to the resource type that needs to be considered when determining the resource usage information on the virtual machine. When configuring the optimization policy, the user can manually select the resources to be considered on the configuration page, such as CPU and memory. In a possible example, if the measurement factors configured by the user in the optimization policy include: CPU and memory, when determining whether the virtual machine on the server needs to be converted to a container, the CPU usage and memory usage of each process in the virtual machine can be obtained respectively.

[0073] The policy trigger threshold is used to determine whether the system resource usage of the business process in the virtual machine reaches the set threshold. If not, the virtual machine needs to be converted into a container. Otherwise, the virtual machine does not need to be processed.

[0074] The data acquisition cycle refers to the cycle for acquiring resource usage information on the virtual machine. For example, the user can set in the optimization policy to acquire resource usage information in the virtual machine every 10 minutes.

[0075] The data analysis cycle refers to the processing cycle of the obtained virtual machine resource usage information. For example, the resource usage information of each virtual machine is analyzed every 24 hours to calculate the resource usage rate of the non-business related processes in each virtual machine.

[0076] In a possible example, the user may also configure virtual machines that need to be monitored in the optimization policy.

[0077] In a possible example, when configuring the optimization strategy, the user may configure it on the graphical display interface 110 corresponding to the server, or may configure the optimization strategy through a command line.

[0078] Continue to refer to Figure 3After configuring the optimization strategy, the user also needs to bind the optimization strategy to the virtual machines VM1, 2, ... in the server 100. In the process of receiving the user's binding operation, the server 100 needs to perform a precondition check on the virtual machine it runs. The purpose of the precondition check on the virtual machine is mainly to determine whether the virtual machine can be converted into a container, so as to improve the success rate of optimizing the virtual machine through the optimization strategy.

[0079] In one possible example, the conditions for performing a pre-check on a virtual machine may include: ① The virtual machine is installed with a data acquisition tool (for example, whether VMTools is deployed on the virtual machine), and the data acquisition tool can be used to obtain resource usage information on the virtual machine. ② Determine whether the virtual machine has large page memory turned on, bound to a pass-through device, etc. For a virtual machine that is not installed with a data acquisition tool, it is impossible to obtain resource usage information on the virtual machine, that is, it is impossible to determine whether to convert the virtual machine into a container. Therefore, the server cannot bind the optimization policy to the virtual machine. For a virtual machine that turns on large page memory or binds a pass-through device, this type of virtual machine is a virtual machine that processes specific tasks. After being converted to a container, it may not be able to continue to process the business. Therefore, the server 100 cannot bind the optimization policy to the virtual machine. Therefore, for a virtual machine that does not meet the pre-check conditions, the server 100 can output an error prompt message when performing the operation of binding the optimization policy to the virtual machine.

[0080] In a possible example, the server 100 may display an error prompt message in its corresponding display interface 110 , and the error prompt message may include information about the virtual machine to which the optimization policy binding fails.

[0081] (2) Determine the idle virtual machines

[0082] Continue to refer to Figure 3 After configuring the optimization strategy and binding the optimization strategy to the virtual machine, it is also necessary to analyze the resource usage information of the multiple virtual machines bound with the optimization strategy on the server 100.

[0083] In a possible example, the analysis system deployed on the server 100 can periodically obtain resource usage information on the virtual machine through the data acquisition tool pre-deployed in each virtual machine. After obtaining the resource usage information on the virtual machine, the analysis system can analyze the obtained resource usage information according to the measurement factors configured in the optimization strategy to obtain the resource usage rate of the business process and non-business related processes in the virtual machine. Then, the analysis system stores the analysis results of the resource usage information in the database for subsequent historical data analysis.

[0084] Then, the analysis system can analyze the monitoring historical data within a specified time period (for example, within 24 hours) according to the information processing cycle configured in the optimization strategy (for example, 22:00 every day), select at least one virtual machine from the data, and add it to the business idle virtual machine set. For the virtual machines in the business idle virtual machine set, optimization tags need to be added for identification.

[0085] In one possible example, after the analysis system obtains the historical data of the virtual machine, the sum of the business process resource utilization rates on the virtual machine obtained during multiple data acquisition cycles carried in the historical data is sorted in descending order, and then the m virtual machines with the lowest sum of business process system resource utilization rates are selected and added to the idle virtual machine set.

[0086] In another possible example, after the analysis system obtains the historical monitoring data of the virtual machine, for each virtual machine, the analysis system needs to determine the resource utilization rate of the business process of the virtual machine in each data acquisition cycle. If the resource utilization rate of the business process of the virtual machine in multiple data acquisition cycles (for example, more than half of the data acquisition cycles) is less than a preset utilization threshold, the virtual machine is added to the idle virtual machine set.

[0087] In a possible example, before the analysis system determines the idle virtual machine set according to the historical data of the acquired virtual machine, the analysis system can also analyze the historical data of the virtual machine in multiple cycles, and eliminate the virtual machines with relatively large fluctuations. Take the CPU usage and memory usage of the business process included in the acquired historical data as an example. For any virtual machine, the CPU usage variance and memory usage variance in the acquired multiple cycles are calculated. Then, the CPU usage variance is analyzed (the analysis of the memory variance is the same as the analysis of the CPU usage variance, which will not be repeated), and the analysis system compares the CPU usage variance with the first variance threshold set in advance. If the CPU usage variance is greater than the first variance threshold, it indicates that the CPU usage of the corresponding virtual machine fluctuates greatly, and the reference value of the CPU usage of the acquired business-related process is not great. At this time, the analysis of the virtual machine can be abandoned. In this way, it can basically ensure that the resource usage information of the virtual machine being analyzed is relatively stable, and the analysis result obtained is highly reliable, which is conducive to improving the success rate of virtual machine optimization.

[0088] (3) Convert idle virtual machines into containers

[0089] Continue to refer to Figure 3After the analysis system adds optimization tags to the virtual machines in the idle virtual machine set, the server 100 can display corresponding prompt information on the display interface 110 of the display device corresponding to the server 100, and the prompt information is used to prompt the user to convert the virtual machines carrying the optimization tags into containers. The prompt information displayed on the display interface 110 of the server 100 is different according to the different conversion types configured by the user in the optimization strategy.

[0090] like Figure 3 As shown, when the conversion type configured in the optimization policy is automatic conversion, the prompt information may include the first virtual machine identifier and the conversion time. When the conversion type configured in the optimization policy is manual conversion, the prompt information may include the first virtual machine identifier, and the prompt information is also used to prompt the user to enter the conversion time. In the case of manual conversion, the server 100 responds to the conversion time entered by the user and confirms the conversion operation. The server 100 triggers the container conversion engine within the corresponding conversion time to convert the virtual machine carrying the optimization tag into a container.

[0091] In the process of converting the first virtual machine into a container, the server 100 system needs to collect virtual machines (such as Figure 3 The business process information of the virtual machine VM4 in the server 100 is collected and saved to the database, such as the libraries, environment variables, configuration files, mounted storage volumes and other dependency information that the business process depends on. Then, the dependency information of the virtual machine business process can be read from the database through the pre-configured automation script in the server 100, and the corresponding container file (dockerfile) can be written based on the basic image re-built in the server 100 system and these dependency information, thereby obtaining a customized container file that can meet the needs of the business process. Then, the container management engine can create a container image based on the container file, and call the basic component runC to convert the container image into a container and run the container.

[0092] When the conversion type configured in the optimization strategy is automatic conversion, the server 100 can trigger the container management engine to build a container image according to the dockerfile within the conversion time configured in the optimization strategy, and automatically generate container operation parameters according to the business process dependency information obtained by the agent. Then, the container management engine automatically runs the newly generated container and triggers the virtual machine monitor to shut down the original business virtual machine.

[0093] It is understandable that the above analysis of the historical data of multiple virtual machines by the analysis system to select the virtual machines suitable for conversion into containers is only an exemplary description. When the historical data of multiple virtual machines is analyzed by the analysis system to select the virtual machines suitable for conversion into containers, machine learning or other AI algorithms can also be introduced for processing. The embodiments of the present application are not limited to this. The above method of converting a virtual machine into a container can be performed by Figure 1 Executed by a processor in the server 100 shown. In some cases, Figure 1 In the case where the server 100 shown includes a data processor (DPU), the above method can be executed by the DPU to reduce the consumption of processor resources on the server.

[0094] In the embodiment of the present application, it is not necessary to rely on manual decision-making on migration load. Instead, according to the pre-configured virtual machine to container conversion strategy, the resource usage of different processes (business processes and non-business related processes) inside the virtual machine is dynamically tracked and analyzed, and the virtual machine suitable for conversion to a container is selected and a label is added. Then, by converting the virtual machine carrying the label into a container, the overhead of non-business related processes in the server system is reduced, thereby saving more resources for carrying more businesses, or providing more resources for key businesses, and optimizing the overall resource utilization efficiency of the cluster.

[0095] Next, based on the server in the above embodiment, a method for optimizing a virtual machine provided in an embodiment of the present application is introduced. Figure 4 A flowchart of a method for virtual machine optimization provided by an embodiment of the present application is shown. The method can be Figure 1 The processors on the server shown in . Figure 4 As shown, the method includes: step 401-step 403.

[0096] Step 401 : obtaining the system resource usage rate of a business process on each of a plurality of virtual machines deployed on a server.

[0097] In this embodiment, you can continue to refer to Figure 1 As shown, multiple virtual machines VM1, 2, ... can be deployed and run on the server 100, and each virtual machine VM usually runs a business process and a non-business process (such as a system process of GuestOS). The server 100 can monitor the resource usage of these processes through a virtual machine monitor, and in particular determine the system resource usage rate of the business process on the virtual machine.

[0098] Exemplarily, the virtual machine monitor of the server 100 can collect resource usage information of various processes on each virtual machine through the data acquisition tool on each virtual machine. The virtual machine monitor can transmit the resource usage information of all processes (including business processes) of these virtual machines to the analysis system, and the analysis system can filter out the resource usage information of the business process from the resource usage information of each virtual machine, and thus calculate the system resource usage rate of the business process of each virtual machine. Alternatively, the virtual machine monitor can filter out the resource usage information of the business processes of these virtual machines and transmit it to the analysis system, and the analysis system can thus calculate the system resource usage rate of the business process of each virtual machine.

[0099] As an example and not limitation, a virtual machine monitor or analysis system can distinguish between business processes and non-business related processes based on the descriptive information of the process itself. The descriptive information of the process may include but is not limited to the process ID, path, and operating environment (for example, processes running at the system level are usually system processes, and processes running at the user level are usually business processes), etc.

[0100] Step 402: determine at least one target virtual machine from the multiple virtual machines according to the system resource usage rate of the business process on each of the multiple virtual machines, and add an optimization tag to the target virtual machine.

[0101] In this embodiment, the server 100 can screen out target virtual machines from multiple virtual machines based on the system resource utilization of the business processes on each of the multiple virtual machines, whose system resource utilization of the business processes is lower than the above-mentioned preset utilization threshold, or whose system resource utilization of the business processes is lower than the system resource utilization of the business processes of most virtual machines, and add optimization tags to these target virtual machines to indicate that these target virtual machines need to be optimized, that is, they need to be migrated to containers.

[0102] Step 403: Convert the target virtual machine carrying the optimization tag into a container.

[0103] In this embodiment, the target virtual machine carrying the optimization label is a virtual machine whose business process has a low system resource utilization rate. The business processes of these target virtual machines may not necessarily occupy the resources of a virtual machine, and may also cause the system process of the GuestOS of the target virtual machine to occupy a large amount of server 100 resources, resulting in a waste of resources. To this end, in this embodiment, after the server 100 determines the target virtual machine, it can automatically trigger or be manually triggered by the user to perform business migration of the target virtual machine to the container according to its own configuration. In this way, the overhead of non-business-related processes in the server 100 system can be reduced, thereby saving more resources for carrying more businesses, or providing more resources for key businesses, and optimizing the overall resource utilization efficiency of the cluster.

[0104] Another implementation method of the embodiment of the present application is described in detail below with reference to the accompanying drawings.

[0105] For example, Figure 5 The figure shows a flow chart of a virtual machine optimization method provided by an embodiment of the present application. Figure 5 The process shown is Figure 4 A further detailed description of the process is shown. Figure 5 As shown, the method may specifically include:

[0106] Step 501: Receive first information input by a user, where the first information carries an optimization strategy.

[0107] In the embodiment of the present application, the server 100 can be based on Figure 3 The interface 110 shown receives the first information input by the user to pre-configure the optimization strategy for converting the virtual machine to a container. For example, the conversion type for converting the virtual machine to a container, the measurement factors for determining whether to convert the virtual machine to a container, the threshold for triggering the conversion of the virtual machine to a container, the cycle for obtaining the system resource information of the virtual machine process, and the virtual machine information that needs to be monitored can be configured in the optimization strategy. Among them, the specific process of configuring the optimization strategy can refer to the configuration process of the optimization strategy in the above embodiment, which will not be repeated here.

[0108] Step 502: For any one of the multiple virtual machines, determine whether the virtual machine has a data acquisition tool installed, and / or determine whether the business process of the virtual machine meets the conditions for running in a container.

[0109] In the embodiment of the present application, after the optimization strategy is configured, the server 100 also needs to perform a pre-check on the virtual machines so that these virtual machines can be converted into containers according to the optimization strategy during subsequent processing.

[0110] In one possible example, when performing a pre-check on a virtual machine, the check conditions may include: the virtual machine has a data acquisition tool installed, and its business process meets the conditions for running in a container (such as the virtual machine does not have large page memory enabled, and the virtual machine is not bound to a pass-through device). If the checked virtual machine does not meet any of the above check conditions, the optimization strategy cannot be used to optimize the virtual machine, and an error prompt may be output. On the contrary, if the checked virtual machine meets the above check conditions, the following step 503 may be performed.

[0111] Step 503: When the data acquisition tool is installed on the virtual machine and / or the business process of the virtual machine meets the conditions for running in the container, the optimization policy is bound to the virtual machine.

[0112] In the embodiment of the present application, the optimization policy is bound to the virtual machine that meets the above-mentioned inspection conditions. The virtual machine that is not bound to the optimization policy can be ignored when the virtual machine is subsequently converted to a container.

[0113] Step 504: Obtain the system resource usage rate of the business process on each of the multiple virtual machines deployed on the server.

[0114] In an embodiment of the present application, after the optimization strategies are bound to the multiple virtual machines deployed on the server 100, the analysis system deployed on the server can periodically obtain the system resource usage of the business processes in the virtual machines deployed on the server 100 through the data acquisition tool installed on the virtual machines. For example, the analysis system can obtain the system resource usage of the business processes on the virtual machines every 10 minutes. The obtained system resource usage of the business processes on the virtual machines is then saved to the database. Among them, when saving the system resource usage of the business processes on the virtual machines, the corresponding virtual machine identification information and the time information obtained need to be carried. In addition, the specific execution principle of step 504 is similar to the description of step 401 in the above embodiment, and will not be repeated here.

[0115] In some possible implementations, in order to improve the analysis efficiency, when executing step 504, the server 100 can filter out some processes with higher system resource usage rates from the system resource usage rates of all processes of the virtual machine for any virtual machine, and then distinguish the system resource usage rates of business processes and non-business related processes from these processes. This is because usually only business processes and some GuestOS system processes occupy a large amount of resources, and the resource usage of other processes is very small and can be ignored.

[0116] Optionally, in an embodiment of the present application, in order to improve the optimization success rate in the subsequent optimization process of the virtual machine based on the optimization strategy, the virtual machines of the server 100 may be screened to find virtual machines whose business processes run more stably.

[0117] Specifically, after step S504, the method may further include the following steps:

[0118] Calculate the variance of system resource usage of a business process on each of the multiple virtual machines in multiple data acquisition cycles;

[0119] Comparing the variance of resource usage of the business process on each of the multiple virtual machines with a preset variance value;

[0120] The virtual machines with a variance smaller than a preset value are added to a set of virtual machines to be converted, so as to optimize the virtual machines in the set of virtual machines to be converted.

[0121] In this example, after obtaining the system resource usage of the business processes on each virtual machine in the past 24 hours, the analysis system in the server 100 can also filter out the virtual machines with large fluctuations in the system resource usage of the business processes based on the variance of the system resource usage of the business processes on each virtual machine. In order to ensure that the virtual machines converted to containers are accurate business idle virtual machines, virtual machines with large fluctuations in the system resource usage of the business processes will not be considered for conversion to containers. The process of filtering out the virtual machines with large fluctuations in the system resource usage of the business processes based on the variance of the system resource usage of the business processes on each virtual machine can be referred to in Figure 3 The description in the corresponding embodiment will not be repeated here.

[0122] Exemplarily, after the above step 504, or after obtaining the above set of virtual machines to be converted, continue to refer to Figure 5 , the method may further include:

[0123] Step 505 : determining at least one target virtual machine from the multiple virtual machines according to the system resource usage rate of the business process on each of the multiple virtual machines, and adding an optimization tag to the target virtual machine.

[0124] In an embodiment of the present application, the analysis system in the server 100 can periodically analyze the system resource usage of the business process on the acquired virtual machine according to the analysis period configured in the optimization strategy, and select at least one target virtual machine to add to the idle virtual machine set.

[0125] Next, the process of determining the target virtual machine in the idle virtual machine set is introduced by taking the data acquisition cycle configured in the optimization strategy as 10 minutes and the analysis cycle as 24 hours as an example. The analysis cycle of 24 hours means that the analysis system will obtain the system resource usage of the business processes on the multiple virtual machines deployed on the server in the past 24 hours from the server 100 database every 24 hours.

[0126] Then, in a possible example, step 505 may specifically include:

[0127] Step 5051a, sorting the sum of system resource usage rates of business processes on virtual machines obtained in multiple data acquisition cycles in descending order;

[0128] Step 5052a: Add multiple virtual machines with the lowest total system resource usage of the business processes to the idle virtual machine set.

[0129] Through steps 5051a-5052a, for multiple virtual machines deployed on the server, the analysis system can count the sum of system resource usage of each business process on each virtual machine obtained within 24 hours. Then, the analysis system sorts the sum of system resource usage of the business process corresponding to each virtual machine from high to low, and adds the m virtual machines with the lowest sum of system resource usage of the business process to the idle virtual machine list, where m is a natural number greater than or equal to 1.

[0130] Step 5053a: determine at least one target virtual machine from the set of idle virtual machines, and add an optimization tag to the target virtual machine.

[0131] In step 5053a, after determining the target virtual machine in the idle virtual machine set, an optimization tag may be added to the target virtual machine in the idle virtual machine set to indicate that the target virtual machine carrying the optimization tag is a virtual machine that needs to be converted into a container. For example, the optimization tag may be added to the virtual machine information stored in the virtual machine monitor.

[0132] Or, in another possible example, step 505 may specifically include:

[0133] Step 5051b: If the system resource usage of the business process on the virtual machine obtained in a plurality of consecutive data acquisition cycles is less than a preset usage threshold, the virtual machine is added to the idle virtual machine set.

[0134] In step 5051b, after the analysis system obtains the system resource usage of the business process on each virtual machine in the past 24 hours, for each virtual machine, the analysis system can compare the system resource usage of the business process obtained in each data acquisition cycle in the past 24 hours with the preset usage threshold. If there are multiple business processes whose system resource usage is less than the preset usage threshold in the data acquisition cycle, the analysis system can add the virtual machine to the idle virtual machine list. For example, if the analysis system obtains the system resource usage of the business process on the virtual machine every 10 minutes, then the system resource usage of the business process needs to be obtained 1440 times in 24 hours. When the analysis system analyzes the system resource usage of the business process of a virtual machine within 24 hours, if more than 720 of the 1440 business processes whose system resource usage is less than the preset usage threshold, the virtual machine can be added to the idle virtual machine set. Alternatively, if among the 1440 obtained system resource usage rates of the business processes, there are business processes whose system resource usage rates obtained for more than 120 consecutive times are greater than the preset usage rate threshold, then the virtual machine can be added to the idle virtual machine set.

[0135] Step 5052b: determine at least one target virtual machine from the set of idle virtual machines, and add an optimization tag to the target virtual machine.

[0136] In step 5052b, after determining the target virtual machine in the idle virtual machine set, an optimization tag may be added to the target virtual machine in the idle virtual machine set to indicate that the target virtual machine carrying the optimization tag is a virtual machine that needs to be converted into a container. For example, the optimization tag may be added to the virtual machine information stored in the virtual machine monitor.

[0137] In some possible implementations, when executing step 505, in addition to determining the target virtual machine based on whether the system resource usage of the business process on the virtual machine is low, it is also possible to determine whether the system resource usage of the non-business-related process on the virtual machine is greater than a preset maximum usage threshold. If it is greater than the maximum usage threshold, that is, the non-business-related process occupies too much resources, and thus the virtual machine can also be used as the target virtual machine. It should be understood that the method for obtaining and calculating the system resource usage of the non-business-related process is similar to the method for obtaining and calculating the system resource usage of the business process described above, and will not be repeated.

[0138] Step 506: Convert the target virtual machine carrying the optimization tag into a container.

[0139] In the embodiment of the present application, after the analysis system adds optimization tags to the virtual machines in the idle virtual machine set, the server 100 can display corresponding prompt information on its corresponding display interface 110, and the prompt information is used to prompt the user to convert the virtual machines carrying the optimization tags into containers. According to the different conversion types configured by the user in the optimization strategy, the prompt information displayed on the server display interface 110 is also different.

[0140] For example, when the conversion type configured in the optimization strategy is automatic conversion, the prompt information may include the virtual machine identifier and the conversion time. Correspondingly, in this case, when executing step 506, the server 100 may convert the target virtual machine carrying the optimization tag into a container during a preset time period (such as a low-running period of the business process (such as 2:00 to 6:00 in the morning)).

[0141] Alternatively, when the conversion type configured in the optimization strategy is manual conversion, the prompt information may include a virtual machine identifier, and the prompt information is also used to prompt the user to enter a conversion time. Correspondingly, in the case of manual conversion, when executing step 506, the server 100 will first receive an optimization request input by the user, and the optimization request is used to instruct the server 100 to convert the target virtual machine carrying the optimization label into a container, and the optimization request may include the conversion time entered by the user and confirmation of the conversion operation. Next, the server 100 responds to the optimization request input by the user that includes the conversion time and confirmation of the conversion operation, and the server 100 triggers the container conversion engine within the corresponding conversion time to convert the virtual machine carrying the optimization label into a container.

[0142] Exemplarily, step 506 may specifically include steps 5061-5063:

[0143] Step 5061, obtaining the service process information of the target virtual machine carrying the optimization tag.

[0144] In this example, in the process of converting the target virtual machine with the optimization tag into a container, the server 100 system can collect the business process information of the target virtual machine with the optimization tag through the Agent and save it to the database. For example, the database, environment variables, configuration files, mounted storage volumes and other dependency information that the business process depends on. The business process information at least includes the database, environment variables, configuration files and mounted storage volumes that the business process depends on;

[0145] Step 5062: Create a corresponding container image through a preset script or program according to the business process information.

[0146] In this example, the server 100 can read the dependency information of the target virtual machine business process from the database through an automated script pre-configured in the server 100, and write a corresponding container file (dockerfile) based on the basic image re-built into the server system and the dependency information, thereby obtaining a customized container file that can meet the needs of the business process.

[0147] Exemplarily, when the conversion type configured in the optimization strategy is automatic conversion, the server can trigger the container management engine to build a container image according to dockerfile within the conversion time configured in the optimization strategy, and automatically configure the container operation parameters according to the business process dependency information obtained by the Agent. The server can also support users to manually modify the operation parameters.

[0148] Step 5063, convert the container image into a container.

[0149] In this example, the container management engine can create a container image according to the container file, and call the basic component runC to convert the container image into a container.

[0150] Step 507, mount the container to the disk mounted by the target virtual machine; then run the container and shut down the target virtual machine.

[0151] In the step, the converted container is mounted to the disk mounted by the target virtual machine, and then the container management engine automatically runs the newly generated container and triggers the virtual machine monitor to shut down the original business virtual machine to prevent the non-business process of the virtual machine from continuing to occupy resources.

[0152] In the embodiment of the present application, by dynamically tracking and analyzing the resource usage of different processes within the virtual machine, a virtual machine suitable for conversion into a container is selected and a label is added. Then, by converting the labeled virtual machine into a container, the overhead of non-business-related processes in the server system is reduced, thereby saving more resources for carrying more businesses, or providing more resources for key businesses, and optimizing the overall resource utilization efficiency of the cluster.

[0153] It is understandable that the size of the sequence number of each step in the above embodiment does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. In addition, in some possible implementations, the steps in the above embodiment can be selectively executed according to actual conditions, and can be partially executed or fully executed, which is not limited here. In addition, all or part of any features in the above embodiment can be freely and arbitrarily combined without contradiction, and the combined technical solution is also within the scope of the present application.

[0154] Based on the method in the above embodiment, the embodiment of the present application provides a virtual machine optimization device. Figure 6 , Figure 6 It is a structural diagram of a virtual machine optimization device provided in an embodiment of the present application.

[0155] like Figure 6 As shown, the virtual machine optimization device 600 may include: an acquisition module 601, which can be used to obtain the system resource usage rate of the business process on each of the multiple virtual machines deployed on the server; a processing module 602, which can be used to determine at least one target virtual machine from the multiple virtual machines based on the system resource usage rate of the business process on each of the multiple virtual machines, and add an optimization label to the target virtual machine, the optimization label is used to identify that the target virtual machine needs to be optimized; the processing module 602 can also be used to convert the virtual machine carrying the optimization label into a container.

[0156] It should be understood that the above-mentioned device 600 is used to execute the method in the above-mentioned embodiment. The implementation principle and technical effect of the corresponding program module in the device 600 are similar to those described in the above-mentioned method. The working process of the device can refer to the corresponding process in the above-mentioned method, which will not be repeated here.

[0157] Based on the method in the above embodiment, the embodiment of the present application further provides a server 700. Figure 7 As shown, the server includes: an input device 710, a memory 720, a central processing unit (CPU) 730, and an output device 740. Among them, multiple virtual machines are deployed on the server, and the multiple virtual machines can share the input device 710, the memory 720, the CPU 730, the output device 740 and other hardware devices on the server through the virtualized physical hardware system.

[0158] The input device 710 may be used to receive an optimization strategy input by a user, where the optimization strategy is used to select a virtual machine that needs to be converted into a container from multiple virtual machines deployed on the server.

[0159] The memory 720 may be used to store the optimization strategy used for input and the information of multiple virtual machines deployed on the server.

[0160] CPU730 can be used to bind the optimization strategy to multiple virtual machines deployed on the server. When the CPU binds the optimization strategy to multiple virtual machines deployed on the server, it is necessary to detect the bound virtual machine to determine whether the virtual machine is suitable for conversion into a container. For example, it can be determined whether the bound virtual machine has a data acquisition tool installed, whether the large page memory is turned on, and whether the pass-through device is bound. For virtual machines that are not installed with data acquisition tools, it is impossible to obtain resource usage information on the virtual machine, that is, it is impossible to determine whether to convert the virtual machine into a container. Therefore, CPU730 cannot bind the optimization strategy to the virtual machine. For virtual machines that turn on large page memory or bind pass-through devices, this type of virtual machine is a virtual machine that processes specific tasks. After being converted into a container, it may not be able to continue to process the business. Therefore, CPU730 cannot bind the optimization strategy to the virtual machine.

[0161] CPU730 can be used to obtain the system resource usage of the business process on each of the multiple virtual machines deployed on the server according to the optimization strategy input by the user. Then, CPU730 can also select at least one virtual machine from the multiple virtual machines to add to the idle virtual machine set according to the obtained system resource usage of the business process on each of the multiple virtual machines, and add an optimization tag to the virtual machine in the idle virtual machine set. Among them, the optimization tag is used to identify that the corresponding virtual machine needs to be optimized. Finally, CPU730 can also convert the virtual machine carrying the optimization tag into a container according to the conversion type configured in the optimization strategy.

[0162] In a possible example, the CPU 730 may periodically obtain the system resource usage of the business process on each of the multiple virtual machines deployed on the server according to the data acquisition cycle carried in the optimization strategy, and save the obtained system resource usage of the business process on each virtual machine to the memory 720. When the CPU 730 selects an idle virtual machine from the multiple virtual machines deployed on the server, the CPU 730 may filter out the idle virtual machine according to the system resource usage of the business process on the virtual machine obtained in the multiple data acquisition cycles stored in the memory 720. Specifically, for any one of the multiple virtual machines, if the resource usage of the business process on the virtual machine obtained in the multiple data acquisition cycles is less than the preset usage threshold, the CPU 730 needs to add the virtual machine to the idle virtual machine set. Alternatively, the multiple virtual machines are sorted in descending order according to the sum of the business process resource usage on the virtual machines in the multiple data acquisition cycles, and m virtual machines with the lowest sum of business resource usage are selected to be added to the idle virtual machine set, where m is a natural number greater than or equal to 1.

[0163] In a possible example, before determining an idle virtual machine from multiple virtual machines, the CPU 730 may remove virtual machines with large fluctuations in business process resource usage from the multiple virtual machines based on the business process resource usage of the multiple virtual machines stored in the memory 720 in multiple data acquisition cycles. Specifically, the CPU 730 may calculate the variance of the system resource usage of the business process on each of the multiple virtual machines in multiple cycles. Then, the CPU 730 compares the variance of the resource usage of the business process on each of the multiple virtual machines with a preset variance value, and adds the virtual machines with a variance value less than the preset variance value to the set of virtual machines to be converted.

[0164] The output device 740 can be used to output and display information that the server needs to display to the user. For example, after adding an optimization tag to a virtual machine in the idle virtual machine set of CPU 730, the output device 740 can output a prompt message, which is used to prompt the user to convert the virtual machine carrying the optimization tag into a container.

[0165] In a possible example, the server 700 may further include a data processor (DPU) 750. The DPU 750 is mainly used for high-level algorithm analysis. In the process of determining whether to convert a virtual machine on the server 700 into a container, in order to reduce the occupation of CPU resources on the server 700, the process of selecting a virtual machine that needs to be converted into a container from multiple virtual machines can be offloaded to the DPU 750 for implementation.

[0166] Based on the method in the above embodiment, the present application embodiment also provides a terminal device. Figure 8 , Figure 8 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application. Figure 8 As shown, the terminal device includes one or more processors 801 and an interface circuit 802. Optionally, the terminal device may also include a bus 803. Among them:

[0167] Processor 801 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in processor 801 or an instruction in software form. The above-mentioned processor 801 can be a general-purpose processor, a digital communicator (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. The disclosed methods and steps in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.

[0168] The interface circuit 802 can be used to send or receive data, instructions or information. The processor 801 can use the data, instructions or other information received by the interface circuit 802 to process, and can send the processing completion information through the interface circuit 802.

[0169] Optionally, the terminal device further includes a memory, which may include a read-only memory and a random access memory, and provides operation instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory (NVRAM).

[0170] Optionally, the memory stores executable software modules or data structures, and the processor can perform corresponding operations by calling operation instructions stored in the memory (the operation instructions can be stored in the operating system).

[0171] Optionally, the interface circuit 802 may be used to output the execution result of the processor 801 .

[0172] It should be noted that the functions corresponding to the processor 801 and the interface circuit 802 can be implemented through hardware design, software design, or a combination of hardware and software, which is not limited here.

[0173] It should be understood that each step of the above method embodiment can be completed by a hardware-based logic circuit or a software-based instruction in a processor.

[0174] 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.

[0175] Based on the method in the above embodiment, an embodiment of the present application provides a computer program product, characterized in that when the computer program product runs on a processor, the processor executes the method in the above embodiment.

[0176] 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 the 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.

[0177] 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, computer, server or data center to another website site, computer, server or 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 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.

[0178] 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.

Claims

1. A virtual machine optimization method, characterized in that: Applied to a server, the method comprises: Obtaining a system resource usage rate of a business process on each of a plurality of virtual machines deployed on the server; Determine at least one target virtual machine from the multiple virtual machines according to the system resource usage rate of the business process on each of the multiple virtual machines, and add an optimization tag to the target virtual machine, where the optimization tag is used to identify that the target virtual machine needs to be optimized; The target virtual machine carrying the optimization tag is converted into a container.

2. The method according to claim 1, characterized in that Before determining at least one target virtual machine from the multiple virtual machines according to the system resource usage rate of the business process on each of the multiple virtual machines and adding an optimization tag to the target virtual machine, the method further includes: Calculating the variance of the system resource usage rate of the business process on each of the multiple virtual machines in multiple data acquisition cycles; Comparing the variance of the resource usage of the business process on each of the multiple virtual machines with a preset variance value; The virtual machines with a variance smaller than the preset variance value are added to the set of virtual machines to be converted, so as to optimize the virtual machines in the set of virtual machines to be converted.

3. The method according to claim 1 or 2, characterized in that: The selecting at least one target virtual machine from the multiple virtual machines according to the system resource usage rate of the business process on each of the multiple virtual machines, and adding an optimization tag to the target virtual machine, comprises: If the system resource usage of the business process on the virtual machine obtained in a plurality of consecutive data acquisition cycles is less than a preset usage threshold, the virtual machine is added to the idle virtual machine set; At least one target virtual machine is determined from the set of idle virtual machines, and an optimization tag is added to the target virtual machine.

4. The method according to claim 1 or 2, characterized in that: The selecting at least one target virtual machine from the multiple virtual machines according to the system resource usage rate of the business process on each of the multiple virtual machines, and adding an optimization tag to the target virtual machine, comprises: Sorting the sum of system resource usage rates of the business processes on the virtual machine obtained in multiple data acquisition cycles in descending order; Add multiple virtual machines with the lowest total system resource usage of business processes to the idle virtual machine set; At least one target virtual machine is determined from the set of idle virtual machines, and an optimization tag is added to the target virtual machine.

5. The method according to claim 1, characterized in that The converting the target virtual machine carrying the optimization tag into a container includes: In a preset time period, converting the target virtual machine carrying the optimization tag into a container; or, receiving an optimization request input by a user, wherein the optimization request is used to instruct the server to convert the target virtual machine carrying the optimization tag into a container, In response to an optimization request input by a user, the target virtual machine carrying the optimization tag is converted into a container.

6. The method according to claim 1 or 5, characterized in that: The converting the virtual machine carrying the optimization tag into a container includes: Acquire business process information of the target virtual machine carrying the optimization tag, the business process information including at least a database, environment variables, configuration files and / or mounted storage volumes on which the business process depends; According to the business process information, a corresponding container image is created through a preset script or program; The container image is converted into the container.

7. The method according to claim 6, characterized in that After converting the virtual machine carrying the optimization tag into a container, the method includes: Mounting the container to the disk mounted by the target virtual machine; The container is run, and the target virtual machine is shut down.

8. The method according to claim 1, characterized in that The method also includes: receiving first information input by a user, the first information carrying an optimization strategy, the optimization strategy being used to determine the target virtual machine converted to a container from a plurality of virtual machines deployed on the server, the optimization strategy including: at least one of a conversion type, a measurement factor, a policy triggering threshold, a detection cycle, and a data acquisition cycle.

9. The method according to claim 8, characterized in that After receiving the first information input by the user, the method further includes: For any one of the multiple virtual machines, determining whether the virtual machine has a data acquisition tool installed, the data acquisition tool being used to acquire resource usage information on the virtual machine; and / or, For any one of the multiple virtual machines, determining whether a service process of the virtual machine meets a condition for running in a container; For any one of the multiple virtual machines, when the data acquisition tool is installed on the virtual machine and / or the business process of the virtual machine meets the conditions for running in a container, the optimization strategy is bound to the virtual machine.

10. A server, characterized in that: include: at least one memory for storing a program; At least one processor is used to execute the program stored in the memory. When the program stored in the memory is executed, the processor is used to execute the method described in any one of claims 1 to 9.