Task processing method, device, electronic device, storage medium and program product
By predicting the resource requirements of the container group and combining the remaining resources of the nodes, selecting the most suitable node from multiple nodes to schedule the container group, the problem of low accuracy in resource request scheduling in the prior art is solved, and more efficient resource utilization and load balancing are achieved.
Patent Information
- Application Number
- CN202410518047.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-26
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2044-04-26
AI Technical Summary
In the prior art, when determining nodes for container groups to be scheduled, the accuracy of resource request scheduling is low, resulting in problems of load imbalance and resource waste.
By obtaining the historical resource usage of the container group, predicting its required resource amount, and combining the remaining allocable resources of the task processing node, the most suitable target node is determined from multiple nodes to schedule the container group to perform tasks.
It improves the accuracy of container group node allocation, reduces the possibility of load imbalance and resource waste, and improves resource utilization.
Smart Images

Figure CN118860587B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, for example, may involve fields such as cloud technology and database processing. Specifically, the present application relates to a method, device, electronic device, storage medium and program product for task processing. Background Art
[0002] Kubernetes (K8s) is a container-based cluster management platform. Multiple nodes and multiple container groups are deployed in the cluster managed by K8s. When executing processing tasks, the container group can carry the tasks to be processed and be scheduled to the corresponding node to run the task. Therefore, how to determine the corresponding node for the container group to be scheduled from multiple nodes becomes a key issue.
[0003] In the related art, Kube-Scheduler is used to determine the corresponding node for the container group to be scheduled from multiple nodes. Specifically, Kube-Scheduler is a scheduler officially provided by Kubernetes, which is used to process scheduling requests for container groups. Kube-Scheduler makes scheduling decisions by comparing the resource requirements statically declared by the container group with the total resource specifications of each node. When the total amount of resources declared by the container group to be scheduled and the declared resources of the container group scheduled by the node is less than the total resource specifications of the node, the container group can be scheduled to the node.
[0004] However, in the above technology, the container group can only be scheduled according to the resource request to execute the pending tasks on the corresponding node, so that the accuracy of determining the node to be scheduled for the container group may be low, which may lead to a series of load imbalance problems. For example, for some nodes, the actual load is not much different from the resource request, which will lead to a high probability of stability problems. For other nodes, the actual node load is much less than the resource request, which will lead to resource waste. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a method, device, electronic device, storage medium and program product for task processing, so as to reduce the problem of load imbalance that may be caused when determining the corresponding node for the container group to be scheduled to execute the task to be processed. In order to achieve the above purpose, the technical solution provided by the embodiments of the present application is as follows:
[0006] In a first aspect, a method for task processing is provided, the method comprising:
[0007] Determine at least one container group to be scheduled, each container group corresponding to at least one processing task;
[0008] Obtaining the required resources corresponding to each container group to be scheduled within a preset time period; wherein the required resources include: required resource quantity, the required resource quantity corresponding to a container group to be scheduled within the preset time period is obtained based on the historical resource usage prediction corresponding to the container group to be scheduled;
[0009] Determine the remaining allocatable resources corresponding to each task processing node in the task processing node cluster in the preset time period; wherein at least two task processing nodes are deployed in the cluster, and the remaining allocatable resources include: the remaining allocatable resource amount;
[0010] For each container group to be scheduled, based on the required resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to each task processing node, a target node corresponding to the container group to be scheduled is determined from the at least two task processing nodes, so that the container group to be scheduled is run in the target node to execute the at least one processing task.
[0011] In a possible implementation, determining a target node corresponding to the container group to be scheduled from the at least two task processing nodes based on the required resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to each task processing node includes:
[0012] Based on the remaining allocatable resources corresponding to each task processing node, at least one candidate node that meets the required resource amount corresponding to the container group to be scheduled is selected from each task processing node;
[0013] Based on the required resource amount corresponding to the container group to be scheduled and the remaining allocatable resource amount corresponding to each candidate node, a target node corresponding to the container group to be scheduled is determined from the candidate nodes.
[0014] In another possible implementation, the preset time period includes at least two unit times, the demand resources corresponding to the container group to be scheduled include the demand resource amounts corresponding to each unit time within the preset time, and the remaining allocatable resources corresponding to each task processing node include the remaining allocatable resource amounts corresponding to each unit time within the preset time;
[0015] The method of selecting at least one candidate node that meets the required resource amount corresponding to the container group to be scheduled from each task processing node based on the remaining allocatable resource amount corresponding to each task processing node includes:
[0016] Based on the remaining allocatable resources corresponding to each task processing node at each unit time, and the required resources corresponding to each unit time of the container group to be scheduled, at least one candidate node is selected from the task processing nodes;
[0017] For each unit time, the remaining allocatable resources corresponding to each candidate node in the unit time are greater than the required resources corresponding to the unit time.
[0018] In another possible implementation, determining a target node corresponding to the container group to be scheduled from the at least two task processing nodes based on the required resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to each task processing node includes:
[0019] For each task processing node, based on the required resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to the task processing node, determine the resource matching degree between the task processing node and the container group to be scheduled;
[0020] The target node is determined from the at least two task processing nodes based on the resource matching degree corresponding to each of the processing task nodes in the at least two task processing nodes.
[0021] In another possible implementation, the preset time period includes at least two unit times, the demand resources corresponding to the container group to be scheduled include the demand resource amounts corresponding to each unit time within the preset time, and the remaining allocatable resources corresponding to each task processing node include the remaining allocatable resource amounts corresponding to each unit time within the preset time;
[0022] The determining, based on the required resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to the task processing node, a resource matching degree between the task processing node and the container group to be scheduled includes:
[0023] Based on the required resource amounts corresponding to the container group to be scheduled in the at least two unit times, constructing a required resource matrix of the container group to be scheduled;
[0024] Based on the remaining allocatable resource amounts of the task processing node corresponding to the at least two unit times, constructing a remaining allocatable resource matrix of the task processing node;
[0025] Based on the required resource matrix and the remaining allocatable resource matrix, determining at least one resource similarity between the task processing node and the container group to be scheduled in at least one manner;
[0026] Based on the at least one resource similarity, a resource matching degree between the task processing node and the container group to be scheduled is determined.
[0027] In another possible implementation, for each of the task processing nodes, determining the remaining allocatable resources corresponding to the task processing node in the preset time period includes:
[0028] Obtain the required resources corresponding to each container group running in the task processing node;
[0029] Determine the allocated resources corresponding to the task processing node based on the required resources corresponding to each container group;
[0030] Acquire initial allocatable resources corresponding to the task processing node; wherein the initial allocatable resources corresponding to the task processing node are allocatable resources corresponding to when the processing node does not run any container group;
[0031] Based on the initial allocatable resources corresponding to the task processing node and the allocated resources corresponding to the task processing node, the remaining allocatable resources corresponding to the task processing node are determined.
[0032] In another possible implementation, the method further includes:
[0033] Acquire the historical resource usage corresponding to each container group in real time; wherein each container group includes the container group to be scheduled and each container group running in each task processing node, and the historical resource usage corresponding to any container group is the resource usage occupied by the container group when running the historical processing task;
[0034] Based on the historical resource usage of each container group, the required resource volume of each container group is predicted;
[0035] The required resource amounts corresponding to each of the container groups are stored.
[0036] In another possible implementation, the required resources corresponding to a container group to be scheduled are represented by a resource matrix, the number of columns of the resource matrix is equal to the number of unit times included in the preset time period, and the number of rows is equal to the number of types of resources required for a container group to run the task to be processed;
[0037] The method further comprises:
[0038] If the required resources corresponding to the container group to be scheduled are not obtained, the resource amount declared by the container group to be scheduled is obtained; wherein the resource amount declared by the container group to be scheduled is represented by a matrix, and each column of data is the resource amount corresponding to each type of resource declared by the task to be processed;
[0039] The resource amount declared by the container group to be scheduled is determined as the required resource amount corresponding to the container group to be scheduled within a preset time period.
[0040] In a second aspect, a task processing device is provided, the device comprising:
[0041] A first determining module, configured to determine at least one container group to be scheduled, each container group corresponding to at least one processing task;
[0042] The first acquisition module is used to obtain the required resources corresponding to each container group to be scheduled within a preset time period; wherein the required resources include: the required resource amount, and the required resource amount corresponding to a container group to be scheduled within the preset time period is obtained based on the historical resource usage prediction corresponding to the container group to be scheduled;
[0043] The second determination module is used to determine the remaining allocatable resources corresponding to each task processing node in the task processing node cluster in the preset time period; wherein at least two task processing nodes are deployed in the cluster, and the remaining allocatable resources include: the remaining allocatable resource amount;
[0044] The third determination module is used to determine, for each container group to be scheduled, a target node corresponding to the container group to be scheduled from the at least two task processing nodes based on the required resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to each task processing node, so that the container group to be scheduled is run in the target node to execute the at least one processing task.
[0045] In a possible implementation, when the third determination module determines the target node corresponding to the container group to be scheduled from the at least two task processing nodes based on the required resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to each task processing node, the third determination module is specifically configured to:
[0046] Based on the remaining allocatable resources corresponding to each task processing node, at least one candidate node that meets the required resource amount corresponding to the container group to be scheduled is selected from each task processing node;
[0047] Based on the required resource amount corresponding to the container group to be scheduled and the remaining allocatable resource amount corresponding to each candidate node, a target node corresponding to the container group to be scheduled is determined from the candidate nodes.
[0048] In another possible implementation, the preset time period includes at least two unit times, the demand resources corresponding to the container group to be scheduled include the demand resource amounts corresponding to each unit time within the preset time, and the remaining allocatable resources corresponding to each task processing node include the remaining allocatable resource amounts corresponding to each unit time within the preset time;
[0049] The third determination module is specifically used to select at least one candidate node that meets the required resource amount corresponding to the container group to be scheduled from each task processing node based on the remaining allocatable resource amount corresponding to each task processing node:
[0050] Based on the remaining allocatable resources corresponding to each task processing node at each unit time, and the required resources corresponding to each unit time of the container group to be scheduled, at least one candidate node is selected from the task processing nodes;
[0051] For each unit time, the remaining allocatable resources corresponding to each candidate node in the unit time are greater than the required resources corresponding to the unit time.
[0052] In another possible implementation, when the third determination module determines the target node corresponding to the container group to be scheduled from the at least two task processing nodes based on the required resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to each task processing node, the third determination module is specifically configured to:
[0053] For each task processing node, based on the required resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to the task processing node, determine the resource matching degree between the task processing node and the container group to be scheduled;
[0054] The target node is determined from the at least two task processing nodes based on the resource matching degree corresponding to each of the processing task nodes in the at least two task processing nodes.
[0055] In another possible implementation, the preset time period includes at least two unit times, the demand resources corresponding to the container group to be scheduled include the demand resource amounts corresponding to each unit time within the preset time, and the remaining allocatable resources corresponding to each task processing node include the remaining allocatable resource amounts corresponding to each unit time within the preset time;
[0056] When determining the resource matching degree between the task processing node and the container group to be scheduled based on the required resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to the task processing node, the third determining module is specifically used to:
[0057] Based on the required resource amounts corresponding to the container group to be scheduled in the at least two unit times, constructing a required resource matrix of the container group to be scheduled;
[0058] Based on the remaining allocatable resource amounts of the task processing node corresponding to the at least two unit times, constructing a remaining allocatable resource matrix of the task processing node;
[0059] Based on the required resource matrix and the remaining allocatable resource matrix, determining at least one resource similarity between the task processing node and the container group to be scheduled in at least one manner;
[0060] Based on the at least one resource similarity, a resource matching degree between the task processing node and the container group to be scheduled is determined.
[0061] In another possible implementation, for each of the task processing nodes, when determining the remaining allocatable resources corresponding to the task processing node in the preset time period, the second determining module is specifically configured to:
[0062] Obtain the required resources corresponding to each container group running in the task processing node;
[0063] Determine the allocated resources corresponding to the task processing node based on the required resources corresponding to each container group;
[0064] Acquire initial allocatable resources corresponding to the task processing node; wherein the initial allocatable resources corresponding to the task processing node are allocatable resources corresponding to when the processing node does not run any container group;
[0065] Based on the initial allocatable resources corresponding to the task processing node and the allocated resources corresponding to the task processing node, the remaining allocatable resources corresponding to the task processing node are determined.
[0066] In another possible implementation, the device further includes: a second acquisition module, a prediction module, and a storage module, wherein:
[0067] The second acquisition module is used to acquire the historical resource usage corresponding to each container group in real time; wherein each container group includes the container group to be scheduled and each container group running in each task processing node, and the historical resource usage corresponding to any container group is the resource usage occupied by the container group when running the historical processing task;
[0068] The prediction module is used to predict the required resource amount corresponding to each container group based on the historical resource usage corresponding to each container group;
[0069] The storage module is used to store the required resource quantities corresponding to each of the container groups.
[0070] In another possible implementation, the required resources corresponding to a container group to be scheduled are represented by a resource matrix, the number of columns of the resource matrix is equal to the number of unit times included in the preset time period, and the number of rows is equal to the number of types of resources required for a container group to run the task to be processed;
[0071] The device further includes: a third acquisition module and a fourth determination module, wherein:
[0072] The third acquisition module is used to acquire the resource quantity declared by the container group to be scheduled when the required resources corresponding to the container group to be scheduled are not acquired; wherein the resource quantity declared by the container group to be scheduled is represented by a matrix, and each column of data is the resource quantity corresponding to each type of resource declared by the task to be processed;
[0073] The fourth determining module is configured to determine the resource quantity declared by the container group to be scheduled as the required resource quantity corresponding to the container group to be scheduled within a preset time period.
[0074] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the computer program to implement the task processing method provided by any possible implementation method of the first aspect.
[0075] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method for task processing provided by any possible implementation of the first aspect is implemented.
[0076] In a fifth aspect, an embodiment of the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the task processing method provided by any possible implementation method of the first aspect.
[0077] The beneficial effects of the technical solution provided by the embodiment of the present application are as follows:
[0078] The embodiments of the present application provide a method, device, electronic device, storage medium and program product for task processing. Compared with the related art, in the embodiments of the present application, for a container group to be scheduled, when determining a task processing node for scheduling the container group from multiple task processing nodes in a task processing node cluster, a target task node is determined based on the relationship between the demand resources corresponding to the container group to be scheduled in a preset time period and the remaining allocatable resources corresponding to each task processing node in the preset time period, so as to schedule the container group to be scheduled to perform the corresponding task. Since the demand resources corresponding to the container group to be scheduled in the preset time period are obtained based on the historical resource usage of the container group, the demand resources corresponding to the container group to be scheduled in the preset time period are more accurate, and what is predicted is the resources that the container group to be scheduled needs to occupy within a period of time, not just a simple static resource amount, so that the accuracy of the nodes allocated to the container group to be scheduled can be improved, and the problem of load imbalance can be avoided as much as possible. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in describing the embodiments of the present application.
[0080] Figure 1a A schematic diagram of the architecture of the Kubernetes system provided in the embodiment of the present application;
[0081] Figure 1b A schematic diagram of an application environment of a task processing method is provided for an embodiment of the present application;
[0082] Figure 1c A schematic diagram of an application environment of another task processing method is provided for an embodiment of the present application;
[0083] Figure 2 A flowchart of a task processing method provided in an embodiment of the present application;
[0084] Figure 3 A flowchart of a task processing method provided in an embodiment of the present application;
[0085] Figure 4 A flowchart of another method for task processing provided in an embodiment of the present application;
[0086] Figure 5 A schematic diagram of a task processing device structure provided in an embodiment of the present application;
[0087] Figure 6 A schematic diagram of the device structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0088] The embodiments of the present application are described below in conjunction with the drawings in the present application. It should be understood that the implementation methods described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions of the embodiments of the present application.
[0089] It will be understood by those skilled in the art that, unless specifically stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present application refer to that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude the implementation as other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the technical field. It should be understood that when we say that an element is "connected" or "coupled" to another element, the one element may be directly connected or coupled to the other element, or it may refer to that the one element and the other element establish a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein indicates at least one of the items defined by the term, for example, "A and / or B" may be implemented as "A", or as "B", or as "A and B". When describing multiple (two or more) items, if the relationship between the multiple items is not clearly defined, the multiple items may refer to one, multiple or all of the multiple items. For example, the description of "parameter A includes A1, A2, A3" can be implemented as parameter A including A1 or A2 or A3, and can also be implemented as parameter A including at least two of the three items A1, A2, A3.
[0090] In order to better understand the embodiments provided in this application, some nouns are explained as follows:
[0091] Kubernetes: is an open source containerized application management framework for multiple hosts in a cloud platform. The goal of Kubernetes is to make the deployment of containerized applications simple and powerful. Kubernetes provides a mechanism for application deployment, planning, updating, and maintenance. Kubernetes defines a series of building blocks in its design structure, with the goal of providing a mechanism that can jointly provide a mechanism for deploying, maintaining, and scaling applications. The components that make up Kubernetes are designed to be loosely coupled and scalable, so that they can meet a variety of different workloads. Scalability is largely provided by the Kubernetes API, which is mainly used as an extended internal component and as a container running on Kubernetes. See Figure 1a , Figure 1a Schematic diagram of the architecture of the Kubernetes system provided in the embodiment of the present application. Figure 1a As shown in the figure, a Kubernetes system usually includes a master node and multiple computing nodes. The master shown here can be the enhanced scheduling node shown below. The master node includes API Server, Scheduler, Controller Manager, etcd. API Server is the external interface of the entire system for clients and other components to call. Scheduler is responsible for scheduling resources within the cluster. Controller Manager is the controller responsible for management. etcd is a distributed and reliable key-value storage for storing data. Node nodes include Pod, Docker, kubelet, kube-proxy, and Fluentd. Pod is the most basic operation unit of Kubernetes. A Pod represents a process running in the cluster. It encapsulates one or more closely related containers. Docker is used to create containers. Kubelet is responsible for detecting the Pod assigned to the Node where it is located, including creation, modification, and deletion. Kube-proxy is responsible for providing agents for Pod objects. Fluentd is responsible for log collection, storage, and query.
[0092] Pod: The basic scheduling unit of Kubernetes is called a "pod". This abstract class allows higher-level abstractions to be added to containerized components. A pod generally contains one or more containers, which ensures that they are always located on the host and can share resources. Each pod in Kubernetes is assigned a unique (within the cluster) IP address, which allows applications to use the same port and avoid conflicts. A pod can define a volume, such as a local disk directory or a network disk, and expose it in a container in the pod. Pods can be managed manually through the Kubernetes API or delegated to a controller for automatic management.
[0093] Node: Also known as Worker or Minion or node, it is a single machine (or virtual machine) where containers (workloads) are deployed. Each node in the cluster must have a container runtime, such as Docker;
[0094] Application Programming Interface Service (APIServer): Provides the Resource Representational State Transfer (HTTP REST) interface for adding, deleting, modifying, checking, and obtaining various resource objects in Kubernetes. It is the data bus and data center of the entire system. Functions of APIServer: (1) Provides the RestAPI (Application Programming Interface) interface for cluster management (including authentication and authorization, data verification, and cluster status changes); (2) Provides a hub for data interaction and communication between other modules (other modules query or modify data through APIServer); (3) Is the entry point for resource quota control; (4) Has a complete cluster security mechanism.
[0095] Cosine Similarity: is a measurement method used to measure the similarity between two vectors. It determines their similarity by calculating the cosine value of the angle between the two vectors. The value range of cosine similarity is between -1 and 1. When the directions of the two vectors are exactly the same, the cosine similarity is 1; when the directions of the two vectors are completely opposite, the cosine similarity is -1; when the directions of the two vectors are completely unrelated, the cosine similarity is 0. In the fields of natural language processing and recommendation systems, cosine similarity is often used to measure the similarity between texts, users or items. For example, in text mining, each article can be represented as a vector in a high-dimensional space, each dimension of the vector corresponds to a term, and the value of the dimension represents the weight of the term in the article. By calculating the cosine similarity of the vectors of two articles, the similarity of their contents can be obtained.
[0096] Euclidean distance: is a metric used to measure the distance between two points. It is the most commonly used distance metric in Euclidean space. Euclidean distance is obtained by calculating the straight-line distance between two points. Its calculation formula is based on the Pythagorean theorem.
[0097] For two points A(x1, y1) and B(x2, y2) on a two-dimensional plane, the Euclidean distance between them can be calculated by the following formula:
[0098] distance = sqrt((x2 - x1)^2 + (y2 - y1)^2);
[0099] In high-dimensional space, the Euclidean distance between two points can be calculated using a similar formula. Simply square the difference in each dimension, sum it up, and then take the square root.
[0100] Euclidean distance is widely used in many fields, such as data mining, machine learning, image processing, etc. In these fields, Euclidean distance is often used to measure the similarity or difference between samples.
[0101] A component is a functional module of the mini-program's view, also known as a front-end component. It includes buttons, titles, tables, sidebars, content, and footers on a page. Components include modular codes for easy reuse in different pages of the mini-program.
[0102] Workload: A workload is a type of application that can have multiple replica instances.
[0103] In related technologies, it is also possible to schedule container groups (pods) based on the current actual utilization of nodes, but not based on the actual resource requirements of container groups. There are the following scenarios: actual resource requirements of container groups at time t + actual resource utilization of nodes at time t > total resources of nodes * target scheduling watermark (t is any time). When encountering the above scenario, the container group will still be scheduled to the node. After scheduling, it is very likely that the available resources of the node will be insufficient, resulting in stability problems.
[0104] The embodiment of the present application provides a method for staggered deployment based on actual resource demand, which can support the same scale of business with fewer resource specifications, or can reduce resource competition under the premise of unchanged total resource specifications; and improve the reliability of scheduling. The embodiment of the present application can be applied to Kubernetes clusters, but is not limited to Kubernetes clusters.
[0105] Optionally, the solution provided by the embodiment of the present application may involve cloud technology and database processing technology. For example, the solution of the embodiment of the present application may be executed by a server, wherein the server may be a cloud server. The data processing involved in the implementation of the solution may be implemented based on cloud technology, and the data storage involved in the implementation may use cloud storage. For example, the calculation of the Euclidean distance between the resource requirements corresponding to each container group to be scheduled and the remaining allocatable resources corresponding to each task processing node may be implemented using cloud technology, and the storage of the required resource amount corresponding to each container group may use cloud storage and be stored in the cloud server.
[0106] Specifically, the database can be regarded as an electronic filing cabinet in short - a place to store electronic files, where users can add, query, update, delete, and other operations on the data in the files. The so-called "database" is a collection of data that is stored together in a certain way, can be shared with multiple users, has as little redundancy as possible, and is independent of the application. A database management system (DBMS) is a computer software system designed for managing databases, generally with basic functions such as storage, interception, security, and backup. Database management systems can be classified according to the database model it supports, such as relational, Extensible Markup Language (XML); or according to the type of computer supported, such as server clusters and mobile phones; or according to the query language used, such as SQL (Structured Query Language), XQuery; or according to the performance impulse focus, such as maximum scale, maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMS can cross categories, for example, supporting multiple query languages at the same time.
[0107] Among them, cloud computing is a computing model that distributes computing tasks on a resource pool composed of a large number of computers, so that various application systems can obtain computing power, storage space and information services as needed. The network that provides resources is called "cloud". The resources in the "cloud" are infinitely expandable in the eyes of users, and can be obtained at any time, used on demand, expanded at any time, and paid for by use.
[0108] As a cloud computing basic capability provider (i.e., cloud vendor), a cloud computing resource pool (referred to as a cloud platform, generally referred to as an IaaS (Infrastructure as a Service) platform) will be established, and various types of virtual resources will be deployed in the resource pool for external customers to choose to use. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices.
[0109] According to the logical function division, the PaaS (Platform as a Service) layer can be deployed on the IaaS (Infrastructure as a Service) layer, and the SaaS (Software as a Service) layer can be deployed on the PaaS layer. SaaS can also be deployed directly on IaaS. PaaS is a platform for software operation, such as databases, web containers, etc. SaaS is a variety of business software, such as web portals, SMS mass senders, etc. Generally speaking, SaaS and PaaS are upper layers relative to IaaS.
[0110] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, which is used on demand and is flexible and convenient. Cloud computing technology will become an important support. Cloud storage is a new concept that extends and develops from the concept of cloud computing. Distributed cloud storage system (hereinafter referred to as storage system) refers to a storage system that uses cluster applications, grid technology, and distributed storage file systems to bring together a large number of different types of storage devices (storage devices are also called storage nodes) in the network through application software or application interfaces to work together and provide data storage and business access functions to the outside world.
[0111] Cloud products refer to cloud computing products that provide cloud services. There are many types of cloud computing products, covering a wide range of fields such as transportation, medical care, and energy. Different products have different characteristics and application scenarios. For example, cloud management products are used to manage and deploy cloud computing resources to achieve unified management of cloud resources; cloud storage products provide storage services based on cloud computing platforms, which can provide massive storage space and efficient access speeds; cloud security products involve the protection of network security in cloud computing environments, providing powerful security protection functions; cloud communication products provide communication services based on cloud computing platforms to achieve data transmission, providing a more convenient and efficient communication method.
[0112] It should be noted that in the optional embodiments of the present application, the object information (tasks to be processed, etc.) and other related data involved, when the embodiments in the present application are applied to specific products or technologies, need to obtain the permission or consent of the object, and the collection, use and processing of the relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions. In other words, if the embodiments of the present application involve data related to the object, it needs to be obtained with the authorization and consent of the object, the authorization and consent of the relevant departments, and in compliance with the relevant laws, regulations and standards of the country and region. If personal information is involved in the embodiments, the acquisition of all personal information needs to obtain the consent of the individual. If sensitive information is involved, the separate consent of the information subject needs to be obtained. The embodiments also need to be implemented with the authorization and consent of the object.
[0113] The present application embodiment provides an application environment of a task processing method, see Figure 1b , the application environment includes: a first device 101 and a second device 102. The first device 101 and the second device 102 are connected via a network, the first device 101 is an access device, and the second device 102 is an accessed device. The first device 101 is a device where the initiator of the processing task is located; it can be an application server of an application program, or a terminal, a vehicle-mounted device, a smart speaker, etc. where the client of the application is located, which is not specifically limited here. The second device 102 can be a master node in a cluster, and the server can be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The node can be a device without a public IP, such as a smart car, a smart speaker, a smart watch, etc., but is not limited thereto. The node and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in this application.
[0114] Specifically, in Figure 1b Based on this, more detailed scenarios such as Figure 1c As shown, the above master node is deployed in a cluster system. Figure 1c Schematic diagram of an application scenario of the present application according to an embodiment of the present application. Figure 1c As shown, the application scenario includes a cluster system 110 and a first device 120. The cluster system 110 includes an enhanced scheduling node 111 (which may be the master node shown above) and a plurality of task processing nodes ( Figure 1cThe first task processing node 112 and the second task processing node 113 are exemplarily shown in the figure. Graphics Processing Unit (GPU) and / or Central Processing Unit (CPU) are deployed on each task processing node. One or more container groups can be run on each GPU and / or each CPU. The enhanced scheduling node 111 is used for resource scheduling. Specifically, it can schedule the container group to the GPU and / or CPU in the corresponding task processing node for operation according to the method of the present application.
[0115] The first device 120 refers to the device where the initiator of the processing task is located; it can be an application server of the application, or a terminal, vehicle-mounted equipment, smart speaker, etc. where the client of the application is located, which is not specifically limited here. The processing task initiated by the first device 120 can be a face recognition task, an image classification task, a text classification task, a speech recognition task, an audio encoding task, a video decoding task, etc., which is not specifically limited here. It should be noted that the GPU (CPU) shown below represents the GPU and / or CPU, which will not be repeated in the following embodiments.
[0116] The enhanced scheduling node 111 in the cluster system 110 can also be responsible for communicating with external devices. After receiving the task processing request initiated by the first device 120, the enhanced scheduling node 111 allocates an available GPU (CPU) to the task processing request according to the resource demand requested by the task processing request and the remaining resources of the GPU (CPU) in each task processing node, and then requests to create a container group for the processing task indicated by the task processing request. Afterwards, the enhanced scheduling node 111 can schedule the container group according to the method of the present application to schedule the container group to be scheduled to the GPU (CPU) in the task processing node to run, so as to utilize the resources in the GPU (CPU) for task processing. Figure 1c exemplarily shows container group I and container group II running in the GPU of the first task processing slave node 112, and container group III running in the GPU of the second task processing node 113. After the running container group ends, the task processing node can return the task processing result to the enhanced scheduling node 111, and the enhanced scheduling node 111 sends the task processing result to the first device 120.
[0117] It should be noted that if the cluster system 110 is a Kubernetes cluster, the container group can be called a pod; furthermore, although the above text uses GPU and / or CPU as an example to introduce resources, the resources shown in the embodiments of the present application are not limited to GPU and / or CPU. Any resources required to run the container group to perform the corresponding processing tasks are within the protection scope of the embodiments of the present application.
[0118] In order to better understand and explain the method provided by the embodiment of the present application, the optional implementation method of the method provided by the present application is first introduced in conjunction with a specific scenario embodiment. Under the system architecture shown above, the embodiment of the present application provides a task processing method, which can be executed by the enhanced scheduling node shown above. In the embodiment of the present application, the enhanced scheduling node can be a virtual node set in the server, or it can be a physical node, such as Figure 2 As shown, the method may include:
[0119] Step S201: Determine at least one container group to be scheduled.
[0120] Specifically, for a Kubemetes cluster, a container group can be called a pod. A Pod contains an application container (in some cases, multiple containers), storage resources, a unique network IP address, and some options to determine how the container should run. The Pod container group represents an independent application running instance in Kubernetes, which may consist of a single container or several tightly coupled containers. In an embodiment of the present application, each container group corresponds to at least one processing task, that is, a container group can carry at least one processing task to run the at least one processing task.
[0121] Specifically, in the embodiments of the present application, processing tasks may include: training tasks, computing tasks, and data search tasks, etc. Any task that can be executed on a node is within the protection scope of the embodiments of the present application.
[0122] Step 202: Obtain the required resources corresponding to each container group to be scheduled within a preset time period.
[0123] For the embodiment of the present application, the preset time period can be preset, that is, it can be preset by the administrator, or it can be input by the administrator. In the embodiment of the present application, the preset time period can be any time period, for example, one day can be used as the preset time period, or one month can be used as the preset time period.
[0124] Specifically, if the preset time period is one day, that is, for each container group to be scheduled, the required resources corresponding to the container group to be scheduled within one day are obtained.
[0125] The demand resources include: the demand resource quantity, and the demand resource quantity corresponding to a container group to be scheduled in a preset time period is predicted based on the historical resource usage corresponding to the container group to be scheduled. In other words, the demand resource quantity corresponding to a container group to be scheduled in a preset time period (that day) is predicted based on the historical resource usage corresponding to the scheduled container group in the historical time.
[0126] Among them, the required resource amount corresponding to each container group to be scheduled within the preset time can be pre-stored in the database. When a container group needs to be scheduled, the required resource amount corresponding to the container group within the preset time period is obtained from the database. Of course, the required resource amount corresponding to the container group to be scheduled within the preset time period can also be predicted in real time based on the historical resource usage corresponding to the scheduled container group.
[0127] It should be noted that the required resource amount corresponding to a container group to be scheduled within a preset time period can be predicted by the enhanced scheduling node shown above, or by other devices, for example, by a prediction component set in other devices.
[0128] Step 203: Determine the remaining allocatable resources corresponding to each task processing node in the task processing node cluster in a preset time period.
[0129] Wherein, at least two task processing nodes are deployed in the cluster, and the remaining allocatable resources include: the remaining allocatable resource amount. That is, the remaining allocatable resource amount of each task processing node in the cluster within a preset time period is calculated. As mentioned above, task processing node 1 and task processing node 2 may be deployed in the cluster, that is, the remaining allocatable resources of task processing node 1 within 1 day (that day) and the remaining allocatable resources of task processing node 2 within that day are calculated.
[0130] It should be noted that step S201-step S202 can be executed before step S203, or after step S203, or simultaneously with step S202, which is not limited in the embodiments of the present application.
[0131] Step 204: For each container group to be scheduled, based on the required resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to each task processing node, determine a target node corresponding to the container group to be scheduled from at least two task processing nodes, so that the container group to be scheduled is run in the target node to execute at least one processing task.
[0132] Specifically, taking the preset time period of one day as an example, that is, based on the predicted demand resource amount corresponding to the container group to be scheduled in the day and the remaining allocatable resource amount corresponding to each task processing node in the next day, the target node corresponding to the container group to be scheduled is determined from at least two task processing nodes, so as to select the node with the best compact packing for the container group to be scheduled and achieve the best scheduling decision.
[0133] Further, after a target node is determined for the container group to be scheduled, the target node is used as a task processing node to which the container group to be scheduled is finally bound, so that the container group to be scheduled is run in the target node to execute at least one processing task.
[0134] Further, in the embodiments of the present application, Figure 3 As shown, for a kubernetes cluster, an enhanced scheduler component can be deployed in the cluster, wherein the enhanced scheduler component can be deployed in the enhanced scheduling node shown above, and an ApiServer is also provided in the cluster, that is, the enhanced scheduler component can detect a pod object (container group) creation event without a nodename from the ApiServer, and the scheduler component specified by the pod object creation event is the enhanced scheduler component, so as to determine the pod object without a nodename as the container group to be scheduled (specifically, the container group to be scheduled can be detected by the ApiServer). In an embodiment of the present application, a new pod is created and the scheduler component is specified as the enhanced scheduler component as follows:
[0135] template:
[0136] metadata:
[0137] labels:
[0138] app: my-app
[0139] spec:
[0140] schedulerName: this-scheduler
[0141] Further, in the embodiments of the present application, Figure 3As shown, for a kubernetes cluster, a detection component may be deployed in the cluster, wherein the detection component may be located in the enhanced scheduling node shown above, or may not be deployed in the enhanced scheduling node shown above. Further, in an embodiment of the present application, a database component and a prediction component may also be deployed, wherein the database component and the prediction component may be located in the kubernetes cluster, or may not be located in the kubernetes cluster, such as Figure 3 As shown in , the database component and the prediction component are not located in the kubernetes cluster; wherein the detection component can periodically collect resource usage data corresponding to each container group in the cluster, and store the collected resource usage data corresponding to each container group in the database component, wherein the prediction component can obtain the historical resource usage data corresponding to each container group from the database component to predict the demand resources corresponding to each container group within a preset time period, and store them in the database component, and then after the enhanced scheduler component determines the container group to be scheduled, it obtains the demand resources corresponding to each container group to be scheduled within the preset time period from the database component. Figure 3 As shown, the prediction component periodically obtains the historical resource usage data of each pod, predicts the demand matrix of each pod, and stores it in the database component.
[0142] Further, when the prediction component is set in the kubernetes cluster, the prediction component and the enhanced scheduler component can be deployed in one device, that is, deployed in the enhanced scheduling node shown above, so that the enhanced scheduling node can periodically obtain the historical resource usage corresponding to each container group, each container group includes the container group to be scheduled and each container group running in each task processing node. The historical resource usage corresponding to any container group is the resource usage occupied by the container group when running the historical processing task, and then based on the historical resource usage corresponding to each container group, the demand resource amount corresponding to each container group is predicted, and then the demand resource amount corresponding to each container group is stored. In an embodiment of the present application, the demand resource amount corresponding to each container group is stored in the database component.
[0143] Specifically, the preset time period includes at least two unit times, and the demand resources corresponding to the container group to be scheduled include the demand resource amounts corresponding to each unit time in the preset time. For example, if the preset time period is one day and the unit time is one hour, the demand resources corresponding to the scheduled container group include: the demand resource amounts corresponding to each hour in the day.
[0144] Further, for each task processing node in the task processing node, the remaining allocatable resources corresponding to the task processing node in the preset time period are determined. Specifically, for each task processing node in the task processing node, the remaining allocatable resources corresponding to the task processing node in the preset time period are determined, which may specifically include: obtaining the required resources corresponding to each container group running in the task processing node; determining the allocated resources corresponding to the task processing node based on the required resources corresponding to each container group; obtaining the initial allocatable resources corresponding to the task processing node; determining the remaining allocatable resources corresponding to the task processing node based on the initial allocatable resources corresponding to the task processing node and the allocated resources corresponding to the task processing node. In an embodiment of the present application, the initial allocatable resources corresponding to the task processing node are the allocatable resources corresponding to the processing node when no container group is running.
[0145] For the embodiment of the present application, at least one container group may be running in each task processing node. Therefore, for any task processing node, when determining the remaining allocatable resources corresponding to the task processing node in the preset time period, the demand resources corresponding to each container group running in the task processing node are obtained, and then the demand resources corresponding to each container group are superimposed to obtain the allocated resources corresponding to the task processing node, and then the remaining allocatable resources corresponding to the task processing node are determined based on the initial allocatable resources corresponding to the task processing node and the allocated resources corresponding to the task processing node. In the embodiment of the present application, the initial allocatable resources corresponding to the task processing node can be obtained first, and then the demand resources corresponding to each container group running in the task processing node can be obtained, or the demand resources corresponding to each container group running in the task processing node can be obtained first, and then the initial allocatable resources corresponding to the task processing node can be obtained, or the demand resources corresponding to each container group running in the task processing node and the initial allocatable resources corresponding to the task processing node can be obtained at the same time, which is not limited in the embodiment of the present application.
[0146] From the above, it can be seen that the preset time period includes at least two unit times, that is, the demand resources corresponding to each container group running in the task processing node, the initial allocatable resources corresponding to the task processing node, the allocated resources corresponding to the task processing node, and the remaining allocatable resources corresponding to the task processing node, which can all include: the resources corresponding to each unit time in the preset time period, that is, the demand resources corresponding to each container group running in the task processing node include: the demand resources corresponding to each unit time in the preset time period; the initial allocatable resources corresponding to the task processing node may include: the allocatable resources corresponding to each unit time in the preset time period; the allocated resources corresponding to the task processing node may include: the allocated resources corresponding to each unit time of the task processing node in the preset time period; the remaining allocatable resources corresponding to the task processing node include: the allocatable resources corresponding to each unit time of the task processing node in the preset time period.
[0147] Taking the preset time period as one day and the unit time as one hour as an example, the demand resources corresponding to each container group running in the task processing node include: the demand resources corresponding to each hour from 0 to 23 hours of the day; the initial allocatable resources corresponding to the task processing node may include: the initial allocatable resources corresponding to each hour from 0 to 23 hours of the day; the allocated resources corresponding to the task processing node may include: the allocated resources corresponding to each hour from 0 to 23 hours of the day; the remaining allocatable resources corresponding to the task processing node include: the remaining allocatable resources corresponding to each hour from 0 to 23 hours of the day.
[0148] Further, after obtaining the allocatable resources corresponding to each unit time of each task processing node within the preset time period, in step S204, based on the demand resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to each task processing node, determining the target node corresponding to the container group to be scheduled from at least two task processing nodes, may specifically include: based on the remaining allocatable resource amounts corresponding to each task processing node, selecting at least one candidate node that meets the demand resource amount corresponding to the container group to be scheduled from each task processing node; and determining the target node corresponding to the container group to be scheduled from each candidate node based on the demand resource amount corresponding to the container group to be scheduled and the remaining allocatable resource amounts corresponding to each candidate node. In an embodiment of the present application, the resource demand corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to each task processing node are both the resource amounts for each unit time within a preset time period, that is, the predicted resource demand corresponding to the container group to be scheduled is the resource amount corresponding to each unit time within the preset time period, and the remaining allocatable resources corresponding to any task processing node are the remaining allocatable resources of the task processing node for each unit time within the preset time period. The resource demand for each unit time and the remaining allocatable resources for the corresponding unit time are matched to determine the target node, so that the accuracy of the target node is higher, and then the business is deployed in a staggered manner based on the actual resource demand, resource utilization is greatly improved, and resource competition is reduced.
[0149] Specifically, in an embodiment of the present application, the remaining allocatable resource amount corresponding to each task processing node and the required resource amount corresponding to the container group to be scheduled can be obtained through the above embodiment, so as to screen out at least one task processing node whose remaining allocatable resource amount is not less than the required resource amount corresponding to the container group to be scheduled from each task processing node as a candidate node.
[0150] Specifically, it can be seen from the above that the preset time period includes at least two unit times, the demand resources corresponding to the container group to be scheduled include the demand resource amounts corresponding to each unit time within the preset time, and the remaining allocatable resources corresponding to each task processing node include the remaining allocatable resource amounts corresponding to each unit time within the preset time; in an embodiment of the present application, based on the remaining allocatable resource amounts corresponding to each task processing node, at least one candidate node that meets the demand resource amounts corresponding to the container group to be scheduled is selected from each task processing node, which can specifically include: based on the remaining allocatable resource amounts corresponding to each task processing node in each unit time, and the demand resource amounts corresponding to the container group to be scheduled in each unit time, at least one candidate node is selected from the task processing nodes.
[0151] Among them, for each unit time, the remaining allocatable resources corresponding to each candidate node in the unit time are not less than the required resources corresponding to the unit time. Figure 3 As shown, one unit time is one hour, and the enhanced scheduler component filters out nodes with insufficient resources in any hour. For example, the remaining allocatable resources corresponding to each task processing node in each unit time are the remaining allocatable resources corresponding to the task node at each time from 0 to 23 o'clock, and the required resources corresponding to the container group to be scheduled in each unit time are the required resources corresponding to the container to be scheduled at each time from 0 to 23 o'clock. For a task processing node, the remaining allocatable resources corresponding to each time from 0 to 23 o'clock of the task processing node and the required resources corresponding to each time from 0 to 23 o'clock of the container to be scheduled are compared one by one according to the corresponding relationship of the hours, and the remaining allocatable resources corresponding to each hour are screened out, and the remaining allocatable resources corresponding to each hour are not less than the corresponding required resources, that is, the remaining allocatable resources corresponding to 0 o'clock are not less than the required resources corresponding to 0 o'clock, the remaining allocatable resources corresponding to 1 o'clock are not less than the required resources corresponding to 1 o'clock, ..., and the remaining allocatable resources corresponding to 23 o'clock are not less than the resource demand corresponding to 23 o'clock.
[0152] Furthermore, through the above embodiment, certain task processing nodes are first filtered out, in which the remaining allocatable resources at certain times may be less than the resource demand at that time, so as to obtain candidate nodes in which the remaining allocatable resources at each unit time are greater than the resource demand corresponding to the unit time, so as to improve the accuracy of subsequent selection of target nodes and reduce the computational complexity of subsequent selection of target nodes.
[0153] Another possible implementation manner of the embodiment of the present application, in step S204, based on the demand resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to each task processing node, determining the target node corresponding to the container group to be scheduled from at least two task processing nodes, may specifically include: for each task processing node, based on the demand resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to the task processing node, determining the resource matching degree between the task processing node and the container group to be scheduled; based on the resource matching degree corresponding to each processing task node in the at least two task processing nodes, determining the target node from the at least two task processing nodes.
[0154] Specifically, based on the demand resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to the task processing node, determining the degree of resource matching between the task processing node and the container group to be scheduled may specifically include: constructing a demand resource matrix of the container group to be scheduled based on the demand resource amounts corresponding to the container group to be scheduled in at least two unit times; constructing a remaining allocatable resource matrix of the task processing node based on the remaining allocatable resource amounts corresponding to the task processing node in at least two unit times; determining at least one resource similarity between the task processing node and the container group to be scheduled in at least one manner based on the demand resource matrix and the remaining allocatable resource matrix; and determining the degree of resource matching between the task processing node and the container group to be scheduled based on the at least one resource similarity.
[0155] Specifically, the required resources corresponding to a container group to be scheduled are represented by a resource matrix, the number of columns of the resource matrix is equal to the number of unit times included in the preset time period, and the number of rows is equal to the number of types of resources required for a container group to run the tasks to be processed; for example, the required resources corresponding to a container group to be scheduled can be represented by the following resource matrix R, where the resource matrix R is as follows:
[0156] ;
[0157] Among them, each row of data represents different types of resources, and each column of data represents the resources occupied by different units of time. The first column of data in the R matrix represents the resources occupied by the container group to be scheduled at time 0, the second column of data represents the resources occupied by the container group to be scheduled at time 1, and so on. The last column represents the resources occupied by the container group to be scheduled at time 23. For example, the first row represents the GPU resources required by the container group to be scheduled, and c0 can represent the GPU resources required by the container group to be scheduled at time 0.
[0158] The remaining allocatable resources of a task processing node can also be represented by the remaining allocatable resource matrix. Taking the task processing node as task processing node j as an example, the remaining allocatable resource matrix corresponding to the task processing node j is represented by S j Characterize, where S j As shown below:
[0159] ;
[0160] Among them, S j Each column of data in the matrix represents: the remaining allocatable resources at each time from 0 to 23; each row of data represents the remaining allocatable resources for each type of resource. jThe first row in the matrix still represents GPU resources, which specifically represents the remaining allocatable resources of task processing node j at different times, S j,m1 Represents the remaining allocatable resources corresponding to type m resources when task processing node j is 1.
[0161] Furthermore, after obtaining the demand resource matrix of the container group to be scheduled and the remaining allocatable matrix corresponding to each task processing node, at least one resource similarity between the task processing node and the container group to be scheduled is determined in at least one manner based on the demand resource matrix and the remaining allocatable resource matrix, and then, based on the at least one resource similarity, the degree of resource matching between the task processing node and the container group to be scheduled is determined.
[0162] Specifically, at least one method may include: Euclidean distance and / or cosine similarity, that is, determining the Euclidean distance between the task processing node and the container group to be scheduled, and / or determining the cosine similarity between the task processing node and the container group to be scheduled.
[0163] Specifically, based on the following formula 1, the Euclidean distance between the remaining resources S of node j and the resource requirements R of the container group to be scheduled is calculated:
[0164] , formula 1;
[0165] Where d is the Euclidean distance between the remaining resources S of computing node j and the required resources R of the container group to be scheduled.
[0166] Specifically, when calculating the cosine similarity between the remaining resources S of node j and the resource requirements R of the container group to be scheduled, the two matrices are flattened into vectors before calculation. Specifically, the cosine similarity between the remaining resources S of node j and the resource requirements R of the container group to be scheduled is calculated based on the following formula 2:
[0167] , formula 2;
[0168] in
[0169] ;
[0170] ; ; Among them, the W matrix is customized by the user according to the importance of the resources. The W in the embodiment of the present application is only a possible implementation method and is not intended to be limiting. Taking the resources including: CPU resources, MEM resources and network resources as an example, the weight of CPU resources is 2, the weight of MEM resources is 1, and the network weight is 1, that is, cpu weight=2, mem weight=1, networkweight=1.
[0171] Further, after obtaining the Euclidean distance between the remaining resources S of node j and the resource demand R of the container group to be scheduled and the cosine similarity between the remaining resources S of node j and the resource demand R of the container group to be scheduled, the score of the node j is calculated based on the following formula 3 to characterize the resource matching degree between the task processing node j and the container group to be scheduled, where:
[0172] , formula 3;
[0173] Among them, f represents the cosine similarity between the remaining resources S of node j and the resource requirements R of the container group to be scheduled; d is the Euclidean distance between the remaining resources S of node j and the required resources R of the container group to be scheduled; score j Represents the score of node j.
[0174] Furthermore, the scores between each task processing node and the container to be scheduled can be obtained through the above method.
[0175] Furthermore, based on the scores between each task processing node and the container to be scheduled, the node with the highest score is selected as the node to which the container group to be scheduled is finally bound. Figure 3 As shown, the enhanced scheduler component selects the node with the highest score as the node to which the container group to be scheduled is finally bound.
[0176] Furthermore, the bind interface is called to submit the container group to be scheduled and the node to which the container group to be scheduled is finally bound to the Apiserver to complete the scheduling process.
[0177] Further, in the above embodiment, the demand resources corresponding to the container group to be scheduled are predicted based on the historical resource usage data corresponding to the container group. If the demand resources corresponding to the container group to be scheduled are not obtained when determining the target node corresponding to the container group to be scheduled (the demand resources shown here refer to those predicted based on the historical resource usage data corresponding to the container group), the resource amount declared by the container group to be scheduled is obtained, and the resource amount declared by the container group to be scheduled is determined as the demand resource amount corresponding to the container group to be scheduled within the preset time period.
[0178] The resource amount declared by the container group to be scheduled is represented by a matrix, and each column of data is the resource amount corresponding to each type of resource declared by the task to be processed.
[0179] Further, after the resource amount declared by the container group to be scheduled is used as the required resource amount corresponding to the container group to be scheduled within the preset time period, a method of determining the target node corresponding to the container group to be scheduled based on the required resource amount corresponding to the container group to be scheduled within the preset time period is described in detail in the above embodiment, which will not be repeated here.
[0180] In the following embodiments, the method for task processing shown in the embodiments of the present application is introduced by using specific examples. In this embodiment, a Kubernetes cluster is used as an example for introduction, wherein the Kubernetes cluster includes multiple task processing nodes, as shown in the following embodiments. Figure 4 As shown:
[0181] Step 1: Deploy the enhanced scheduler component in the Kubernetes cluster as a pod.
[0182] Step 2: The enhanced scheduler component builds the allocatable resource matrix T of all nodes in the cluster. Taking node j as an example, T j The matrix is as follows:
[0183] ,
[0184] In this matrix, each row is a resource dimension, and each column is the resource specification for each hour. Since the node specifications remain unchanged, the values in each row are consistent.
[0185] Step 3: The enhanced scheduler component detects the creation event of the pod object of the specified enhanced scheduler without nodename from the ApiServer in the Kubernetes cluster;
[0186] Step 4: After detecting the event of the relevant pod, the enhanced scheduler component handles the scheduling of the pod;
[0187] (1) Prefilter stage: Obtain the pre-scheduled pod demand matrix R from the database. Each row in the matrix is a resource dimension, representing different types of resources, and each column is the resource demand for a certain hour, representing the amount of resources required in that hour.
[0188] ;
[0189] The demand matrix R of the pre-scheduled pod is obtained, that is, the demand matrix of the pod of the workload to which the pod belongs is obtained; if the pod demand matrix of the workload can be successfully obtained, the next stage is entered; if the pod demand matrix of the same workload cannot be found, the resource demand of each column is initialized to the resource specification declared by the pod;
[0190] (2) Filter stage:
[0191] ① Calculate the allocated resources U of node J. Specifically, the method of calculating the allocated resources U of node J includes: obtaining K Pods of the current node J, then the allocated resources U of node J is the sum of k R matrices. Taking node j as an example, U j The matrix is as follows:
[0192] ;
[0193] If R cannot be obtained, k The value of R k All are initialized to the resource requirements declared by the pod. The resource requirements of each column are initialized to the resource specifications declared by the pod.
[0194] ② Calculate the remaining allocatable resources S of each node. Taking node j as an example, the remaining allocatable resources S of node j is calculated by the following formula: j ,in,
[0195] ;
[0196] in, .
[0197] ③ Filter out nodes that have insufficient resources at any time, that is, the nodes obtained after filtering meet the following conditions:
[0198] ;
[0199] (3) Score stage:
[0200] If the number of nodes after filtering is less than 2, the Score stage is skipped; if the number of nodes after filtering is not less than 2, the Score stage can be executed; in the embodiment of the present application, the score of each node is calculated for each node.
[0201] Specifically, taking node j as an example, the scoring method of node j is introduced, including:
[0202] ① Calculate the remaining resources S of node j jThe Euclidean distance between the pre-scheduled pod demand R is calculated by the following formula:
[0203] ;
[0204] Where, d(R,S j ) represents the remaining resources S of node j j The Euclidean distance from the pre-scheduled pod demand R;
[0205] Among them, the remaining resources S in computing node j j When the Euclidean distance between the pre-scheduled pod demand R and the Euclidean distance between the pre-scheduled pod demand R, S is required j After flattening y and R into vectors, the calculation is performed.
[0206] ② Calculate the remaining resources S of node j j The cosine similarity of the pre-scheduled pod demand R can be calculated by the following formula, where:
[0207] ;
[0208] in, ;
[0209] ; ; Among them, the W matrix is customized by the user according to the importance of the resources. The W in the embodiment of the present application is only a possible implementation method and is not intended to be limiting. Taking the resources including: CPU resources, MEM resources and network resources as an example, the weight of CPU resources is 2, the weight of MEM resources is 1, and the network weight is 1, that is, cpu weight=2, mem weight=1, networkweight=1.
[0210] Among them, the remaining resources S in computing node j j When the cosine similarity between the Euclidean distance of the pre-scheduled pod demand R is calculated, S j After flattening y and R into vectors, the calculation is performed.
[0211] ③ Based on the remaining resources S of node j j The Euclidean distance between the pre-scheduled pod demand R and the remaining resources S of node j j The cosine similarity of the pre-scheduled pod demand R is calculated, and the final score of node j is calculated by the following formula; where,
[0212] ;
[0213] Where f is the remaining resource S of node j shown above j and the cosine similarity of the pre-scheduled pod demand R, and d is the remaining resource S of node j shown above j The Euclidean distance between the pre-scheduled pod demand R and score j is the final score of node j.
[0214] Furthermore, the score corresponding to each node is calculated in the Score stage, and the node with the highest score is selected as the node to which the pod is finally bound.
[0215] Finally, the bind interface is called to submit the pod and the final scheduling result to the apiserver to complete the scheduling process.
[0216] Based on the same principle as the task processing method provided in the embodiment of the present application, the embodiment of the present application also provides a task processing device, such as Figure 5 As shown, the device 50 may include: a first determination module 51, a first acquisition module 52, a second determination module 53 and a third determination module 54, wherein:
[0217] A first determination module 51 is used to determine at least one container group to be scheduled, each container group corresponding to at least one processing task;
[0218] The first acquisition module 52 is used to obtain the required resources corresponding to each container group to be scheduled within a preset time period; wherein the required resources include: the required resource amount, and the required resource amount corresponding to a container group to be scheduled within the preset time period is obtained based on the historical resource usage prediction corresponding to the container group to be scheduled;
[0219] The second determination module 53 is used to determine the remaining allocatable resources corresponding to each task processing node in the task processing node cluster in a preset time period; wherein at least two task processing nodes are deployed in the cluster, and the remaining allocatable resources include: the remaining allocatable resource amount;
[0220] The third determination module 54 is used to determine, for each container group to be scheduled, a target node corresponding to the container group to be scheduled from at least two task processing nodes based on the required resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to each task processing node, so that the container group to be scheduled is run in the target node to execute at least one processing task.
[0221] In a possible implementation manner of the embodiment of the present application, when the third determination module 54 determines the target node corresponding to the container group to be scheduled from at least two task processing nodes based on the required resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to each task processing node, it is specifically used to:
[0222] Based on the remaining allocatable resources corresponding to each task processing node, at least one candidate node that meets the required resource amount corresponding to the container group to be scheduled is selected from each task processing node;
[0223] Based on the required resource amount corresponding to the container group to be scheduled and the remaining allocatable resource amount corresponding to each candidate node, a target node corresponding to the container group to be scheduled is determined from each candidate node.
[0224] In another possible implementation manner of the embodiment of the present application, the preset time period includes at least two unit times, the demand resources corresponding to the container group to be scheduled include the demand resource amounts corresponding to each unit time within the preset time, and the remaining allocatable resources corresponding to each task processing node include the remaining allocatable resource amounts corresponding to each unit time within the preset time;
[0225] The third determination module 54 is specifically used to select at least one candidate node that meets the required resource amount corresponding to the container group to be scheduled from each task processing node based on the remaining allocatable resource amount corresponding to each task processing node:
[0226] Based on the remaining allocatable resources corresponding to each task processing node at each unit time, and the required resources corresponding to each unit time of the container group to be scheduled, at least one candidate node is selected from the task processing nodes;
[0227] For each unit time, the remaining allocatable resources corresponding to each candidate node in the unit time are greater than the required resources corresponding to the unit time.
[0228] In another possible implementation of the embodiment of the present application, when the third determination module 94 determines the target node corresponding to the container group to be scheduled from at least two task processing nodes based on the required resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to each task processing node, it is specifically configured to:
[0229] For each task processing node, based on the required resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to the task processing node, determine the resource matching degree between the task processing node and the container group to be scheduled;
[0230] Based on the resource matching degree corresponding to each processing task node in the at least two task processing nodes, a target node is determined from the at least two task processing nodes.
[0231] In another possible implementation manner of the embodiment of the present application, the preset time period includes at least two unit times, the demand resources corresponding to the container group to be scheduled include the demand resource amounts corresponding to each unit time within the preset time, and the remaining allocatable resources corresponding to each task processing node include the remaining allocatable resource amounts corresponding to each unit time within the preset time;
[0232] When determining the resource matching degree between the task processing node and the container group to be scheduled based on the required resources corresponding to the container group to be scheduled and the remaining allocatable resources corresponding to the task processing node, the third determining module 54 is specifically used to:
[0233] Based on the required resource amounts corresponding to the container group to be scheduled in at least two unit times, construct a required resource matrix of the container group to be scheduled;
[0234] Based on the remaining allocatable resource amounts corresponding to the task processing node in at least two unit times, constructing a remaining allocatable resource matrix of the task processing node;
[0235] Based on the required resource matrix and the remaining allocatable resource matrix, determining at least one resource similarity between the task processing node and the container group to be scheduled in at least one manner;
[0236] Based on at least one resource similarity, a resource matching degree between the task processing node and the container group to be scheduled is determined.
[0237] In another possible implementation of the embodiment of the present application, for each task processing node in the task processing nodes, the second determination module 53, when determining the remaining allocatable resources corresponding to the task processing node in the preset time period, is specifically used to:
[0238] Obtain the required resources corresponding to each container group running in the task processing node;
[0239] Determine the allocated resources corresponding to the task processing node based on the required resources corresponding to each container group;
[0240] Acquire the initial allocatable resources corresponding to the task processing node; wherein the initial allocatable resources corresponding to the task processing node are the allocatable resources corresponding to when the processing node does not run any container group;
[0241] Based on the initial allocatable resources corresponding to the task processing node and the allocated resources corresponding to the task processing node, the remaining allocatable resources corresponding to the task processing node are determined.
[0242] In another possible implementation of the embodiment of the present application, the device 50 further includes: a second acquisition module, a prediction module, and a storage module, wherein:
[0243] The second acquisition module is used to obtain the historical resource usage corresponding to each container group in real time; wherein each container group includes a container group to be scheduled and each container group running in each task processing node, and the historical resource usage corresponding to any container group is the resource usage occupied by the container group when running the historical processing task;
[0244] A prediction module, used to predict the required resource amount corresponding to each container group based on the historical resource usage corresponding to each container group;
[0245] The storage module is used to store the required resource quantities corresponding to each container group.
[0246] In another possible implementation of the embodiment of the present application, the required resources corresponding to a container group to be scheduled are represented by a resource matrix, the number of columns of the resource matrix is equal to the number of unit times included in the preset time period, and the number of rows is equal to the number of types of resources required for a container group to run the task to be processed; the device 50 also includes: a third acquisition module and a fourth determination module, wherein,
[0247] The third acquisition module is used to acquire the resource amount declared by the container group to be scheduled when the required resources corresponding to the container group to be scheduled are not acquired; wherein the resource amount declared by the container group to be scheduled is represented by a matrix, and each column of data is the resource amount corresponding to each type of resource declared by the task to be processed;
[0248] The fourth determining module is used to determine the resource quantity declared by the container group to be scheduled as the required resource quantity corresponding to the container group to be scheduled within a preset time period.
[0249] It should be noted that the first determination module 51, the second determination module 53, the third determination module 54 and the fourth determination module can be the same determination module, or different determination modules, or partially the same determination module; the first acquisition module 52, the second acquisition module and the third acquisition module can be the same acquisition module, or different acquisition modules, or partially the same acquisition module, which is not limited in the embodiments of the present application.
[0250] The embodiment of the present application provides a task processing device. Compared with the related art, in the embodiment of the present application, for a certain container group to be scheduled, when determining a task processing node for scheduling the container group from multiple task processing nodes of a task processing node cluster, based on the demand resources corresponding to the container group to be scheduled within a preset time period and the relationship between the remaining allocatable resources corresponding to each task processing node in the preset time period, a target task node is determined to schedule the container group to be scheduled to perform the corresponding task. Since the demand resources corresponding to the container group to be scheduled within the preset time period are obtained based on the historical resource usage of the container group, the demand resources corresponding to the container group to be scheduled within the preset time period are more accurate, and what is predicted is the resources that the container group to be scheduled needs to occupy within a period of time, not just a simple static resource amount, so that the accuracy of the nodes allocated to the container group to be scheduled can be improved, and the problem of load imbalance can be avoided as much as possible.
[0251] The device of the embodiments of the present application can execute the method provided by the embodiments of the present application, and the implementation principles are similar. The actions performed by each module in the device of each embodiment of the present application correspond to the steps in the method of each embodiment of the present application. For the detailed functional description of each module of the device, please refer to the description in the corresponding method shown in the previous text, which will not be repeated here.
[0252] Figure 6 A schematic diagram of the structure of an electronic device applicable to the embodiment of the present application is shown. Figure 6 As shown, for example, the electronic device may be a server or a user terminal, and the electronic device may be used to implement the method provided in any embodiment of the present application.
[0253] like Figure 6 As shown in FIG. , the electronic device 2000 may mainly include at least one processor 2001 ( Figure 6 ), memory 2002, communication module 2003 and input / output interface 2004 and other components. Optionally, the components can be connected and communicated through bus 2005. It should be noted that Figure 6 The structure of the electronic device 2000 shown in the figure is merely illustrative and does not constitute a limitation on the electronic device to which the method provided in the embodiment of the present application is applicable.
[0254] The memory 2002 may be used to store an operating system and an application program, etc. The application program may include a computer program that implements the method shown in the embodiment of the present invention when called by the processor 2001, and may also include a program for implementing other functions or services. The memory 2002 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and computer programs, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compact optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0255] The processor 2001 is connected to the memory 2002 via the bus 2005, and implements corresponding functions by calling the application program stored in the memory 2002. The processor 2001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof, which may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the present invention. The processor 2001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0256] The electronic device 2000 can be connected to the network through the communication module 2003 (which may include but is not limited to components such as a network interface) to communicate with other devices (such as a user terminal or a server, etc.) through the network to achieve data interaction, such as sending data to other devices or receiving data from other devices. Among them, the communication module 2003 may include a wired network interface and / or a wireless network interface, etc., that is, the communication module may include at least one of a wired communication module or a wireless communication module.
[0257] The electronic device 2000 can be connected to the required input / output devices, such as a keyboard, a display device, etc., through the input / output interface 2004. The electronic device 2000 itself can have a display device, and can also be connected to other display devices through the interface 2004. Optionally, a storage device, such as a hard disk, can also be connected through the interface 2004, so that data in the electronic device 2000 can be stored in the storage device, or data in the storage device can be read, and data in the storage device can also be stored in the memory 2002. It can be understood that the input / output interface 2004 can be a wired interface or a wireless interface. Depending on the actual application scenario, the device connected to the input / output interface 2004 can be a component of the electronic device 2000, or it can be an external device connected to the electronic device 2000 when needed.
[0258] The bus 2005 for connecting the components may include a path for transmitting information between the above components. The bus 2005 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. According to different functions, the bus 2005 may be divided into an address bus, a data bus, a control bus, etc.
[0259] Optionally, for the solution provided in the embodiments of the present application, the memory 2002 can be used to store a computer program for executing the solution of the present application, and run by the processor 2001. When the processor 2001 runs the computer program, the actions of the method or device provided in the embodiments of the present application are implemented.
[0260] Based on the same principle as the method provided in the embodiment of the present application, the embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the corresponding content of the aforementioned method embodiment can be implemented.
[0261] An embodiment of the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the corresponding content of the aforementioned method embodiment can be implemented.
[0262] It should be noted that the terms "first", "second", "third", "fourth", "1", "2", etc. (if any) in the specification and claims of this application 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 numbers used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that shown in the figure or described in the text.
[0263] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0264] It should be understood that, although each operation step is indicated by arrows in the flowchart of the embodiment of the present application, the implementation order of these steps is not limited to the order indicated by the arrows. Unless clearly stated herein, in some implementation scenarios of the embodiment of the present application, the implementation steps in each flowchart can be performed in other orders according to demand. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on actual implementation scenarios. Some or all of these sub-steps or stages may be executed at the same time, and each sub-step or stage in these sub-steps or stages may also be executed at different times respectively. In different scenarios of execution time, the execution order of these sub-steps or stages may be flexibly configured according to demand, and the embodiment of the present application does not limit this.
[0265] The above is only an optional implementation method for some implementation scenarios of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the technical concept of the solution of the present application, other similar implementation methods based on the technical ideas of the present application are also within the protection scope of the embodiments of the present application.
Claims
1. A task processing method, characterized in that: The method comprises: For at least one container group to be scheduled, obtain the required resource amount corresponding to each container group to be scheduled within a preset time period; each container group corresponds to at least one task to be processed; the preset time period includes at least two unit times, and the required resource amount corresponding to each container group to be scheduled includes the required resource amount corresponding to each unit time in the preset time period; Determine the remaining allocatable amount of resources corresponding to each task processing node in the task processing node cluster during the preset time period; at least two task processing nodes are deployed in the cluster, and the remaining allocatable amount of resources corresponding to each task processing node includes the remaining allocatable amount of resources corresponding to each unit time during the preset time period; For each container group to be scheduled, based on the required resource amount corresponding to the container group to be scheduled and the remaining allocatable resource amount corresponding to each task processing node, determine a target node corresponding to the container group to be scheduled from the at least two task processing nodes, so that the container group to be scheduled is run in the target node to execute the at least one processing task; Among them, the determination of the target node includes: determining the resource matching degree between the demand resource matrix corresponding to each container group to be scheduled and the remaining allocatable resource matrix corresponding to each task processing node, and determining the target node from the at least two task processing nodes based on the resource matching degree; the number of columns of the demand resource matrix is equal to the number of unit times included in the preset time period, and the number of rows is equal to the number of types of resources required for a container group to run the tasks to be processed; each column of data in the remaining allocatable resource matrix represents the remaining allocatable resource amount per unit time, and each row of data represents the remaining allocatable resource amount of each type of resource.
2. The method according to claim 1, characterized in that The required resource amount corresponding to a container group to be scheduled within a preset time period is obtained based on the historical resource usage prediction corresponding to the container group to be scheduled; Or, determining the target node corresponding to the container group to be scheduled from the at least two task processing nodes based on the required resource amount corresponding to the container group to be scheduled and the remaining allocatable resource amount corresponding to each task processing node includes: Based on the remaining allocatable resources corresponding to each task processing node, at least one candidate node that meets the required resource amount corresponding to the container group to be scheduled is selected from each task processing node; Based on the required resource amount corresponding to the container group to be scheduled and the remaining allocatable resource amount corresponding to each candidate node, a target node corresponding to the container group to be scheduled is determined from the candidate nodes.
3. The method according to claim 2, characterized in that The method of selecting at least one candidate node that satisfies the required resource amount corresponding to the container group to be scheduled from each task processing node based on the remaining allocatable resource amount corresponding to each task processing node includes: Based on the remaining allocatable resources corresponding to each task processing node at each unit time, and the required resources corresponding to each unit time of the container group to be scheduled, at least one candidate node is selected from the task processing nodes; For each unit time, the remaining allocatable resources corresponding to each candidate node in the unit time are greater than the required resources corresponding to the unit time.
4. The method according to any one of claims 1 to 3, characterized in that: The determining, based on the required resource amount corresponding to the container group to be scheduled and the remaining allocatable resource amount corresponding to each task processing node, a target node corresponding to the container group to be scheduled from the at least two task processing nodes comprises: For each task processing node, based on the required resource amount corresponding to the container group to be scheduled and the remaining allocatable resource amount corresponding to the task processing node, determine the resource matching degree between the task processing node and the container group to be scheduled; The target node is determined from the at least two task processing nodes based on the resource matching degree corresponding to each of the processing task nodes in the at least two task processing nodes.
5. The method according to claim 4, characterized in that The determining, based on the required resource amount corresponding to the container group to be scheduled and the remaining allocatable resource amount corresponding to the task processing node, a resource matching degree between the task processing node and the container group to be scheduled includes: Based on the required resource amounts corresponding to the container group to be scheduled in the at least two unit times, constructing a required resource matrix of the container group to be scheduled; Based on the remaining allocatable resource amounts of the task processing node corresponding to the at least two unit times, constructing a remaining allocatable resource matrix of the task processing node; Based on the required resource matrix and the remaining allocatable resource matrix, determining at least one resource similarity between the task processing node and the container group to be scheduled in at least one manner; Based on the at least one resource similarity, a resource matching degree between the task processing node and the container group to be scheduled is determined.
6. The method according to claim 1, characterized in that For each of the task processing nodes, determining the remaining allocatable amount of resources corresponding to the task processing node in the preset time period includes: Obtain the required resource amount corresponding to each container group running in the task processing node; Determine the allocated resource amount corresponding to the task processing node based on the required resource amount corresponding to each container group; Obtaining an initial allocatable amount of resources corresponding to the task processing node; wherein the initial allocatable amount of resources corresponding to the task processing node is an allocatable amount of resources corresponding to when the processing node does not run any container group; Based on the initial allocatable amount of resources corresponding to the task processing node and the allocated amount of resources corresponding to the task processing node, the remaining allocatable amount of resources corresponding to the task processing node is determined.
7. The method according to claim 1 or 6, characterized in that: The method further comprises: Acquire the historical resource usage corresponding to each container group in real time; wherein each container group includes the container group to be scheduled and each container group running in each task processing node, and the historical resource usage corresponding to any container group is the resource usage occupied by the container group when running the historical processing task; Based on the historical resource usage of each container group, the required resource volume of each container group is predicted; The required resource amounts corresponding to each of the container groups are stored.
8. The method according to claim 1, characterized in that The method further comprises: If the required resource amount corresponding to the container group to be scheduled is not obtained, the resource amount declared by the container group to be scheduled is obtained; wherein the resource amount declared by the container group to be scheduled is represented by a matrix, and each column of data is the resource amount corresponding to each type of resource declared by the task to be processed; The resource amount declared by the container group to be scheduled is determined as the required resource amount corresponding to the container group to be scheduled within a preset time period.
9. A task processing device, characterized in that: The device comprises: A first acquisition module is used to acquire, for at least one container group to be scheduled, the required resource amount corresponding to each container group to be scheduled within a preset time period; each container group corresponds to at least one task to be processed; the preset time period includes at least two unit times, and the required resource amount corresponding to each container group to be scheduled includes the required resource amount corresponding to each unit time in the preset time period; The second determination module is used to determine the remaining allocatable resources corresponding to each task processing node in the task processing node cluster during the preset time period; at least two task processing nodes are deployed in the cluster, and the remaining allocatable resources corresponding to each task processing node include the remaining allocatable resources corresponding to each unit time within the preset time period; The third determination module is used to determine, for each container group to be scheduled, a target node corresponding to the container group to be scheduled from the at least two task processing nodes based on the required resource amount corresponding to the container group to be scheduled and the remaining allocatable resource amount corresponding to each task processing node, so that the container group to be scheduled is run in the target node to perform the at least one processing task; wherein the determination of the target node includes: determining the resource matching degree between the required resource matrix corresponding to each container group to be scheduled and the remaining allocatable resource matrix corresponding to each task processing node, and determining the target node from the at least two task processing nodes based on the resource matching degree; the number of columns of the required resource matrix is equal to the number of unit times included in the preset time period, and the number of rows is equal to the number of types of resources required to be occupied by a container group to run the task to be processed; each column of data in the remaining allocatable resource matrix represents the remaining allocatable resource amount per unit time, and each row of data represents the remaining allocatable resource amount per type of resource.
10. The device according to claim 9, characterized in that The required resource amount corresponding to a container group to be scheduled within a preset time period is obtained based on the historical resource usage prediction corresponding to the container group to be scheduled; Or, when the third determination module determines the target node corresponding to the container group to be scheduled from the at least two task processing nodes based on the required resource amount corresponding to the container group to be scheduled and the remaining allocatable resource amount corresponding to each task processing node, it is specifically used to: Based on the remaining allocatable resources corresponding to each task processing node, at least one candidate node that meets the required resource amount corresponding to the container group to be scheduled is selected from each task processing node; Based on the required resource amount corresponding to the container group to be scheduled and the remaining allocatable resource amount corresponding to each candidate node, a target node corresponding to the container group to be scheduled is determined from the candidate nodes.
11. The device according to claim 10, characterized in that The third determination module is specifically used to select at least one candidate node that meets the required resource amount corresponding to the container group to be scheduled from each task processing node based on the remaining allocatable resource amount corresponding to each task processing node: Based on the remaining allocatable resources corresponding to each task processing node at each unit time, and the required resources corresponding to each unit time of the container group to be scheduled, at least one candidate node is selected from the task processing nodes; For each unit time, the remaining allocatable resources corresponding to each candidate node in the unit time are greater than the required resources corresponding to the unit time.
12. The device according to any one of claims 9 to 11, characterized in that: The third determination module is specifically used to determine the target node corresponding to the container group to be scheduled from the at least two task processing nodes based on the required resource amount corresponding to the container group to be scheduled and the remaining allocatable resource amount corresponding to each task processing node: For each task processing node, based on the required resource amount corresponding to the container group to be scheduled and the remaining allocatable resource amount corresponding to the task processing node, determine the resource matching degree between the task processing node and the container group to be scheduled; The target node is determined from the at least two task processing nodes based on the resource matching degree corresponding to each of the processing task nodes in the at least two task processing nodes.
13. The device according to claim 12, characterized in that The third determination module is specifically used to determine the resource matching degree between the task processing node and the container group to be scheduled based on the required resource amount corresponding to the container group to be scheduled and the remaining allocatable resource amount corresponding to the task processing node: Based on the required resource amounts corresponding to the container group to be scheduled in the at least two unit times, constructing a required resource matrix of the container group to be scheduled; Based on the remaining allocatable resource amounts of the task processing node corresponding to the at least two unit times, constructing a remaining allocatable resource matrix of the task processing node; Based on the required resource matrix and the remaining allocatable resource matrix, determining at least one resource similarity between the task processing node and the container group to be scheduled in at least one manner; Based on the at least one resource similarity, a resource matching degree between the task processing node and the container group to be scheduled is determined.
14. The device according to claim 9, characterized in that For each of the task processing nodes, when determining the remaining allocatable amount of resources corresponding to the task processing node in the preset time period, the second determining module is specifically used to: Obtain the required resource amount corresponding to each container group running in the task processing node; Determine the allocated resource amount corresponding to the task processing node based on the required resource amount corresponding to each container group; Obtaining an initial allocatable amount of resources corresponding to the task processing node; wherein the initial allocatable amount of resources corresponding to the task processing node is an allocatable amount of resources corresponding to when the processing node does not run any container group; Based on the initial allocatable amount of resources corresponding to the task processing node and the allocated amount of resources corresponding to the task processing node, the remaining allocatable amount of resources corresponding to the task processing node is determined.
15. The device according to claim 9 or 14, characterized in that The device further includes: a second acquisition module, a prediction module and a storage module, wherein: The second acquisition module is used to acquire the historical resource usage corresponding to each container group in real time; wherein each container group includes the container group to be scheduled and each container group running in each task processing node, and the historical resource usage corresponding to any container group is the resource usage occupied by the container group when running the historical processing task; The prediction module is used to predict the required resource amount corresponding to each container group based on the historical resource usage corresponding to each container group; The storage module is used to store the required resource quantities corresponding to each of the container groups.
16. The device according to claim 9, characterized in that The device further includes: a third acquisition module and a fourth determination module, wherein: The third acquisition module is used to acquire the resource amount declared by the container group to be scheduled when the required resource amount corresponding to the container group to be scheduled is not acquired; wherein the resource amount declared by the container group to be scheduled is represented by a matrix, and each column of data is the resource amount corresponding to each type of resource declared by the task to be processed; The fourth determining module is configured to determine the resource quantity declared by the container group to be scheduled as the required resource quantity corresponding to the container group to be scheduled within a preset time period.
17. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the task processing method according to any one of claims 1 to 8 when running the computer program.
18. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method for task processing according to any one of claims 1 to 8 is implemented.
19. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the task processing method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Resource allocation method and device, computer equipment and storage medium
CN113110938A
Container scheduling method, electronic equipment and storage medium
CN114840304A
Resource demand prediction method, device and equipment and computer readable storage medium
CN116820739A