Resource scheduling method, device and storage medium
By querying the computing power value of the computing node in real time and converting resource requests, and correcting the resource requirements with the resource usage of the deployed Pod, the performance inconsistency caused by the computing power differences between Kubernetes nodes under the multi-CPU architecture is solved, and resource usage efficiency and consistency are improved.
Patent Information
- Application Number
- CN202410920718.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2044-07-10
AI Technical Summary
In container orchestration cluster Kubernetes with multi-CPU architecture, due to the computing power differences of computing nodes, the performance of Pod applications is inconsistent, which reduces the overall consistency of Kubernetes.
By querying the real-time computing power value of each computing node, the original resource request is converted into a standard resource request, and the resource requirements are corrected based on the actual resource usage of the deployed Pod, and the Pod is finally deployed to the computing node that meets the actual resource requirements.
It effectively reduces the risk of Pod runtime, improves the consistency of Pod deployment to different compute nodes, and improves the efficiency of resource usage in container orchestration cluster Kubernetes.
Smart Images

Figure CN118921284B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of container orchestration clusters, and in particular to a resource scheduling method, device and storage medium. Background Art
[0002] Due to the differences in servers purchased at different times, even if the server architecture is the same, there will be differences in computing power due to differences in generation and manufacturer. In addition, with the widespread use of non-x86 architecture processors, the demand for one cloud with multiple chips (that is, the cloud contains multiple CPU (central processing unit) architectures) has increased sharply. There are multiple CPU architectures in a container orchestration cluster Kubernetes, which makes the configuration of each computing node in Kubernetes different.
[0003] In this case, the specifications of the Request (minimum resource requirement) and Limit (maximum resource usage) of the application resource object Pod in Kubernetes are fixed. When the Pod is deployed to Nodes of different architectures, the same resources are allocated. If the computing power of the two Nodes is very different, the performance of the application in the Pod will be very different, which will reduce the consistency of Kubernetes. Summary of the invention
[0004] In view of this, the present invention provides a resource scheduling method, device and storage medium to keep the applicability of Pods similar and improve the consistency of Kubernetes.
[0005] A first aspect of the present invention provides a resource scheduling method for distributing computing nodes Node and application resource objects Pod in a container orchestration cluster Kubernetes, the method comprising:
[0006] Query the real-time computing power value of each computing node Node;
[0007] When receiving the original resource request sent by the application resource object Pod to be deployed for the computing node Node, converting the original resource request into a standard resource request according to the real-time computing power value of the computing node Node;
[0008] Correcting the standard resource request to the actual resource demand according to the actual resource usage of the deployed application resource object Pod;
[0009] The current application resource object Pod is deployed to the computing node Node that meets the actual resource requirements.
[0010] A second aspect of the present invention provides a resource scheduling device for distributing computing nodes Node and application resource objects Pod in a container orchestration cluster Kubernetes, the device comprising:
[0011] A real-time computing power value query module is used to query the real-time computing power value of each computing node Node;
[0012] A standard resource request conversion module, configured to, upon receiving an original resource request sent by the application resource object Pod to be currently deployed for the computing node Node, convert the original resource request into a standard resource request according to the real-time computing power value of the computing node Node;
[0013] An actual resource demand correction module, used to correct the standard resource request to the actual resource demand according to the actual resource usage of the deployed application resource object Pod;
[0014] The application resource object deployment module is used to deploy the current application resource object Pod to the computing node Node that meets the actual resource demand.
[0015] A third aspect of the present invention provides an electronic device, the electronic device comprising:
[0016] at least one processor; and
[0017] a memory communicatively connected to the at least one processor; wherein,
[0018] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the resource scheduling method as described in the first aspect above.
[0019] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the resource scheduling method as described in the first aspect above is implemented.
[0020] A fifth aspect of the present invention provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the resource scheduling method as described in the first aspect above is implemented.
[0021] In this embodiment, the real-time computing power value of each computing node Node is queried; when the original resource request sent by the current application resource object Pod to be deployed to the computing node Node is received, the original resource request is converted into a standard resource request according to the real-time computing power value of the computing node Node, thereby effectively reducing the risk of the application resource object Pod during operation; the standard resource request is corrected to the actual resource demand according to the actual resource usage of the deployed application resource object Pod; the current application resource object Pod is deployed to the computing node Node that meets the actual resource demand, thereby improving the consistency of the application resource object Pod deployed to different computing nodes Node and improving the resource usage in the container orchestration cluster Kubernetes.
[0022] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0024] Figure 1 This is a flow chart of a resource scheduling method provided in Example 1 of the present invention.
[0025] Figure 2 It is a structural diagram of a container orchestration cluster Kubernetes provided in Example 1 of the present invention.
[0026] Figure 3 is an example diagram of an exponential histogram provided in Embodiment 1 of the present invention;
[0027] Figure 4 It is a structural diagram of a resource scheduling device provided in Embodiment 2 of the present invention.
[0028] Figure 5 It is a structural schematic diagram of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can cover sequential implementations other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] Embodiment 1
[0032] See also Figure 1 , showing a flow chart of a resource scheduling method provided in the first embodiment of the present invention, the method can be executed by a resource scheduling device, the resource scheduling device can be implemented in the form of hardware and / or software, the resource scheduling device can be configured in an electronic device of a container orchestration cluster Kubernetes, and the computing node Node and the application resource object Pod are distributed in the container orchestration cluster Kubernetes, such as Figure 1 As shown, the method includes:
[0033] Step 101: Query the real-time computing power value of each computing node Node.
[0034] The container orchestration cluster Kubernetes, also known as K8s, is a cluster system that can automatically deploy, scale, and manage containerized applications. As a core component of cloud native technology, it helps users build, deploy, and manage microservice architecture applications through container orchestration capabilities; through automated container orchestration and resource scheduling, it achieves scalability and high availability of applications and simplifies container management.
[0035] At the same time, Kubernetes also provides a rich API (Application Programming Interface) and tool set, allowing users to flexibly control the life cycle of containers, including container creation, start, stop, upgrade, rollback and other operations.
[0036] In addition, Kubernetes also integrates network and storage management functions, simplifies the complexity of network communication and data storage between containers, and provides resource monitoring and log management functions, enabling users to monitor the usage of container resources in real time and diagnose the running status of applications.
[0037] In short, Kubernetes is a versatile and flexible container orchestration cluster that provides a solution for the management of containerized applications and improves the reliability and maintainability of applications. Its introduction allows developers to focus on application innovation and development without having to worry about the underlying container management and scheduling issues.
[0038] In general, if Figure 2 As shown in the figure, the container orchestration cluster Kubernetes has the following components:
[0039] 1. Control Plane
[0040] CONTROL PLANE refers to the container orchestration layer, which exposes APIs and interfaces to define, deploy containers, and manage the container lifecycle.
[0041] 2. Computing Node
[0042] A Node can be a virtual machine or a physical machine. Each Node contains the services required to run a Pod, and these Nodes are managed by the Controller Manager.
[0043] 3. Controller Manager
[0044] Controller Manager is a mechanism for managing and coordinating the state of resources in the cluster. Controller Manager monitors the difference between the actual state of Kubernetes and the expected state, and automatically adjusts and coordinates to ensure the continued normal operation of Kubernetes.
[0045] 4. Interface service (kube-api-server)
[0046] kube-api-server is one of the core components of Kubernetes. It provides HTTP REST (web service architecture based on hypertext protocol) interfaces such as CRUD, watch, etc. for distributed systems (etcd), schedulers, Controller Manager, and agents in Node (kubelet, kube-proxy). It is the data bus and data center of the entire Kubernetes.
[0047] 5. Application Resource Object (Pod)
[0048] A Pod is the smallest deployable computing unit created and managed in Kubernetes. It contains one or more containers with interfaces (CRI), shared storage, networks, and declarations on how to run these containers.
[0049] Pods are usually not created directly, but are created using workload resources. In the Pod configuration, the container uses the resources.requests and resources.limits methods to describe resource requirements and limits using the Request and Limit concepts. Among them, Request will be matched with the Node's resource capacity (capacity) when scheduling the container, and Limits indicates the upper limit of resources that the container can use when the node is running. When trying to overuse resources, the CPU will be constrained (throttled) and the memory will be terminated (oom-kill).
[0050] For example, the following Pod has two containers. The resources requested by each container are 0.25 CPU and 64 MiB of memory, and the resources limited by each container are 0.5 CPU and 128 MiB of memory. It can be considered that the resources requested by the Pod are 0.5 CPU and 128 MiB of memory, and the resources limited are 1 CPU and 256 MiB of memory.
[0051] apiVersion:v1
[0052] kind:Pod
[0053] metadata:
[0054] name:frontend
[0055] spec:
[0056] containers:
[0057] -name:app
[0058] image:images.my-company.example / app:v4
[0059] resources:
[0060] requests:
[0061] memory:"64Mi"
[0062] cpu:"250m"
[0063] limits:
[0064] memory:"128Mi"
[0065] cpu:"500m"
[0066] -name:log-aggregator
[0067] image:images.my-company.example / log-aggregator:v6
[0068] resources:
[0069] requests:
[0070] memory:"64Mi"
[0071] cpu:"250m"
[0072] limits:
[0073] memory:"128Mi"
[0074] cpu:"500m"
[0075] In this embodiment, a computing power detection device can be deployed in each Node. The computing power detection device periodically executes a computing power detection function to detect the amount of resources in the Node in real time, and converts the amount of resources into a computing power value of the Node where it is located, which is recorded as a real-time computing power value. Then, the real-time computing power value can represent the real computing power of the Node. The computing power detection device can send the real-time computing power value to a management node in Kubernetes (such as a Node or Controller Manager with management functions). Then, the management node in Kubernetes can periodically receive and store the real-time computing power value of each Node.
[0076] Step 102: upon receiving the original resource request sent by the application resource object Pod to be currently deployed to the computing node Node, convert the original resource request into a standard resource request according to the real-time computing power value of the computing node Node.
[0077] If the management node in Kubernetes receives an original resource request for a Pod that is waiting to be deployed in a Node, it can convert the original resource request into a standard resource request based on the real-time computing power value of each Node with the goal of maintaining consistency between the Nodes.
[0078] In one embodiment of the present invention, step 102 may include the following steps:
[0079] Step 1021: Take the absolute value of the difference between the real-time computing power value of the computing node Node and the preset reference computing power value as the deviation computing power value.
[0080] In this embodiment, the management node in Kubernetes can calculate the benchmark computing power value based on the real-time computing power values of all Nodes, where the benchmark computing power value is a specified quantile (such as a quartile) on the sum of the real-time computing power values of all computing nodes Node.
[0081] Calculate the difference between the current Node's real-time computing power value and the benchmark computing power value, take the absolute value of the difference between the current Node's real-time computing power value and the benchmark computing power value, record it as the deviation computing power value, and compare the deviation computing power value with the preset computing power threshold.
[0082] The original resource request of the Pod can be regarded as the resource request of the baseline computing power value, and the standard resource request of the Pod can be regarded as the resource request of the real-time computing power value. By comparing the real-time computing power value of the Node with the baseline computing power value using the preset computing power threshold, it is possible to determine the degree of impact on the application experience of the Pod when deploying the Pod to the Node.
[0083] For example, if the original resource request of the Pod is a 2-core CPU, it can be considered that the Pod requests a 2-core CPU with a real-time computing power value equal to the benchmark computing power value.
[0084] Generally speaking, the preset computing power threshold can be set differently based on experimental experience.
[0085] Step 1022: If the deviation computing power value is less than or equal to the preset computing power threshold, the original resource request is maintained unchanged as a standard resource request, and the original resource request in the resource declaration field of the application resource object Pod to be deployed is maintained unchanged.
[0086] If the deviation computing power value is less than or equal to the preset computing power threshold, that is, the real-time computing power value of the Node is slightly different from the benchmark computing power value, it can be considered that when the Pod is deployed to the Node, the application experience of the Node will be less affected. In this case, the original resource request can be maintained unchanged and recorded as the standard resource request. In addition, the original resource request in the resource declaration field of the Pod to be deployed is maintained unchanged.
[0087] Step 1023: If the deviation computing power value is greater than the preset computing power threshold, the original resource request is converted into a standard resource request based on the real-time computing power value and the benchmark computing power value of the computing node Node, and the original resource request in the resource declaration field of the application resource object Pod to be deployed is replaced with the standard resource request.
[0088] If the deviation computing power value is greater than the preset computing power threshold, that is, the real-time computing power value of the Node is significantly different from the benchmark computing power value, it can be considered that when the Pod is deployed to the Node, the application experience of the Node will be greatly affected. Therefore, in order to make the application experience of the Pod consistent, the original resource request is dynamically converted into a standard resource request based on the real-time computing power value of the computing node Node and the benchmark computing power value, so that the standard resource request is greater than the original resource request and is within a reasonable range. For example, the standard resource request is set from a 2-core CPU to a 4-core CPU.
[0089] Generally speaking, the deviation computing power value is positively correlated with the deviation resource value, where the deviation resource value is the difference between the original resource request and the standard resource request. That is, the greater the absolute value of the difference between the real-time computing power value of the Node and the preset benchmark computing power value, the greater the difference between the original resource request and the standard resource request. Conversely, the smaller the absolute value of the difference between the real-time computing power value of the Node and the preset benchmark computing power value, the smaller the difference between the original resource request and the standard resource request.
[0090] Furthermore, when the real-time computing power value of the Node is less than the benchmark computing power value, the standard resource request of the Pod is greater than the original resource request; when the real-time computing power value of the Node is greater than the benchmark computing power value, the standard resource request of the Pod is less than the original resource request.
[0091] Under this principle, the method of converting original resource requests into standard resource requests can be set according to actual business needs.
[0092] In one conversion method, the real-time computing power value and the benchmark computing power value of the computing node Node are substituted into the following formula to correct the resource usage in the original resource request and obtain the standard resource request:
[0093]
[0094] Among them, sr is the resource usage in the standard resource request, r is the resource usage in the original resource request, sc is the benchmark computing power value, and c is the real-time computing power value of the computing node Node.
[0095] When the resource usage in the standard resource request is a decimal, the resource usage in the standard resource request may be rounded up.
[0096] For example, the original resource request of the Pod is CPU600m, the real-time computing power value of a Node is 50, and the baseline computing power value is 85. Then the standard resource request = 600 + 600 * (85-50) / 85 = 848, and the standard resource request of the Pod deployed to the Node is CPU848m.
[0097] Additionally, replace the original resource requests in the Pod's resource declaration field ( resources.requests ) with standard resource requests.
[0098] Exemplarily, the process of replacing the original resource request in the resource declaration field (resources.requests) of the Pod with the standard resource request is as follows:
[0099] requests:
[0100] memory:"100Mi"
[0101] cpu:"848m"
[0102] Step 103: Correct the standard resource request to the actual resource demand based on the actual resource usage of the deployed application resource object Pod.
[0103] In this embodiment, the actual resource usage of the deployed application resource object Pod in the Node of Kubernetes can be monitored, and the standard resource request can be corrected to the actual resource demand based on the actual resource usage of the deployed application resource object Pod.
[0104] In one embodiment of the present invention, step 103 may include the following steps:
[0105] Step 1031: When the current application resource object Pod is deployed for the first time, the minimum resource requirement Request in the standard resource request is multiplied by a preset ratio to obtain the actual resource requirement.
[0106] In Kubernetes, Request is usually more important during scheduling, and Limit is usually more important during runtime.
[0107] In actual use, there are limitations on the setting specifications of Request and Limit in Pod. The business side hopes to reserve a considerable amount of resource redundancy to cope with load fluctuations in upstream and downstream links and ensure the stability of online applications. Usually, a higher Request is set for the business according to the maximum resource demand, but the actual resources used are far less than its Request for a long time.
[0108] For the business side, billing by request will lead to increased costs, and when the container exits abnormally or is rescheduled, large-scale containers may not be scheduled due to Kubernetes idle resource fragments.
[0109] On the platform side, this will result in a high resource packing rate for Kubernetes and low Node utilization, resulting in a large number of idle resources that cannot be scheduled, resulting in a waste of computing power.
[0110] In this embodiment, considering the difference in computing power in multi-architecture Kubernetes and the fact that a higher Request is usually set when the business side applies for resource rules, the Request is reasonably set in resources.requests to ensure that the container obtains sufficient resources to run and reduce the idle resource fragments of Kubernetes, thereby reducing the application runtime risk and improving resource usage.
[0111] When a Pod is deployed for the first time (no recommended value or the recommended value is not effective), a static controllable overselling solution can be implemented to reduce the Pod's standard resource request by a certain proportion to obtain the actual resource demand. The proportion can be derived from the static coefficient set based on prior knowledge, that is, the static coefficients for different Kubernetes, different computer rooms, and different environments are set based on operational experience, and are automatically modified by the custom PodModifier component.
[0112] For example, the standard resource request specification of a Pod is Request for 1 core, Limit for 2 cores, and a fixed static coefficient of 0.7. Then, the Request is updated to 0.7 cores, and Kubernetes performs scheduling and deployment based on the revised Request.
[0113] Step 1032: When the current application resource object Pod is not deployed for the first time, monitor the actual resource usage of the deployed application resource object Pod.
[0114] When it is not the first time to deploy a Pod, you can implement a dynamically controllable overselling solution and deploy a custom monitoring component StandardRecommend in Kubernetes. The monitoring component monitors the actual resource usage of the deployed Pod in real time and modifies the standard resource request based on the actual resource usage of the deployed Pod.
[0115] In the specific implementation, the controller in the container orchestration cluster Kubernetes is configured (profile) to listen to the template custom resource (template crd).
[0116] Create recommendation custom resources (recommendation crd) in multiple dimensions based on template custom resources, such as namespace, workload, or pod.
[0117] Perform initialization operations to determine whether there is a periodic (such as 1 minute) checkpoint. If not, you can choose subsequent operations. If so, recover directly from the checkpoint.
[0118] Execute the loop, determine the deployed application resource object Pod to be managed from the recommended custom resources, and obtain the resource object list (pod labels).
[0119] Pull resource data with timestamp (i.e. sampling time) from the aggregator (metrics server) in the container orchestration cluster Kubernetes according to the namespace of the deployed application resource object Pod to be managed in the resource object list.
[0120] Aggregate resource data (container) into the actual resource usage of the deployed application resource object Pod to be managed.
[0121] Step 1033: Correct the minimum resource requirement Request in the standard resource request according to the actual resource usage of the deployed application resource object Pod to obtain the actual resource requirement.
[0122] In this embodiment, the minimum resource requirement Request in the standard resource request may be corrected with reference to the actual resource usage of the deployed Pod to obtain the actual resource requirement.
[0123] In one embodiment of the present invention, step 1033 may further include the following steps:
[0124] Step 10331: Query the resource type corresponding to the actual resource usage of the deployed application resource object Pod.
[0125] In this embodiment, the resource type corresponding to the actual resource usage of the deployed Pod can be queried, and the resource type includes memory resources and processor (CPU) resources.
[0126] Step 10332: If the resource type is memory resource, a fixed resource weight is configured for the actual resource usage of the deployed application resource object Pod.
[0127] If the resource type is memory resource, which is an incompressible resource, a fixed resource weight, such as 1.0, is configured for the actual resource usage of the deployed Pod.
[0128] Step 10333: If the resource type is processor resources, query the sampling time corresponding to the actual resource usage of the deployed application resource object Pod.
[0129] Step 10334: Attenuate the sampling time to obtain the resource weight of the actual resource usage of the deployed application resource object Pod.
[0130] If the resource type is processor resources, you can query the sampling time corresponding to the actual resource usage of the deployed Pod, and use the time decay mode to determine the resource weight of the actual resource usage of the deployed Pod.
[0131] Exemplarily, a half-life sliding window model may be used to attenuate the resource weight of the actual resource usage of the deployed Pod, thereby determining the resource weight of the actual resource usage of the deployed Pod.
[0132] In this example, the query is for the reference time set in the process of monitoring the actual resource usage of the deployed application resource object Pod, such as the most recent 0:00.
[0133] Substitute the sampling time and reference time into the following formula to calculate the attenuation coefficient:
[0134]
[0135] Among them, w is the attenuation coefficient, timestamp is the sampling time, referenceTimestamp is the reference time, and halfLife is the half-life. That is, after the half-life, the resource weight is reduced to half. For the actual resource usage of the deployed Pod, the half-life can be set to 24 hours.
[0136] Considering that before the reference time, the farther the actual resource usage of the deployed Pod is from the reference time, the lower the resource weight is; after the reference time, the farther the actual resource usage of the deployed Pod is from the reference time, the higher the resource weight is. Therefore, the fixed resource weight (such as 1.0) can be multiplied by the attenuation coefficient to obtain the resource weight of the actual resource usage of the deployed application resource object Pod.
[0137] Step 10335: Calculate the recommended value for the standard resource request based on the actual resource usage and resource weight of the deployed application resource object Pod.
[0138] In this embodiment, the actual resource usage and resource weight of a deployed application resource object Pod may be used as a reference to calculate a recommended value for a standard resource request.
[0139] In the specific implementation, on each wordload, an index histogram is constructed for the resource type corresponding to the actual resource usage of the deployed application resource object Pod.
[0140] Among them, the horizontal axis of the exponential histogram is defined as resource usage, and the vertical axis is defined as resource weight. The exponential histogram is divided into multiple buckets, and the size of each bucket gradually increases at an exponential rate.
[0141] The sample storage method of the exponential histogram facilitates regular checkpoint saving and can significantly improve the program recovery performance.
[0142] For example, Figure 3 In the exponential histogram shown, the resource usage statistics interval increases by about 5%. The subscript of the bucket is N, and the size of the bucket increases exponentially bucketSize = 0.01 × 1.05 N , the size of the bucket with subscript 0 is 0.01, and the range is [0,0.01), and the size of the bucket with subscript 1 is 0.01×1.05 1 =0.0105, accommodating the range [0.01,0.0205), and the range [0.01,173] can be completely preserved with about two hundred buckets.
[0143] When the actual resource usage of the deployed application resource object Pod is within the range of a bucket, the actual resource usage of the deployed application resource object Pod is placed in the bucket. At this time, the bucket increases the resource weight corresponding to the actual resource usage of the deployed application resource object Pod.
[0144] For each bucket, calculate the sum of the actual resource usage of the deployed application resource object Pod in the bucket and the corresponding resource weight to obtain the bucket weight.
[0145] Query the percentile value of the resource type setting corresponding to the actual resource usage of the deployed application resource object Pod, multiply the sum of all bucket weights by the percentile value, and get the recommended value of the standard resource request.
[0146] For example, Figure 3The exponential histogram shown in the figure considers that the processor resources fluctuate greatly and are compressible, so the 95% percentile (P95) can be used. The memory resources are incompressible, so the 99% percentile (P99) is used. Assuming that the application percentile is 95%, the recommended value W(95) = 95% × the bucket weight of all buckets.
[0147] If the first three buckets are considered, the sum of the bucket weights is 20, so the recommended value is 19.
[0148] Furthermore, the largest bucket is accumulated from the smallest bucket, and this weight is recorded as S. When S≥W(95), the subscript of the bucket is N, then the minimum boundary value of the bucket with subscript N+1 is the 95% percentile value.
[0149] For example, Figure 3 In the exponential histogram shown, when N=3, S≥W(95), the 95% quantile is 0.01×1.05 2 .
[0150] Step 10336: If the recommended value is less than the minimum resource requirement Request in the standard resource request, the recommended value is assigned to the minimum resource requirement Request in the standard resource request as the actual resource requirement.
[0151] Step 10337: If the recommended value is greater than or equal to the minimum resource requirement Request in the standard resource request, the minimum resource requirement Request in the standard resource request is maintained unchanged as the actual resource requirement.
[0152] In this embodiment, the recommended value may be greater than or equal to the minimum resource requirement Request in the standard resource request for comparison.
[0153] If the recommended value is less than the minimum resource requirement Request in the standard resource request, the recommended value may be assigned to the minimum resource requirement Request in the standard resource request to obtain the actual resource requirement.
[0154] If the recommended value is greater than or equal to the minimum resource requirement Request in the standard resource request, the minimum resource requirement Request in the standard resource request can be maintained unchanged to obtain the actual resource requirement.
[0155] This embodiment reduces the request of the business container to a reasonable value through a dynamically controllable overselling solution, reduces the business usage cost, alleviates the problem of insufficient Kubernetes resources, and improves the node utilization rate.
[0156] Step 104: deploy the current application resource object Pod to a computing node Node that meets actual resource requirements.
[0157] In this embodiment, each Node in Kubernetes can be traversed to select a Node that meets the actual resource requirements of the current Pod, deploy the current Pod on the Node, and allocate the resources required for the actual resource requirements to the current Pod.
[0158] In this embodiment, the real-time computing power value of each computing node Node is queried; when the original resource request sent by the current application resource object Pod to be deployed to the computing node Node is received, the original resource request is converted into a standard resource request according to the real-time computing power value of the computing node Node, thereby effectively reducing the risk of the application resource object Pod during operation; the standard resource request is corrected to the actual resource demand according to the actual resource usage of the deployed application resource object Pod; the current application resource object Pod is deployed to the computing node Node that meets the actual resource demand, thereby improving the consistency of the application resource object Pod deployed to different computing nodes Node and improving the resource usage in the container orchestration cluster Kubernetes.
[0159] Embodiment 2
[0160] See also Figure 4 , showing a schematic diagram of the structure of a resource scheduling device provided by Embodiment 2 of the present invention. In the container orchestration cluster Kubernetes, computing nodes Node and application resource objects Pod are distributed, such as Figure 4 As shown, the device comprises:
[0161] A real-time computing power value query module 401 is used to query the real-time computing power value of each computing node Node;
[0162] The standard resource request conversion module 402 is used to convert the original resource request to the standard resource request according to the real-time computing power value of the computing node Node when receiving the original resource request sent by the application resource object Pod currently to be deployed for the computing node Node;
[0163] The actual resource demand correction module 403 is used to correct the standard resource request to the actual resource demand according to the actual resource usage of the deployed application resource object Pod;
[0164] The application resource object deployment module 404 is used to deploy the current application resource object Pod to the computing node Node that meets the actual resource demand.
[0165] In one embodiment of the present invention, the standard resource request conversion module 402 includes:
[0166] The deviation computing power value calculation module is used to take the absolute value of the difference between the real-time computing power value of the computing node Node and the reference computing power value as the deviation computing power value; the reference computing power value is a specified quantile on the sum of the real-time computing power values of all the computing nodes Node;
[0167] The original resource request maintaining module is used to maintain the original resource request unchanged as a standard resource request if the deviation computing power value is less than or equal to a preset computing power threshold, and maintain the original resource request in the resource declaration field of the application resource object Pod to be deployed unchanged;
[0168] An original resource request conversion module is used to convert the original resource request into a standard resource request according to the real-time computing power value of the computing node Node and the benchmark computing power value if the deviation computing power value is greater than a preset computing power threshold, and replace the original resource request in the resource declaration field of the application resource object Pod to be deployed with the standard resource request;
[0169] The deviation computing power value is positively correlated with the deviation resource value, and the deviation resource value is the difference between the original resource request and the standard resource request.
[0170] In one embodiment of the present invention, the original resource request conversion module includes:
[0171] The resource usage correction module is used to substitute the real-time computing power value of the computing node Node and the reference computing power value into the following formula to correct the resource usage in the original resource request to obtain a standard resource request:
[0172]
[0173] Among them, sr is the resource usage in the standard resource request, r is the resource usage in the original resource request, sc is the benchmark computing power value, and c is the real-time computing power value of the computing node Node.
[0174] In one embodiment of the present invention, the actual resource demand correction module 403 includes:
[0175] A resource usage static reduction module, used to multiply the minimum resource requirement Request in the standard resource request by a preset ratio when the current application resource object Pod is deployed for the first time, to obtain the actual resource requirement;
[0176] A resource usage monitoring module, used to monitor the actual resource usage of the deployed application resource object Pod when the current application resource object Pod is not deployed for the first time;
[0177] The minimum resource requirement correction module is used to correct the minimum resource requirement Request in the standard resource request according to the actual resource usage of the deployed application resource object Pod to obtain the actual resource requirement.
[0178] In one embodiment of the present invention, the resource usage monitoring module includes:
[0179] A template custom resource definition module is used to configure the controller in the container orchestration cluster Kubernetes to listen to the template custom resource;
[0180] A recommended custom resource creation module, used to create recommended custom resources in multiple dimensions based on the template custom resources;
[0181] An application resource object management module, used to determine the application resource object Pod to be managed and deployed from the recommended custom resources;
[0182] A resource data pulling module is used to pull resource data from the aggregator in the container orchestration cluster Kubernetes according to the namespace of the application resource object Pod to be managed and deployed;
[0183] The resource data aggregation module is used to aggregate the resource data into the actual resource usage of the application resource object Pod that is to be managed and has been deployed.
[0184] In one embodiment of the present invention, the minimum resource requirement correction module includes:
[0185] A resource type query module is used to query the resource type corresponding to the actual resource usage of the deployed application resource object Pod;
[0186] A resource weight configuration module, for configuring a fixed resource weight for the actual resource usage of the deployed application resource object Pod if the resource type is a memory resource;
[0187] A sampling time query module, used to query the sampling time corresponding to the actual resource usage of the deployed application resource object Pod if the resource type is a processor resource;
[0188] A sampling time attenuation module, used to attenuate the sampling time to obtain the resource weight of the actual resource usage of the deployed application resource object Pod;
[0189] A recommended value calculation module, used to calculate a recommended value for the standard resource request in combination with the actual resource usage of the deployed application resource object Pod and the resource weight;
[0190] A recommended value assignment module, configured to assign the recommended value to the minimum resource requirement Request in the standard resource request as the actual resource requirement if the recommended value is less than the minimum resource requirement Request in the standard resource request;
[0191] The minimum resource requirement maintaining module is used to maintain the minimum resource requirement Request in the standard resource request unchanged as the actual resource requirement if the recommended value is greater than or equal to the minimum resource requirement Request in the standard resource request.
[0192] In one embodiment of the present invention, the sampling time decay module comprises:
[0193] A reference time query module, used to query the reference time set in the process of monitoring the actual resource usage of the deployed application resource object Pod;
[0194] The attenuation coefficient calculation module is used to substitute the sampling time and the reference time into the following formula for calculation to obtain the attenuation coefficient:
[0195]
[0196] Wherein, w is the attenuation coefficient, timestamp is the sampling time, referenceTimestamp is the reference time, and halfLife is the half-life;
[0197] The resource weight decay module is used to multiply the fixed resource weight by the decay coefficient to obtain the resource weight of the actual resource usage of the deployed application resource object Pod.
[0198] In one embodiment of the present invention, the recommendation value calculation module includes:
[0199] An index histogram construction module is used to construct an index histogram for resource types corresponding to actual resource usage of the deployed application resource object Pod; the index histogram is divided into multiple buckets;
[0200] A data bucketing module, used for putting the actual resource usage of the deployed application resource object Pod into the bucket when the actual resource usage of the deployed application resource object Pod is within the range of a certain bucket;
[0201] A bucket weight calculation module is used to calculate, for each bucket, the sum of the actual resource usage of the application resource object Pod deployed in the bucket and the resource weight, to obtain the bucket weight;
[0202] A percentile query module is used to query the percentile value set for the resource type corresponding to the actual resource usage of the deployed application resource object Pod;
[0203] The bucket quantile calculation module is used to multiply the sum of all the bucket weights by the quantile value to obtain the recommended value of the standard resource request.
[0204] The resource scheduling device provided in the embodiment of the present invention can execute the resource scheduling method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the resource scheduling method.
[0205] Embodiment 3
[0206] See also Figure 5 , shows a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0207] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0208] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0209] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the resource scheduling method.
[0210] In some embodiments, the resource scheduling method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the resource scheduling method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the resource scheduling method in any other appropriate manner (e.g., by means of firmware).
[0211] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0212] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0213] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0214] Embodiment 4
[0215] An embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the resource scheduling method provided by any embodiment of the present invention is implemented.
[0216] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0217] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A resource scheduling method, characterized in that: Distributing computing nodes Node and application resource objects Pod in a container orchestration cluster Kubernetes, the method comprising: Query the real-time computing power value of each computing node Node; When receiving the original resource request sent by the application resource object Pod to be deployed for the computing node Node, converting the original resource request into a standard resource request according to the real-time computing power value of the computing node Node; Correcting the standard resource request to the actual resource demand according to the actual resource usage of the deployed application resource object Pod; Deploy the current application resource object Pod to the computing node Node that meets the actual resource requirements; The step of correcting the standard resource request to the actual resource demand according to the actual resource usage of the deployed application resource object Pod includes: When the current application resource object Pod is deployed for the first time, the minimum resource requirement Request in the standard resource request is multiplied by a preset ratio to obtain the actual resource requirement; When the current application resource object Pod is not deployed for the first time, monitoring the actual resource usage of the deployed application resource object Pod; Correct the minimum resource requirement Request in the standard resource request according to the actual resource usage of the deployed application resource object Pod to obtain the actual resource requirement; The step of correcting the minimum resource requirement Request in the standard resource request according to the actual resource usage of the deployed application resource object Pod to obtain the actual resource requirement includes: Query the resource type corresponding to the actual resource usage of the deployed application resource object Pod; the resource type includes memory resources and processor resources; If the resource type is a memory resource, a fixed resource weight is configured for the actual resource usage of the deployed application resource object Pod; If the resource type is a processor resource, query the sampling time corresponding to the actual resource usage of the deployed application resource object Pod; Attenuating the sampling time to obtain a resource weight of the actual resource usage of the deployed application resource object Pod; Calculate a recommended value for the standard resource request based on the actual resource usage of the deployed application resource object Pod and the resource weight; If the recommended value is less than the minimum resource requirement Request in the standard resource request, assigning the recommended value to the minimum resource requirement Request in the standard resource request as the actual resource requirement; If the recommended value is greater than or equal to the minimum resource requirement Request in the standard resource request, the minimum resource requirement Request in the standard resource request is maintained unchanged as the actual resource requirement.
2. The method according to claim 1, characterized in that The converting the original resource request into a standard resource request according to the real-time computing power value of the computing node Node includes: The absolute value of the difference between the real-time computing power value of the computing node Node and the benchmark computing power value is taken as the deviation computing power value; the benchmark computing power value is a specified quantile on the sum of the real-time computing power values of all the computing nodes Node; If the deviation computing power value is less than or equal to the preset computing power threshold, the original resource request is maintained unchanged as a standard resource request, and the original resource request in the resource declaration field of the application resource object Pod to be deployed is maintained unchanged; If the deviation computing power value is greater than the preset computing power threshold, the original resource request is converted into a standard resource request according to the real-time computing power value of the computing node Node and the benchmark computing power value, and the original resource request in the resource declaration field of the application resource object Pod to be deployed is replaced with the standard resource request; The deviation computing power value is positively correlated with the deviation resource value, and the deviation resource value is the difference between the original resource request and the standard resource request.
3. The method according to claim 2, characterized in that The converting the original resource request into a standard resource request according to the real-time computing power value of the computing node Node and the benchmark computing power value includes: Substitute the real-time computing power value of the computing node Node and the benchmark computing power value into the following formula to correct the resource usage in the original resource request to obtain a standard resource request: Among them, sr is the resource usage in the standard resource request, r is the resource usage in the original resource request, sc is the benchmark computing power value, and c is the real-time computing power value of the computing node Node.
4. The method according to claim 1, characterized in that: The monitoring of the actual resource usage of the deployed application resource object Pod includes: Configure the controller listening template custom resource in the container orchestration cluster Kubernetes; Creating recommended custom resources in multiple dimensions based on the template custom resources; Determine the application resource object Pod to be managed and deployed from the recommended custom resources; Pull resource data from the aggregator in the container orchestration cluster Kubernetes according to the namespace of the application resource object Pod to be managed and deployed; The resource data is aggregated into the actual resource usage of the application resource object Pod to be managed and deployed.
5. The method according to claim 1, characterized in that The attenuating the sampling time to obtain the resource weight of the actual resource usage of the deployed application resource object Pod includes: Query the reference time set in the process of monitoring the actual resource usage of the deployed application resource object Pod; Substitute the sampling time and the reference time into the following formula for calculation to obtain the attenuation coefficient: Wherein, w is the attenuation coefficient, timestamp is the sampling time, referenceTimestamp is the reference time, and halfLife is the half-life; The fixed resource weight is multiplied by the attenuation coefficient to obtain the resource weight of the actual resource usage of the deployed application resource object Pod.
6. The method according to claim 1, characterized in that The calculating a recommended value for the standard resource request based on the actual resource usage of the deployed application resource object Pod and the resource weight includes: Constructing an index histogram for resource types corresponding to actual resource usage of the deployed application resource object Pod; dividing the index histogram into multiple buckets; When the actual resource usage of the deployed application resource object Pod is within the range of a certain bucket, the actual resource usage of the deployed application resource object Pod is placed into the bucket; For each of the buckets, the actual resource usage of the application resource object Pod deployed in the bucket and the sum of the resource weights are calculated to obtain the bucket weight; Query the percentile value of the resource type setting corresponding to the actual resource usage of the deployed application resource object Pod; The recommended value of the standard resource request is obtained by multiplying the sum of all the bucket weights by the percentile value.
7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the resource scheduling method according to any one of claims 1 to 6.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the resource scheduling method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Container cluster computing power scheduling method and related device
CN115562843A