Container dispensing method, device and electronic equipment

By analyzing the historical use of the container's resource and combining it, the problem of low resource utilization of physical nodes in traditional container cloud is solved, and more efficient resource utilization and cluster load are achieved.

CN114253727BActive Publication Date: 2025-02-18BEIJING CREATION CLOUD TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111565377.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-20
Publication Date
2025-02-18
Estimated Expiration
2041-12-20

AI Technical Summary

Technical Problem

The container scheduling strategy in traditional container cloud only considers the idle rate of the CPU and memory of the physical node and the maximum number of requests for CPU and memory resources by the container when orchestrating the container, resulting in lower resource utilization of physical nodes.

Method used

By determining the resource historical usage of multiple containers, we judge whether the two containers can be combined, and when combined, they are allocated to the same physical node to achieve more efficient resource utilization.

Benefits of technology

By redistributing multiple containers under the physical node, the utilization rate of some or more resources in each period of the physical node is achieved, and the cluster load is reduced, and resource waste in the physical node is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114253727B_ABST
    Figure CN114253727B_ABST
Patent Text Reader

Abstract

The present invention provides a container allocation method, device and electronic device, wherein the method includes: determining the historical usage of at least one resource of multiple containers; judging whether the two containers can be combined according to the historical usage of the resources of two containers; and allocating the two containers to the same physical node when the two containers can be combined. The container allocation method, device and electronic device provided by the embodiments of the present invention can take into account the characteristics of different types of container resources having time sequence differences in historical usage, and by determining the historical usage of one or more resources in different containers and judging whether different containers can be combined, multiple containers under the physical node are reallocated to achieve balanced utilization of one or more resources in each time period of the physical node, thereby achieving the purpose of avoiding waste of resources in the physical node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of virtualization technology and cloud computing service technology, and in particular to a container allocation method, device, electronic device and computer-readable storage medium. Background Art

[0002] With the development of container virtualization technology and container large-scale cluster management technology, PaaS (Platform as a Service) platforms based on container virtualization technology have gradually become the core of cloud computing. Compared with traditional virtual machines, containers are more convenient, faster and more efficient, which has led many large companies to use container technology to provide cloud services, and a large number of container clouds based on containerization technology have emerged.

[0003] However, as the practice of container cloud platforms deepens, the allocation and use of container infrastructure resources have also exposed some problems. The container scheduling strategy in traditional container clouds often only considers the idle rate of the CPU and memory of the physical node and the maximum request amount of the container for CPU and memory resources when scheduling containers, which easily leads to low utilization of physical node resources. Summary of the invention

[0004] In order to solve the existing technical problems, the embodiments of the present invention provide a container dispensing method, device, electronic device and computer-readable storage medium.

[0005] In a first aspect, an embodiment of the present invention provides a container allocation method, comprising: determining a historical usage of at least one resource of multiple containers, the resource comprising a CPU resource, a memory resource, or a network bandwidth resource, the historical usage comprising a situation in which the container uses the resource in multiple time periods within a preset time period; judging whether the two containers can be combined according to the historical usage of the resources of two containers; and if the two containers can be combined, allocating the two containers to the same physical node.

[0006] Optionally, judging whether the two containers can be combined according to historical usage of the resources of the two containers includes: determining a resource utilization matching degree between the two containers, the resource utilization matching degree indicating a matching degree of the resources between the two containers in a time dimension; determining a resource utilization conflict degree between the two containers, the resource utilization conflict degree indicating a conflict degree of the resources between the two containers in a time dimension; determining a comprehensive score of the two containers according to the resource utilization matching degree and the resource utilization conflict degree of the two containers, the comprehensive score indicating a possibility that the two containers can be combined; and judging whether the two containers can be combined according to the comprehensive score of the two containers.

[0007] Optionally, determining the resource utilization matching degree between the two containers includes: determining the resource form similarity between the two containers, and determining the resource fluctuation trend similarity between the two containers; the resource form similarity between the two containers is used to measure the similarity of the numerical value and / or shape of the historical usage of the resources between the two containers, and the resource fluctuation trend similarity between the two containers is used to measure the similarity of the fluctuation trend of the historical usage of the resources between the two containers; the resource utilization matching degree is obtained according to the resource form similarity and the resource fluctuation trend similarity between the two containers.

[0008] Optionally, the resource shape similarity between two containers is: Wherein, r represents the resource; i and j represent the two containers; Indicates the historical usage of the resource r in the container i; Indicates the historical usage of the resource r in the container j; represents the resource form similarity between the two containers; T represents the number of time periods included in the preset time period; represents the Euclidean distance between the historical usages of the two containers; represents the Manhattan distance between the historical usages of the two containers; represents the absolute value of the sum of the differences in the historical usage of the two containers at different time periods; the similarity of the resource fluctuation trend between the two containers is: in, represents the similarity of resource fluctuation trends between the two containers; t represents the time period; represents the historical usage of container i in time period t in resource r; based on the formula The resource utilization matching degree between container i and container j is determined.

[0009] Optionally, determining the resource utilization conflict degree between the two containers includes: determining the total amount of available resources of the physical node and the combined resource demand between the two containers; the total amount of available resources is the amount of the resources that can be used by the two containers in the total amount of the resources of the physical node, and the combined resource demand is the sum of the historical usage of the resources of the two containers; determining the resource utilization conflict degree of the two containers as RUC (R i , R j ),and in, Indicates the historical usage of the resource r in the container i; represents the historical usage of the resource r in the container j, represents the combined resource demand, S represents the preset conflict threshold; N represents the number of conflicts within the preset time period; Represents the Euclidean distance between the combined resource demand and the conflict threshold.

[0010] Optionally, if the average value of the combined resource demand between the two containers is greater than the total amount of available resources of the physical node, the resource utilization conflict degree between the two containers is set to be greater than a preset value.

[0011] Optionally, determining the comprehensive scores of the two containers according to the resource utilization matching degree and the resource utilization conflict degree of the two containers includes: determining a weight vector of the resources between the two containers according to the importance of the multiple resources between the two containers; scoring the two containers based on the resource utilization matching degree, the resource utilization conflict degree and the weight vector of the two containers to obtain a comprehensive score of the two containers, wherein the comprehensive score of container i and container j is score ij , and score ij =C RUM ij ,M RUM ij ,B RUM ij )·ζ×γ-(C RUCij ,M RUCij ,B RUCij )·ζ×(1-γ); where C RUM ij ,M RUM ij ,B RUM ij respectively represent the resource utilization matching degree of the CPU resource, the memory resource, and the network bandwidth resource between the container i and the container j; C RUCij ,M RUCij ,B RUCij Respectively represent the resource utilization conflict degree of the CPU resources, the memory resources, and the network bandwidth resources between the container i and the container j; ζ represents the weight vector; γ represents the preset parameter; · represents the inner product operation between vectors.

[0012] Optionally, judging whether the two containers can be combined according to the comprehensive scores of the two containers includes: when the comprehensive score of the two containers is the highest score among a plurality of comprehensive scores obtained by scoring each container with other containers respectively, determining that the two containers can be combined.

[0013] Optionally, when the two containers can be combined, the method further includes: treating the two containers as a new container, and performing a cyclic scoring operation on the multiple containers until a preset condition is met; the cyclic scoring operation includes: scoring the multiple containers in pairs to obtain multiple comprehensive scores, determining that the two containers corresponding to the highest scores among the multiple comprehensive scores can be combined, and treating the two containers corresponding to the highest scores as a new container; the preset condition includes that the total number of the containers is equal to the number of the physical nodes, or that each of the comprehensive scores is a non-positive number.

[0014] Optionally, allocating the two containers to the same physical node includes: taking the containers that can be combined as container sets, and generating a combination scheme containing at least one of the container sets; performing an optimization action on the combination scheme, and determining an evaluation value of the optimized combination scheme, the optimization action including a migration action and / or a replacement action; the optimization action is used to adjust the container set in the combination scheme; determining an optimal combination scheme according to the evaluation value, and allocating containers belonging to the same container set in the optimal combination scheme to the same physical node.

[0015] Optionally, the migration action includes: extracting containers before the first combination from the container set, taking the container set containing the containers before the first combination as the original container set, and determining migration scores between the containers before the first combination and other containers or other container sets; if the maximum score among the multiple migration scores is greater than the comprehensive score of the original container set, forming a new container set with other containers or other container sets corresponding to the maximum score among the multiple migration scores and the containers before the first combination, and taking other containers in the original container set except the containers before the first combination as new containers or container sets.

[0016] Optionally, the replacement action includes: replacing the container before the first combination extracted from the first container set with the container before the first combination extracted from the second container set to obtain the replaced first container set and the replaced second container set; calculating the comprehensive score of the replaced first container set and the comprehensive score of the replaced second container set; if the average of the comprehensive score of the replaced first container set and the comprehensive score of the replaced second container set is greater than the average of the comprehensive score of the first container set before the replacement and the comprehensive score of the second container set before the replacement, then using the replaced first container set and the replaced second container set as the new container set.

[0017] In a second aspect, an embodiment of the present invention provides a container dispensing device, including: a determination module, a judgment module, and a processing module.

[0018] A determination module is used to determine the historical usage of at least one resource of multiple containers, where the resource includes a CPU resource, a memory resource, or a network bandwidth resource, and the historical usage includes the usage of the resource by the container in multiple time periods within a preset time period.

[0019] The judging module is used to judge whether the two containers can be combined according to the historical usage of the resources of the two containers.

[0020] The processing module is configured to allocate the two containers to the same physical node if the two containers can be combined.

[0021] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor; the transceiver, the memory, and the processor are connected via the bus, and when the computer program is executed by the processor, the steps in the container allocating method as described above are implemented.

[0022] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, comprising: a computer program stored on the computer-readable storage medium; when the computer program is executed by a processor, the steps in the container allocation method described above are implemented.

[0023] The container allocation method, device, electronic device and computer-readable storage medium provided by the embodiments of the present invention take into account the characteristics that the historical usage of different types of container resources has time sequence differences, extract the historical usage corresponding to multiple time periods, determine the historical usage of one or more resources in different containers, and judge whether different containers can be combined, so as to reallocate multiple containers under the physical node, realize balancing the utilization rate of one or more resources in each time period of the physical node, reduce the cluster load, and thus achieve the purpose of avoiding resource waste in the physical node. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the background technology, the drawings required for use in the embodiments of the present invention or the background technology will be described below.

[0025] Figure 1 A flow chart of a container allocation method provided by an embodiment of the present invention is shown;

[0026] Figure 2 A flowchart of a specific method of "determining whether two containers can be combined according to historical usage of resources of two containers" in the container allocation method provided by an embodiment of the present invention is shown;

[0027] Figure 3A flowchart of a specific method of "allocating two containers to the same physical node" in the container allocation method provided in an embodiment of the present invention is shown;

[0028] Figure 4 A detailed flow chart of the container dispensing method provided by an embodiment of the present invention is shown;

[0029] Figure 5 A schematic diagram showing the structure of a container dispensing device provided by an embodiment of the present invention is shown;

[0030] Figure 6 A schematic structural diagram of an electronic device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0031] The embodiments of the present invention are described below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0032] In the process of implementing the present invention, the inventors found that the usage of different types of container resources has the characteristics of time period differences. For example, the usage of securities industry application resources is often concentrated between 9 am and 10 am, while the usage of short video application resources is concentrated around 12 noon and after 9 pm. Therefore, for the time periods from 10 am to 12 noon and from 1 pm to 9 pm, the usage of container resources is unbalanced. The container scheduling strategy in the traditional container cloud cannot fully take into account the characteristics of time period differences in container resource usage. When arranging containers, it often only considers the idle rate of the CPU and memory of the physical node and the maximum request amount of the container for CPU and memory resources, which leads to waste of resources of the physical node in certain time periods and low utilization of physical node resources.

[0033] Based on this, the present invention proposes a container allocation method. Figure 1 FIG. 2 is a flow chart of a container allocation method provided by an embodiment of the present invention. Figure 1 As shown, the method includes the following steps 101-103.

[0034] Step 101: Determine historical usage of at least one resource of multiple containers, where the resource includes CPU resources, memory resources, or network bandwidth resources, and the historical usage includes resource usage of the container in multiple time periods within a preset time period.

[0035] Among them, multiple containers can be obtained based on the physical nodes on the container cloud platform, and the multiple containers can belong to the same physical node or to different physical nodes. Each container can use one or more resources, which can be CPU resources, memory resources, or network bandwidth resources. In an embodiment of the present invention, the historical usage of multiple containers can be determined in units of time periods (such as 1 hour, etc.), and the historical usage can be the use of CPU resources, memory resources, or network bandwidth resources by a container in multiple time periods within a preset time period.

[0036] For example, a container cloud platform has 4 physical nodes, and the total amount of resources in each physical node is the same. Assuming that the 7 containers in the above 4 physical nodes need to be reorganized and deployed, 24 hours can be divided into 6 periods, and the CPU resource usage, memory resource usage, and network bandwidth resource usage of the 7 containers in each period can be determined respectively. The historical usage of each resource includes the usage of 6 periods.

[0037] Step 102: Determine whether the two containers can be combined based on the historical usage of the resources of the two containers.

[0038] Among them, by arbitrarily selecting two containers and judging the historical usage of a certain resource of the two containers, it can be determined whether the two containers can be combined. The method for judging whether the two containers can be combined can be to obtain the historical usage of the resource of the two containers for a certain resource, and record the historical usage of the resource corresponding to each time period in a table, and judge whether the two containers can be combined by comparing the data in the table; or, the time period can be used as the X-axis and the historical usage of the resource as the Y-axis, and the historical usage of the resource corresponding to each time period can be marked on the graph in the form of a histogram or a line graph, and the two containers can be judged whether they can be combined by comparing the image data.

[0039] In the embodiment of the present invention, if two containers are combined and a physical node can provide the required resources to the two containers after the combination, then it can be considered that the two containers can be combined. For example, when the historical usage of the two containers does not conflict with each other, it is not easy to exceed the resource usage after the two containers are combined, and the two containers can be combined.

[0040] Step 103: If the two containers can be combined, the two containers are allocated to the same physical node.

[0041] Among them, when two containers can be combined, it means that a physical node can provide the resources required by the two containers at the same time. At this time, it can be determined that the two containers can be combined into a whole, and the two containers are allocated to the same physical node to ensure that the resources of the physical node are not wasted and do not affect the normal operation of the physical node. For example, a line graph is used to represent the historical usage of a certain resource by two containers in 6 time periods in 24 hours, and based on the line graph, it is known that the difference between the historical usage of a certain resource by the two containers in each time period is relatively large (such as the distance between the two points on the Y axis corresponding to each point on the X axis is large), then it can be considered that the use of the resource by the two containers in the 6 time periods in the 24 hours will not appear at the same time or at the same time, and the historical usage of the resource by the two containers is relatively complementary. It can be determined that the two containers can be combined, and at this time, the two containers can be allocated to the same physical node.

[0042] The container allocation method provided in the embodiment of the present invention takes into account the characteristics that there are time series differences in the historical usage of different types of container resources, extracts the historical usage corresponding to multiple time periods, and reallocates multiple containers under the physical node by determining the historical usage of one or more resources in different containers and judging whether different containers can be combined, so as to achieve balanced utilization of one or more resources in each time period of the physical node, reduce the cluster load, and thus achieve the purpose of avoiding waste of resources in the physical node.

[0043] Alternatively, see Figure 2 As shown, judging whether the two containers can be combined according to the historical usage of the resources of the two containers includes the following steps 201-204.

[0044] Step 201: Determine a resource utilization matching degree between two containers, where the resource utilization matching degree indicates a matching degree of resources between the two containers in a time dimension.

[0045] When it is necessary to determine whether two containers can be combined, the resource utilization matching degree between the two containers for a resource can be obtained by the historical usage of the resource by the two containers in a preset time period, and each resource corresponds to a resource utilization matching degree. For example, the resource utilization matching degree C of container i and container j for the CPU resource can be obtained by determining the CPU resource usage of container i and container j in multiple time periods of a day. RUM i,j ; It is also possible to obtain the resource utilization matching degree M of the container i and container j for the memory resource by determining the usage of the memory resource of the container i and container j in multiple periods of a day. RUM i,j .

[0046] The historical usage includes multiple time periods, and can be a sequence including multiple time periods. The sequence can represent the usage of the resource in the time dimension. By using the historical usage of the two containers, the degree of matching between the two in the time dimension, that is, the resource utilization matching degree, can also be determined. In an embodiment of the present invention, the two containers can match, which means that the resources required by the two containers do not conflict with each other in the time dimension, and the two can be set on the same physical node. For example, the greater the resource utilization matching degree between the two containers, the more the two containers can use the resource in the same period without conflict, and the more the two containers can be combined so that the two containers can be set on the same physical node.

[0047] Step 202: Determine the resource utilization conflict degree between the two containers. The resource utilization conflict degree indicates the conflict degree of resources between the two containers in the time dimension.

[0048] When it is necessary to determine whether two containers can be combined, the resource utilization conflict between the two containers for a resource can be obtained by the historical usage of the two containers for a certain resource in a preset time period (such as the demand for the resource, the average demand for the resource, etc.), and each resource corresponds to a resource utilization conflict. For example, the resource utilization matching degree C of container i and container j for the CPU resource can be obtained by determining the demand for CPU resources of container i and container j in multiple time periods of a day. RUC i,j ; It is also possible to obtain the resource utilization matching degree M of container i and container j for the memory resource by determining the demand for memory resources of container i and container j at multiple time periods in a day RUC i,j .

[0049] Similarly, based on the historical usage of the two containers, the degree of conflict between the two in the time dimension, i.e., the resource utilization conflict degree, can also be determined. In contrast to the resource utilization matching degree mentioned above, the resource utilization conflict degree indicates the magnitude of the conflict in the time dimension when the two containers use the resource. For example, the greater the resource utilization conflict degree, the more likely it is that there will be a conflict when the two containers use the resource at the same time, the more impossible it is to combine the two containers, and the more impossible it is to set the two containers on the same physical node.

[0050] Step 203: Determine the comprehensive scores of the two containers according to the resource utilization matching degree and resource utilization conflict degree of the two containers. The comprehensive score indicates the possibility that the two containers can be combined.

[0051] Step 204: Determine whether the two containers can be combined according to the comprehensive scores of the two containers.

[0052] In the embodiment of the present invention, the resource utilization matching degree and resource utilization conflict degree between two containers can be used to score the two containers to obtain the comprehensive score of the two containers. Since the comprehensive score is used to measure whether the two containers can be combined, after obtaining the comprehensive scores of the two containers, it can be determined whether the two containers can be combined based on the comprehensive score. Among them, the resource utilization matching degree and resource utilization conflict degree between the two containers obtained for multiple resources can be combined to score the two containers to determine the comprehensive score of the two containers; the resource utilization matching degree and resource utilization conflict degree between the two containers can also be calculated for only one resource, and the two containers can be scored to determine the comprehensive score of the two containers.

[0053] For example, the comprehensive score is positively correlated with the resource utilization matching degree and negatively correlated with the resource utilization conflict degree, that is, the greater the resource utilization matching degree, the higher the comprehensive score, and the greater the resource utilization conflict degree, the lower the comprehensive score. Accordingly, the higher the comprehensive score, the more likely the two containers are to be combined.

[0054] When it is necessary to determine whether two containers can be combined, the embodiment of the present invention determines the historical usage of a certain resource by the two containers within a preset time period, thereby obtaining an important basis (i.e., a comprehensive score) that can measure whether the two containers can be combined, and based on this, determines whether the two containers can be combined. This method makes full use of the historical usage of resources by containers, and measures the matching degree and conflict degree between containers from the time dimension according to the characteristics of the differences in resource usage time periods of different containers, thereby balancing the resource utilization of the physical nodes of the container cloud platform in each time period and avoiding resource waste.

[0055] Optionally, determining the resource utilization matching degree between two containers includes the following steps A1-A2.

[0056] Step A1: Determine the resource form similarity between the two containers, and determine the resource fluctuation trend similarity between the two containers; the resource form similarity between the two containers is used to measure the similarity of the numerical value and / or shape of the historical usage of the resources between the two containers, and the resource fluctuation trend similarity between the two containers is used to measure the similarity of the fluctuation trend of the historical usage of the resources between the two containers.

[0057] In the embodiment of the present invention, the resource form similarity between two containers is a basis for measuring and comparing the historical usage of a certain resource between the two containers, and can be used to compare whether the numerical values ​​of the use of a certain resource between the two containers are similar, or whether the shapes are similar. The resource fluctuation trend similarity between two containers is another basis for measuring and comparing the historical usage of a certain resource between the two containers, and can be used to compare whether the fluctuation trend of the use of a certain resource between the two containers is similar. For example, the historical usage of a certain resource used by two containers in a preset time period can be depicted in the same coordinate system in the form of a line graph, and then the resource form similarity and resource fluctuation trend similarity between the two containers corresponding to the two lines can be obtained through the curvature and fluctuation trend of the two lines; or, the numerical values ​​and numerical change trends of the use of a certain resource by the two containers in a preset time period can be expressed in the form of a table, so as to obtain the resource form similarity and resource fluctuation trend similarity between the two containers through the data in the table. Among them, each resource corresponds to a resource form similarity and a resource fluctuation trend similarity.

[0058] Step A2: Obtain resource utilization matching degree according to the resource form similarity and resource fluctuation trend similarity between the two containers.

[0059] Among them, based on the resource form similarity and resource fluctuation trend similarity between the two containers, a resource utilization matching degree that can represent the matching degree of resources between the two containers in the time dimension can be obtained. For example, after obtaining the broken lines representing the historical usage of a certain resource by two containers in a preset time period in the same coordinate system, the resource form similarity and resource fluctuation trend similarity are determined by comparing the curvature, fluctuation trend and other attributes between the two broken lines, and then the resource utilization matching degree between the two containers can be obtained. Alternatively, the resource utilization matching degree between the two containers can also be determined by other means. For example, when the numerical value and numerical change trend of a certain resource used by two containers in a preset time period are expressed in the form of a table, the resource form similarity and resource fluctuation trend similarity between the two containers can be determined by comparing the data in the table, and then the resource utilization matching degree can be obtained. The present invention does not limit this.

[0060] The embodiment of the present invention selects multiple bases that can be used to measure the degree of matching between two containers for a certain resource, namely, the resource form similarity and resource fluctuation trend similarity between the two containers, so as to more accurately judge the degree of matching of the resources used between the two containers, thereby making the obtained resource utilization matching degree more precise.

[0061] Optionally, the resource shape similarity between two containers is: Among them, r represents a resource; i and j represent two containers; Indicates the historical usage of resource r in container i; Indicates the historical usage of resource r in container j; Indicates the resource form similarity between two containers; T indicates the number of time periods included in the preset time period; represents the Euclidean distance between the historical usage of two containers; represents the Manhattan distance between the historical usage of two containers; Indicates the absolute value of the sum of the differences in the historical usage of two containers at different time periods.

[0062] In the embodiment of the present invention, the historical usage can be expressed as a time series vector, and the historical usage of resource r by container i can be expressed as Where T represents the number of time periods contained in the preset time period (such as 24 hours), Each element in represents the use of resource r by container i in the corresponding period, for example Indicates the usage of resource r (such as CPU resource) by container i in the Tth period of the preset time period. In order to facilitate calculation and eliminate the influence of data differences, the historical usage of a certain resource of a certain container can be normalized by z-score (zero-mean). For example, for resource r (such as CPU resource), the usage of resource r by container i in each period of the preset time period can be represented as a time series vector, and the time series vector is normalized by z-score to obtain Therefore, in this embodiment, Indicates the historical usage of resource r in container i; represents the historical usage of resource r in container j; the resource form similarity between two containers corresponding to resource r is expressed as

[0063] Among them, the Euclidean distance between the historical usage of resource r by container i and container j can be calculated separately Manhattan distance between the historical usage of resource r by container i and container j and the absolute value of the sum of the differences in the historical usage of resource r between container i and container j in each period Obtain resource shape similarity that can measure the similarity of the numerical value and / or shape of the historical usage of resource r between container i and container j The absolute value of the sum of the differences in the historical usage of resource r between container i and container j in each period is The formula can be: Calculated.

[0064] The similarity of resource fluctuation trends between the two containers is: in, Indicates the similarity of resource fluctuation trends between two containers; t indicates the time period; Represents the historical usage of container i in time period t.

[0065] In the embodiment of the present invention, the resource usage r of each time period t in the historical usage of container i can be calculated separately. And the historical usage of container j in each period t of resource r Get the resource fluctuation trend similarity that can measure the similarity between the fluctuation trends of the historical usage of resource r between container j and container j

[0066] Based on the formula Determine the resource utilization match between container i and container j.

[0067] Among them, when the resource form similarity between container i and container j is determined And the similarity of resource fluctuation trends between container i and container j Later, we can use the similarity of resource fluctuation trends between container i and container j to The value range of the resource utilization matching degree between container i and container j is directly obtained based on different calculation formulas. Among them, the similarity of resource fluctuation trend between container i and container j is The value range can be [-1,1].

[0068] The embodiment of the present invention represents the historical usage of resources by a container with a time series vector, calculates a set of vectors on a time dimension corresponding to each container, and obtains the resource form similarity and resource fluctuation trend similarity between the two containers through the calculation results, thereby obtaining the resource utilization matching degree between the two containers. This method converts the non-specific historical usage into something more specific, and can also be more accurate in calculating the resource utilization matching degree.

[0069] Optionally, determining the resource utilization conflict degree between two containers includes the following steps B1-B2.

[0070] Step B1: Determine the total amount of available resources of the physical node and the combined resource demand between the two containers; the total amount of available resources is the amount of resources that can be used by the two containers out of the total amount of resources of the physical node, and the combined resource demand is the sum of the historical usage of the resources of the two containers.

[0071] The total amount of resources in each physical node is fixed, that is, the total amount of resources of the physical node is constant, and the amount of resources available for two containers (such as container i and container j) in the total amount of resources of the physical node is the total amount of available resources, which is not greater than the total amount of resources of the physical node. When it is necessary to determine whether two containers can be combined, the sum of the historical usage of the two containers for a certain resource is used as the combined resource demand of the two containers for the resource.

[0072] Step B2: Determine the resource utilization conflict between the two containers as RUC (R i , R j ),and in, Indicates the historical usage of resource r in container i; Indicates the historical usage of resource r in container j. represents the combined resource demand, S represents the preset conflict threshold, and N represents the number of conflicts within the preset time period; Represents the Euclidean distance between the combined resource demand and the conflict threshold.

[0073] In the embodiment of the present invention, the resource utilization conflict degree RUC (R i , R j ). First, determine the historical usage of resource r in container i And the historical usage of resource r in container j The sum of the historical usage of resource r by container i and container j As the combined resource demand; then through the preset conflict threshold S, the number of conflicts in the preset time period N, and then the conflict degree between the container i and the container j is obtained Combining the conflict levels in multiple preset time periods, the resource utilization conflict RUC (R i , R j ).

[0074] The conflict threshold S is the resource amount corresponding to the percentage of the combined resource demand of the two containers to the total resource amount of the physical node when determining the conflict between the two containers, for example, the total available resource amount of the physical node. For example, a conflict is defined when the combined resource demand of the two containers is greater than 90% of the total resource amount of the physical node, then the 90% total resource amount is the conflict threshold, and 90% of the total resource amount of the physical node can also be used as the total available resource amount.

[0075] The embodiment of the present invention obtains the resource utilization conflict degree between the two containers by calculating the sum of the historical usage of a resource each time a conflict occurs between the two containers within a preset time period. The method is simple in calculation and can obtain accurate results quickly.

[0076] Optionally, if the average of the combined resource requirements between the two containers is greater than the total available resources of the physical node, the resource utilization conflict degree between the two containers is set to be greater than a preset value.

[0077] The mean of the combined resource demand is the average historical usage of a certain resource by the two containers within a preset time period. For example, the sum of the historical usage of resource r by container i and container j in one day is divided by the number of time periods, and the value obtained is the mean of the combined resource demand. In an embodiment of the present invention, if the mean of the combined resource demand between the two containers exceeds the total amount of available resources of the physical node, the resource utilization conflict degree between the two containers is set to be greater than a preset value, which can be positive infinity, or a larger value (such as 10000, etc.), that is, when the mean of the combined resource demand between the two containers exceeds the total amount of available resources of the physical node, the resource utilization conflict degree between the two containers can be positive infinity, and it is determined that the total amount of available resources of the physical node cannot meet the resource demand required by the two containers when they are set at the physical node. The two containers must conflict, and the two cannot be combined and stored in the physical node. When the average of the combined resource demand of two containers exceeds the total available resources of the physical node, the method directly sets the resource utilization conflict degree of the two containers to positive infinity or a larger value, which can quickly obtain the resource utilization conflict degree and effectively avoid combining the two containers together.

[0078] Optionally, determining the comprehensive scores of the two containers according to the resource utilization matching degree and the resource utilization conflict degree of the two containers includes the following steps C1-C2.

[0079] Step C1: Determine a weight vector of resources between two containers according to the importance of multiple resources between two containers.

[0080] In an embodiment of the present invention, the importance of each resource may be different. For example, the importance of CPU resources may be higher than that of memory resources, and the importance of memory resources may be higher than that of network bandwidth resources, that is, the importance relationship between the three resources is CPU resources>memory resources>network bandwidth resources; or, each resource may be equally important. Among them, a weight vector of resources between two containers may be determined, and the weight vector is used to indicate the importance of a certain resource compared to another resource. For example, for three resources: CPU resources, memory resources, and network bandwidth resources, the historical usage of the above three resources by container i and container j is determined, respectively. The historical usage may include an average utilization rate, and the fuzzy number corresponding to the use of the resource is obtained based on the average utilization rate of a certain resource used by container i and container j. The higher the average utilization rate of the resource used by container i and container j, the larger the fuzzy number corresponding to the resource. A comparison matrix A is constructed through the fuzzy numbers corresponding to each resource, and the corresponding judgment matrix A' can be obtained based on the comparison matrix and the preset comparison matrix parameters, and finally the weight vector of each resource between the two containers is determined. The specific calculation formula is:

[0081]

[0082] l α =(ba)α+a

[0083] u α =-(cb)α+c

[0084] Among them, a′ ij is a matrix element in the judgment matrix A' obtained based on the contrast matrix composed of multiple resource importances and the preset contrast matrix parameters; each fuzzy number has a corresponding fuzzy number set, which contains three values ​​of a, b, and c. Generally, at least one of a, b, and c is the same as the fuzzy number; α and μ are preset contrast matrix parameters, which can usually be set to 0.5; a ij is a matrix element in the comparison matrix A based on the importance of multiple resources, that is, a fuzzy number corresponding to the importance of a certain resource i compared to another resource j. The selection of this fuzzy number can be customized according to needs. Based on the above formula, the judgment matrix A' can be determined.

[0085] Solve the eigenvector corresponding to the maximum eigenvalue of the judgment matrix A', and normalize the eigenvector to obtain the vector ζ, which is the required weight; if three resources are included, the weight vector can be expressed as: ζ = (μ 1 ,μ 2 ,μ 3 ).

[0086] Step C2: Based on the resource utilization matching degree, resource utilization conflict degree and weight vector of the two containers, the two containers are scored to obtain the comprehensive score of the two containers. The comprehensive score of container i and container j is score ij , and score ij =(C RUM ij ,M RUM ij ,B RUM ij )·ζ×γ-(C RUCij ,M RUCij ,B RUCij )·ζ×(1-γ); where C RUM ij ,M RUM ij ,B RUM ij Respectively represent the resource utilization matching degree of CPU resources, memory resources, and network bandwidth resources between container i and container j; C RUCij ,M RUCij ,B RUCij Respectively represent the resource utilization conflict between container i and container j, CPU resources, memory resources, and network bandwidth resources; ζ represents the weight vector; γ represents the preset parameter; · represents the inner product operation between vectors. 1 ,μ 2 ,μ 3 ), then μ 1 ,μ 2 ,μ 3 Respectively represent the weights of CPU resources, memory resources, and network bandwidth resources.

[0087] Among them, according to the weight vector of resources between container i and container j that can be determined according to the above step C1, and combined with the resource utilization matching degree and resource utilization conflict degree between the two containers, the comprehensive score between the two containers can be determined. In the embodiment of the present invention, C represents CPU resources, M represents memory resources, and B represents network bandwidth resources; first, according to the historical usage of CPU resources or memory resources or network bandwidth resources between container i and container j, the resource utilization matching degree C between container i and container j for the above three resources is determined respectively. RUM ij 、M RUM ij , B RUM ij ; and determine the resource utilization conflict degree C between container i and container j for the above three types RUCij 、M RUCij , B RUCij ; Combined with the weight vector ζ of the resources between container i and container j and the preset parameter γ, container i and container j are scored to obtain the comprehensive score between container i and container j ij; Among them, the preset parameter γ is the trade-off parameter between the resource utilization matching degree and the resource utilization conflict degree between the two containers; · represents the inner product operation of the resource utilization matching degree and the resource utilization conflict degree of different resources represented in the form of vectors with the weight vector ζ respectively.

[0088] In the embodiment of the present invention, the obtained judgment matrix can also be subjected to consistency check, and the consistency check can be performed by the consistency index formula And the consistency ratio formula Measure whether the judgment matrix is ​​correctly allocated. Where n is the number of factors, λ max is the maximum eigenvalue, and RI is the random consistency index. Since the resources used by the two containers can include CPU resources, memory resources, and network bandwidth resources, n = 3, and RI can be 0.58. When CR < 0.1, it is considered that the judgment matrix meets the definition of the consistency matrix, and the weight vector is correctly assigned; otherwise, the judgment matrix needs to be adjusted, that is, the fuzzy number or the preset contrast matrix parameters are adjusted, and the judgment matrix is ​​reconstructed to obtain the weight vector that meets the definition of the consistency matrix.

[0089] The method judges the importance of each resource based on the difference in historical usage of different resources by two containers, and determines a weight vector based on the importance of each resource. On the basis of calculating the combined score of the two containers by using the resource utilization matching degree and resource utilization conflict degree between the two containers, a weight vector that can represent the importance of the resources is added. At the same time, a consistency check is performed on the judgment matrix to determine that the obtained judgment matrix is ​​consistent, and then it can be determined that the final comprehensive score between the two containers is accurate.

[0090] Optionally, judging whether the two containers can be combined according to the comprehensive scores of the two containers includes: when the comprehensive score of the two containers is the highest score among multiple comprehensive scores obtained by scoring each container with other containers, determining that the two containers can be combined.

[0091] Among them, by combining each container with other containers in pairs to score, multiple comprehensive scores can be obtained, and each comprehensive score corresponds to two containers. The embodiment of the present invention can determine which two containers can be combined based on multiple comprehensive scores, that is, among the multiple comprehensive scores, it can be determined that the two containers corresponding to the highest comprehensive scores can be combined. For example, there are 8 containers (such as container 1, container 2, ..., container 8), and container 1 is combined with the remaining 7 containers in pairs to score, and 7 comprehensive scores (such as score 12 =0.2388, score 13 =0.3683, ... score 18=0.4845), and then use each container from container 2 to container 8 to score in combination with the other 7 containers in turn. After each container has been scored in combination with the other containers in combination, the two containers corresponding to the highest comprehensive scores among the 28 comprehensive scores finally obtained (see Table 1) are determined as the containers that can be combined, that is, container 6 and container 8 corresponding to the comprehensive score of 0.6131 can be combined.

[0092]

[0093] Table 1- Comprehensive score table of each container after combining the scores

[0094] The method uses the comprehensive scores of two containers as a basis for judging whether the two containers can be combined. By screening out the highest comprehensive score, it is determined that the two containers corresponding to the highest comprehensive score can be combined, and the specific two containers that can be combined can be obtained quickly and intuitively.

[0095] Optionally, when the two containers can be combined, the method further comprises step D1.

[0096] Step D1: The two containers are regarded as a new container, and a cyclic scoring operation is performed on multiple containers until the preset conditions are met.

[0097] Among them, when two containers can be combined, the two containers can be combined as a new container. For example, still taking the example shown in Table 1 above as an example, there are 8 containers (such as container 1, container 2, ..., container 8), and the two containers that can be combined are calculated to be container 6 and container 8, respectively. Then the container 6 and container 8 can be used as a new container (6, 8), and there are currently 7 containers, namely container 1, container 2, container 3, container 4, container 5, container 7, container (6, 8). In the embodiment of the present invention, after the two containers are used as a new container, a cyclic scoring operation can be performed on the multiple containers existing at this time until the cycle ends, and the cycle end time is when the result of the cyclic operation meets the preset condition. For example, after container 6 and container 8 are used as a new container (6, 8), a cyclic scoring operation is performed on the containers 1, container 2, container 3, container 4, container 5, container 7, container (6, 8) existing at this time until the operation result meets the preset condition.

[0098] The cyclic scoring operation in step D1 includes: scoring multiple containers in pairs to obtain multiple comprehensive scores, determining that the two containers corresponding to the highest scores among the multiple comprehensive scores can be combined, and using the two containers corresponding to the highest scores as a new container.

[0099] In an embodiment of the present invention, the cyclic scoring operation may include: each container is scored in combination with other containers in pairs, until all existing containers are traversed to obtain multiple comprehensive scores; then, according to the highest score among the multiple comprehensive scores currently obtained, it is determined that the two containers corresponding to the highest score can be combined, and the two containers are used as a new container. Among the multiple comprehensive scores currently obtained, since the comprehensive scores between some containers and some other containers have been calculated in the previous round of operations, in the subsequent cyclic scoring operation, the comprehensive scores between the two containers that have obtained the comprehensive scores may not be repeatedly calculated, thereby simplifying the process of the cyclic scoring operation and improving the processing speed.

[0100] For example, there are 7 containers currently, namely, container 1, container 2, container 3, container 4, container 5, container 7, and container (6, 8). These 7 containers can be scored in a loop. Specifically, container 1 can be scored in pairs with container 2, container 3, container 4, container 5, container 7, and container (6, 8), and each of the two containers can be scored. A comprehensive score is obtained for each pair of containers. Similarly, each of container 2, container 3, container 4, container 5, container 7, and container (6, 8) can be scored in pairs with other containers in turn, until each container is scored with other containers to obtain a corresponding comprehensive score. The highest score is selected from the currently obtained comprehensive scores (e.g., the comprehensive score between container 3 and container 5 is the highest score), and the two containers corresponding to the highest score are used as a new container (i.e., container 3 and container 5 are used as a new container to obtain container (3, 5)). At this time, if the preset condition for terminating the loop scoring operation has not been met, the 6 currently existing containers are scored in pairs, and the loop scoring operation is continued.

[0101] The preset conditions include that the total number of containers is equal to the number of physical nodes, or each comprehensive score is a non-positive number.

[0102] The preset condition for ending the loop scoring operation can be set differently according to the different purposes to be achieved by allocating containers. For example, if the purpose of allocating containers is to balance the resource utilization of each physical node in each time period, the preset condition can be that the total number of containers is equal to the number of physical nodes; if the purpose of allocating containers is to deploy a large number of containers using the least number of physical nodes, the preset condition can be that each comprehensive score currently calculated is less than 0.

[0103] The embodiment of the present invention performs a cyclic scoring operation to score each currently existing container in combination with other containers, thereby obtaining a comprehensive score between each container and other containers, and taking the two containers corresponding to the highest comprehensive scores among the multiple comprehensive scores as a new container, and then performing the next cyclic scoring operation on the currently existing containers until the preset conditions are met. This method can comprehensively obtain the comprehensive scores between each container and other containers, and take two containers that can be combined as a new container, and add the new container to the ranks of containers that need to be scored, thereby adding new containers that are completely different from the original containers, and also adding new combinations. This method can iterate containers that were originally large in number and uneven in resource utilization to a state where the number is small and the resource utilization is relatively stable and balanced in each time period.

[0104] Alternatively, see Figure 3 As shown, allocating two containers to the same physical node includes the following steps 301-303.

[0105] Step 301: taking containers that can be combined as container sets, and generating a combination scheme including at least one container set.

[0106] When the containers that can be combined are obtained, these containers can be taken as a container set, and a combination scheme in which each container is included can be generated. The combination scheme can include only one container set, and the rest are individual containers that cannot be combined; the combination scheme can also include multiple container sets, which is not limited in the embodiment of the present invention. Moreover, the container set can include two containers or more containers, which is determined based on actual conditions. For example, taking the example shown in Table 1 above as an example, for the original 8 containers, container 1, container 2, ..., container 8 are scored and it is determined which two containers can be combined. After performing three rounds of cyclic scoring operations, the resulting combination scheme is container (6, 8), container (3, 5), container (1, 7), container (2), and container (4). In the fourth round of cyclic scoring operations, it is determined that the comprehensive score between container (2) and the new container (1, 7) is the highest, and the two can be combined, thereby generating a container set (1, 2, 7) including containers (1), (2), and (7). At this time, the combination scheme is: container (6, 8), container (3, 5), container (1, 2, 7), and container (4). There are three container sets and one uncombined container in this combination scheme, and this combination scheme includes all the original containers.

[0107] Step 302: performing an optimization action on the combination scheme and determining an evaluation value of the optimized combination scheme, wherein the optimization action includes a migration action and / or a replacement action; the optimization action is used to adjust the container set in the combination scheme.

[0108] In the embodiment of the present invention, after obtaining the combination scheme, the combination scheme can be optimized and the optimized evaluation value can be obtained. By performing the optimization action on the scheme, the container set in the combination scheme can be adjusted. The evaluation value can be used to indicate whether the optimized combination scheme is more stable and reasonable in terms of resource usage and container deployment. The optimization action can be a migration action or a replacement action, and can also include both a migration action and a replacement action. This embodiment does not limit the order in which the two actions are performed.

[0109] The evaluation value U can be obtained based on the following formula:

[0110] Among them, the usage of resources r in each physical node is preset, such as the average utilization sequence is P, and T is the number of time periods; M r represents the idle status of resource r in the physical node. Correspondingly, are the idle conditions of CPU resources, memory resources, and network bandwidth resources of the ith physical node, ζ is the weight vector of each resource, and ζ=(μ 1 , μ 2 , μ 3 ); n is the number of physical nodes. Since the total amount of resources required by all current containers is relatively fixed, in this case, based on the above formula, it can be determined that when the usage of CPU resources, memory resources and network bandwidth resources in each physical node is more average, the usage of resources in each time period is more average, and the usage of each container resource is more average, then U is smaller, that is, the evaluation value of the optimized combination scheme is smaller. The embodiment of the present invention selects the optimization action with a smaller evaluation value to reorganize the container to obtain a new container set, so as to generate a combination scheme with a smaller evaluation value.

[0111] Step 303: Determine an optimal combination scheme according to the evaluation value, and allocate containers belonging to the same container set in the optimal combination scheme to the same physical node.

[0112] Among them, a more reasonable combination scheme after the optimization action processing can be determined according to the calculated evaluation value, and the containers contained in the same container set in the combination scheme are allocated to the same physical node for use. For example, if the optimized combination scheme is container set (1, 4), container set (2, 7), container set (3, 5), and container set (6, 8), then container 1 and container 4 in container set (1, 4) can be allocated to the same physical node.

[0113] After obtaining the combination scheme, the embodiment of the present invention continues to perform optimization actions on the combination scheme to obtain the evaluation value of the optimized combination scheme, and selects a combination scheme corresponding to one or more optimization actions that are more reasonable and have better effects by analyzing the evaluation value, and finally allocates the containers corresponding to the container set in the combination scheme to the same physical node. The method performs the optimization and reorganization process to effectively prevent the situation where the local optimization of the combination scheme is determined only by calculating the comprehensive score, and the optimization action can make the final combination scheme more reasonable.

[0114] Optionally, the migration action includes the following steps E1-E2.

[0115] Step E1: extracting containers before the first combination from the container set, taking the container set containing the containers before the first combination as the original container set, and determining the migration scores between the containers before the first combination and other containers or other container sets.

[0116] In the embodiment of the present invention, the container before the first combination is an original single container, which is not a new container determined after executing the cyclic scoring operation. The new container also contains multiple original single containers. The container before the first combination can be extracted from the container set, and the container set of the container before the first combination is extracted as the original container set. Then, the container before the first combination is scored in pairs with other containers or other container sets in the combination scheme to obtain the migration score between the container before the first combination and other containers or other container sets in the combination scheme. The scoring method for obtaining the migration score can be the same as the scoring method used when determining the comprehensive score. For example, the obtained combination scheme is container set (6, 8), container set (3, 5), container set (1, 2, 7), container (4), and container 6 before the first combination is selected from container set (6, 8), and container 6 is sequentially combined with container set (3, 5), container set (1, 2, 7), and container (4) to calculate the migration score. In the embodiment of the present invention, the above-mentioned operation of calculating the migration score can be performed on the containers before the first combination in each container set.

[0117] Step E2: If the maximum score among the multiple migration scores is greater than the comprehensive score of the original container set, the other containers or other container sets corresponding to the maximum score among the multiple migration scores and the container before the first combination are formed into a new container set, and the other containers in the original container set except the container before the first combination are used as new containers or container sets.

[0118] Among them, when the maximum score in the migration score between the container before the first combination and other containers or other container sets in the combination scheme is greater than the comprehensive score of the original container set, it means that it is more reasonable to migrate the container before the first combination to other containers or other container sets corresponding to the maximum score for use. Therefore, the other containers or other container sets that obtain the maximum score in the migration score and the extracted container before the first combination can be used as a new container set; at the same time, the remaining other containers in the original container set are used as new containers or container sets.

[0119] The embodiment of the present invention extracts the container before the first combination from the container set, calculates the migration score between the container before the first combination and other containers or other container sets in the combination scheme, and can determine whether the container before the first combination is better used in the original container set or is better used in other containers or other container sets. This method provides a richer container allocation scheme and increases the probability of improving the original combination scheme.

[0120] Optionally, the replacement action includes the following steps F1-F3.

[0121] Step F1: Replace the containers before the first combination extracted from the first container set with the containers before the first combination extracted from the second container set to obtain a replaced first container set and a replaced second container set.

[0122] Among them, containers before the first combination can be extracted from different container sets for replacement, that is, containers before the first combination are extracted from the first container set, containers before the first combination are extracted from the second container set, the containers before the first combination extracted from the first container set are replaced into the second container set, and the containers before the first combination extracted from the second container set are replaced into the first container set, so as to obtain the replaced first container set and the replaced second container set; the first container set and the second container set are two different container sets in the combination scheme. For example, the first container set is (1, 2) and the second container set is (3, 4), container 1 in the first container set (1, 2) and container 3 in the second container set (3, 4) can be selected to replace each other, so as to obtain the replaced first container set (3, 2) and the replaced second container set (1, 4).

[0123] Step F2: Calculate the comprehensive score of the first container set after replacement and the comprehensive score of the second container set after replacement.

[0124] In the embodiment of the present invention, the comprehensive score is calculated for the replaced first container set, that is, the comprehensive scores between the containers recombined in the replaced first container set are calculated, and the calculation method is the same as the calculation method when judging whether two containers can be combined. Similarly, the comprehensive score can also be calculated for the replaced second container set. For example, the replaced first container set is (3, 2), and the replaced second container set is (1, 4). The comprehensive scores between container 3 and container 2 are calculated respectively, and the comprehensive scores between container 1 and container 4 are calculated respectively.

[0125] Step F3: If the average of the comprehensive scores of the replaced first container set and the replaced second container set is greater than the average of the comprehensive scores of the first container set and the replaced second container set, the replaced first container set and the replaced second container set are used as new container sets.

[0126] Among them, for the obtained comprehensive scores of the replaced first container set and the replaced second container set, an average value of the comprehensive scores of the replaced first container set and the replaced second container set can be further calculated. If the average value is greater than the average value of the comprehensive scores of the first container set and the second container set before replacement, it means that after the two containers before the first combination in the two container sets are replaced by the other container set through the replacement action performed this time, the use effect of the two replaced container sets is better, so the replaced first container set and the replaced second container set can be used as new container sets.

[0127] The embodiment of the present invention extracts two containers before the first combination from two different container sets for replacement, so that it is possible to determine whether the result of the replacement action is a better result by comparing the average value of the comprehensive scores of the two container sets after the replacement with the average value of the comprehensive scores of the two container sets before the replacement, thereby providing a richer container allocation solution.

[0128] The following describes the process of the container allocation method in detail through an embodiment. Figure 4 As shown, the method includes the following steps 401-413.

[0129] Step 401: Determine the historical usage of three resources for each container.

[0130] Among them, the three resources are CPU resources, memory resources, and network bandwidth resources.

[0131] Step 402: Based on the historical usage of each resource, determine the resource utilization matching degree between any two containers.

[0132] Among them, the resource form similarity and resource fluctuation trend similarity between the two containers can be determined according to the method described in the above steps A1-A2, so as to obtain the resource utilization matching degree between the two containers.

[0133] Step 403: Determine the resource utilization conflict degree between any two containers according to the total amount of available resources of the physical node and the combined resource demand between the two containers.

[0134] The resource utilization conflict degree may be obtained according to the method described in the above steps B1-B2, which will not be described in detail here.

[0135] Step 404: Determine the weight vectors of the three resources.

[0136] The weight vector may be determined according to the method described in the above step C1, which will not be described in detail here.

[0137] Step 405: Based on the resource utilization matching degree, resource utilization conflict degree and weight vector between the two containers, the two containers are scored to obtain a comprehensive score of the two containers.

[0138] The comprehensive score between the two containers may be calculated according to the method described in the above step C2, which will not be described in detail here.

[0139] Step 406: Determine whether there is a positive number among the multiple comprehensive scores. If so, execute step 407; then execute step 409.

[0140] Step 407: According to the highest score among the multiple comprehensive scores, determine whether two containers corresponding to the highest score can be combined.

[0141] Step 408: The two containers are used as a new container, and steps 401-408 are executed in a loop until there are no positive numbers in all the comprehensive scores.

[0142] In the process of looping through steps 401 - 408 , it is only necessary to determine the historical usage of the new container and the comprehensive score between the new container and other containers.

[0143] Step 409: The containers that can be combined are taken as a container set, and a combination scheme including the container set is generated.

[0144] Step 410: Perform a migration action on the combination scheme to obtain a migrated combination scheme, and calculate an evaluation value of the migrated combination scheme.

[0145] Step 411: Perform a replacement action on the combination scheme to obtain a replaced combination scheme, and calculate an evaluation value of the replaced combination scheme.

[0146] Step 412: Determine the optimal combination solution based on the evaluation value of the combination solution after migration and the evaluation value of the combination solution after replacement.

[0147] Step 413: Allocate containers belonging to the same container set in the optimal combination solution to the same physical node.

[0148] The present invention also provides a container dispensing device, see Figure 5 As shown, it includes: a determination module 51, a judgment module 52, and a processing module 53.

[0149] The determination module 51 is used to determine the historical usage of at least one resource of multiple containers, where the resource includes CPU resources, memory resources or network bandwidth resources, and the historical usage includes the usage of the resource by the container in multiple time periods within a preset time period.

[0150] The determination module 52 is used to determine whether the two containers can be combined according to the historical usage of the resources of the two containers.

[0151] The processing module 53 is configured to allocate the two containers to the same physical node if the two containers can be combined.

[0152] Optionally, the judgment module 52 includes: a first determination unit, a second determination unit, a calculation unit, and a judgment unit.

[0153] The first determining unit is used to determine a resource utilization matching degree between the two containers, where the resource utilization matching degree indicates a matching degree of the resources between the two containers in a time dimension.

[0154] The second determining unit is used to determine a resource utilization conflict degree between the two containers, where the resource utilization conflict degree indicates a conflict degree of the resources between the two containers in a time dimension.

[0155] The calculation unit is used to determine a comprehensive score of the two containers according to the resource utilization matching degree and the resource utilization conflict degree of the two containers, wherein the comprehensive score indicates a possibility that the two containers can be combined.

[0156] The judging unit is used to judge whether the two containers can be combined according to the comprehensive scores of the two containers.

[0157] Optionally, the first determining unit includes: a first determining subunit and a first generating subunit.

[0158] The first determination subunit is used to determine the resource form similarity between the two containers, and to determine the resource fluctuation trend similarity between the two containers; the resource form similarity between the two containers is used to measure the similarity of the numerical value and / or shape of the historical usage of the resources between the two containers, and the resource fluctuation trend similarity between the two containers is used to measure the similarity of the fluctuation trend of the historical usage of the resources between the two containers.

[0159] The first generating subunit is used to obtain the resource utilization matching degree according to the resource form similarity and resource fluctuation trend similarity between the two containers.

[0160] Optionally, the resource shape similarity between two containers is: Wherein, r represents the resource; i and j represent the two containers; Indicates the historical usage of the resource r in the container i; Indicates the historical usage of the resource r in the container j; represents the resource form similarity between the two containers; T represents the number of time periods included in the preset time period; represents the Euclidean distance between the historical usages of the two containers; represents the Manhattan distance between the historical usages of the two containers; represents the absolute value of the sum of the differences in the historical usage of the two containers at different time periods; the similarity of the resource fluctuation trend between the two containers is: in, represents the similarity of resource fluctuation trends between the two containers; t represents the time period; represents the historical usage of container i in time period t in resource r; based on the formula The resource utilization matching degree between container i and container j is determined.

[0161] Optionally, the second determining unit includes: a second determining subunit and a second generating subunit.

[0162] The second determination subunit is used to determine the total amount of available resources of the physical node and the combined resource demand between the two containers; the total amount of available resources is the amount of the resources that can be used by the two containers in the total amount of the resources of the physical node, and the combined resource demand is the sum of the historical usage of the resources of the two containers;

[0163] The second generating subunit is used to determine the resource utilization conflict degree of the two containers as RUC (R i, R j ),and in, Indicates the historical usage of the resource r in the container i; represents the historical usage of the resource r in the container j, represents the combined resource demand, S represents the preset conflict threshold; N represents the number of conflicts within the preset time period; Represents the Euclidean distance between the combined resource demand and the conflict threshold.

[0164] Optionally, if the average value of the combined resource demand between the two containers is greater than the total amount of available resources of the physical node, the resource utilization conflict degree between the two containers is set to be greater than a preset value.

[0165] Optionally, the calculation unit includes: a weight vector calculation subunit and a scoring subunit.

[0166] The weight vector calculation subunit is used to determine the weight vector of the resources between the two containers according to the importance of the multiple resources between the two containers.

[0167] The scoring subunit is used to score the two containers based on the resource utilization matching degree, the resource utilization conflict degree and the weight vector of the two containers to obtain the comprehensive score of the two containers. The comprehensive score of container i and container j is score ij , and score ij =(C RUM ij ,M RUM ij ,B RUM ij )·ζ×γ-(C RUCij ,M RUCij ,B RUCij )·ζ×(1-γ); where C RUM ij ,M RUM ij ,B RUM ij respectively represent the resource utilization matching degree of the CPU resource, the memory resource, and the network bandwidth resource between the container i and the container j; C RUCij ,M RUCij ,B RUCij Respectively represent the resource utilization conflict degree of the CPU resources, the memory resources, and the network bandwidth resources between the container i and the container j; ζ represents the weight vector; γ represents the preset parameter; · represents the inner product operation between vectors.

[0168] Optionally, the judging unit is configured to determine that the two containers can be combined when the comprehensive score of the two containers is the highest score among a plurality of comprehensive scores obtained by scoring each container with the other containers.

[0169] Optionally, the processing module 53 further includes: a cyclic scoring unit

[0170] The circular scoring unit is used to treat the two containers as a new container and perform circular scoring operations on the multiple containers until a preset condition is met. The circular scoring operation includes: scoring the multiple containers in pairs to obtain multiple comprehensive scores, determining that the two containers corresponding to the highest scores in the multiple comprehensive scores can be combined, and treating the two containers corresponding to the highest scores as a new container; the preset conditions include that the total number of the containers is equal to the number of the physical nodes, or that each of the comprehensive scores is a non-positive number.

[0171] Optionally, the processing module 53 includes: a generating unit, an optimizing unit, and an allocating unit.

[0172] The generating unit is used to take the containers that can be combined as container sets, and generate a combination scheme including at least one of the container sets.

[0173] The optimization unit is used to perform an optimization action on the combination scheme and determine an evaluation value of the optimized combination scheme, wherein the optimization action includes a migration action and / or a replacement action; and the optimization action is used to adjust the container set in the combination scheme.

[0174] The allocation unit is used to determine an optimal combination scheme according to the evaluation value, and allocate containers belonging to the same container set in the optimal combination scheme to the same physical node.

[0175] Optionally, the migration action includes: extracting containers before the first combination from the container set, taking the container set containing the containers before the first combination as the original container set, and determining migration scores between the containers before the first combination and other containers or other container sets; if the maximum score among the multiple migration scores is greater than the comprehensive score of the original container set, forming a new container set with other containers or other container sets corresponding to the maximum score among the multiple migration scores and the containers before the first combination, and taking other containers in the original container set except the containers before the first combination as new containers or container sets.

[0176] Optionally, the replacement action includes: replacing the container before the first combination extracted from the first container set with the container before the first combination extracted from the second container set to obtain the replaced first container set and the replaced second container set; calculating the comprehensive score of the replaced first container set and the comprehensive score of the replaced second container set; if the average of the comprehensive score of the replaced first container set and the comprehensive score of the replaced second container set is greater than the average of the comprehensive score of the first container set before the replacement and the comprehensive score of the second container set before the replacement, then using the replaced first container set and the replaced second container set as the new container set.

[0177] The container allocation device provided in the embodiment of the present invention takes into account the characteristics that the historical usage of different types of container resources has time sequence differences, extracts the historical usage corresponding to multiple time periods, and reallocates multiple containers under the physical node by determining the historical usage of one or more resources in different containers and judging whether different containers can be combined, so as to achieve balanced utilization of one or more resources in each time period of the physical node, reduce the cluster load, and thus achieve the purpose of avoiding waste of resources in the physical node.

[0178] In addition, an embodiment of the present invention further provides an electronic device, including a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor. The transceiver, the memory, and the processor are respectively connected via a bus. When the computer program is executed by the processor, each process of the above-mentioned container allocation method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

[0179] For details, see Figure 6 As shown, an embodiment of the present invention further provides an electronic device, which includes a bus 1110 , a processor 1120 , a transceiver 1130 , a bus interface 1140 , a memory 1150 and a user interface 1160 .

[0180] In the embodiment of the present invention, the electronic device further includes: a computer program stored in the memory 1150 and executable on the processor 1120, and when the computer program is executed by the processor 1120, each process of the above container allocating method embodiment is implemented.

[0181] The transceiver 1130 is configured to receive and send data under the control of the processor 1120 .

[0182] In an embodiment of the present invention, the bus architecture (represented by bus 1110), bus 1110 may include any number of interconnected buses and bridges, and bus 1110 connects various circuits including one or more processors represented by processor 1120 and a memory represented by memory 1150.

[0183] Bus 1110 represents one or more of any of several types of bus structures, including a memory bus and memory controller, a peripheral bus, an Accelerate Graphical Port (AGP), a processor, or a local bus using any of a variety of bus architectures. By way of example and not limitation, such architectures include: Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA), Peripheral Component Interconnect (PCI) bus.

[0184] The processor 1120 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method embodiment may be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processors include: a general-purpose processor, a central processing unit (CPU), a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a complex programmable logic device (CPLD), a programmable logic array (PLA), a microcontroller unit (MCU) or other programmable logic devices, discrete gates, transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention may be implemented or executed. For example, the processor may be a single-core processor or a multi-core processor, and the processor may be integrated into a single chip or located in multiple different chips.

[0185] Processor 1120 can be a microprocessor or any conventional processor. The method steps disclosed in conjunction with the embodiments of the present invention can be directly executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a readable storage medium known in the art, such as a random access memory (RAM), a flash memory (FlashMemory), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a register, etc. The readable storage medium is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in conjunction with its hardware.

[0186] The bus 1110 may also connect various other circuits such as peripheral devices, voltage regulators or power management circuits, and the bus interface 1140 provides an interface between the bus 1110 and the transceiver 1130, which are well known in the art. Therefore, the embodiments of the present invention will not be further described.

[0187] The transceiver 1130 may be one element or multiple elements, such as multiple receivers and transmitters, and provides a unit for communicating with various other devices on a transmission medium. For example, the transceiver 1130 receives external data from other devices, and the transceiver 1130 is used to send data processed by the processor 1120 to other devices. Depending on the nature of the computer system, a user interface 1160 may also be provided, such as a touch screen, a physical keyboard, a display, a mouse, a speaker, a microphone, a trackball, a joystick, and a stylus.

[0188] It should be understood that in an embodiment of the present invention, the memory 1150 may further include a memory remotely arranged relative to the processor 1120, and these remotely arranged memories may be connected to the server through a network. One or more parts of the above-mentioned network may be an ad hoc network, an intranet, an extranet, a virtual private network (VPN), a local area network (LAN), a wireless local area network (WLAN), a wide area network (WAN), a wireless wide area network (WWAN), a metropolitan area network (MAN), the Internet, a public switched telephone network (PSTN), a plain old telephone service network (POTS), a cellular telephone network, a wireless network, a wireless fidelity (Wi-Fi) network, and a combination of two or more of the above-mentioned networks. For example, the cellular telephone network and the wireless network can be a Global System for Mobile Communications (GSM) system, a Code Division Multiple Access (CDMA) system, a Worldwide Interoperability for Microwave Access (WiMAX) system, a General Packet Radio Service (GPRS) system, a Wideband Code Division Multiple Access (WCDMA) system, a Long Term Evolution (LTE) system, a LTE Frequency Division Duplex (FDD) system, a LTE Time Division Duplex (TDD) system, an Advanced Long Term Evolution (LTE-A) system, a Universal Mobile Telecommunications (UMTS) system, an Enhanced Mobile Broadband (Enhance Mobile Broadband, eMBB) system, a massive Machine Type of Communication (mMTC) system, an Ultra-Reliable Low Latency Communications (UltraReliable Low Latency Communications, uRLLC) system, etc.

[0189] It should be understood that the memory 1150 in the embodiment of the present invention may be a volatile memory or a non-volatile memory, or may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory includes: a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory.

[0190] Volatile memory includes: Random Access Memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as: Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), Synchronous Link Dynamic Random Access Memory (SLDRAM) and Direct Rambus RAM (DRRAM). The memory 1150 of the electronic device described in the embodiment of the present invention includes but is not limited to the above and any other suitable types of memory.

[0191] In the embodiment of the present invention, the memory 1150 stores the following elements of the operating system 1151 and the application program 1152: executable modules, data structures, or subsets thereof, or extended sets thereof.

[0192] Specifically, the operating system 1151 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 1152 includes various applications, such as a media player (Media Player) and a browser (Browser), which are used to implement various application services. The program for implementing the method of the embodiment of the present invention may be included in the application 1152. The application 1152 includes applets, objects, components, logic, data structures, and other computer system executable instructions that perform specific tasks or implement specific abstract data types.

[0193] In addition, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned container allocation method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0194] Computer readable storage media include: permanent and non-permanent, removable and non-removable media, which are tangible devices that can retain and store instructions for use by instruction execution devices. Computer readable storage media include: electronic storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, and any suitable combination of the above. Computer readable storage media include: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), non-volatile random access memory (NVRAM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassette storage, magnetic tape disk storage or other magnetic storage devices, memory sticks, mechanical encoding devices (such as punched cards or raised structures in grooves with instructions recorded thereon) or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined in the embodiments of the present invention, computer-readable storage media do not include temporary signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (such as light pulses passing through fiber optic cables), or electrical signals transmitted through wires.

[0195] In the several embodiments provided in the present application, it should be understood that the disclosed devices, electronic devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or it can be an electrical, mechanical or other form of connection.

[0196] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, and may be located in one location or distributed over multiple network units. Some or all of the units may be selected according to actual needs to solve the problem to be solved by the embodiments of the present invention.

[0197] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0198] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention is essentially or part of the contribution to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (including: a personal computer, a server, a data center or other network device) to perform all or part of the steps of the method described in each embodiment of the present invention. The above-mentioned storage medium includes various media that can store program codes as listed above.

[0199] In the description of the embodiments of the present invention, those skilled in the art should know that the embodiments of the present invention can be implemented as methods, devices, electronic devices and computer-readable storage media. Therefore, the embodiments of the present invention can be specifically implemented in the following forms: complete hardware, complete software (including firmware, resident software, microcode, etc.), a combination of hardware and software. In addition, in some embodiments, the embodiments of the present invention can also be implemented in the form of a computer program product in one or more computer-readable storage media, and the computer-readable storage medium contains computer program code.

[0200] The above-mentioned computer-readable storage medium may adopt any combination of one or more computer-readable storage media. Computer-readable storage media include: electrical, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or devices, or any combination of the above. More specific examples of computer-readable storage media include: portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM), flash memories, optical fibers, compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices or any combination of the above. In an embodiment of the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device, or device.

[0201] The computer program code contained in the above-mentioned computer-readable storage medium can be transmitted using any appropriate medium, including: wireless, wire, optical cable, radio frequency (RF) or any suitable combination thereof.

[0202] The computer program code for performing the operation of the embodiments of the present invention can be written in assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, integrated circuit configuration data, or in one or more programming languages ​​or a combination thereof, wherein the programming language includes an object-oriented programming language, such as Java, Smalltalk, C++, and also includes a conventional procedural programming language, such as C language or a similar programming language. The computer program code can be executed completely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer, partially on a remote computer, and completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer or to an external computer through any type of network, including a local area network (LAN) or a wide area network (WAN).

[0203] The embodiments of the present invention describe the provided methods, devices, and electronic devices through flowcharts and / or block diagrams.

[0204] It should be understood that each box in the flowchart and / or block diagram and the combination of boxes in the flowchart and / or block diagram can be implemented by computer-readable program instructions. These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine, and these computer-readable program instructions are executed by a computer or other programmable data processing device to produce a device that implements the functions / operations specified by the boxes in the flowchart and / or block diagram.

[0205] These computer-readable program instructions may also be stored in a computer-readable storage medium that enables a computer or other programmable data processing device to work in a specific manner. In this way, the instructions stored in the computer-readable storage medium produce an instruction device product including functions / operations specified in the blocks in the flowchart and / or block diagram.

[0206] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device, so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby enabling the instructions executed on the computer or other programmable data processing apparatus to provide a process for implementing the functions / operations specified in the blocks in the flowchart and / or block diagram.

[0207] The above is only a specific implementation of the embodiment of the present invention, but the protection scope of the embodiment of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the embodiment of the present invention, which should be included in the protection scope of the embodiment of the present invention. Therefore, the protection scope of the embodiment of the present invention should be based on the protection scope of the claims.

Claims

1. A container dispensing method, characterized in that: include: Determine historical usage of at least one resource of the plurality of containers, the resource comprising a CPU resource, a memory resource, or a network bandwidth resource, the historical usage comprising usage of the resource by the container in a plurality of time periods within a preset time period; Determining whether the two containers can be combined according to historical usage of the resources of the two containers; If the two containers can be combined, allocating the two containers to the same physical node; The determining, based on historical usage of the resources of the two containers, whether the two containers can be combined includes: Determine a resource utilization matching degree between the two containers, where the resource utilization matching degree indicates a matching degree of the resources between the two containers in a time dimension; Determining a resource utilization conflict degree between the two containers, where the resource utilization conflict degree indicates a conflict degree of the resources between the two containers in a time dimension; Determining, according to the resource utilization matching degree and the resource utilization conflict degree of the two containers, a comprehensive score of the two containers, wherein the comprehensive score indicates a possibility that the two containers can be combined; Determining whether the two containers can be combined according to the comprehensive scores of the two containers; Determining the resource utilization conflict degree between the two containers includes: Determine the total amount of available resources of the physical node and the combined resource demand between the two containers; the total amount of available resources is the amount of the resources that can be used by the two containers in the total amount of the resources of the physical node, and the combined resource demand is the sum of the historical usage of the resources of the two containers; Determine the resource utilization conflict degree of the two containers as RUC(R i , R j ),and in, Indicates the historical usage of the resource r in the container i; represents the historical usage of the resource r in the container j, represents the combined resource demand, S represents the preset conflict threshold; N represents the number of conflicts within the preset time period; Represents the Euclidean distance between the combined resource demand and the conflict threshold.

2. The method according to claim 1, characterized in that Determining the resource utilization matching degree between the two containers includes: Determine the resource form similarity between the two containers, and determine the resource fluctuation trend similarity between the two containers; the resource form similarity between the two containers is used to measure the similarity of the numerical value and / or shape of the historical usage of the resources between the two containers, and the resource fluctuation trend similarity between the two containers is used to measure the similarity of the fluctuation trend of the historical usage of the resources between the two containers; The resource utilization matching degree is obtained according to the resource form similarity and resource fluctuation trend similarity between the two containers.

3. The method according to claim 2, characterized in that The resource form similarity between the two containers is: Wherein, r represents the resource; i and j represent the two containers; Indicates the historical usage of the resource r in the container i; Indicates the historical usage of the resource r in the container j; represents the resource form similarity between the two containers; T represents the number of time periods included in the preset time period; represents the Euclidean distance between the historical usages of the two containers; represents the Manhattan distance between the historical usages of the two containers; represents the absolute value of the sum of the differences in the historical usage of the two containers at different time periods; The similarity of resource fluctuation trends between the two containers is: in, represents the similarity of resource fluctuation trends between the two containers; t represents the time period; Indicates the historical usage of container i in time period t in which resource r was used; Based on the formula The resource utilization matching degree between container i and container j is determined.

4. The method according to claim 1, characterized in that If the average value of the combined resource requirements between the two containers is greater than the total available resources of the physical node, the resource utilization conflict degree between the two containers is set to be greater than a preset value.

5. The method according to claim 1, characterized in that The determining, according to the resource utilization matching degree and the resource utilization conflict degree of the two containers, a comprehensive score of the two containers includes: Determining a weight vector of the resources between the two containers according to the importance of the multiple resources between the two containers; Based on the resource utilization matching degree, the resource utilization conflict degree and the weight vector of the two containers, the two containers are scored to obtain a comprehensive score of the two containers. The comprehensive score of container i and container j is score ij , and score ij = (C RUM ij , M RUM ij , B RUM ij )·ζ×γ - (C RUCij , M RUCij , B RUCij )·ζ×(1 - γ); Among them, C RUM ij , M RUM ij , B RUM ij respectively represent the resource utilization matching degree of the CPU resource, the memory resource, and the network bandwidth resource between the container i and the container j; C RUCij , M RUCij , B RUCij Respectively represent the resource utilization conflict degree of the CPU resources, the memory resources, and the network bandwidth resources between the container i and the container j; ζ represents the weight vector; γ represents the preset parameter; · represents the inner product operation between vectors.

6. The method according to claim 1, characterized in that The judging whether the two containers can be combined according to the comprehensive scores of the two containers comprises: determining that the two containers can be combined when the comprehensive score of the two containers is the highest score among a plurality of comprehensive scores obtained by scoring each container with other containers.

7. The method according to any one of claims 1 to 6, characterized in that: In the case where the two containers can be combined, the method further comprises: The two containers are regarded as a new container, and a cyclic scoring operation is performed on the multiple containers until a preset condition is met; The cyclic scoring operation includes: scoring the multiple containers in pairs to obtain multiple comprehensive scores, determining that the two containers corresponding to the highest scores among the multiple comprehensive scores can be combined, and using the two containers corresponding to the highest scores as a new container; The preset condition includes that the total number of the containers is equal to the number of the physical nodes, or each of the comprehensive scores is a non-positive number.

8. The method according to any one of claims 1 to 6, characterized in that: The allocating the two containers to the same physical node comprises: Taking the containers that can be combined as container sets, and generating a combination scheme including at least one of the container sets; Performing an optimization action on the combination scheme and determining an evaluation value of the optimized combination scheme, wherein the optimization action includes a migration action and / or a replacement action; the optimization action is used to adjust a container set in the combination scheme; An optimal combination scheme is determined according to the evaluation value, and containers belonging to the same container set in the optimal combination scheme are allocated to the same physical node.

9. The method according to claim 8, characterized in that The migration action includes: Extracting the container before the first combination from the container set, taking the container set containing the container before the first combination as the original container set, and determining the migration score between the container before the first combination and other containers or other container sets; If the maximum score among the multiple migration scores is greater than the comprehensive score of the original container set, other containers or other container sets corresponding to the maximum score among the multiple migration scores and the containers before the first combination are formed into a new container set, and other containers in the original container set except the containers before the first combination are used as new containers or container sets.

10. The method according to claim 8, characterized in that The replacement action includes: Replace the container before the first combination extracted from the first container set with the container before the first combination extracted from the second container set to obtain a replaced first container set and a replaced second container set; Calculate the comprehensive score of the first container set after replacement and the comprehensive score of the second container set after replacement; If the average of the comprehensive scores of the replaced first container set and the replaced second container set is greater than the average of the comprehensive scores of the first container set and the replaced second container set, the replaced first container set and the replaced second container set are used as new container sets.

11. A container dispensing device, characterized in that: include: Determination module, judgment module and processing module; The determination module is used to determine the historical usage of at least one resource of the multiple containers, the resource including CPU resources, memory resources or network bandwidth resources, and the historical usage includes the usage of the resource by the container in multiple time periods within a preset time period; The judging module is used to judge whether the two containers can be combined according to the historical usage of the resources of the two containers; The judging module is used to judge whether the two containers can be combined according to the historical usage of the resources of the two containers, including: Determine a resource utilization matching degree between the two containers, where the resource utilization matching degree indicates a matching degree of the resources between the two containers in a time dimension; Determining a resource utilization conflict degree between the two containers, where the resource utilization conflict degree indicates a conflict degree of the resources between the two containers in a time dimension; Determining, according to the resource utilization matching degree and the resource utilization conflict degree of the two containers, a comprehensive score of the two containers, wherein the comprehensive score indicates a possibility that the two containers can be combined; Determining whether the two containers can be combined according to the comprehensive scores of the two containers; The judgment module is used to determine the resource utilization conflict degree between the two containers, including: Determine the total amount of available resources of the physical node and the combined resource demand between the two containers; the total amount of available resources is the amount of the resources that can be used by the two containers in the total amount of the resources of the physical node, and the combined resource demand is the sum of the historical usage of the resources of the two containers; Determine the resource utilization conflict degree of the two containers as RUC(R i , R j ),and in, Indicates the historical usage of the resource r in the container i; represents the historical usage of the resource r in the container j, represents the combined resource demand, S represents the preset conflict threshold; N represents the number of conflicts within the preset time period; represents the Euclidean distance between the combined resource demand and the conflict threshold; The processing module is configured to allocate the two containers to the same physical node if the two containers can be combined.

12. An electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, wherein: When the computer program is executed by the processor, the steps of the container dispensing method according to any one of claims 1 to 10 are implemented.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the container dispensing method according to any one of claims 1 to 10 are implemented.

Citation Information

Patent Citations

  • Cluster inner container scheduling method and device, storage medium and electronic equipment

    CN112540844A