Method, device and electronic equipment for deploying a container
By calculating the communication latency and resource utilization between the container and the target cluster, the container deployment process is optimized, solving the problem of low container deployment accuracy in existing technologies and achieving more efficient resource utilization and reduced response time.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-23
- Publication Date
- 2026-03-20
AI Technical Summary
Existing container deployment methods fail to effectively consider the impact of communication latency between containers, resulting in uneven resource utilization and low deployment accuracy. This is especially true when business fluctuations occur, such as in mobile banking, where the normal operation of containers cannot be guaranteed.
By acquiring the basic data of the container to be deployed, calculating the communication latency between it and the containers and data sources in the target cluster, and combining this with resource utilization, the target node is determined for deployment, thus optimizing the container deployment process.
It improved the accuracy of container deployment, optimized resource utilization, reduced response time, and enhanced user experience.
Smart Images

Figure CN115454574B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of cloud computing, in particular to a container deployment method and device and electronic equipment. BACKGROUND
[0002] With the development of cloud computing and container technology, the advantages of using container technology to effectively improve deployment efficiency and simplify deployment process are highlighted. Mobile banking also performs corresponding splitting and uses containerization for deployment. Due to the fluctuating changes in the use of mobile banking due to business needs and other reasons, such as the issuance of national debt, the reservation of commemorative coins, and the like, there will be a situation of user surge in a short period of time. Therefore, container expansion and scheduling have become a necessary means to ensure the normal operation of each function.
[0003] At present, the container scheduling method of the prior art mostly only considers the use of a single basic resource as the scheduling basis, but this will cause uneven resource usage on a single server, such as excessively high CPU utilization and excessively low memory utilization, thereby causing resource waste.
[0004] In addition, the response time of each container of mobile banking in the process of providing services to the outside is affected by the service communication time of the upstream and downstream services and the time generated by the data transmission between the data sources dependent thereon. However, the container deployment in the prior art does not consider the influence of communication delay, resulting in the problem of low container deployment accuracy.
[0005] In view of the above problems, no effective solution has been proposed so far. SUMMARY
[0006] The embodiments of the present application provide a container deployment method, device and electronic equipment to at least solve the technical problem of low container deployment accuracy in the prior art.
[0007] According to an aspect of the embodiments of the present application, a container deployment method is provided, comprising: obtaining basic data of a to-be-deployed container, wherein the basic data of the to-be-deployed container represents dependency relationship information between the to-be-deployed container and a container in a target cluster, and the target cluster is a cluster where a target node corresponding to the to-be-deployed container is located; when it is determined according to the basic data that the to-be-deployed container has a dependency relationship with the container in the target cluster, determining a communication delay time between the to-be-deployed container and at least one target container in a plurality of first nodes, wherein the target container is a container having a dependency relationship with the to-be-deployed container; calculating the sum of the communication delay times between the to-be-deployed container and at least one target container in each first node to obtain a plurality of first delay times, wherein the first delay time is the delay time of each first node; determining the target node from the plurality of first nodes based on the plurality of first delay times, and deploying the to-be-deployed container to the target node.
[0008] Further, the method further comprises: determining dependency relationship information between the to-be-deployed container and the data sources stored by the containers in the target cluster based on the basic data of the to-be-deployed container; detecting whether there is a dependency relationship between the to-be-deployed container and the data sources stored by the containers in the target cluster; when there is a dependency relationship between the to-be-deployed container and the data sources stored by the containers in the target cluster, determining the communication delay time between the to-be-deployed container and the containers of each stored data source; calculating the sum of the communication delay time between the to-be-deployed container and the nodes where the containers of each stored data source are located, to obtain a plurality of second delay times; calculating the sum of the first delay time and the second delay time of each node to obtain a plurality of target delay times; and determining the target node from the plurality of first nodes based on the plurality of target delay times.
[0009] Further, the method further comprises: before determining the target node from the plurality of first nodes based on the plurality of first delay times, obtaining resource data of the target cluster of the to-be-deployed container, wherein the resource data at least includes CPU resource data and memory resource data of the target cluster; and processing the resource data of the target cluster to obtain a first data set.
[0010] Further, the method further comprises: when the resource data of the target cluster is the CPU resource data, calculating the ratio between the occupied CPU resource and the total CPU resource of each node to obtain the CPU resource utilization rate of each node; when the resource data of the target cluster is the memory resource data, calculating the ratio between the occupied memory resource and the total memory resource of each node to obtain the memory resource utilization rate of each node; and calculating the difference between the CPU resource utilization rate of each node and the memory resource utilization rate corresponding to the CPU resource utilization rate of each node to obtain a plurality of target resource utilization rates, wherein the first data set at least includes the CPU resource utilization rate of each node, the memory resource utilization rate of each node, and the plurality of target resource utilization rates.
[0011] Further, the method further comprises: after obtaining the plurality of target resource utilization rates, detecting whether the target resource utilization rate of each node is less than a preset threshold; and when the target resource utilization rate is less than the preset threshold, determining a plurality of candidate nodes.
[0012] Further, the container deployment method further includes: after the plurality of candidate nodes are determined, determining a second data set corresponding to the plurality of candidate nodes based on the plurality of candidate nodes, wherein the second data set at least includes CPU resource utilization corresponding to the plurality of candidate nodes, memory resource utilization corresponding to the plurality of candidate nodes, target resource utilization corresponding to the plurality of candidate nodes, and target delay time corresponding to the plurality of candidate nodes; performing mean value processing on data in the second data set to obtain a target data set; and performing weighted calculation on data in the target data set to obtain a weight corresponding to the plurality of candidate nodes.
[0013] Further, the container deployment method further includes: after the weight corresponding to the plurality of candidate nodes is obtained, sorting the plurality of candidate nodes according to the weight corresponding to the plurality of candidate nodes to obtain a sorting result; and determining a target node from the plurality of candidate nodes based on the sorting result.
[0014] According to another aspect of the embodiments of the present application, a container deployment apparatus is also provided, which includes: an obtaining module configured to obtain basic data of a container to be deployed, wherein the basic data of the container to be deployed represents dependency relationship information between the container to be deployed and a container in a target cluster, and the target cluster is a cluster in which a target node corresponding to the container to be deployed is located; a determining module configured to, when it is determined according to the basic data that the container to be deployed has a dependency relationship with the container in the target cluster, determine a communication delay time between the container to be deployed and at least one target container in a plurality of first nodes, wherein the target container is a container having a dependency relationship with the container to be deployed; a calculating module configured to calculate a sum of the communication delay time between the container to be deployed and at least one target container in each first node to obtain a plurality of first delay times, wherein the first delay time is a delay time of each first node; and a processing module configured to determine a target node from the plurality of first nodes based on the plurality of first delay times, and deploy the container to be deployed on the target node.
[0015] According to another aspect of the embodiments of the present application, a computer readable storage medium is also provided, and the computer readable storage medium stores a computer program, wherein the computer program is configured to execute the container deployment method when the computer program is run.
[0016] According to another aspect of the embodiments of the present application, an electronic device is also provided, which includes one or more processors, and a memory configured to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement a program configured to execute the container deployment method when the program is run.
[0017] According to another aspect of the embodiments of the present application, there is also provided a computer program product comprising computer programs / instructions which, when executed by a processor, implement the container deployment method described above.
[0018] In the embodiments of the present application, the container deployment method comprises the following steps: obtaining basic data of a to-be-deployed container, wherein the basic data of the to-be-deployed container represents dependency relationship information between the to-be-deployed container and containers in a target cluster; determining, according to the basic data, that the to-be-deployed container has a dependency relationship with at least one target container in a plurality of first nodes, wherein the target container is a container having a dependency relationship with the to-be-deployed container; calculating a communication delay time between the to-be-deployed container and each target container in the plurality of first nodes; calculating a sum of the communication delay times between the to-be-deployed container and each target container in the plurality of first nodes, to obtain a plurality of first delay times, wherein each first delay time is a delay time of each first node; determining a target node from the plurality of first nodes based on the plurality of first delay times, and deploying the to-be-deployed container on the target node.
[0019] In the above process, by calculating the communication delay time between the to-be-deployed container and the target container, the node with the lowest communication delay time is determined as the target node based on the delay factor caused by the dependency relationship between the containers, thereby reducing the response time of the container resources and improving the accuracy of the container deployment.
[0020] Therefore, the scheme provided in the present application achieves the purpose of determining a target node from a plurality of first nodes based on a communication delay time between a to-be-deployed container and a container having a dependency relationship with the to-be-deployed container, and deploying the to-be-deployed container on the target node, thereby achieving the technical effect of improving the accuracy of container deployment, and further solving the technical problem of low accuracy of container deployment in the prior art. BRIEF DESCRIPTION OF DRAWINGS
[0021] The accompanying drawings, which are included to provide a further understanding of the present application and constitute a part of this application, illustrate certain illustrative embodiments of the present application and together with the description serve to explain the present application. In the drawings:
[0022] Figure 1 is a schematic diagram of an optional container deployment method according to an embodiment of the present application;
[0023] Figure 2 is a flowchart of an optional container deployment method according to an embodiment of the present application;
[0024] Figure 3 An optional schematic view of a deployment device of a container according to an embodiment of the present application;
[0025] Figure 4 An optional schematic view of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to make the personnel in the technical field better understand the present application scheme, the technical scheme in the embodiment of the present application will be described clearly and completely below in combination with the drawings in the embodiment of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by the person skilled in the art without creative labor should belong to the scope of protection of the present application.
[0027] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0028] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, analyzed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties. For example, an interface is provided between the system and the relevant user or institution. Before obtaining the relevant information, the interface needs to send a request to the aforementioned user or institution, and after receiving the consent information fed back by the aforementioned user or institution, the relevant information is obtained.
[0029] Embodiment 1
[0030] According to an embodiment of the present application, an embodiment of a deployment method of a container is provided. It should be noted that the steps shown in the flowchart of the drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.
[0031] Figure 1 is a schematic diagram of a method for deploying a container according to an embodiment of the present application, as Figure 1 shown, the method comprises the following steps:
[0032] In step S101, the basic data of the container to be deployed is obtained, wherein the basic data of the container to be deployed represents the dependency relationship information between the container to be deployed and the containers in the target cluster, and the target cluster is the cluster where the target node corresponding to the container to be deployed is located.
[0033] In step S101, the basic data of the container to be deployed can be obtained based on a system, a server, an electronic device or the like. In this embodiment, the basic data of the container to be deployed can be obtained by the system.
[0034] Optionally, the basic data of the container to be deployed at least includes the dependency relationship information between the container to be deployed and the containers in the target cluster, and the dependency relationship information between the container to be deployed and the data source stored in the containers in the target cluster. For example, as Figure 2 shown, during the operation of the system, the system extracts the container dependency relationship information, the container and data source dependency relationship information, the container deployment location information in the target cluster, and the resource usage of the container, such as CPU resource, memory resource, disk I / O, network communication state information, by monitoring the data collection service of the system.
[0035] In step S102, when it is determined according to the basic data that the container to be deployed has a dependency relationship with the containers in the target cluster, the communication delay time between the container to be deployed and at least one target container in the plurality of first nodes is determined, wherein the target container is a container having a dependency relationship with the container to be deployed.
[0036] In step S103, the sum of the communication delay time between the container to be deployed and at least one target container in each first node is calculated to obtain a plurality of first delay times, wherein the first delay time is the delay time of each first node.
[0037] In steps S102-S103, the system determines the dependency relationship between the container to be deployed and the containers in the target cluster through the basic data, determines the first node where each target container is located through the container dependency relationship, and then determines the communication delay time between the container to be deployed and each target container.
[0038] Further, the system obtains the first delay time corresponding to each first node by calculating the sum of the communication delay times of all target containers in each first node.
[0039] Optionally, taking the deployment of the container to be deployed i to the target node k as an example, the specific calculation method of the response delay of the container is as follows:
[0040]
[0041] wherein t container is the first latency time, m is the number of containers in the target cluster, D is the dependency matrix between n x n containers, n is the total number of nodes, D i,j has a value of 0 or 1. D i,j has a value of 1, indicating that container i has a dependency relationship with container j, D i,j has a value of 0, indicating that container i has no dependency relationship with container j. T k,zone(j) represents the communication latency time between the to-be-deployed container and the first node, and zone(j) represents the node where the container j, which is dependent on the to-be-deployed container i, is located.
[0042] Optionally, when container i has no dependency relationship with container j, the product of D i,j and T k,zone(j) is 0, and when there is a dependency relationship, the product is the communication latency time. All communication latency times due to container dependency relationships are added to obtain the first latency time corresponding to the first node.
[0043] In step S104, the target node is determined from the plurality of first nodes based on the plurality of first latency times, and the to-be-deployed container is deployed to the target node.
[0044] In step S104, the system can determine the dependency relationship between the to-be-deployed container and the data source stored by the container in the target cluster based on the basic data of the to-be-deployed container, determine the plurality of second latency times of the node where each stored data source container is located based on the dependency relationship between the to-be-deployed container and the data source, obtain the target latency time based on the sum of the first latency time and the second latency time, determine the CPU resource utilization, the memory resource utilization, and the difference between the CPU resource utilization and the memory resource utilization of the container based on the resource usage of the container, then perform weighted calculation based on the target latency time, the CPU resource utilization, the memory resource utilization, and the difference between the CPU resource utilization and the memory resource utilization, determine the target node from the plurality of first nodes based on the weight of each node, and deploy the to-be-deployed container to the target node.
[0045] Based on the scheme defined in steps S101-S104, in the embodiment of the present application, the communication delay time between the to-be-deployed container and the container having a dependency relationship with the to-be-deployed container is calculated, the target node is determined from the plurality of first nodes based on the communication delay time, and the to-be-deployed container is deployed on the target node. First, the basic data of the to-be-deployed container is obtained, wherein the basic data of the to-be-deployed container represents the dependency relationship information between the to-be-deployed container and the containers in the target cluster, and the target cluster is the cluster in which the target node corresponding to the to-be-deployed container is located. When it is determined according to the basic data that the to-be-deployed container has a dependency relationship with the containers in the target cluster, the communication delay time between the to-be-deployed container and at least one target container in the plurality of first nodes is determined, wherein the target container is the container having a dependency relationship with the to-be-deployed container. The sum of the communication delay times between the to-be-deployed container and at least one target container in each first node is calculated to obtain a plurality of first delay times, wherein the first delay time is the delay time of each first node. The target node is determined from the plurality of first nodes based on the plurality of first delay times, and the to-be-deployed container is deployed on the target node.
[0046] It is easy to note that in the above process, by calculating the communication delay time between the to-be-deployed container and the target container, the node with the lowest communication delay time is determined as the target node from the plurality of first nodes based on the delay factor caused by the dependency relationship between the containers, thereby reducing the response time of the container resource and improving the accuracy of container deployment.
[0047] Therefore, the scheme provided in the present application achieves the purpose of calculating the communication delay time between the to-be-deployed container and the container having a dependency relationship with the to-be-deployed container, determining the target node from the plurality of first nodes based on the communication delay time, and deploying the to-be-deployed container on the target node, thereby achieving the technical effect of improving the accuracy of container deployment, and further solving the technical problem of low accuracy of container deployment in the prior art.
[0048] Further, the system determines the target node from the plurality of first nodes based on the plurality of first delay times, including: determining the dependency relationship information between the to-be-deployed container and the data sources stored in the containers in the target cluster based on the basic data of the to-be-deployed container; detecting whether there is a dependency relationship between the to-be-deployed container and the data sources stored in the containers in the target cluster; when there is a dependency relationship between the to-be-deployed container and the data sources stored in the containers in the target cluster, determining the communication delay time between the to-be-deployed container and the containers of each stored data source; calculating the sum of the communication delay times between the to-be-deployed container and the nodes where the containers of each stored data source are located to obtain a plurality of second delay times; calculating the sum of the first delay time and the second delay time of each node to obtain a plurality of target delay times; and determining the target node from the plurality of first nodes based on the plurality of target delay times.
[0049] Optionally, taking the communication delay between the container i and the data source of the target node k as an example, the specific definition formula is as follows:
[0050]
[0051] Wherein, t_data is the second delay time, x represents the number of all data sources, data is the dependency matrix of the service and the data source, if the container and the data source do not have a dependency relationship, data i,l is 0, if the container and the data source have a dependency relationship, data i,l is 1, T k,zone(j) represents the communication delay time between the container to be deployed and the node where the data source is located, when the container and the data source do not have a dependency relationship, t_data is 0, when the container and the data source have a dependency relationship, t_data is 1.
[0052] Optionally, the first delay time of each node and the second delay time corresponding to each node are added to obtain the total communication delay time of each node, that is, the target delay time.
[0053] It should be noted that since the container is more inclined to be deployed on the node with smaller delay after deployment, by calculating the delay time of the dependency relationship between the containers and the delay time of the dependency relationship between the containers and the data sources, the service response time is improved, and thus the accuracy of container deployment is improved.
[0054] In an optional embodiment, the system obtains resource data of a target cluster of a container to be deployed before determining a target node from a plurality of first nodes based on a plurality of first delay times, wherein the resource data at least includes CPU resource data, memory resource data of the target cluster; The resource data of the target cluster is processed to obtain a first data set.
[0055] In this embodiment, the system obtains the resource data of the target cluster of the container to be deployed by monitoring the data collection service, wherein the resource data of the target cluster at least includes CPU resource data, memory resource data, disk I / O data, network communication state data, etc., and then processes the resource data of the target cluster based on the monitoring data processing service of the system to obtain a first data set.
[0056] Further, the system processes the resource data of the target cluster to obtain a first data set, including: when the resource data of the target cluster is CPU resource data, calculating the ratio between the occupied CPU resource and the total CPU resource of each node to obtain the CPU resource utilization of each node; when the resource data of the target cluster is memory resource data, calculating the ratio between the occupied memory resource and the total memory resource of each node to obtain the memory resource utilization of each node; calculating the difference between the CPU resource utilization of each node and the memory resource utilization corresponding to the CPU resource utilization of each node to obtain a plurality of target resource utilizations, wherein the first data set at least includes the CPU resource utilization of each node, the memory resource utilization of each node and the plurality of target resource utilizations.
[0057] Optionally, when the resource data of the target cluster is CPU resource data, the CPU resource utilization of each node is calculated by the following formula:
[0058]
[0059] wherein, Ratio_Node (CPU) is the CPU resource utilization, Allocated (CPU) is the CPU resource used in the node, Capacity (CPU) is the total allocated CPU resource.
[0060] Optionally, when the resource data of the target cluster is memory resource data, the memory resource utilization of each node is calculated by the following formula:
[0061]
[0062] wherein, Ratio_Node (memory) is the memory resource utilization, Allocated (memory) is the allocated memory resource in the node, Capacity (memory) is the total available memory resource.
[0063] Optionally, the difference between the CPU resource utilization and the memory resource utilization is calculated by the following formula:
[0064] Ratio_Node=|Ratio_Node (memory) -Ratio_Node (CPU) |
[0065] wherein, Ratio_Node is the difference between the CPU resource utilization and the memory resource utilization.
[0066] In another alternative, the system obtains the target resource utilization of each node, and detects whether the target resource utilization of each node is less than a preset threshold. When the target resource utilization is less than the preset threshold, the system determines the plurality of candidate nodes.
[0067] In this embodiment, the pre-selection strategy of the system screens the nodes according to whether the target resource utilization (remaining resource) of the node is less than a preset threshold, that is, whether the node meets the minimum request for the resource required for running the container. The nodes that do not meet the condition are screened, and the plurality of candidate nodes that meet the condition are obtained.
[0068] Optionally, the pre-selection strategy of the system can also screen the nodes according to the node port usage state of the container to be deployed and the container in the target cluster. The nodes in which the port used by the container is occupied are screened, and the plurality of candidate nodes that meet the condition are obtained.
[0069] Optionally, the pre-selection strategy of the system can also screen the nodes according to the specified label information in the process of creating the container and writing the configuration file. The nodes in which the specified label information does not match are screened, and the plurality of candidate nodes that meet the condition are obtained.
[0070] It should be noted that the nodes that do not meet the condition are screened through the pre-selection strategy, which further improves the accuracy of container deployment.
[0071] Further, after the plurality of candidate nodes are determined, the system determines a second data set corresponding to the plurality of candidate nodes based on the plurality of candidate nodes. The second data set at least includes the CPU resource utilization corresponding to the plurality of candidate nodes, the memory resource utilization corresponding to the plurality of candidate nodes, the target resource utilization corresponding to the plurality of candidate nodes, and the target delay time corresponding to the plurality of candidate nodes. The data in the second data set is processed by mean value, and a target data set is obtained. The data in the target data set is calculated by weighting, and the weight corresponding to the plurality of candidate nodes is obtained.
[0072] Optionally, since there is a magnitude difference between the data in the second data set, the data is processed by mean value to obtain the target data set. For example, taking the data x1 in the second data set as an example, x1 is the CPU resource utilization, and x1 is processed by mean value by the following formula:
[0073]
[0074] x1' is the CPU resource utilization after the mean value processing, x 1_max is the maximum value of all CPU resource utilizations.
[0075] Furthermore, the corresponding nodes are scored by weighting the data in the target dataset using the following formula:
[0076] f(x1,x2,x3,x4) = 4 - (k1x1' + k2x2' + k3x3' + k4x4')
[0077] Where x1, x2, x3, and x4 correspond to the CPU resource utilization, memory resource utilization, target resource utilization, and target latency in the target data set, respectively, and their values are all between 0 and 1.
[0078] Optionally, nodes with lower CPU and memory resource utilization, smaller target resource utilization, and shorter target latency will receive higher scores based on their weights.
[0079] It is easy to see that by scoring nodes based on a weighted calculation of CPU resource utilization, memory resource utilization, target resource utilization, and target latency, the goal of improving resource utilization, reducing idle resources, and lowering response time is achieved, thereby improving user experience and ultimately increasing the accuracy of container deployment.
[0080] Furthermore, after obtaining the weights corresponding to multiple candidate nodes, the system sorts the multiple candidate nodes according to their weights to obtain a sorting result; and determines the target node from the multiple candidate nodes based on the sorting result.
[0081] In this embodiment, the system scores nodes based on weights, sorts multiple candidate nodes from highest to lowest score, and selects the candidate node with the highest score as the target node.
[0082] Therefore, this invention provides a new method for task execution. This method, by comprehensively considering resource usage and container dependencies, deploys containers based on latency factors arising from container-to-container and container-to-data source dependencies. This ensures the quality of services provided by the container group while improving resource utilization, reducing response time, and increasing the accuracy of container deployment, thereby enhancing the user experience.
[0083] Example 2
[0084] According to an embodiment of the present invention, an embodiment of a container deployment apparatus is provided, wherein, Figure 3 A schematic diagram of an optional container deployment apparatus according to an embodiment of the present invention, as shown below. Figure 3 As shown, the device includes:
[0085] The acquisition module 301 is configured to acquire basic data of a to-be-deployed container, wherein the basic data of the to-be-deployed container represents dependency relationship information between the to-be-deployed container and a container in a target cluster, and the target cluster is a cluster in which a target node corresponding to the to-be-deployed container is located. The determination module 302 is configured to, when it is determined according to the basic data that the to-be-deployed container has a dependency relationship with the container in the target cluster, determine a communication delay time between the to-be-deployed container and at least one target container in a plurality of first nodes, wherein the target container is a container that has a dependency relationship with the to-be-deployed container. The calculation module 303 is configured to calculate a sum of the communication delay times between the to-be-deployed container and at least one target container in each first node, to obtain a plurality of first delay times, wherein the first delay time is a delay time of each first node. The processing module 304 is configured to determine the target node from the plurality of first nodes based on the plurality of first delay times, and deploy the to-be-deployed container on the target node.
[0086] It should be noted that the acquisition module 301, the determination module 302, the calculation module 303, and the processing module 304 correspond to steps S101 to S104 in the above embodiment, and the four modules have the same examples and application scenarios as the corresponding steps, but are not limited to the content disclosed in Embodiment 1.
[0087] Optionally, the processing module further includes a first determination module, a first detection module, a second determination module, a first calculation module, a second calculation module, and a third determination module. The first determination module is configured to determine dependency relationship information between the to-be-deployed container and a data source stored by a container in the target cluster based on the basic data of the to-be-deployed container. The first detection module is configured to detect whether there is a dependency relationship between the to-be-deployed container and the data source stored by the container in the target cluster. The second determination module is configured to, when there is a dependency relationship between the to-be-deployed container and the data source stored by the container in the target cluster, determine a communication delay time between the to-be-deployed container and a container of each stored data source. The first calculation module is configured to calculate a sum of communication delay times between the to-be-deployed container and nodes in which the containers of each stored data source are located, to obtain a plurality of second delay times. The second calculation module is configured to calculate a sum of the first delay time and the second delay time of each node, to obtain a plurality of target delay times. The third determination module is configured to determine the target node from the plurality of first nodes based on the plurality of target delay times.
[0088] Optionally, the container deployment apparatus further includes a resource acquisition module and a resource processing module. The resource acquisition module is configured to acquire resource data of a target cluster of a to-be-deployed container, wherein the resource data at least includes CPU resource data and memory resource data of the target cluster. The resource processing module is configured to process the resource data of the target cluster to obtain a first data set.
[0089] Optionally, the container deployment apparatus further comprises a third calculation module, a fourth calculation module and a fifth calculation module.
[0090] Optionally, the container deployment apparatus further comprises a second detection module and a fourth determination module.
[0091] Optionally, the container deployment apparatus further comprises a fifth determination module, a mean value processing module and a weight calculation module.
[0092] Optionally, the container deployment apparatus further comprises a sorting module and a sixth determination module.
[0093] Embodiment 3
[0094] According to another aspect of the embodiments of the present application, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program.
[0095] Embodiment 4
[0096] According to another aspect of the embodiments of the present application, an electronic device is also provided, comprising: Figure 4 is a schematic diagram of an optional electronic device according to an embodiment of the present application, as shown in the figure, the electronic device comprises one or more processors; a memory for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement a program for running, wherein the program is arranged to run to perform the above-mentioned container deployment method. Figure 4
[0097] Embodiment 5
[0098] According to another aspect of the embodiments of the present application, a computer program product is also provided, comprising computer programs / instructions, which are executed by a processor to implement the above-mentioned container deployment method.
[0099] The above-mentioned embodiment numbers of the present application are only for description, not representing the advantages and disadvantages of the embodiments.
[0100] In the above-mentioned embodiments of the present application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0101] In several embodiments provided in the present application, it should be understood that the disclosed technical contents can be implemented by other ways. Among them, the above-mentioned device embodiments are only schematic, for example, the division of units can be a logical function division, and actual implementation can have another division way, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed units can be indirect coupling or communication connection through some interfaces, units or modules, which can be electrical or other forms.
[0102] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or they can be distributed to multiple units. Part or all of the units can be selected according to actual needs to achieve the purpose of the present embodiment scheme.
[0103] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be realized in the form of hardware or in the form of software functional unit.
[0104] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application, essentially or in other words, the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server or a network device, etc.) execute all or part of the steps of the embodiments of the present application. The aforementioned storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.
[0105] The above is only the preferred embodiment of the present application, and it should be pointed out that for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present application.
Claims
1. A method for deploying a container, characterized in that, include: Obtain basic data of the container to be deployed, wherein the basic data of the container to be deployed represents the dependency information between the container to be deployed and the containers in the target cluster, as well as the dependency information between the container to be deployed and the data source stored in the containers in the target cluster, and the target cluster is the cluster where the target node corresponding to the container to be deployed is located; When it is determined from the basic data that the container to be deployed has a dependency relationship with the container in the target cluster, the communication delay time between the container to be deployed and at least one target container among multiple first nodes is determined, wherein the target container is a container that has a dependency relationship with the container to be deployed; The sum of communication delay times between the container to be deployed and at least one of the target containers in each first node is calculated to obtain a plurality of first delay times, wherein the first delay time is the delay time of each first node; The target node is determined from the plurality of first nodes based on the plurality of first delay times, and the container to be deployed is deployed to the target node; Determining the target node from the plurality of first nodes based on multiple first delay times includes: determining the dependency information between the container to be deployed and the data source stored in the container in the target cluster based on the basic data of the container to be deployed; detecting whether there is a dependency between the container to be deployed and the data source stored in the container in the target cluster; when there is a dependency between the container to be deployed and the data source stored in the container in the target cluster, determining the communication delay time between the container to be deployed and the container of each stored data source; calculating the sum of the communication delay times between the container to be deployed and the node where the container of each stored data source is located to obtain multiple second delay times; calculating the sum of the first delay time and the second delay time of each node to obtain multiple target delay times; and determining the target node from the plurality of first nodes based on the multiple target delay times.
2. The method according to claim 1, characterized in that, Before determining the target node from the plurality of first nodes based on a plurality of first delay times, the method further includes: Obtain the resource data of the target cluster of the container to be deployed, wherein the resource data includes at least the CPU resource data and memory resource data of the target cluster; The resource data of the target cluster is processed to obtain a first data set.
3. The method according to claim 2, characterized in that, The resource data of the target cluster is processed to obtain a first data set, including: When the resource data of the target cluster is the CPU resource data, the ratio between the occupied CPU resources of each node and the total CPU resources is calculated to obtain the CPU resource utilization rate of each node. When the resource data of the target cluster is the memory resource data, the ratio between the occupied memory resources of each node and the total memory resources is calculated to obtain the memory resource utilization rate of each node; The difference between the CPU resource utilization of each node and the memory resource utilization corresponding to the CPU resource utilization of each node is calculated to obtain multiple target resource utilization rates. The first data set includes at least the CPU resource utilization of each node, the memory resource utilization of each node, and multiple target resource utilization rates.
4. The method according to claim 3, characterized in that, After obtaining multiple target resource utilization rates, the method further includes: Detect whether the target resource utilization rate of each node is less than a preset threshold; When the target resource utilization rate is less than the preset threshold, multiple candidate nodes are determined.
5. The method according to claim 4, characterized in that, After identifying multiple candidate nodes, including: Based on the multiple candidate nodes, a second data set corresponding to the multiple candidate nodes is determined, wherein the second data set includes at least the CPU resource utilization rate corresponding to the multiple candidate nodes, the memory resource utilization rate corresponding to the multiple candidate nodes, the target resource utilization rate corresponding to the multiple candidate nodes, and the target latency time corresponding to the multiple candidate nodes; The data in the second dataset are averaged to obtain the target dataset. The data in the target dataset are weighted to obtain the weights corresponding to the multiple candidate nodes.
6. The method according to claim 5, characterized in that, After obtaining the weights corresponding to the plurality of candidate nodes, the method further includes: The candidate nodes are sorted according to their corresponding weights to obtain a sorting result; The target node is determined from the plurality of candidate nodes based on the sorting results.
7. A container deployment apparatus, characterized in that, include: The acquisition module is used to acquire the basic data of the container to be deployed. The basic data of the container to be deployed represents the dependency information between the container to be deployed and the containers in the target cluster, as well as the dependency information between the container to be deployed and the data source stored in the containers in the target cluster. The target cluster is the cluster where the target node corresponding to the container to be deployed is located. The determination module is used to determine the communication latency between the container to be deployed and at least one target container among a plurality of first nodes when it is determined from the basic data that the container to be deployed has a dependency relationship with the container in the target cluster. The target container is a container that has a dependency relationship with the container to be deployed. The calculation module is used to calculate the sum of communication delay times between the container to be deployed and at least one of the target containers in each first node, to obtain a plurality of first delay times, wherein the first delay time is the delay time of each first node; The processing module is configured to determine the target node from the plurality of first nodes based on a plurality of first delay times, and deploy the container to be deployed to the target node; The processing module further includes: a first determining module, used to determine the dependency information between the container to be deployed and the data source stored in the container in the target cluster based on the basic data of the container to be deployed; a first detecting module, used to detect whether there is a dependency between the container to be deployed and the data source stored in the container in the target cluster; a second determining module, used to determine the communication latency between the container to be deployed and the container of each stored data source when there is a dependency between the container to be deployed and the data source stored in the container in the target cluster; a first calculating module, used to calculate the sum of the communication latency between the container to be deployed and the node where the container of each stored data source is located, to obtain multiple second latency times; a second calculating module, used to calculate the sum of the first latency time and the second latency time of each node, to obtain multiple target latency times; and a third determining module, used to determine the target node from the multiple first nodes based on the multiple target latency times.
8. A computer-readable storage medium, characterized in that, A computer-readable storage medium stores a computer program, wherein the computer program is configured to execute, at runtime, the container deployment method of any one of claims 1 to 6.
9. An electronic device, characterized in that, Electronic devices include one or more processors; A memory for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to be configured to run the programs, wherein the programs are configured to execute the container deployment method of any one of claims 1 to 6 at runtime.
10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the container deployment method of any one of claims 1 to 6.
Citation Information
Patent Citations
Edge computing-oriented service scheduling system and scheduling method thereof
CN114679451A