Resource allocation method and device and electronic equipment
By constructing a method based on performance data time series and topology graph in a cloud computing environment, the similarity and correlation between microservice nodes are determined and performance prediction data is generated, which solves the problem of traditional cloud resource scheduling methods perform poorly when facing large-scale and complex microservice applications, and realizes efficient optimization of cloud resources and improves cloud resource utilization.
Patent Information
- Application Number
- CN202411934436.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-12-25
AI Technical Summary
Traditional cloud resource scheduling methods perform poorly when facing the resource usage of large-scale and complex applications of microservices, making it difficult to effectively allocate computing resources to microservices, improve cloud resource utilization, and ensure their efficient and stable operation.
By determining the similarity between each node based on the performance data time series between the service nodes to be allocated, a topology map is formed, and performance prediction data is generated based on the correlation and autocorrelation of adjacent nodes, so as to determine task nodes among multiple nodes to achieve efficient optimization scheduling of cloud resources.
This method can accurately give performance prediction data by learning the regular characteristics of nodes in time and space, and filter out service nodes that are more suitable for cloud computing tasks, improving the accuracy of cloud resource utilization and scheduling.
Smart Images

Figure CN119883611A_ABST
Abstract
Description
Background Art
[0002] With the vigorous development of cloud computing technology, cloud resource scheduling has become a research hotspot in the field of cloud computing. As the mainstream application type in cloud native environments, microservice architecture has significant advantages in deployment and scalability due to its loosely coupled structure. However, this distributed and loosely coupled nature also brings new challenges to cloud resource scheduling. Traditional cloud resource scheduling methods often rely on statistical data or simple rules to make decisions, and often perform poorly when faced with the resource usage of large-scale and complex microservice applications. How to effectively allocate computing resources to these microservices, improve cloud resource utilization, and ensure their efficient and stable operation has become an urgent problem to be solved.
[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0004] The purpose of the present disclosure is to provide a resource allocation method, device and electronic device for efficiently allocating computing resources for applications such as microservices served by at least cloud computing, thereby improving cloud resource utilization.
[0005] According to a first aspect of an embodiment of the present disclosure, a resource allocation method is provided, comprising: determining the similarity between multiple nodes based on a first performance data time series of the nodes, forming a topological graph based on nodes whose similarity is greater than a preset value, the nodes are service nodes to be allocated, and the first performance data time series is a sequence of multiple performance data of the service nodes to be allocated that change over time; determining a correlation coefficient between adjacent nodes in the topological graph, determining a second performance data time series of each of the nodes based on the correlation coefficient; determining an autocorrelation function of the node based on the second performance data time series; determining performance prediction data of the node based on the autocorrelation function and the second performance data time series; and determining a task node among multiple nodes based on the performance prediction data.
[0006] In an exemplary embodiment of the present disclosure, determining similarities between multiple nodes according to a time series of first performance data of the nodes includes:
[0007] Obtain a first performance data time series of the first node and a first performance data time series of the second node;
[0008] Calculate the dynamic time warping distance between the first performance data time series of the first node and the first performance data time series of the second node using a dynamic time warping algorithm;
[0009] The similarity between the first node and the second node is determined according to the dynamic regularization distance, and the smaller the dynamic regularization distance is, the greater the similarity is.
[0010] In an exemplary embodiment of the present disclosure, determining the correlation coefficient between adjacent nodes in the topology graph, and determining the second performance data time series of each node according to the correlation coefficient includes:
[0011] Determine an attention coefficient of a target node to each adjacent node by using a preset loss function and the first performance data time series;
[0012] Normalizing each attention coefficient corresponding to the target node to obtain a correlation coefficient between the target node and each adjacent node;
[0013] The second performance data time series of the target node is determined according to the correlation coefficient corresponding to each adjacent node and the first performance data time series of each adjacent node.
[0014] In an exemplary embodiment of the present disclosure, determining the autocorrelation function of the node according to the second performance data time series includes:
[0015] Processing the second performance data time series by a gated recurrent unit algorithm to obtain a hidden state sequence corresponding to the second performance data time series;
[0016] The autocorrelation function of the node corresponding to the second performance data time series is determined according to the hidden state sequence.
[0017] In an exemplary embodiment of the present disclosure, determining the performance prediction data of the node according to the autocorrelation function and the second performance data time series includes:
[0018] Constructing a prediction model according to the autocorrelation function, and training the prediction model using performance data sets at multiple time points in the second performance data time series;
[0019] The performance data corresponding to the most recent time point in the second performance data time series is input into the prediction model, and the output data of the prediction model is set as the performance prediction data of the node.
[0020] In an exemplary embodiment of the present disclosure, determining the performance prediction data of the node according to the autocorrelation function and the second performance data time series further includes:
[0021] Acquire current performance data of the node, and update the first performance data time series and the second performance data time series according to the current performance data;
[0022] The performance data corresponding to the current performance data in the second performance data time series is input into the prediction model, and the output data of the prediction model is set as the performance prediction data of the node.
[0023] According to a second aspect of an embodiment of the present disclosure, a resource allocation device is provided, including:
[0024] A topology map construction module, configured to determine the similarity between multiple nodes according to a first performance data time series of the nodes, and form a topology map according to nodes whose similarity is greater than a preset value, wherein the nodes are service nodes to be assigned, and the first performance data time series is a sequence of multiple performance data of the service nodes to be assigned that changes over time;
[0025] A time series updating module, configured to determine a correlation coefficient between adjacent nodes in the topology graph, and determine a second performance data time series of each node according to the correlation coefficient;
[0026] An autocorrelation determination module, configured to determine the autocorrelation function of the node according to the second performance data time series;
[0027] a performance prediction module, configured to determine the performance prediction data of the node according to the autocorrelation function and the second performance data time series;
[0028] The task node determination module is configured to determine a task node among multiple nodes according to the performance prediction data.
[0029] According to a third aspect of the present disclosure, there is provided an electronic device, comprising: a memory; and a processor coupled to the memory, wherein the processor is configured to execute any one of the methods described above based on instructions stored in the memory.
[0030] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a program is stored, and when the program is executed by a processor, the resource allocation method as described in any one of the above is implemented.
[0031] The disclosed embodiment determines the similarity between nodes according to the performance data time series between the service nodes to be allocated, forms a topological graph based on the similarity, and obtains the second performance data time series of each node according to the correlation between adjacent nodes in the topological graph, so that the second performance data time series can integrate the information of similar nodes; by determining the performance prediction data of the node according to the autocorrelation of the node and the second performance data time series, the performance prediction data can be accurately given by learning the regular characteristics of the node in time and space, and then, the service nodes that are more suitable for undertaking cloud computing tasks, namely, task nodes, are screened out, so as to realize efficient optimization scheduling of cloud resources and improve the utilization rate of cloud resources.
[0032] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0034] Figure 1 is a flow chart of a resource allocation method in an exemplary embodiment of the present disclosure.
[0035] Figure 2 It is a sub-flow chart for determining the similarity between nodes in one embodiment of the present disclosure.
[0036] Figure 3 It is a flowchart of determining a second performance data time series in one embodiment of the present disclosure.
[0037] Figure 4 It is a schematic diagram of forming a second performance data time series in an embodiment of the present disclosure.
[0038] Figure 5 It is a schematic diagram of generating performance prediction data in one embodiment of the present disclosure.
[0039] Figure 6 It is a block diagram of a resource allocation device in an exemplary embodiment of the present disclosure.
[0040] Figure 7 is a block diagram of an electronic device in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0041] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0042] In addition, the accompanying drawings are only schematic diagrams of the present disclosure, and the same reference numerals in the drawings represent the same or similar parts, so their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities, which do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0043] The exemplary embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0044] Figure 1 is a flow chart of a resource allocation method in an exemplary embodiment of the present disclosure.
[0045] refer to Figure 1 , the resource allocation method 100 may include:
[0046] Step S1, determining the similarity between multiple nodes according to the first performance data time series of the nodes, and forming a topological graph according to the nodes whose similarity is greater than a preset value, wherein the nodes are service nodes to be allocated, and the first performance data time series is a sequence of multiple performance data of the service nodes to be allocated that change over time;
[0047] Step S2, determining a correlation coefficient between adjacent nodes in the topology graph, and determining a second performance data time series of each node according to the correlation coefficient;
[0048] Step S3, determining the autocorrelation function of the node according to the second performance data time series;
[0049] Step S4, determining the performance prediction data of the node according to the autocorrelation function and the second performance data time series;
[0050] Step S5: determining a task node among multiple nodes according to the performance prediction data.
[0051] The disclosed embodiment determines the similarity between nodes according to the performance data time series between the service nodes to be allocated, forms a topological graph based on the similarity, and obtains the second performance data time series of each node according to the correlation between adjacent nodes in the topological graph, so that the second performance data time series can integrate the information of similar nodes; by determining the performance prediction data of the node according to the autocorrelation of the node and the second performance data time series, the performance prediction data can be accurately given by learning the regular characteristics of the node in time and space, and then, the service nodes that are more suitable for undertaking cloud computing tasks, namely, task nodes, are screened out, so as to realize efficient optimization scheduling of cloud resources and improve the utilization rate of cloud resources.
[0052] Next, each step of the resource allocation method 100 is described in detail.
[0053] In step S1, the similarity between multiple nodes is determined based on the first performance data time series of the nodes, and a topological graph is formed based on the nodes whose similarity is greater than a preset value. The nodes are service nodes to be assigned, and the first performance data time series is a sequence of multiple performance data of the service nodes to be assigned that changes over time.
[0054] The nodes of the embodiments of the present disclosure may be referred to as service nodes to be allocated, and the service nodes to be allocated may be physical nodes or logical nodes used to process tasks in cloud computing. Correspondingly, the service nodes to be allocated correspond to different performance data according to the types of physical nodes / logical nodes.
[0055] Exemplarily, the embodiments of the present disclosure can be applied to allocate computing resources for microservices, and the computing resources are allocated based on the corresponding service nodes. The service nodes to be allocated, that is, the service nodes to be allocated, belong to the service nodes that can currently be used for task allocation, and can be updated in real time according to the system resource management situation. The service nodes to be allocated include but are not limited to physical servers, virtual servers, and containers, etc. These service nodes carry computing resources such as CPU, memory, storage, and network bandwidth for use by microservices. At this time, the performance data of the service nodes to be allocated can be data such as CPU occupancy, memory occupancy, storage occupancy, network bandwidth, etc.
[0056] In some embodiments, the disclosed embodiments may also regard task processing entities such as microservice examples or functional resources as service nodes to be allocated. In a complex microservice system, each microservice instance will call and communicate with each other, forming a network structure. From the perspective of business scheduling, these microservices can be used as a kind of "resource", and different microservices can be allocated to handle corresponding user requests according to business scenarios (such as service scenarios for ordinary users and service scenarios for high-security enterprise users). At this time, the performance data of the service nodes to be allocated may include indicators such as call frequency and response time.
[0057] It should be noted that no matter what type of service nodes to be allocated are, the types of service nodes to be allocated processed by method 100 are the same.
[0058] A variety of performance data (such as CPU occupancy rate, memory occupancy rate) for sampling can be set for the service node to be assigned according to its type, and the various performance data are sampled according to the preset time step. The various performance data sampled at one time constitute a set of performance data, and different sets of performance data corresponding to different time points constitute a first performance data time series of the service node to be assigned. That is, the first performance data time series represents the change of the value of a set of performance data over time.
[0059] For example, a group of performance data can be formed according to service load-related parameters, and the load-related performance data such as CPU usage, memory occupancy, network bandwidth occupancy, etc. of the service node to be assigned at different times are collected, and arranged in chronological order to form a first load-related performance data time series. In addition, performance data such as the number of requests and service response time can also be included in the group of performance data, so that the first performance data time series can reflect the changes in performance data such as the number of requests and service response time over time.
[0060] Microservices are usually distributed on multiple physical nodes, and related methods usually cannot fully capture the correlation between different physical nodes. In addition, the dynamic and short-term nature of microservice resource usage patterns makes it difficult for traditional methods that rely on long-term historical data to accurately understand their short-term characteristics, which seriously affects the accuracy of resource scheduling.
[0061] In the embodiment of the present disclosure, after determining the first performance data time series of each node, it is set to determine the similarity between each node based on the first performance data time series of each node, and form a topological graph based on the nodes whose similarity is greater than a preset value, so as to consider the impact of similar nodes on the performance of a node and improve the accuracy of performance prediction of the node.
[0062] Figure 2 It is a sub-flow chart for determining the similarity between nodes in one embodiment of the present disclosure.
[0063] refer to Figure 2 In one embodiment, step S1 may include:
[0064] Step S11, obtaining a first performance data time series of a first node and a first performance data time series of a second node;
[0065] Step S12, using a dynamic time warping algorithm to calculate a dynamic time warping distance between a first performance data time series of a first node and a first performance data time series of a second node;
[0066] Step S13, determining the similarity between the first node and the second node according to the dynamic regularization distance, the smaller the dynamic regularization distance, the greater the similarity.
[0067] In an exemplary embodiment, the correlation between different service nodes in the cluster can be quantified based on the Dynamic Time Warping (DTW) algorithm. The DTW algorithm can compare the similarity of two performance data time series of different lengths corresponding to two cloud computing service nodes, and find a set of continuous matching relationships containing all corresponding points of the two sequences without being restricted by the Euclidean distance.
[0068] The basic principle of DTW is based on distance measurement. For two first performance data time series, for example, for a sequence X=(x 1 ,x 2 ,...,x N ) and a sequence Y of length M = (y 1 ,y 2 ,...,y M ), first, we need to define a distance function to measure the difference between two data points, usually using the Euclidean distance (i.e. the straight-line distance between two points) or other suitable distance metrics. This distance can be called a twisted path.
[0069] In order to find the best matching path between two first performance data time series, DTW constructs a cost matrix. The rows of this matrix correspond to the time points of sequence X, and the columns correspond to the time points of sequence Y. Each element (i, j) in the matrix represents the distance between the i-th point in sequence X and the j-th point in sequence Y (calculated by the distance function defined above).
[0070] The core of DTW is to find an optimal path in this cost matrix. This path starts from the upper left corner of the matrix (i.e. the first point of sequence X and the first point of sequence Y) and ends at the lower right corner of the matrix (i.e. the last point of sequence X and the last point of sequence Y). The constraints of the path include continuity and monotonicity. Continuity means that adjacent points in the path are also adjacent in the matrix, and there cannot be jump connections; monotonicity requires that the path can only move to the right, downward, or to the lower right to ensure the order of the time series. The optimal path is the path that minimizes the sum of the distances corresponding to all points on the path. The sum of the distances corresponding to this path is the DTW distance of the two first performance data time series, which reflects the similarity of the two first performance data time series. The smaller the distance, the more similar the two first performance data time series.
[0071] The DTW algorithm uses the idea of dynamic programming to solve the optimal path and recursively defines a cumulative distance function, which can be expressed as:
[0072] D(i,j)=d(i,j)+min{D(i-1,j), D(i,j-1), D(i-1,j-1)} (1)
[0073] Among them, D(i,j) is the minimum cumulative distance to point (i,j), and d(i,j) is the distance of point (i,j) in the cost matrix. In this way, the minimum cumulative distance from the starting point to each point can be calculated step by step, and finally the minimum cumulative distance from the upper left corner to the lower right corner is found, that is, the DTW distance of the two first performance data time series.
[0074] Next, the similarity between the two nodes may be determined according to the DTW distance of the two first performance data time series. The similarity is inversely proportional to the DTW distance. For example, the inverse of the DTW distance may be used as the similarity.
[0075] Since similarity is used to group service nodes to form a topological map in step S1, in an exemplary embodiment, the service nodes can also be grouped according to the DTW distance, for example, two service nodes whose DTW distance is less than a preset value are divided into a topological map. Ultimately, the topological map includes two or more service nodes, and the DTW distances between adjacent service nodes are all less than the preset value.
[0076] When processing node data related to time series, DTW can mine the dynamic similarity of time series. For example, the performance time series of different service nodes may not be completely aligned in time due to different startup times, short-term failures, etc., but DTW can find the similarity in their operating modes, thereby determining whether the service nodes are in a similar operating state and capturing the dynamic laws in the time series.
[0077] In addition to using the DTW distance between the first performance data time series to measure the similarity between different service nodes, the Euclidean distance, Manhattan distance, Pearson Correlation Coefficient, Cosine Similarity, etc. can also be used to measure the similarity between two first performance data time series, and then measure the similarity between two service nodes. The effects of these methods may not be as good as DTW, but they can also reflect the similarity between the operating states of the service nodes. Those skilled in the art can determine the method for measuring the similarity between service nodes according to actual conditions.
[0078] When forming a topology map based on similarity, we can first set a reasonable similarity threshold (or DTW distance) based on the application scenario and business needs. This threshold will serve as a key criterion for judging whether the nodes are connected to each other to form a topology map. If the threshold is set too low, the connections in the topology map may be too dense, and the associations between nodes may become unclear, which is not conducive to the subsequent analysis and use of the graph structure; if the threshold is too high, many nodes that originally had a certain association may not be connected, resulting in a topology map that is too sparse and some important structural information is lost.
[0079] Next, we traverse each pair of service nodes to be assigned. For any two nodes, if the similarity between them is greater than or equal to the set similarity threshold, we add an edge connecting the two nodes to the topology graph, indicating that there is a certain association between them. As the traversal of all node pairs is completed, the final topology graph can clearly show the mutual connection between nodes based on similarity.
[0080] It is understandable that, since the similarity is determined based on a variety of performance data at the same time, multiple service nodes to be allocated may constitute multiple topological graphs according to the similarity between the nodes, and the nodes in different topological graphs are different.
[0081] After the topology is initially constructed, it can be optimized and verified based on business domain knowledge and some additional data information. For example, the historical interaction records of nodes (such as actual call logs between microservices) can be combined to check whether the connection of edges in the topology is reasonable. If it is found that some nodes have a similarity that reaches the threshold but are not directly related, or that there is an important connection but is not connected because the similarity is slightly lower than the threshold, the threshold can be adjusted appropriately or some edges can be manually added / deleted to improve the topology structure.
[0082] At the same time, some graph analysis algorithms can also be used to verify some characteristics of the topological map, such as checking whether there are isolated nodes (nodes that are not connected to any other nodes). If there are too many isolated nodes, it may mean that there are unreasonable similarity calculations or threshold settings, and it is necessary to re-examine the previous steps and make adjustments; or analyze the connectivity and clustering of the topological map to ensure that the constructed topological map can truly and effectively reflect the actual relationship between the nodes, so as to facilitate subsequent in-depth research such as graph-based clustering analysis and node influence evaluation.
[0083] By forming a topological graph composed of similar nodes, the next step of processing can be performed based on similar nodes.
[0084] In step S2, the correlation coefficient between adjacent nodes in the topology graph is determined, and the second performance data time series of each node is determined according to the correlation coefficient.
[0085] In a topological graph, the adjacent nodes of a node are nodes that have edge connections with it, that is, nodes whose similarity with it is greater than a preset value.
[0086] Figure 3 It is a flowchart of determining a second performance data time series in one embodiment of the present disclosure.
[0087] refer to Figure 3 In an exemplary embodiment, step S2 may include:
[0088] Step S21, determining an attention coefficient of a target node to each adjacent node by using a preset loss function and a first performance data time series;
[0089] Step S22, normalizing the attention coefficients corresponding to the target node to obtain the correlation coefficients between the target node and each adjacent node;
[0090] Step S23, determining the second performance data time series of the target node according to the correlation coefficient corresponding to each adjacent node and the first performance data time series of each adjacent node.
[0091] In step S2, it is necessary to measure the influence of each adjacent node on the current node (i.e., the target node). To this end, in the exemplary embodiment, Figure 3The graph attention network (GAT) is used for measurement. The graph attention network is a deep learning model based on graph structured data. When processing graph data, traditional graph neural network (GNN) methods have certain limitations. For example, the graph convolutional network (GCN) is based on fixed weights when aggregating neighbor node information, without considering the different importance between nodes. GAT can effectively assign different attention weights to each node in the graph, thereby better aggregating the information of neighbor nodes.
[0092] The following is a detailed description based on Figure 3 The method shown is based on GAT to measure the degree of correlation between adjacent nodes, that is, the correlation coefficient.
[0093] In step S21, the attention coefficient between nodes is first calculated. For node i and its neighbor node j in the graph, the node features are first mapped to a new space through linear transformation. Assuming that the feature vector of node i is hi and the feature vector of node is hj, the vectors Whi and Whj are obtained by linear transformation through the weight matrix W. Among them, in the early stage of model training, the weight matrix W is usually randomly initialized. During the training process of the model, the weight matrix W will be optimized together with other model parameters (such as parameters in the attention function). During the training process, it is updated by the back propagation algorithm based on the given training data and loss function (such as the cross entropy loss in the node classification task).
[0094] Then the attention coefficient eij is calculated to measure the importance of node j to node i. The calculation formula can be, for example:
[0095] eij=a(Whi,Wh) (2)
[0096] Where a is an attention function, for example, it can be a simple neural network (such as a single hidden layer feedforward neural network), whose input is the concatenation of vectors Whi and Whj, and whose output is a scalar representing the attention coefficient. Exemplarily, the attention function can be the activation function LeakyReLU.
[0097] In step S22, the calculated attention coefficients cannot be directly compared between different nodes, because the numerical ranges of the attention coefficients calculated by different nodes and their neighbors may be inconsistent. Therefore, standardization functions such as the softmax function can be used to standardize all neighbors of the node. The softmax function can convert a set of values into a probability distribution, so that these values are normalized when the sum is , which is convenient for comparing the attention levels of different nodes on the same scale. After standardizing the attention coefficients, the correlation coefficient aij between node i and node j is obtained. When aij is large, it means that when updating the state of node i, the features of node j will have a larger weight, which means that the correlation between the two nodes is strong.
[0098] By setting a node i as a target node, the correlation coefficient between the target node and all its adjacent nodes can be calculated. Similarly, the correlation coefficients between all adjacent nodes in the topology graph can be determined.
[0099] In step S23, after completing the normalization to obtain the normalized correlation coefficient, the coefficient can be used to calculate the linear combination of the corresponding features. For example, for a certain node, considering the degree of association with each neighboring node (reflected by aij) and the features of the neighboring nodes, the node features are updated by linear combination, and the final result is used as the new state of each node.
[0100] An example is given below to illustrate step S23.
[0101] Assume that the first performance data time series of node A is hA=[2,3] (the example only represents the characteristic values in two dimensions).
[0102] The first performance data time series of node B is hB=[1,4].
[0103] The first performance data time series of node C is hC=[3,2].
[0104] The first performance data time series of node D is hD=[4,1].
[0105] Assume that after the previous steps (calculating the attention coefficient and normalizing it), the correlation coefficients of node A to nodes B, C, and D are:
[0106] aAB=0.2 (indicates the degree of attention of node A to node B).
[0107] aAC=0.5 (the degree of attention that node A pays to node C).
[0108] aAD=0.3 (the degree of attention that node A pays to node D).
[0109] For each neighbor node, multiply its feature vector by the corresponding normalized attention coefficient and then sum them to update the feature of node A and obtain the second performance data time series of node A. There are:
[0110] hA'=aAB*hB+ aAC*hC+ aAD*hD (3)
[0111] Substituting the above values, we get hA' = [0.2, 0.8] + [1.5, 1] + [1.2, 0.3] = [2.9, 2.1].
[0112] That is, the first performance data time series of node A is [2,3]. After the neighboring nodes are updated, the second performance data time series of node A is [2.9,2.1]. This new time series incorporates the relevant information of the neighboring nodes and can be used in subsequent analysis or tasks (such as node classification, predicting the influence of nodes in the graph, etc.).
[0113] In formula (3), only the correlation of nodes B, C, and D to node A is calculated. In some processing methods, the correlation between node A and node A itself can also be calculated at the same time. In this case, the correlation coefficient of node A to node A can be set to 1, so that the final hA' needs to consider the value of the first performance data time series of node A, and the hA' value in formula (3) is updated to [4.9,5.1].
[0114] How to set the update mode specifically can be set by those skilled in the art according to actual conditions.
[0115] Figure 4 It is a schematic diagram of forming a second performance data time series in an embodiment of the present disclosure.
[0116] refer to Figure 4 For node h1, calculate the correlation coefficients a11~a61 between it and itself and the adjacent nodes h2~h6, and then, based on the correlation coefficients and the first performance data time series hi of each node i (here i=1~6), weightedly obtain the second performance data time series h1' of node h1.
[0117] This approach effectively captures the correlation between nodes and thus optimizes the scheduling process of cloud resources.
[0118] In general, the input of GAT is a set of node features, h = (h 1 ,h 2 ,...,h N ),h i v F, where N is the number of nodes and F is the number of features of each node. A new set of node features h′ generated by GAT = (h′ 1 ,h′ 2 ,...,h′ N ),h′ i ∈R F , as output.
[0119] For example, the attention coefficient between node i and node j can be calculated by:
[0120] e(h i ,h j )=LeakyReLU(a T ·[Wh i ||Wh j ]) (4)
[0121] where a∈R 2n′ , W∈R n′×n It can be learned, || indicates vector concatenation. LeakyReLU is the activation function.
[0122] In order to make the attention coefficients comparable between different nodes, a softmax function is used for all j∈N i (N i is the set of all neighbors of node i) and normalizes them to obtain the correlation coefficient aij:
[0123]
[0124] Finally, use the normalized attention coefficient a ij Calculate the linear combination of the corresponding features as the new state of each node:
[0125]
[0126] By considering the attention coefficient between the node and its neighbors and the characteristics of the neighbors, the new state incorporates more information about the node's surrounding environment. This makes the node features richer and more representative, and can better adapt to subsequent tasks such as node classification, link prediction, etc.
[0127] In other embodiments of the present disclosure, other methods may also be used, such as measurement based on distance (such as Euclidean distance, Manhattan distance), measurement based on similarity coefficient (such as cosine similarity, Pearson correlation coefficient), measurement based on information theory (such as mutual information, information gain), etc.
[0128] In step S3, the autocorrelation function of the node is determined according to the second performance data time series.
[0129] In an exemplary embodiment, the second performance data time series can be processed by a gated recurrent unit algorithm to obtain a hidden state sequence corresponding to the second performance data time series, and then the autocorrelation function of the node corresponding to the second performance data time series is determined based on the hidden state sequence.
[0130] Since the GRU (Gated Recurrent Unit) structure is relatively simple, has fewer parameters, and has a faster training speed, in the embodiment of the present disclosure, the GRU model is selected to obtain the autocorrelation function of the node.
[0131] GRU is mainly composed of an update gate zt and a reset gate rt.
[0132] Formula (7) can be used to update the hidden state of a certain layer of GRU.
[0133]
[0134] Among them, h t is the hidden state at timestamp t, x t is the input at timestamp t, σ and tanh are activation functions, Wr is the weight matrix of the reset gate, and Wz is the weight matrix of the update gate.
[0135] After using GRU to process the second performance data time series of a node, a hidden state sequence of the node is obtained. The hidden state sequence can be used as the autocorrelation function of the node.
[0136] In addition to using GRU to solve the autocorrelation of nodes and determine the autocorrelation function, the autocorrelation function of the node can also be determined by LSTM (Long Short-Term Memory Network), ARIMA (Autoregressive Moving Average Model), autocorrelation function (ACF), VAR (Vector Autoregressive Model), etc., and technical personnel in this field can choose according to actual conditions.
[0137] In step S4, the performance prediction data of the node is determined according to the autocorrelation function and the second performance data time series.
[0138] Figure 5 It is a schematic diagram of generating performance prediction data in one embodiment of the present disclosure.
[0139] refer to Figure 5 In an exemplary embodiment, step S4 may include:
[0140] Step S41, constructing a prediction model according to the autocorrelation function, and using the performance data groups at multiple time points in the second performance data time series to train the prediction model;
[0141] Step S42: input the performance data corresponding to the most recent time point in the second performance data time series into the prediction model, and set the output data of the prediction model as the performance prediction data of the node.
[0142] exist Figure 5 In the illustrated embodiment, after the GRU outputs the hidden state sequence, one or more fully connected layers can be added to construct a prediction layer. The input of the fully connected layer is the hidden state output by the GRU (which can be the hidden state of the last time step, or the entire hidden state sequence is fused in some way, such as averaging, concatenation, etc.).
[0143] Then, the prediction model is trained using supervised learning. A portion of the node's historical performance data (i.e., a performance data group at multiple time points in the second performance data time series) is used as a training set to train the model's parameters (including the parameters in the GRU and the parameters of the prediction layer), so that the model can learn the law of node performance parameter changes. For example, using the mean square error (MSE) as the loss function, the model parameters are updated through the back propagation algorithm to minimize the difference between the predicted value and the true value.
[0144] After the prediction model training is completed, the performance data corresponding to the most recent time point in the current second performance data time series can be directly input into the prediction model, processed using the prediction model, and the output data of the prediction model is set as the performance prediction data of the node at the next time point.
[0145] In addition, the current performance data of the node can be obtained, and the first performance data time series and the second performance data time series of the node can be updated according to the current performance data, and the performance data corresponding to the current performance data in the second performance data time series can be input into the prediction model, and the output data of the prediction model can be set as the performance prediction data of the node.
[0146] That is, the current performance data of the node can be collected in real time, and after being processed by the correlation coefficient, the latest set of data in the second performance data time series is formed, and the prediction model is used to process the latest set of data to obtain the performance prediction data of the node at the next time point.
[0147] In some embodiments, the above-mentioned GAT process and GRU process can also be combined to form a prediction model, and the prediction model can be jointly trained using the first performance data time series to train the parameters of the prediction model (including parameters in GAT and GRU and parameters of the prediction layer).
[0148] After the model training is completed, when new node performance data is input, the node performance data will be updated by GAT and then input into GRU. The hidden state output by GRU is converted by the prediction layer to obtain the node performance prediction data. For example, the CPU utilization, response time and other performance parameters of the node at a certain time step in the future can be predicted.
[0149] In step S5, a task node is determined among a plurality of nodes according to the performance prediction data.
[0150] At one point in time, after obtaining the performance prediction data for the next point in time based on the latest performance data of each node, the task nodes can be determined among multiple nodes by assigning tasks to each node as needed.
[0151] For example, in a cloud computing environment, nodes are numerous server instances. At the current moment, by monitoring and analyzing the CPU usage, memory occupancy, network bandwidth and other performance indicators of each server, the trained prediction model (such as a model combining GAT and GRU) is used to predict the performance of the next time step. If the prediction results show that the CPU utilization of a group of servers will be at a low level in the next period of time, and at this time there are a batch of new computing tasks (such as batch processing tasks of large-scale data) that need to be executed, these tasks require high CPU computing power and the demand for network bandwidth and memory is relatively stable within an acceptable range, then this batch of tasks can be assigned to this group of servers with low predicted CPU utilization, and they can be identified as task nodes.
[0152] For another example, in an intelligent transportation system, nodes are traffic light control devices distributed at various intersections. Based on the traffic flow detection data of each traffic light node at the current moment, the current traffic light state switching frequency, and the congestion of surrounding roads, the traffic flow change trend of each intersection in the next time period is predicted. If it is predicted that the traffic flow at several adjacent intersections will increase significantly in the next few minutes, and some nearby traffic light nodes have relatively light loads (that is, the traffic conditions at the currently controlled intersections are relatively smooth, and the traffic light switching frequency is not high), then the task of coordinating the traffic flow at these intersections can be assigned to these lightly loaded traffic light nodes, making them task nodes, and optimizing traffic flow by adjusting the traffic light timing plan to alleviate possible congestion.
[0153] For example, in an industrial production line, nodes are various production equipment. Sensors collect the equipment's operating temperature, operating speed, energy consumption and other performance parameters in real time, and predict the equipment's performance in the next production cycle based on these current performance data. If it is predicted that the energy consumption of certain equipment will remain at a low level and the operating state will be stable, and at this time there are some production tasks (such as production tasks for products with low processing accuracy but large output) that need to be arranged, and these tasks have certain requirements for the energy consumption and stability of the equipment, then these equipment can be selected as task nodes to undertake these production tasks, thereby improving production efficiency and resource utilization, while ensuring the overall stable operation of the production line.
[0154] Table 1 shows the experimental results of node performance prediction using the method provided by the embodiment of the present disclosure. It is obvious that the model using the embodiment of the present disclosure is superior to other models in terms of prediction performance. Traditional FC, MLP, LSTM and GRU models only consider time correlation, while the model of the present disclosure not only considers time correlation, but also takes advantage of topological information, thereby showing superior performance in time series prediction. For example, when the timestamp is 30 seconds, based on MAE data, the prediction accuracy of the model of the present disclosure is improved by 48.27% compared with the RNN (GRU) model that only considers time correlation. Compared with other algorithms, the combination strategy of GAT and GRU in the model of the present disclosure shows significant advantages. These results show that the model of the present disclosure has high accuracy and effectiveness in predicting resource utilization in large-scale cluster environments. By integrating time series data and topological information, resource usage in the cluster can be predicted more accurately, thereby providing cluster operators with more effective resource management.
[0155] Table 1 Experimental results analysis
[0156]
[0157] In summary, the embodiments of the present disclosure update node features based on adjacent nodes and obtain performance prediction data for the nodes in combination with the autocorrelation of the nodes, which can greatly improve the accuracy of the performance prediction data and optimize the utilization of cloud computing resources.
[0158] Corresponding to the above method embodiments, the present disclosure also provides a resource allocation device, which can be used to execute the above method embodiments.
[0159] Figure 6 It is a block diagram of a resource allocation device in an exemplary embodiment of the present disclosure.
[0160] refer to Figure 6 , the resource allocation device 600 may include:
[0161] A topology map construction module 61 is configured to determine the similarity between multiple nodes according to the first performance data time series of the nodes, and form a topology map according to the nodes whose similarity is greater than a preset value, wherein the nodes are service nodes to be allocated, and the first performance data time series is a sequence of multiple performance data of the service nodes to be allocated that changes over time;
[0162] A time series updating module 62 is configured to determine a correlation coefficient between adjacent nodes in the topology graph, and determine a second performance data time series of each node according to the correlation coefficient;
[0163] An autocorrelation determination module 63, configured to determine the autocorrelation function of the node according to the second performance data time series;
[0164] A performance prediction module 64, configured to determine the performance prediction data of the node according to the autocorrelation function and the second performance data time series;
[0165] The task node determination module 65 is configured to determine a task node among multiple nodes according to the performance prediction data.
[0166] Since the functions of the device 600 have been described in detail in the corresponding method embodiments, the present disclosure will not elaborate on them here.
[0167] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0168] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
[0169] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0170] Refer to the following Figure 7 An electronic device 700 according to this embodiment of the present invention will be described. Figure 7 The electronic device 700 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0171] like Figure 7 As shown, the electronic device 700 is in the form of a general computing device. The components of the electronic device 700 may include but are not limited to: at least one processing unit 710, at least one storage unit 720, and a bus 730 connecting different system components (including the storage unit 720 and the processing unit 710).
[0172] The storage unit stores program codes, which can be executed by the processing unit 710, so that the processing unit 710 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 710 can perform the method shown in the embodiment of the present disclosure.
[0173] The storage unit 720 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 7201 and / or a cache storage unit 7202 , and may further include a read-only storage unit (ROM) 7203 .
[0174] The storage unit 720 may also include a program / utility 7204 having a set (at least one) of program modules 7205, such program modules 7205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0175] Bus 730 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0176] The electronic device 700 may also communicate with one or more external devices 800 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 700, and / or communicate with any device that enables the electronic device 700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 750. Furthermore, the electronic device 700 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 760. As shown, the network adapter 760 communicates with other modules of the electronic device 700 via a bus 730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0177] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0178] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.
[0179] The program product for implementing the above method according to an embodiment of the present invention can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0180] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0181] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0182] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0183] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0184] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0185] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are to be considered exemplary only, and the true scope and concept of the present disclosure are indicated by the claims.
Claims
1. A resource allocation method, characterized in that: include: Determine the similarity between multiple nodes according to the first performance data time series of the nodes, and form a topology graph according to the nodes whose similarity is greater than a preset value, wherein the nodes are service nodes to be assigned, and the first performance data time series is a sequence of multiple performance data of the service nodes to be assigned that changes over time; Determine a correlation coefficient between adjacent nodes in the topology graph, and determine a second performance data time series of each node according to the correlation coefficient; determining an autocorrelation function of the node according to the second performance data time series; Determine the performance prediction data of the node according to the autocorrelation function and the second performance data time series; A task node is determined among multiple nodes according to the performance prediction data.
2. The resource allocation method according to claim 1, characterized in that: Determining the similarity between multiple nodes according to the first performance data time series of the nodes includes: Obtain a first performance data time series of the first node and a first performance data time series of the second node; Calculate the dynamic time warping distance between the first performance data time series of the first node and the first performance data time series of the second node using a dynamic time warping algorithm; The similarity between the first node and the second node is determined according to the dynamic regularization distance, and the smaller the dynamic regularization distance is, the greater the similarity is.
3. The resource allocation method according to claim 1, characterized in that: Determining the correlation coefficient between adjacent nodes in the topology graph, and determining the second performance data time series of each node according to the correlation coefficient comprises: Determine an attention coefficient of a target node to each adjacent node by using a preset loss function and the first performance data time series; Normalizing each attention coefficient corresponding to the target node to obtain a correlation coefficient between the target node and each adjacent node; The second performance data time series of the target node is determined according to the correlation coefficient corresponding to each adjacent node and the first performance data time series of each adjacent node.
4. The resource allocation method according to claim 1, characterized in that: Determining the autocorrelation function of the node according to the second performance data time series includes: Processing the second performance data time series by a gated recurrent unit algorithm to obtain a hidden state sequence corresponding to the second performance data time series; The autocorrelation function of the node corresponding to the second performance data time series is determined according to the hidden state sequence.
5. The resource allocation method according to claim 1, characterized in that: Determining the performance prediction data of the node according to the autocorrelation function and the second performance data time series includes: Constructing a prediction model according to the autocorrelation function, and training the prediction model using performance data sets at multiple time points in the second performance data time series; The performance data corresponding to the most recent time point in the second performance data time series is input into the prediction model, and the output data of the prediction model is set as the performance prediction data of the node.
6. The resource allocation method according to claim 5, characterized in that: The determining the performance prediction data of the node according to the autocorrelation function and the second performance data time series also includes: Acquire current performance data of the node, and update the first performance data time series and the second performance data time series according to the current performance data; The performance data corresponding to the current performance data in the second performance data time series is input into the prediction model, and the output data of the prediction model is set as the performance prediction data of the node.
7. A resource allocation device, characterized in that: include: A topology map construction module, configured to determine the similarity between multiple nodes according to a first performance data time series of the nodes, and form a topology map according to nodes whose similarity is greater than a preset value, wherein the nodes are service nodes to be assigned, and the first performance data time series is a sequence of multiple performance data of the service nodes to be assigned that changes over time; A time series updating module, configured to determine a correlation coefficient between adjacent nodes in the topology graph, and determine a second performance data time series of each node according to the correlation coefficient; An autocorrelation determination module, configured to determine the autocorrelation function of the node according to the second performance data time series; a performance prediction module, configured to determine the performance prediction data of the node according to the autocorrelation function and the second performance data time series; The task node determination module is configured to determine a task node among multiple nodes according to the performance prediction data.
8. An electronic device, characterized in that: include: Memory; as well as A processor coupled to the memory, the processor being configured to execute the method according to any one of claims 1 to 6 based on instructions stored in the memory.
9. A computer-readable storage medium having a program stored thereon, wherein when the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Prediction of resource demand and adjustment of resource configuration for nodes within cluster
CN116266814A