An energy consumption determination method, apparatus, device, and computer-readable storage medium
By obtaining sample feature parameters of virtual machines and using decision tree regression algorithm to generate energy consumption prediction model, the problem of unmeasurable container energy consumption is solved, and accurate prediction and resource scheduling of container energy consumption are achieved, thereby reducing the energy consumption of IT equipment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
- Filing Date
- 2021-09-02
- Publication Date
- 2026-08-04
AI Technical Summary
Existing technologies cannot directly measure container energy consumption, making it impossible to schedule resources based on container energy consumption to reduce the energy consumption of IT equipment.
By obtaining sample feature parameters of virtual machines, an energy consumption prediction model is established. The energy consumption prediction model is generated using a decision tree regression algorithm. Based on the feature parameters, the target energy consumption prediction model is determined from multiple energy consumption prediction models, thereby determining the energy consumption of the container.
It enables accurate prediction of container energy consumption, supports more efficient resource scheduling, reduces IT equipment energy consumption, and promotes the implementation of power-based billing models in data centers.
Smart Images

Figure CN115757002B_ABST
Abstract
Description
Technical Field
[0001] This application relates to energy consumption determination technology in the field of energy resource management, and in particular to an energy consumption determination method, apparatus, equipment and computer-readable storage medium. Background Technology
[0002] With the rapid development of the internet and mobile networks, the scale and number of data centers supporting these services are also growing rapidly. As a result, data centers have become the largest and fastest-growing consumers of electricity. Internet technology (IT) equipment is the main source of energy consumption in data centers, and most of the energy consumption of IT equipment is consumed by servers. Virtual machines and containers are the main environments running on servers. Since the energy consumption of containers cannot be directly measured, there is no information to refer to about container energy consumption, and therefore it is impossible to schedule resources for containers based on their energy consumption to reduce the energy consumption of IT equipment. Summary of the Invention
[0003] To address the aforementioned technical problems, embodiments of this application provide an energy consumption determination method, apparatus, device, and computer-readable storage medium, which solves the problem that the energy consumption of containers cannot be measured in the prior art.
[0004] To achieve the above objectives, the technical solution of this application is implemented as follows: A method for determining energy consumption, the method comprising: Obtain the first sample feature parameters of the virtual machine; the first sample feature parameters are used to characterize the energy consumption of different types of virtual machines; Based on the feature parameters of the first sample, determine the energy consumption prediction model corresponding to each type of virtual machine; Obtain the characteristic parameters of the target container, and determine the target energy consumption prediction model from multiple energy consumption prediction models based on the characteristic parameters; Based on the characteristic parameters and the target energy consumption prediction model, the energy consumption of the target container is determined.
[0005] In the above scheme, obtaining the first sample feature parameters of the virtual machine includes: Obtain the attribute parameters of the virtual machines, and classify the multiple virtual machines based on the attribute parameters; Obtain the first sample feature parameters for each type of virtual machine.
[0006] In the above scheme, determining the energy consumption prediction model corresponding to each type of virtual machine based on the first sample feature parameters includes: Based on the feature parameters of the first sample, a decision tree regression algorithm is used for analysis to generate a decision tree; Based on the first weight parameters of the leaf nodes of the decision tree, the energy consumption prediction model corresponding to each type of virtual machine is generated.
[0007] In the above scheme, determining the target energy consumption prediction model from multiple energy consumption prediction models based on the feature parameters includes: Based on the feature parameters and the decision tree, the target leaf node is determined from the nodes of the decision tree; Obtain the first weight parameter of the target leaf node; The second weight parameter is determined based on the first weight parameter of the target leaf node and the type of the target virtual machine corresponding to the target container; Based on the second weight parameter, the target energy consumption prediction model is determined from the plurality of energy consumption prediction models.
[0008] In the above scheme, obtaining the first weight parameter of the target leaf node includes: Obtain the first weighted feature vector and the first offset of the target leaf node; Accordingly, determining the second weight parameter based on the first weight parameter of the target leaf node and the type of the target virtual machine corresponding to the target container includes: Determine the type of the target virtual machine and the association between the weight feature vector and the type; Based on the association, a second weight feature vector and a second offset corresponding to the type of the target virtual machine are determined from the first weight feature vector and the first offset.
[0009] The method in the above scheme further includes: Obtain the feature parameters of the second sample according to the target sampling period; The first sample feature parameters are updated based on the second sample feature parameters.
[0010] In the above scheme, the first sample feature parameters include the historical usage status information of the virtual machine's central processing unit, the historical usage status information of the virtual machine's memory, and the historical usage status of the virtual machine's network port; The characteristic parameters include the usage status information of the target container's central processing unit, memory, and network port.
[0011] An energy consumption determination device, the device comprising: An acquisition unit is used to acquire first sample feature parameters of a virtual machine; the first sample feature parameters are used to characterize the energy consumption of different types of virtual machines. The processing unit is used to determine the energy consumption prediction model corresponding to each type of virtual machine based on the feature parameters of the first sample. The processing unit is also used to obtain the characteristic parameters of the target container and determine the target energy consumption prediction model from multiple energy consumption prediction models based on the characteristic parameters. The processing unit is further configured to determine the energy consumption of the target container based on the feature parameters and the target energy consumption prediction model.
[0012] An energy consumption determination device, the device comprising: a processor, a memory, and a communication bus; The communication bus is used to realize the communication connection between the processor and the memory; The processor is used to execute the energy consumption determination program stored in the memory to perform the following steps: Obtain the first sample feature parameters of the virtual machine; the first sample feature parameters are used to characterize the energy consumption of different types of virtual machines; Based on the feature parameters of the first sample, determine the energy consumption prediction model corresponding to each type of virtual machine; Obtain the characteristic parameters of the target container, and determine the target energy consumption prediction model from multiple energy consumption prediction models based on the characteristic parameters; Based on the characteristic parameters and the target energy consumption prediction model, the energy consumption of the target container is determined.
[0013] A computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the steps of the energy consumption determination method described above.
[0014] The energy consumption determination method, apparatus, device, and computer-readable storage medium provided in this application embodiment obtain first sample feature parameters of virtual machines; the first sample feature parameters are used to characterize the energy consumption of different types of virtual machines; based on the first sample feature parameters, an energy consumption prediction model corresponding to each type of virtual machine is determined; feature parameters of a target container are obtained, and a target energy consumption prediction model is determined from multiple energy consumption prediction models based on the feature parameters; the energy consumption of the target container is determined based on the feature parameters and the target energy consumption prediction model; thus, the energy consumption of the target container can be obtained based on the feature parameters and the target energy consumption prediction model, so that the container can be resource-scheduled based on the energy consumption of the target container to reduce the energy consumption of IT equipment. Attached Figure Description
[0015] Figure 1 A flowchart illustrating an energy consumption determination method provided in an embodiment of this application; Figure 2A flowchart illustrating another energy consumption determination method provided in an embodiment of this application; Figure 3 A schematic diagram of the architecture of the energy consumption determination model provided in the embodiments of this application; Figure 4 A schematic diagram of the simulation experimental environment architecture for the energy consumption determination method provided in the embodiments of this application; Figure 5 This is a schematic diagram of the structure of an energy consumption determination device provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of an energy consumption determination device provided in an embodiment of this application. Detailed Implementation
[0016] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.
[0017] This application provides an energy consumption determination method, which is applied to an energy consumption determination device, such as... Figure 1 As shown, the method includes the following steps: Step 101: Obtain the first sample feature parameters of the virtual machine.
[0018] The first sample feature parameter is used to characterize the energy consumption of different types of virtual machines. The first sample feature parameter can be the running status data of multiple types of virtual machines. The running status data of the virtual machine includes at least the historical usage status information of the virtual machine's central processing unit (CPU), the historical usage status information of the virtual machine's memory, and the historical usage status information of the virtual machine's network port.
[0019] In this embodiment of the application, the running status data of the virtual machine can be collected by the management tool installed on the server. Then, the energy consumption determination device can send an acquisition command to the server, so that after receiving the acquisition command, the server sends the collected running status data of the virtual machine to the energy consumption determination device.
[0020] In one feasible implementation, the first sample feature parameters can be the historical CPU utilization rate of various types of virtual machines, the historical memory utilization rate of virtual machines, the historical hard disk read / write bytes, and the historical network inbound / outbound bytes.
[0021] Step 102: Based on the feature parameters of the first sample, determine the energy consumption prediction model corresponding to each type of virtual machine.
[0022] In this embodiment of the application, the first sample feature parameters can be transformed to obtain the feature vector corresponding to the first sample feature parameters, and an energy consumption prediction model corresponding to each type of virtual machine can be generated based on the feature vector corresponding to the first sample feature parameters.
[0023] Specifically, the energy consumption determination device can transform the runtime status data of each type of virtual machine to obtain a feature vector for each type of virtual machine. Then, it combines or concatenates the feature vectors of multiple types of virtual machines to obtain the feature vector corresponding to the first sample feature parameter. The dimension of the feature vector corresponding to the first sample feature parameter can be the number of virtual machine types multiplied by the dimension of the feature vector corresponding to each type of virtual machine; the dimension of the feature vector corresponding to each type of virtual machine is determined by the category (type) of the virtual machine's runtime status data.
[0024] In one feasible implementation, if the first sample feature parameters include runtime status data for four types of virtual machines, and the runtime status data for each type of virtual machine can be divided into six categories, then for each type of virtual machine, a 6-dimensional feature vector can be obtained. Therefore, the dimension of the feature vector corresponding to the first sample feature parameters is 4*6=24, where there is one virtual machine of each type. Of course, there can also be multiple virtual machines of each type; when there are multiple virtual machines, the dimension of the feature vector for each type of virtual machine will change.
[0025] It should be noted that there can be multiple energy consumption prediction models for each type of virtual machine; the applicable conditions for each energy consumption prediction model for the same type of virtual machine are different; in one feasible implementation, the energy consumption prediction models for type A virtual machines are the first energy consumption prediction model and the second energy consumption prediction model. The CPU utilization rates corresponding to the first energy consumption prediction model and the second energy consumption prediction model are different. In actual use, the corresponding energy consumption prediction model can be selected for energy consumption prediction based on the current CPU utilization of the target container.
[0026] Step 103: Obtain the feature parameters of the target container, and determine the target energy consumption prediction model from multiple energy consumption prediction models based on the feature parameters.
[0027] The characteristic parameters of the target container can be the operating status data of the target container collected in real time by the energy consumption determination device; the operating status data of the target container can include the usage status information of the target container's central processing unit, the usage status information of the target container's memory, and the usage status information of the target container's network ports.
[0028] In this embodiment of the application, multiple energy consumption prediction models can be screened based on the characteristic parameters of the target container, and the target energy consumption prediction model can be determined from the multiple energy consumption prediction models.
[0029] In one feasible implementation, the characteristic parameters of the target container can be the CPU utilization rate, memory utilization rate, disk read / write bytes, and network inbound / outbound bytes of the target container. Then, the CPU utilization rate, memory utilization rate, disk read / write bytes, and network inbound / outbound bytes of the target container can be used sequentially to filter multiple energy consumption prediction models to obtain the target energy consumption prediction model.
[0030] Step 104: Determine the energy consumption of the target container based on the characteristic parameters and the target energy consumption prediction model.
[0031] In this embodiment of the application, feature parameters can be input into the target energy consumption prediction model, and the target energy consumption prediction model can output the energy consumption of the target container.
[0032] It should be noted that the energy consumption prediction model provided in this application embodiment can predict not only the energy consumption of containers, but also the energy consumption of virtual machines. When predicting the energy consumption of virtual machines, the characteristic parameters of the virtual machine can be obtained, and a target prediction model can be determined from multiple energy consumption prediction models based on the characteristic parameters of the virtual machine. The characteristic parameters of the virtual machine are then input into the target energy consumption prediction model, and the output of the target energy consumption prediction model is used as the energy consumption of the virtual machine. The characteristic parameters of the virtual machine may include the usage status information of the virtual machine's central processing unit, the usage status information of the virtual machine's memory, and the usage status information of the virtual machine's network ports.
[0033] Determining the energy consumption of target containers can help data centers better manage and schedule containers, thereby making more efficient use of server resources to reduce the energy consumption of IT equipment. Furthermore, it can help data centers change from the existing time-based billing model to a power-based billing model to achieve fairer pricing.
[0034] The energy consumption determination method provided in this application embodiment obtains first sample feature parameters of virtual machines; the first sample feature parameters are used to characterize the energy consumption of different types of virtual machines; based on the first sample feature parameters, an energy consumption prediction model corresponding to each type of virtual machine is determined; feature parameters of a target container are obtained, and a target energy consumption prediction model is determined from multiple energy consumption prediction models based on the feature parameters; the energy consumption of the target container is determined based on the feature parameters and the target energy consumption prediction model; thus, the energy consumption of the target container can be obtained based on the feature parameters and the target energy consumption prediction model, so that the container can be resource-scheduled based on the energy consumption of the target container to reduce the energy consumption of IT equipment.
[0035] Based on the foregoing embodiments, embodiments of this application improve an energy consumption determination method, referring to... Figure 2 As shown, the method includes the following steps: Step 201: The energy consumption determination device obtains the attribute parameters of the virtual machines and classifies multiple virtual machines based on the attribute parameters.
[0036] The virtual machine's attribute parameters include at least one of the following: memory management parameters, just-in-time compilation parameters, type loading parameters, multithreading-related parameters, performance parameters, and debugging parameters.
[0037] In this embodiment of the application, the attribute parameters of the virtual machine can be obtained directly from the server by the virtual energy consumption device sending an acquisition command; the energy consumption determination device can adaptively divide multiple virtual machines according to the attribute parameters of the virtual machine to obtain virtual machines of different categories.
[0038] In one feasible implementation, the energy consumption determination device can classify multiple virtual machines into three categories based on the virtual machine's memory management parameters: micro virtual machines, medium-sized virtual machines, and large virtual machines.
[0039] Step 202: The energy consumption determination device obtains the first sample feature parameters for each type of virtual machine.
[0040] In this embodiment of the application, the energy consumption determination device can send an acquisition instruction to the server, wherein the acquisition instruction is used to instruct the server to acquire the candidate sample feature parameters of different types of virtual machines. Then, the candidate sample feature parameters of different types of virtual machines can be compared and analyzed, and the first sample feature parameter corresponding to each type of virtual machine can be determined from multiple candidate sample feature parameters.
[0041] Step 203: The energy consumption determination device uses the decision tree regression algorithm to analyze the feature parameters of the first sample and generate a decision tree.
[0042] In this embodiment, the first sample feature parameters can be transformed to obtain the feature vector corresponding to the first sample feature parameters, and a decision tree regression algorithm is used to analyze the first sample feature vector to obtain a decision tree. The feature vector is the vector representation of the first sample feature parameters. The nodes of the decision tree include leaf nodes and decision nodes (non-leaf nodes). Each decision node's data includes a separating feature and a separating value; the leaf nodes' data includes a first weight parameter, which includes a first weight vector and a first offset.
[0043] It's important to note that decision tree regression is an instance-based inductive learning method that extracts a tree-like classification model from given unordered training samples. Each non-leaf node in the decision tree records which feature (separating feature) was used to determine the class, while each leaf node represents the final class determination. A classification path is formed from the root node to each leaf node. When testing a new sample, it only needs to start from the root node, test at each branch node (decision node), recursively enter the subtree along the corresponding branch, and test again until it reaches a leaf node. The class represented by that leaf node is the predicted class of the current test sample.
[0044] In this application embodiment, the decision tree regression algorithm can also be called the piecewise regression algorithm of decision trees, where "multiple segments" can refer to the running status data of different virtual machines. Due to the emergence of energy-saving technologies, the relationship between power and features is no longer linear. This application proposes a decision tree regression algorithm to fit the model, effectively solving this nonlinear problem. Moreover, it cleverly utilizes the decision tree generated by the first sample feature parameters of the virtual machine, and constructs a virtual machine energy consumption prediction model based on the decision tree, avoiding larger fitting errors caused by secondary modeling. The virtual machine energy consumption prediction model can predict not only the energy consumption of the virtual machine, but also the energy consumption of the container, improving the efficiency of determining the energy consumption of the virtual machine and the container.
[0045] The main energy consumption of a server is caused by the operation of virtual machines and the management of virtual machines by virtualization programs. However, the server also consumes energy when no virtual machines are running; this energy consumption is called idle energy consumption. Therefore, the total energy consumption generated by the virtual machine operation is equal to the server's energy consumption. The relationship between them can be expressed by formula (1) as follows: Formula (1) in, This indicates the total number of virtual machines. Indicates the first The power of each virtual machine; for a certain type of virtual machine, assume that the feature vector corresponding to the first sample feature parameters of that type of virtual machine is... ,in, Let X represent the value of the i-th feature, and m represent the number of features. In one feasible implementation, X can be the feature vector of a medium-sized virtual machine, and m can be 6. , , , , and These can be the CPU utilization, memory utilization, disk read bytes, disk write bytes, network inbound bytes, and network outbound bytes for a medium-sized virtual machine.
[0046] The energy consumption determination device can establish the correlation between the first sample characteristic parameters of this type of virtual machine and power, which can be expressed by formula (2): Formula (2) in, This represents the weight (weight parameter) of each feature of the virtual machine under this type. This represents the offset. Therefore, the total energy consumption of the virtual machine running on the server can be expressed by formula (3): Formula (3) in, This indicates the number of virtual machine types on the server. This indicates the number of virtual machines running under each virtual machine type. This represents the sum of the offsets of virtual machines running under each virtual machine type. According to formula (2), all the corresponding features under each virtual machine type are fitted as single features to obtain the weight feature vector in the weight parameters for each virtual machine type. For the offset, it can be divided according to the proportion of the CPU utilization of a single virtual machine to the CPU utilization of all virtual machines.
[0047] like Figure 3 As shown, there are 2 types of virtual machines and 4 virtual machines in total. The virtual machines include 2 medium-sized virtual machines and 2 micro-sized virtual machines. Feature vectors for the medium-sized virtual machines can be obtained based on the first sample feature parameters of the two medium-sized virtual machines, and feature vectors for the micro-sized virtual machines can be obtained based on the first sample feature parameters of the two micro-sized virtual machines. The feature vectors for the medium-sized and micro-sized virtual machines are combined, and the combined vectors are processed to generate a decision tree, as shown below. Figure 3 As shown, each decision node in the generated decision tree stores the node's separating feature (split feature) and its separating value (split value). The node is then divided into two child nodes based on its separating feature and its separating value. These child nodes then decide whether to continue splitting. The leaf nodes store the first weight parameters after the split. Each decision node splits into two child nodes; the left child is called the left child, and the right child is called the right child.
[0048] A key issue at the decision node is the selection of the separating feature. Since the first sample feature parameters are continuous data, traditional methods such as maximizing information gain in classification decision trees cannot be used. For regression problems, the squared error is used as the selection criterion. This error can be expressed by formula (4): Formula (4) in, This indicates the number of data points allocated to the current node. This represents the value obtained through fitting. This represents the actual power value of the physical machine.
[0049] For each feature This feature appears in the parameters of the current node. Let there be 10 different values. First, arrange these values in ascending order, and denote them as _____. Among them, features This refers to any one of the following characteristics of a virtual machine: historical CPU utilization, historical memory utilization, historical disk read / write bytes, and historical network inbound / outbound bytes. For every two adjacent values... A dividing point can be extracted. The parameters of the current node are divided into two subsets. Therefore, a set of all possible split points for this feature can be obtained. It can be expressed by formula (5): Formula (5) for Each dividing point The errors obtained by fitting linear models to the two subsets after partitioning are calculated and summed. If the error after partitioning exceeds a threshold compared to the error before partitioning... If the value decreases, then the split point under this feature is... As an alternative, the process continues until all split points under all features have been traversed, at which point a splitting feature (separating feature) is selected. The error reduction is greatest for this. If none of them... It can cause the error to exceed the threshold If the value decreases, then no further division is performed at that node; it is used as a leaf node to fit the model, and the first weight parameter is saved.
[0050] For model fitting at leaf nodes, excessively small datasets are detrimental to linear models learning the true data distribution. Therefore, a threshold is set when the size of the partitioned subset is less than a certain value. At that time, the partition will not be included in the partitioning scheme.
[0051] It should be noted that there is a problem with the selection of split points. When there are many features and many singular values for each feature, traversing these split points will consume a lot of time, resulting in slow decision tree generation. Therefore, while ensuring the accuracy of the model, the feature parameters of the first sample can be normalized and then rounded to a specific precision to reduce the number of singular values generated by the parameters, thereby reducing the number of split points and reducing the traversal time.
[0052] Step 204: The energy consumption determination device generates an energy consumption prediction model for each type of virtual machine based on the first weight parameter of the leaf node of the decision tree.
[0053] In this embodiment, if the first sample feature parameters include the running status data of four types of virtual machines, then the first weight parameters stored in each leaf node of the decision tree will include the feature parameters corresponding to each of the four types of virtual machines. For any leaf node, an energy consumption prediction model for each type of virtual machine corresponding to that leaf node can be generated based on the feature parameters of each type of virtual machine in the leaf node. The first weight parameters are different for each leaf node.
[0054] Step 205: The energy consumption determination device determines the target leaf node from the nodes of the decision tree based on the feature parameters and the decision tree.
[0055] In this embodiment, the energy consumption determination device traverses the nodes in the decision tree starting from the root node based on the feature parameters, determines the leaf node that matches the feature parameters, and takes that node as the target leaf node.
[0056] Step 206: The energy consumption determination device obtains the first weight parameter of the target leaf node.
[0057] The target leaf node is the leaf node in the decision tree determined based on the feature parameters.
[0058] In this embodiment of the application, the energy consumption determination device can obtain the stored first weight parameter from the target leaf node based on the determined target leaf node.
[0059] Step 206 can be achieved by the following steps; a. The energy consumption determination device obtains the first weighted feature vector and the first offset of the target leaf node.
[0060] In this embodiment, the first weight feature vector and the first offset are parameters stored in the target leaf node of the decision tree, which can be directly obtained from the target leaf node.
[0061] Step 207: The energy consumption determination device determines the second weight parameter based on the first weight parameter of the target leaf node and the type of the target virtual machine corresponding to the target container.
[0062] In this embodiment, a second weight parameter can be obtained by filtering the first weight parameter of the target leaf node based on the type of the target virtual machine corresponding to the target container. The first weight parameter includes weight parameters for different types of virtual machines within the target leaf node.
[0063] Step 207 can be achieved by the following steps; b. Energy consumption determination equipment determines the type and weight feature vector of the target virtual machine and the relationship between the type.
[0064] In this embodiment of the application, the energy consumption determination device can determine the target virtual machine where the target container is located based on the target container, and determine the type of the target virtual machine based on the attribute parameters of the target virtual machine.
[0065] It should be noted that the type of the target virtual machine can be determined before or after the second weight parameter is obtained.
[0066] The association between weighted feature vectors and type refers to the relationship between the first weighted feature vector and the first offset in the leaf node of the decision tree and the type of the virtual machine; specifically, this relationship can be the correspondence between the first weighted feature vector and the first offset and the position of the virtual machine's type. The association between weighted feature vectors and type is obtained by analyzing the first weight parameters of the leaf nodes of the decision tree.
[0067] c. The energy consumption determination device determines the second weight feature vector and the second offset corresponding to the type of the target virtual machine from the first weight feature vector and the first offset based on the association relationship.
[0068] In this embodiment of the application, the energy consumption determination device can determine the position parameter of the second weight feature vector corresponding to the type of the target virtual machine from the first weight feature vector according to the association relationship, and determine the second weight feature vector from the first weight feature vector according to the position parameter.
[0069] Step 208: The energy consumption determination device determines the target energy consumption prediction model from multiple energy consumption prediction models based on the second weight parameter.
[0070] In this embodiment of the application, multiple energy consumption prediction models can be screened based on the second weight parameter to obtain the target energy consumption prediction model corresponding to the second weight parameter.
[0071] Step 209: Determine the energy consumption of the target container based on the characteristic parameters and the target energy consumption prediction model.
[0072] It should be noted that the descriptions of the same steps and contents as in other embodiments in this embodiment can be found in the descriptions in other embodiments, and will not be repeated here.
[0073] Based on the foregoing embodiments, in other embodiments of this application, the energy consumption determination method may further include the following steps: Step 210: The energy consumption determination device acquires the second sample feature parameters according to the target sampling period.
[0074] The second sample feature parameter is the running status data of different types of virtual machines collected at regular intervals.
[0075] In this embodiment of the application, the energy consumption determination device can obtain the second sample feature parameters of the virtual machine according to the target sampling period through the management tool installed on the server; in one feasible implementation, the target sampling period can be one day or one week.
[0076] Step 211: The energy consumption determination device updates the first sample feature parameters based on the second sample feature parameters.
[0077] In this embodiment of the application, second sample feature parameters of various types of virtual machines can be collected periodically according to the target adoption cycle, so that the data used to determine the energy consumption prediction model is closer to the real environment of the current virtual machine, thereby optimizing the energy consumption prediction model. Furthermore, the accuracy of the energy consumption of the determined target container can be improved through the optimized energy consumption prediction model.
[0078] The following section, in conjunction with the accompanying diagrams, provides a detailed explanation of how a data center environment was simulated to collect relevant data from virtual machines and containers.
[0079] like Figure 4As shown, an experimental environment using OpenStack (cloud computing) was set up, including an OpenStack control node, an OpenStack compute node, and a monitoring node for collecting data from the compute node. The control node, compute node, and monitoring node were connected to the same router via network cables to form a local area network (LAN). This allows data from the compute node to be sent to the monitoring node. The compute node's power cord was plugged into a power distribution unit to monitor its power information. Data was transmitted from the power distribution unit to the monitoring node via a serial cable at a frequency of 1Hz. After deploying this environment, data acquisition could begin. Specifically, a data acquisition program called `collectd` was deployed on the compute node. This program could collect the compute node's Resource Performance Counters (RPC) and Production Material Control (PMC) data, and could also read these metrics from the virtual machine through the hypervisor layer. The acquisition frequency of `collectd` was set to the same 1Hz frequency as the acquisition frequency from the power distribution unit. The compute node's power data was collected by executing a serial communication script on the monitoring node. Container data is primarily collected by executing the `docker stats` command that comes with Docker. Container data is collected once per second. Since the scripts for collecting features (collectd) and power data are not on the same server, to ensure that the data collected by the compute nodes and monitoring nodes are time-synchronized, the time synchronization program `chrony` is installed on all servers and virtual machines, and time is uniformly synchronized from the monitoring nodes.
[0080] The most common RPC features selected for collection are CPU utilization, memory utilization, disk read / write bytes, and network inbound / outbound bytes—a total of six features. Since disk read bytes and disk write bytes contribute equally to power consumption, these two features can be summed into a single feature. These features are chosen because they are readily collectable on any system (including virtualized environments) because they are system-level metrics, unlike PMC which is hardware-level and cannot be collected on different hardware platforms or virtualized environments. Secondly, these features are also natively supported by docker stats, eliminating the need for additional plugins to collect container-level features.
[0081] When directly substituting container characteristics (i.e., the characteristic parameters of the target container) into the target energy consumption prediction model of the corresponding target virtual machine, one point needs attention: the range of virtual machine CPU utilization collected by collectd is... Regardless of the number of cores a virtual machine has, the range of container CPU utilization collected by docker stats is... , This indicates the number of server cores. Therefore, when normalizing data, the normalization ranges need to be set separately, rather than using the same normalization range for all data.
[0082] The energy consumption determination method provided in this application embodiment can obtain the energy consumption of the target container based on the characteristic parameters of the target container and the energy consumption prediction model, so that the resources of IT equipment can be scheduled based on the energy consumption of the target container and the determined energy consumption of the virtual machine, thereby further reducing the energy consumption of IT equipment.
[0083] Based on the foregoing embodiments, this application provides an energy consumption determination device, which can be applied to... Figure 1-2 In the energy consumption determination method provided in the corresponding embodiment, such as Figure 5 As shown, the energy consumption determination device 3 includes: The acquisition unit 31 is used to acquire the first sample feature parameters of the virtual machine; the first sample feature parameters are used to characterize the energy consumption of different types of virtual machines; Processing unit 32 is used to determine the energy consumption prediction model corresponding to each type of virtual machine based on the feature parameters of the first sample; The processing unit 32 is also used to obtain the characteristic parameters of the target container and determine the target energy consumption prediction model from multiple energy consumption prediction models based on the characteristic parameters; The processing unit 32 is also used to determine the energy consumption of the target container based on the characteristic parameters and the target energy consumption prediction model.
[0084] In this embodiment of the application, the processing unit 32 is further configured to perform the following steps: Obtain the attribute parameters of the virtual machines and classify multiple virtual machines based on the attribute parameters; Obtain the first sample feature parameters for each type of virtual machine.
[0085] In this embodiment of the application, the processing unit 32 is further configured to perform the following steps: Based on the feature parameters of the first sample, a decision tree regression algorithm is used for analysis to generate a decision tree; Based on the first weight parameter of the leaf node of the decision tree, an energy consumption prediction model is generated for each type of virtual machine.
[0086] In this embodiment of the application, the processing unit 32 is further configured to perform the following steps: Based on feature parameters and a decision tree, the target leaf node is determined from the nodes of the decision tree; Obtain the first weight parameter of the target leaf node; The second weight parameter is determined based on the first weight parameter of the target leaf node and the type of the target virtual machine corresponding to the target container. Based on the second weight parameter, the target energy consumption prediction model is determined from multiple energy consumption prediction models.
[0087] In this embodiment of the application, the processing unit 32 is further configured to perform the following steps: Obtain the first weighted feature vector and the first offset of the target leaf node; Accordingly, based on the first weight parameter of the target leaf node and the type of the target virtual machine corresponding to the target container, the second weight parameter is determined, including: Determine the type of the target virtual machine and the correlation between the weighted feature vector and the type; Based on the association, the second weight feature vector and the second offset corresponding to the type of the target virtual machine are determined from the first weight feature vector and the first offset.
[0088] In this embodiment of the application, the processing unit 32 is further configured to perform the following steps: Obtain the feature parameters of the second sample according to the target sampling period; Update the feature parameters of the first sample based on the feature parameters of the second sample.
[0089] In this embodiment of the application, the first sample feature parameters include the historical usage status information of the virtual machine's central processing unit, the historical usage status information of the virtual machine's memory, and the historical usage status of the virtual machine's network port. The characteristic parameters include the target container's CPU usage status information, memory usage status information, and network port usage status information.
[0090] The energy consumption determination device provided in this application embodiment can obtain the energy consumption of the target container based on the characteristic parameters of the target container and the target energy consumption prediction model, so that the container can be resource-scheduled based on the energy consumption of the target container to reduce the energy consumption of IT equipment.
[0091] Based on the foregoing embodiments, embodiments of this application provide an energy consumption determination device, which can be applied to... Figure 1-2 In the energy consumption determination method provided in the corresponding embodiment, refer to Figure 6 As shown, the energy consumption determination device 4 includes: a memory 41, a processor 42, and a communication bus 43; Communication bus 43 is used to realize the communication connection between processor 42 and memory 41; The processor 42 is used to execute the energy consumption determination program stored in the memory 41 to perform the following steps: Obtain the first sample feature parameters of the virtual machine; the first sample feature parameters are used to characterize the energy consumption of different types of virtual machines; Based on the feature parameters of the first sample, determine the energy consumption prediction model corresponding to each type of virtual machine; Obtain the feature parameters of the target container, and determine the target energy consumption prediction model from multiple energy consumption prediction models based on the feature parameters; Based on characteristic parameters and the target energy consumption prediction model, the energy consumption of the target container is determined; In other embodiments of this application, processor 42 is configured to execute executable instructions stored in memory 41 to obtain first sample feature parameters of a virtual machine, in order to implement the following steps: Obtain the attribute parameters of the virtual machines and classify multiple virtual machines based on the attribute parameters; Obtain the first sample feature parameters for each type of virtual machine.
[0092] In other embodiments of this application, processor 42 is configured to execute executable instructions stored in memory 41 based on first sample feature parameters to determine the energy consumption prediction model corresponding to each type of virtual machine, in order to implement the following steps: Based on the feature parameters of the first sample, a decision tree regression algorithm is used for analysis to generate a decision tree; Based on the first weight parameter of the leaf node of the decision tree, an energy consumption prediction model is generated for each type of virtual machine.
[0093] In other embodiments of this application, processor 42 is configured to execute executable instructions stored in memory 41 to determine a target energy consumption prediction model from multiple energy consumption prediction models based on feature parameters, in order to perform the following steps: Obtain the first weight parameter of the target leaf node; The second weight parameter is determined based on the first weight parameter of the target leaf node and the type of the target virtual machine corresponding to the target container. Based on the second weight parameter, the target energy consumption prediction model is determined from multiple energy consumption prediction models.
[0094] In other embodiments of this application, processor 42 is configured to execute executable instructions stored in memory 41 to obtain the first weight parameter of the target leaf node, in order to implement the following steps: Obtain the first weighted feature vector and the first offset of the target leaf node; Accordingly, based on the first weight parameter of the target leaf node and the type of the target virtual machine corresponding to the target container, the second weight parameter is determined, including: Determine the type of the target virtual machine and the correlation between the weighted feature vector and the type; Based on the association, the second weight feature vector and the second offset corresponding to the type of the target virtual machine are determined from the first weight feature vector and the first offset.
[0095] In other embodiments of this application, processor 42 is configured to execute executable instructions stored in memory 41 to perform the following steps: Obtain the feature parameters of the second sample according to the target sampling period; Update the feature parameters of the first sample based on the feature parameters of the second sample.
[0096] In other embodiments of this application, the first sample feature parameters include the historical usage status information of the virtual machine's central processing unit, the historical usage status information of the virtual machine's memory, and the historical usage status of the virtual machine's network port. The characteristic parameters include the target container's CPU usage status information, memory usage status information, and network port usage status information.
[0097] It should be noted that the specific implementation process of the steps executed by processor 42 in this embodiment can be referred to Figure 1-2 The implementation process of the energy consumption determination method provided in the corresponding embodiment will not be described in detail here.
[0098] The energy consumption determination device provided in this application embodiment can obtain the energy consumption of the target container based on the characteristic parameters of the target container and the target energy consumption prediction model, so that the container can be resource-scheduled based on the energy consumption of the target container to reduce the energy consumption of IT equipment.
[0099] Based on the foregoing embodiments, this application provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to achieve... Figure 1-2 The steps in the energy consumption determination method provided in the corresponding embodiment.
[0100] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.
[0101] It should be noted that the aforementioned computer-readable storage media can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM), etc.; or it can be various electronic devices including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.
[0102] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0103] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0104] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0105] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0106] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0107] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0108] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for determining energy consumption, characterized in that, The method includes: Obtain the first sample feature parameters of the virtual machine; the first sample feature parameters are used to characterize the energy consumption of different types of virtual machines; Based on the first sample feature parameters, a decision tree regression algorithm is used for analysis to generate a decision tree; based on the first weight parameters of the leaf nodes of the decision tree, an energy consumption prediction model corresponding to each type of virtual machine is generated; wherein, according to the type of virtual machine, all corresponding features under the type of virtual machine are fitted as individual features to obtain the weight feature vector in the first weight parameters of each type of virtual machine; for the offset, it is divided according to the proportion of the CPU utilization of a single virtual machine to the CPU utilization of all virtual machines; the power of the virtual machine is equal to the product of the transpose of the weight feature vector and the feature vector corresponding to the first sample feature parameters, plus the offset. The process involves: acquiring feature parameters of the target container; determining the target leaf node from the nodes of the decision tree based on the feature parameters and the decision tree; acquiring the first weight feature vector and the first offset of the target leaf node; determining the type of the target virtual machine corresponding to the target container and the association between the weight feature vector and the type; determining the second weight feature vector and the second offset corresponding to the type of the target virtual machine from the first weight feature vector and the first offset; and determining the target energy consumption prediction model from multiple energy consumption prediction models based on the second weight feature vector and the second offset. Based on the characteristic parameters and the target energy consumption prediction model, the energy consumption of the target container is determined.
2. The method according to claim 1, characterized in that, The process of obtaining the first sample feature parameters of the virtual machine includes: Obtain the attribute parameters of the virtual machines, and classify the multiple virtual machines based on the attribute parameters; Obtain the first sample feature parameters for each type of virtual machine.
3. The method according to claim 1, characterized in that, The method further includes: Obtain the feature parameters of the second sample according to the target sampling period; The first sample feature parameters are updated based on the second sample feature parameters.
4. The method according to claim 1, characterized in that, The first sample feature parameters include the historical usage status information of the virtual machine's central processing unit, the historical usage status information of the virtual machine's memory, and the historical usage status information of the virtual machine's network port; The characteristic parameters include the usage status information of the target container's central processing unit, memory, and network port.
5. An energy consumption determination device, characterized in that, The device includes: An acquisition unit is used to acquire first sample feature parameters of a virtual machine; the first sample feature parameters are used to characterize the energy consumption of different types of virtual machines. The processing unit is configured to analyze the first sample feature parameters using a decision tree regression algorithm to generate a decision tree; and to generate an energy consumption prediction model for each type of virtual machine based on the first weight parameters of the leaf nodes of the decision tree; wherein, according to the type of the virtual machine, all corresponding features under the type of the virtual machine are fitted as individual features to obtain a weight feature vector in the first weight parameters of each type of virtual machine; the offset is divided according to the proportion of the CPU utilization of a single virtual machine to the CPU utilization of all virtual machines; the power of the virtual machine is equal to the product of the transpose of the weight feature vector and the feature vector corresponding to the first sample feature parameters, plus the offset. The processing unit is further configured to: acquire feature parameters of the target container; determine a target leaf node from the nodes of the decision tree based on the feature parameters and the decision tree; acquire a first weight feature vector and a first offset of the target leaf node; determine the type of the target virtual machine corresponding to the target container and the association between the weight feature vector and the type; determine a second weight feature vector and a second offset corresponding to the type of the target virtual machine from the first weight feature vector and the first offset; and determine a target energy consumption prediction model from multiple energy consumption prediction models based on the second weight feature vector and the second offset. The processing unit is further configured to determine the energy consumption of the target container based on the feature parameters and the target energy consumption prediction model.
6. An energy consumption determination device, characterized in that, The device includes: a processor, a memory, and a communication bus; The communication bus is used to realize the communication connection between the processor and the memory; The processor is used to execute the energy consumption determination program stored in the memory to perform the following steps: Obtain the first sample feature parameters of the virtual machine; the first sample feature parameters are used to characterize the energy consumption of different types of virtual machines; Based on the first sample feature parameters, a decision tree regression algorithm is used for analysis to generate a decision tree; based on the first weight parameters of the leaf nodes of the decision tree, an energy consumption prediction model corresponding to each type of virtual machine is generated; wherein, according to the type of virtual machine, all corresponding features under the type of virtual machine are fitted as individual features to obtain the weight feature vector in the first weight parameters of each type of virtual machine; for the offset, it is divided according to the proportion of the CPU utilization of a single virtual machine to the CPU utilization of all virtual machines; the power of the virtual machine is equal to the product of the transpose of the weight feature vector and the feature vector corresponding to the first sample feature parameters, plus the offset. The process involves: acquiring feature parameters of the target container; determining the target leaf node from the nodes of the decision tree based on the feature parameters and the decision tree; acquiring the first weight feature vector and the first offset of the target leaf node; determining the type of the target virtual machine corresponding to the target container and the association between the weight feature vector and the type; determining the second weight feature vector and the second offset corresponding to the type of the target virtual machine from the first weight feature vector and the first offset; and determining the target energy consumption prediction model from multiple energy consumption prediction models based on the second weight feature vector and the second offset. Based on the characteristic parameters and the target energy consumption prediction model, the energy consumption of the target container is determined.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, which can be executed by one or more processors to implement the steps of the energy consumption determination method as described in any one of claims 1 to 4.