Micro-service scheduling method, device and equipment under k8s cluster and storage medium

By dynamically building a microservice call topology diagram and multi-dimensional evaluation candidate nodes, the traditional k8s cluster scheduling mechanism cannot meet the overall performance balance of the system under the microservice architecture, and realize resource load balancing and communication performance optimization.

CN119892905AActive Publication Date: 2025-04-25CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Application Number
CN202510371571.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-27
Publication Date
2025-04-25
Estimated Expiration
2045-03-27

AI Technical Summary

Technical Problem

The traditional k8s cluster scheduling mechanism cannot meet the balanced needs of the overall performance of the system under the microservice architecture, especially in complex call relationships and dynamic network conditions.

Method used

By collecting data from k8s cluster nodes and microservice instances, a microservice call topology diagram is dynamically built, including microservice nodes, call links, link traffic information and link weight information, evaluate candidate nodes from multiple dimensions, filter target nodes and schedule microservice pods.

Benefits of technology

Multi-dimensional optimization of microservice scheduling is realized, ensuring node resource load balancing, minimum microservice communication cost, best communication performance, and improving the overall system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119892905A_ABST
    Figure CN119892905A_ABST
Patent Text Reader

Abstract

The invention relates to a micro-service scheduling method and device under a k8s cluster, equipment and a storage medium. The method comprises the following steps: collecting node data of each node in a k8s cluster and service flow data of each micro-service instance; constructing a dynamic micro-service topological relation graph according to the service flow data; wherein the dynamic micro-service topological relation graph comprises a micro-service node, a calling link, link flow information and link weight information; based on the dynamic micro-service topological relation graph and the node data, candidate nodes are evaluated from multiple dimensions, and target nodes are obtained through screening; and scheduling the micro service pod to the target node. Therefore, the resource utilization rate of the server and the network topology structure between the micro-services can be comprehensively considered, the micro-service scheduling strategy is greatly optimized, and a scheduling scheme which conforms to node resource load balance and can enable the communication cost between the micro-services to be minimum and the communication performance to be optimal is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing technology, and in particular to a microservice scheduling method, apparatus, computer equipment, computer-readable storage medium, and computer program product under a k8s cluster. Background Art

[0002] With the widespread application of distributed microservice architecture in Kubernetes clusters, higher requirements are placed on QoS. In Kubernetes clusters, pod is the basis of all business types and the smallest unit level managed by k8s. It is a combination of one or more containers. These containers share storage, network, and namespace, as well as specifications on how to run. In a pod, all containers are uniformly arranged and scheduled and run in a shared context.

[0003] In traditional technology, the k8s cluster scheduling mechanism mainly considers the resource utilization of the node (CPU, memory, etc.) and the resource requirements of a single application.

[0004] However, under the microservice architecture, the calling relationships between services are complicated, and the diversity and dynamics of the calling links and the network status of the server will affect the overall performance of the system. Therefore, the traditional k8s cluster scheduling mechanism cannot meet the balanced requirements of the overall performance of the system. Summary of the invention

[0005] Based on this, it is necessary to provide a microservice scheduling method, device, computer equipment, computer-readable storage medium and computer program product under a k8s cluster that can dynamically build microservice call topology relationships and optimize system service performance from multiple dimensions to address the above technical problems.

[0006] In the first aspect, the present application provides a microservice scheduling method under a k8s cluster, including:

[0007] Collect node data of each node in the k8s cluster and service traffic data of each microservice instance;

[0008] According to the service flow data, a dynamic microservice topology relationship diagram is constructed; wherein the dynamic microservice topology relationship diagram includes: microservice nodes, call links, and link flow information and link weight information;

[0009] Based on the dynamic microservice topology relationship diagram and the node data, candidate nodes are evaluated from multiple dimensions to screen out target nodes;

[0010] Schedule the microservice pod to the target node.

[0011] In one embodiment, the node data of each node in the k8s cluster and the service traffic data of each microservice instance are collected, including:

[0012] Collect node data of each node in the k8s cluster according to the preset time period; the node data includes: resource usage data and network data;

[0013] Track and capture the service traffic data of each microservice instance; the service traffic data includes: at least one of the request ID, tracking ID, source service name, target service name, and request duration.

[0014] In one embodiment, constructing a dynamic microservice topology diagram according to the service traffic data includes:

[0015] Aggregating and analyzing the service traffic data to obtain call links between multiple microservice nodes and microservice nodes;

[0016] Constructing a topological relationship of microservices according to the microservice nodes and the call links;

[0017] In the topological relationship of the microservices, link flow information and link weight information are added to obtain a dynamic microservice topological relationship diagram; wherein the link flow information is calculated based on the integral of the total flow of microservices at both ends of the link within the sliding window time, and the calculation method of the link weight information includes at least one of the following:

[0018] Calculated based on the frequency of microservice calls at both ends of the link within a given time;

[0019] Calculated based on the callback frequency of microservices at both ends of the link within a given time;

[0020] It is calculated by adding the experience coefficient according to the importance of the service.

[0021] In one embodiment, based on the dynamic microservice topology relationship diagram and the node data, candidate nodes are evaluated from multiple dimensions to screen out target nodes, including:

[0022] When there are microservice pods to be scheduled in the scheduling queue, at least two candidate nodes are determined based on the dynamic microservice topology relationship graph;

[0023] According to the node data, each candidate node is evaluated from the node resource utilization dimension, the microservice communication network cost dimension, and the communication performance dimension to obtain an evaluation result;

[0024] Based on the evaluation result, a target node is screened out from the candidate nodes.

[0025] In one embodiment, each candidate node is evaluated from the node resource utilization dimension, the microservice communication network cost dimension, and the communication performance dimension to obtain an evaluation result, including:

[0026] Establish node resource utilization evaluation function, microservice communication network cost evaluation function, and communication performance evaluation function respectively;

[0027] Convert the node resource utilization evaluation function, the microservice communication network cost evaluation function, and the communication performance evaluation function into a multi-objective optimization problem to obtain an objective function;

[0028] Based on the objective function, each candidate node is evaluated to obtain an evaluation result.

[0029] In one embodiment, after scheduling the microservice pod to the target node, the method further includes:

[0030] Determine whether the microservice pod is successfully scheduled;

[0031] If the scheduling is successful, the process ends;

[0032] If the scheduling is unsuccessful, the microservice pod is added to the scheduling queue again.

[0033] In a second aspect, the present application also provides a microservice scheduling device under a k8s cluster, the device comprising:

[0034] The data collection module is used to collect node data of each node in the k8s cluster and service traffic data of each microservice instance;

[0035] A topology perception module is used to construct a dynamic microservice topology relationship diagram based on the service traffic data; wherein the dynamic microservice topology relationship diagram includes: microservice nodes, call links, and link traffic information and link weight information;

[0036] A scheduler extension module is used to evaluate candidate nodes from multiple dimensions based on the dynamic microservice topology relationship diagram and the node data, and screen out target nodes;

[0037] The scheduling module is used to schedule the microservice pod to the target node.

[0038] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0039] Collect node data of each node in the k8s cluster and service traffic data of each microservice instance;

[0040] According to the service flow data, a dynamic microservice topology relationship diagram is constructed; wherein the dynamic microservice topology relationship diagram includes: microservice nodes, call links, and link flow information and link weight information;

[0041] Based on the dynamic microservice topology relationship diagram and the node data, candidate nodes are evaluated from multiple dimensions to screen out target nodes;

[0042] Schedule the microservice pod to the target node.

[0043] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0044] Collect node data of each node in the k8s cluster and service traffic data of each microservice instance;

[0045] According to the service flow data, a dynamic microservice topology relationship diagram is constructed; wherein the dynamic microservice topology relationship diagram includes: microservice nodes, call links, and link flow information and link weight information;

[0046] Based on the dynamic microservice topology relationship diagram and the node data, candidate nodes are evaluated from multiple dimensions to screen out target nodes;

[0047] Schedule the microservice pod to the target node.

[0048] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0049] Collect node data of each node in the k8s cluster and service traffic data of each microservice instance;

[0050] According to the service flow data, a dynamic microservice topology relationship diagram is constructed; wherein the dynamic microservice topology relationship diagram includes: microservice nodes, call links, and link flow information and link weight information;

[0051] Based on the dynamic microservice topology relationship diagram and the node data, candidate nodes are evaluated from multiple dimensions to screen out target nodes;

[0052] Schedule the microservice pod to the target node.

[0053] The microservice scheduling method, device, computer equipment, computer-readable storage medium and computer program product under the above k8s cluster collect node data of each node under the k8s cluster and service flow data of each microservice instance; according to the service flow data, a dynamic microservice topology relationship diagram is constructed; wherein the dynamic microservice topology relationship diagram includes: microservice nodes, call links, and link flow information and link weight information; thereby, the resource utilization rate and network performance of the microservice pod can be obtained in time, and a dynamic microservice topology relationship diagram that follows the changes in the call situation of the microservice instance can be constructed. Based on the dynamic microservice topology relationship diagram and the node data, the candidate nodes are evaluated from multiple dimensions, and the target nodes are screened; the microservice pod is scheduled to the target node. Thus, the resource utilization rate of the server and the network topology structure between the microservices can be comprehensively considered, and the microservice scheduling strategy can be greatly optimized to obtain a scheduling scheme that not only meets the node resource load balancing, but also minimizes the communication cost between microservices and optimizes the communication performance. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0055] Figure 1 This is a schematic diagram of the architecture of a k8s cluster in one embodiment;

[0056] Figure 2 It is a flowchart of a microservice scheduling method under a k8s cluster in one embodiment;

[0057] Figure 3 A schematic diagram of a microservice call topology structure in an embodiment;

[0058] Figure 4 A schematic diagram of a flow chart of a microservice scheduling method under a k8s cluster in another embodiment;

[0059] Figure 5 It is a flowchart of a microservice scheduling method under a k8s cluster in another embodiment;

[0060] Figure 6 It is a structural block diagram of a microservice scheduling device under a k8s cluster in an embodiment;

[0061] Figure 7 It is a structural block diagram of a microservice scheduling device under a k8s cluster in another embodiment;

[0062] Figure 8 This is a schematic diagram of the architecture of a microservice scheduling system under a k8s cluster in an embodiment;

[0063] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0065] For example, Figure 1 This is a schematic diagram of the architecture of a k8s cluster in an embodiment. Figure 1 As shown, the k8s cluster may include: a master node 10 and a worker node 11. Among them, the master node 10 may include an application program interface service (kube-apiserver) and a distributed key-value pair storage system (for example, etcd pod). etcd is used in the k8s cluster to store data and notify the cluster of operation changes. The worker node 11 may include a kubelet component, a kube-proxy process, and a container group (pod) object, and the pod contains at least one container, which is used to run the application process. The kube-proxy process can run on each worker node, and can also be used to be responsible for the connection and forwarding of the entire network rules. For example, it can be used to be responsible for the virtual IP service of the service component in the k8s cluster. Among them, the master node 10 can be a physical machine or a virtual machine, and the worker node 11 can be a physical machine or a virtual machine. Optionally, the physical machine can be a computing device or a server, such as a general-purpose server, a graphics processing unit (GPU) server, a data processing unit (DPU) server, or an artificial intelligence (AI) server.

[0066] In an exemplary embodiment, Figure 2 As shown in the figure, a microservice scheduling method under a k8s cluster is provided, which is applied to Figure 1 Take the k8s cluster in as an example to illustrate, including the following steps 201 to 204. Among them:

[0067] Step 201, collect node data of each node under the k8s cluster and service traffic data of each microservice instance.

[0068] In this embodiment, the node data of each node can be collected according to a preset time period by a data collector deployed on each node of the k8s cluster.

[0069] The node data includes: resource usage data and network data.

[0070] For example, the resource usage data (CPU, memory, etc.) and network status (bandwidth, latency, packet loss rate, jitter, etc.) of each node can be collected regularly and stored in the time series database in the form of Prometheus indicators.

[0071] The service flow data of the microservice instance shown includes: call information of each microservice instance, for example: at least one of request ID, tracking ID, source service name, target service name, request duration, etc.

[0072] For example, the traffic tracking of microservice instances can be implemented based on the Envoy proxy of the Istio framework. Optionally, the service traffic collector is injected into the microservice pod in the form of a sidecar to track and capture the call information of each microservice instance.

[0073] Step 202: construct a dynamic microservice topology diagram based on the service traffic data.

[0074] In this embodiment, the microservice topology relationship diagram shows the scheduling relationship between microservice nodes. The dynamic microservice topology relationship diagram includes: microservice nodes, call links, link flow information and link weight information.

[0075] In this embodiment, after obtaining the service flow data, the service flow data is aggregated and analyzed to obtain call links between multiple microservice nodes and microservice nodes; a topological relationship of microservices is constructed based on the microservice nodes and the call links; in the topological relationship of the microservices, link flow information and link weight information are added to obtain a dynamic microservice topological relationship diagram.

[0076] The dynamic microservice topology relationship diagram means that as time goes by (each collection cycle), a new microservice topology relationship diagram will be continuously generated based on the latest collected service traffic data; that is, the microservice topology relationship is not static. In one possible case, even if the microservice node and call link do not change, the traffic information and link weight information of each link will change.

[0077] Optionally, the link traffic information is calculated based on the integral of the total traffic of microservices at both ends of the link within the sliding window time.

[0078] Optionally, the link weight information is calculated in at least one of the following ways:

[0079] Calculated based on the frequency of microservice calls at both ends of the link within a given time;

[0080] Calculated based on the callback frequency of microservices at both ends of the link within a given time;

[0081] It is calculated by adding the experience coefficient according to the importance of the service.

[0082] For example, a service traffic collector can be injected into a microservice pod, and then the function of building a dynamic microservice topology diagram can be implemented based on the distributed tracing system Jaeger.

[0083] Optionally, the data reported by the service traffic collector is aggregated and analyzed, and after a dynamic microservice topology diagram is constructed, it is stored in a database.

[0084] For example, a microservice call topology diagram is provided, such as Figure 3 As shown, taking microservice node A and microservice node B as examples, the total microservice traffic at both ends of the link (A, B) is integrated within the sliding window time to obtain the link traffic<A,B> The link weight is calculated based on the call frequency / callback frequency of the microservices at both ends of the link (A, B) within a given time, or the importance of the service plus the empirical coefficient.<A,B> Similarly, link traffic<B,D> Indicates the link traffic and link weight of microservice node B and microservice node D at both ends of the link within the sliding window time<B,D> Indicates the link weights at both ends of the link between microservice node B and microservice node D within a given time. Link traffic<B,C> Indicates the link traffic and link weight of microservice node B and microservice node C at both ends of the link within the sliding window time<B,C> Indicates the link weights at both ends of the link between microservice node B and microservice node C within a given time. Link traffic<B,E> Indicates the link traffic and link weight of microservice node B and microservice node E at both ends of the link within the sliding window time<B,E> Indicates the link weights at both ends of the link between microservice node B and microservice node E within a given time. Link traffic<A,C> Indicates the link traffic and link weight of microservice node A and microservice node C at both ends of the link within the sliding window time<A,C> Indicates the link weights at both ends of the link between microservice node A and microservice node C within a given time.

[0085] Step 203, based on the dynamic microservice topology diagram and node data, the candidate nodes are evaluated from multiple dimensions to screen out the target nodes.

[0086] In this embodiment, the microservice pod to be scheduled can be added to the scheduling queue, and the pod can be scheduled according to the order in the scheduling queue.

[0087] Exemplarily, when there are microservice pods to be scheduled in the scheduling queue, at least two candidate nodes are determined based on the dynamic microservice topology relationship diagram; according to the node data, each candidate node is evaluated from the node resource utilization dimension, the microservice communication network cost dimension, and the communication performance dimension to obtain an evaluation result; based on the evaluation result, the target node is screened out from the candidate nodes.

[0088] Optionally, establish a node resource utilization evaluation function, a microservice communication network cost evaluation function, and a communication performance evaluation function respectively; transform the node resource utilization evaluation function, the microservice communication network cost evaluation function, and the communication performance evaluation function into a multi-objective optimization problem to obtain an objective function; based on the objective function, evaluate each candidate node to obtain an evaluation result. Thus, the microservice nodes can be evaluated from the three aspects of node resource utilization, microservice communication network cost, and communication performance, and the optimal microservice node can be comprehensively selected for scheduling.

[0089] For example, suppose that after kube-scheduler screening, there are N schedulable nodes that meet the requirements in the k8s cluster. , record the microservice pod to be scheduled as , the node to be scored is recorded as .

[0090] 1) Regarding node resource utilization, Kube-scheduler usually allocates pods to nodes with sufficient resources based on the node's operating status, resource usage, and pod resource requirements, without considering the problem of balanced resource allocation. In order to avoid the risk of excessive CPU or memory usage on a single node due to emergencies (such as a surge in business traffic, leakage of a single pod's resources, large-scale batch task execution, etc.), which in turn may lead to node performance bottlenecks or even node failures, the scheduling algorithm uses node resource utilization as one of the optimization goals, aiming to prioritize pods on nodes with relatively low resource utilization and achieve balanced resource allocation.

[0091] Set the node resource utilization rate to USE x Defined as:

[0092]

[0093] in: Represents the resource dimension, Indicates that resources have been allocated on node x. Indicates the total amount of resources on node x, Indicates the resources required by the pod to be scheduled. are the resource weights of different dimensions, and their sum is 1.

[0094] 2) In terms of communication costs, the microservice architecture splits the application into multiple small, independent services to improve the maintainability, scalability, and flexibility of the system. However, this approach also increases the complexity of communication between services, and the resource consumption of communication between microservices directly affects the response time and performance of the entire application. Therefore, the scheduling algorithm takes communication cost as one of the optimization goals, and uses the ratio of link traffic and node bandwidth in the microservice topology graph to quantify the communication cost between two microservices, aiming to prioritize the scheduling of pods to nodes with relatively low communication costs with other services, thereby reducing service communication overhead.

[0095] Assume that the pod is scheduled to At this time, the communication cost between this service and other microservices is COST x Defined as:

[0096]

[0097] in: Indicates that it is deployed on the node Microservices on Indicates the service to be scheduled and The sum of link traffic generated by calls between all microservices; is the network bandwidth between node x and node n. Considering that the actual utilization of bandwidth will be affected by the network status, a penalty factor based on the node network status is introduced here. , whose value is automatically adjusted according to network performance indicators such as network delay and packet loss rate.

[0098] 3) Regarding communication performance, in the microservice architecture, the high call frequency and large network traffic of key links often become bottlenecks that restrict the overall service performance. Therefore, it is hoped that communication channels with better network performance (such as more abundant network bandwidth, lower latency, and better stability) will be allocated to key links first. Therefore, the scheduling algorithm takes communication performance as one of the optimization goals, evaluates the node network status score in real time, and uses the product of the link weight of the microservice topology graph and the node network status score to quantify the communication performance between two microservices. The purpose is to prioritize the communication quality of key links and allocate better network transmission channels to key links, thereby improving the communication efficiency of key links and improving overall service performance.

[0099] Assume that the pod is scheduled to At this time, the communication performance of this service and other microservices is PERFORM x Defined as:

[0100]

[0101] in: It is the network status score between node x and node n, calculated based on network performance indicators such as bandwidth, latency, packet loss rate, and jitter; Indicates the service to be scheduled and The sum of the link weights between all microservices.

[0102] Optionally, the scheduling problem of each of the above functions is transformed into a multi-objective optimization problem, and the following objective function is obtained:

[0103]

[0104]

[0105] Optionally, the above objective functions are combined by weights and converted into single objective functions for solution, or a genetic algorithm is used for solution to obtain a non-dominated solution closest to the ideal point, thereby scheduling the pod to a node that can achieve relatively balanced resource utilization, relatively low microservice communication network cost, and relatively good communication performance.

[0106] Step 204: Schedule the microservice pod to the target node.

[0107] In this embodiment, by analyzing the request information between microservices, the call relationship topology of the microservices is dynamically constructed, and the call frequency, link flow, service importance and other dimensions are comprehensively considered, and the weight of each link is dynamically calculated, so that it can be used to monitor the service status and optimize the service performance. In addition, by comprehensively considering the resource utilization of the server and the network topology between the microservices, the nodes are evaluated from three aspects: node resource utilization, microservice communication cost, and communication performance. The optimization target mathematical model is constructed based on the topological relationship and link flow, link weight, node resource, node network index and other data, which can transform the scheduling problem into a multi-objective optimization problem solution, thereby screening out the best target node.

[0108] In the above-mentioned microservice scheduling method under the k8s cluster, the node data of each node under the k8s cluster and the service flow data of each microservice instance are collected; according to the service flow data, a dynamic microservice topology relationship diagram is constructed; wherein the dynamic microservice topology relationship diagram includes: microservice nodes, call links, and link flow information and link weight information; so that the resource utilization rate and network performance of the microservice pod can be obtained in time, and a dynamic microservice topology relationship diagram that follows the changes in the call situation of the microservice instance can be constructed. Based on the dynamic microservice topology relationship diagram and the node data, the candidate nodes are evaluated from multiple dimensions, and the target nodes are screened; the microservice pod is scheduled to the target node. In this way, the resource utilization rate of the server and the network topology structure between microservices can be comprehensively considered, and the microservice scheduling strategy can be greatly optimized to obtain a scheduling scheme that not only meets the node resource load balancing, but also minimizes the communication cost between microservices and optimizes the communication performance.

[0109] In an exemplary embodiment, Figure 4 As shown in the figure, a microservice scheduling method under a k8s cluster is provided, which is applied to Figure 1 Take the k8s cluster in as an example to illustrate, including the following steps 401 to 405. Among them:

[0110] Step 401, collect node data of each node under the k8s cluster and service traffic data of each microservice instance.

[0111] Step 402: construct a dynamic microservice topology diagram based on the service traffic data.

[0112] Step 403, based on the dynamic microservice topology diagram and node data, the candidate nodes are evaluated from multiple dimensions to screen out the target nodes.

[0113] Step 404: Schedule the microservice pod to the target node.

[0114] For the specific implementation process and technical effects of steps 401 to 404 in this embodiment, please refer to Figure 2 The descriptions of steps 201 to 204 in the illustrated method embodiment are not repeated here.

[0115] Step 405, determine whether the microservice pod is successfully scheduled. If the scheduling is unsuccessful, add the microservice pod to the scheduling queue again.

[0116] In this embodiment, a subsequent judgment step on the pod scheduling situation is added to determine whether the pod is successfully scheduled to the target node. If it cannot be scheduled to the target node, it is considered that a scheduling failure may have occurred. At this time, the pod can be re-added to the scheduling queue for subsequent re-scheduling to avoid scheduling jams and ensure scheduling efficiency and correctness.

[0117] For example, Figure 5 As shown, first, node resources and service traffic data are collected to build a microservice topology relationship diagram; then, it is determined whether there are microservice pods to be scheduled in the scheduling queue. If there are microservice pods to be scheduled, the nodes are scored based on the network topology and resource utilization, and the pods are scheduled to the optimal node. If there are no microservice pods to be scheduled, the process ends; after the pods are scheduled to the optimal node, it is further determined whether the pod scheduling is successful. If successful, the process ends. If not, the scheduling queue is rejoined.

[0118] In this embodiment, by analyzing the traffic between microservice pods, a microservice call topology diagram is constructed, which includes microservice nodes, call links, and link traffic and weight information; and the resource utilization rate and network performance of the nodes are monitored at the same time; the node network status is scored according to indicators such as bandwidth, latency, and packet loss rate; the node resource utilization rate is evaluated according to the node available resources, occupied resources, and pod required resources, the microservice call network resource overhead is evaluated according to the link traffic and node network bandwidth, and the communication performance between microservices is evaluated according to the link weight and node network status, thereby converting the microservice pod scheduling problem into a multi-objective optimization problem, and solving the Pareto optimal solution that makes the resource utilization rate most balanced, the network resource consumption lowest, and the communication performance best.

[0119] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0120] Based on the same inventive concept, the embodiment of the present application also provides a microservice scheduling device under a k8s cluster for implementing the microservice scheduling method under the k8s cluster involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the microservice scheduling device under one or more k8s clusters provided below can refer to the limitations of the microservice scheduling method under the k8s cluster above, and will not be repeated here.

[0121] In an exemplary embodiment, Figure 6 As shown, a microservice scheduling device under a k8s cluster is provided, including: a data acquisition module 601, a topology perception module 602, a scheduler extension module 603 and a scheduling module 604, wherein:

[0122] The data collection module 601 is used to collect node data of each node under the k8s cluster and service traffic data of each microservice instance;

[0123] A topology perception module 602 is used to construct a dynamic microservice topology relationship diagram according to the service flow data; wherein the dynamic microservice topology relationship diagram includes: microservice nodes, call links, and link flow information and link weight information;

[0124] The scheduler extension module 603 is used to evaluate the candidate nodes from multiple dimensions based on the dynamic microservice topology relationship diagram and the node data, and screen the target node;

[0125] The scheduling module 604 is used to schedule the microservice pod to the target node.

[0126] Exemplarily, the data collection module 601 is specifically used to: collect node data of each node under the k8s cluster according to a preset time period; the node data includes: resource usage data, network data; track and capture service traffic data of each microservice instance; the service traffic data includes: request ID, tracking ID, source service name, target service name, and at least one of request duration.

[0127] Exemplarily, the topology perception module 602 is specifically used to aggregate and analyze the service traffic data to obtain call links between multiple microservice nodes and microservice nodes;

[0128] Constructing a topological relationship of microservices according to the microservice nodes and the call links;

[0129] In the topological relationship of the microservices, link flow information and link weight information are added to obtain a dynamic microservice topological relationship diagram; wherein the link flow information is calculated based on the integral of the total flow of microservices at both ends of the link within the sliding window time, and the calculation method of the link weight information includes at least one of the following:

[0130] Calculated based on the frequency of microservice calls at both ends of the link within a given time;

[0131] Calculated based on the callback frequency of microservices at both ends of the link within a given time;

[0132] It is calculated by adding the experience coefficient according to the importance of the service.

[0133] Exemplarily, the scheduler extension module 603 is specifically used to: when there are microservice pods to be scheduled in the scheduling queue, determine at least two candidate nodes based on the dynamic microservice topology relationship diagram; based on the node data, evaluate each candidate node from the node resource utilization dimension, the microservice communication network cost dimension, and the communication performance dimension to obtain an evaluation result; based on the evaluation result, filter out the target node from the candidate nodes.

[0134] Exemplarily, the scheduler extension module 603 is specifically used to: respectively establish a node resource utilization evaluation function, a microservice communication network cost evaluation function, and a communication performance evaluation function; convert the solution problem of the node resource utilization evaluation function, the microservice communication network cost evaluation function, and the communication performance evaluation function into a multi-objective optimization problem to obtain the objective function; based on the objective function, evaluate each candidate node to obtain an evaluation result.

[0135] In another exemplary embodiment, Figure 7 As shown, a microservice scheduling device under a k8s cluster is provided. Figure 6 On the basis of the device shown, it can also include: a judgment module 605, the judgment module 605 is used to judge whether the microservice pod is scheduled successfully; if the scheduling is successful, the process is ended; if the scheduling is unsuccessful, the microservice pod is re-added to the scheduling queue.

[0136] Each module in the microservice scheduling device under the above k8s cluster can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0137] In an exemplary embodiment, Figure 8As shown, a schematic diagram of the architecture of a microservice scheduling system under a k8s cluster is also provided. The microservice scheduling system under the k8s cluster includes: a data collection module composed of a node data collector and a service traffic collector, a topology perception module and a scheduler extension module. Among them, the node data collector is deployed on each node of the k8s cluster, and is used to regularly collect the resource usage status (CPU, memory, etc.) and network status (bandwidth, delay, packet loss rate, jitter, etc.) of the node, and store it in the form of Prometheus indicators to the time series database. The service traffic collector is implemented based on the Envoy proxy of the Istio framework, and can be injected into the microservice pod in the form of a sidecar to track and capture the call information of each microservice instance (such as request ID, tracking ID, source service name, target service name, request time, etc.), and then report these call information to the topology perception module for subsequent processing. The topology perception module is used to build a dynamic microservice topology relationship diagram, which includes: microservice call nodes, microservice call links, and link traffic information and link weight information. The scheduler extension module is used to expand the scheduling function of k8s so as to evaluate the nodes from three aspects: node resource utilization, microservice communication network cost, and communication performance, and comprehensively select the optimal node for scheduling.

[0138] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig. 9 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store node data and service traffic data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a microservice scheduling method under a k8s cluster is implemented.

[0139] Those skilled in the art will understand that Fig. 9The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0140] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0141] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0142] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0143] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0144] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0145] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0146] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A microservice scheduling method under a k8s cluster, characterized in that: The method comprises: Collect node data of each node in the k8s cluster and service traffic data of each microservice instance; According to the service flow data, a dynamic microservice topology relationship diagram is constructed; wherein the dynamic microservice topology relationship diagram includes: microservice nodes, call links, and link flow information and link weight information; Based on the dynamic microservice topology relationship diagram and the node data, candidate nodes are evaluated from multiple dimensions to screen out target nodes; Schedule the microservice pod to the target node.

2. The method according to claim 1, characterized in that The node data of each node under the k8s cluster and the service traffic data of each microservice instance are collected, including: Collect node data of each node in the k8s cluster according to the preset time period; the node data includes: resource usage data and network data; Track and capture the service traffic data of each microservice instance; the service traffic data includes: at least one of the request ID, tracking ID, source service name, target service name, and request duration.

3. The method according to claim 1, characterized in that The step of constructing a dynamic microservice topology diagram according to the service traffic data includes: Aggregating and analyzing the service traffic data to obtain call links between multiple microservice nodes and microservice nodes; Constructing a topological relationship of microservices according to the microservice nodes and the call links; In the topological relationship of the microservices, link flow information and link weight information are added to obtain a dynamic microservice topological relationship diagram; wherein the link flow information is calculated based on the integral of the total flow of microservices at both ends of the link within the sliding window time, and the calculation method of the link weight information includes at least one of the following: Calculated based on the frequency of microservice calls at both ends of the link within a given time; Calculated based on the callback frequency of microservices at both ends of the link within a given time; It is calculated by adding the experience coefficient according to the importance of the service.

4. The method according to claim 1, characterized in that: The step of evaluating candidate nodes from multiple dimensions based on the dynamic microservice topology relationship diagram and the node data to obtain target nodes includes: When there are microservice pods to be scheduled in the scheduling queue, at least two candidate nodes are determined based on the dynamic microservice topology relationship graph; According to the node data, each candidate node is evaluated from the node resource utilization dimension, the microservice communication network cost dimension, and the communication performance dimension to obtain an evaluation result; Based on the evaluation result, a target node is screened out from the candidate nodes.

5. The method according to claim 4, characterized in that The candidate nodes are evaluated from the perspectives of node resource utilization, microservice communication network cost, and communication performance to obtain evaluation results, including: Establish node resource utilization evaluation function, microservice communication network cost evaluation function, and communication performance evaluation function respectively; Convert the node resource utilization evaluation function, the microservice communication network cost evaluation function, and the communication performance evaluation function into a multi-objective optimization problem to obtain an objective function; Based on the objective function, each candidate node is evaluated to obtain an evaluation result.

6. The method according to any one of claims 1 to 5, characterized in that: After scheduling the microservice pod to the target node, the method further includes: Determine whether the microservice pod is successfully scheduled; If the scheduling is successful, the process ends; If the scheduling is unsuccessful, the microservice pod is added to the scheduling queue again.

7. A microservice scheduling device under a k8s cluster, characterized in that: The device comprises: The data collection module is used to collect node data of each node in the k8s cluster and service traffic data of each microservice instance; A topology perception module is used to construct a dynamic microservice topology relationship diagram based on the service traffic data; wherein the dynamic microservice topology relationship diagram includes: microservice nodes, call links, and link traffic information and link weight information; A scheduler extension module is used to evaluate candidate nodes from multiple dimensions based on the dynamic microservice topology relationship diagram and the node data, and screen out target nodes; The scheduling module is used to schedule the microservice pod to the target node.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. 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 method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • K8s-based resource scheduling method and device and storage medium

    CN110968424A

  • Construction method, device and equipment of distributed operation and maintenance simulation system

    CN113360361A

  • Node resource determination method and device, container scheduling method and device and storage medium

    CN118260031A

  • Scheduling method and system based on Kubernetes in cross-domain environment

    CN118784597A

  • Intelligent operation and maintenance method and system for cloud micro-service architecture

    CN119052096A

Cited By

  • Intelligent ship general assembly construction data service calling link tracking method

    CN120235590A

  • An intelligent ship assembly construction data service call link tracking method

    CN120235590B

  • Cloud computing task scheduling method based on privacy protection

    CN120315845A

  • A cloud computing task scheduling method based on privacy protection

    CN120315845B

  • Traffic scheduling method, traffic scheduling device, electronic equipment and storage medium

    CN121217667A