Task processing method and apparatus, and electronic device, storage medium and program product

By obtaining the required resources of container groups and the remaining resources of task processing nodes in Kubernetes, the node allocation is optimized, solving the problems of load imbalance and resource waste, and achieving more efficient resource utilization.

WO2025223494A1PCT designated stage Publication Date: 2025-10-30TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/090821
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-04-26
Filing Date
2025-04-24
Publication Date
2025-10-30

AI Technical Summary

Technical Problem

In existing technologies, the Kubernetes scheduler allocates nodes to container groups based solely on resource requests, leading to issues such as load imbalance and resource waste.

Method used

By obtaining the required resources of the container group and the remaining allocable resources of the task processing nodes within a preset time period, the target node is selected from multiple task processing nodes to run the container group based on these quantities, thus optimizing the scheduling decision.

Benefits of technology

It improves the accuracy of container group node allocation, reduces load imbalance, optimizes resource utilization, and avoids resource contention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025090821_30102025_PF_FP_ABST
    Figure CN2025090821_30102025_PF_FP_ABST
Patent Text Reader

Abstract

The embodiments of the present application may relate to the fields of cloud technology, databases, etc. Provided are a task processing method and apparatus, and an electronic device, a storage medium and a program product. The method may comprise: determining at least one pod, wherein each pod is used for processing at least one data processing task; acquiring the quantity of required resources of each pod within a preset time period; determining the quantity of remaining allocatable resources of each task processing node in a task processing node cluster within the preset time period, wherein the task processing node cluster comprises at least two task processing nodes; and on the basis of the quantity of required resources of each pod and the quantity of remaining allocatable resources of each task processing node, selecting, from among the at least two task processing nodes, a target node associated with a corresponding pod, so as to run the corresponding pod in the target node.
Need to check novelty before this filing date? Find Prior Art

Description

Methods, apparatuses, electronic devices, storage media, and program products for task processing

[0001] This application claims priority to Chinese Patent Application No. 202410518047.0, filed on April 26, 2024, entitled “Method, Apparatus, Electronic Device, Storage Medium and Program Product for Task Processing”, the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application belongs to the field of computer technology, and may relate to fields such as cloud technology and database processing. Specifically, this application relates to a task processing method, apparatus, electronic device, storage medium, and program product. Background Technology

[0003] Container cluster management systems (such as Kubernetes, K8s) are container-based cluster management platforms. A cluster managed by K8s deploys multiple nodes and multiple container groups. When executing data processing tasks, the container group can host the data processing task 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.

[0004] In related technologies, Kube-Scheduler is used to determine the corresponding node for a container group to be scheduled from multiple nodes. Specifically, Kube-Scheduler is a scheduler officially provided by Kubernetes to handle scheduling requests for container groups. Kube-Scheduler makes scheduling decisions by comparing the statically declared resource requirements of the container group with the total resource specifications of each node. When the declared resources of the container group to be scheduled and the total declared resources of the container groups already scheduled on that node are less than the node's total resource specifications, the container group can be scheduled to that node.

[0005] However, in the above-mentioned technologies, the container group can only be scheduled according to resource requests to execute the data processing tasks on the corresponding nodes. This may result in low accuracy in determining the nodes to be scheduled for the container group, 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 issues. For other nodes, the actual node load is much less than the resource request, which will lead to resource waste. Summary of the Invention

[0006] The purpose of this application is to provide a task processing method, apparatus, electronic device, storage medium, and program product to reduce the load imbalance problem that may occur when determining corresponding nodes for container groups to be scheduled to execute tasks. To achieve the above objective, the technical solutions provided by this application are as follows:

[0007] In a first aspect, a task processing method is provided, executed in an electronic device, the method comprising:

[0008] Identify at least one container group, wherein each container group is used to process at least one data processing task;

[0009] Obtain the resource requirements of each container group within a preset time period;

[0010] Determine the remaining allocable resources for each task processing node in the task processing node cluster during the preset time period; wherein, the task processing node cluster includes at least two task processing nodes.

[0011] Based on the resource requirements of each container group and the remaining allocable resources of each task processing node, a target node associated with the corresponding container group is selected from the at least two task processing nodes, so that the corresponding container group runs on the target node.

[0012] Secondly, a task processing apparatus is provided, the apparatus comprising:

[0013] A first determining module is used to determine at least one container group, wherein each container group is used to process at least one data processing task.

[0014] The first acquisition module is used to acquire the resource requirements of each container group within a preset time period.

[0015] The second determining module is used to determine the remaining allocable resources of each task processing node in the task processing node cluster during the preset time period; wherein, the task processing node cluster includes at least two task processing nodes.

[0016] The third determining module is used to select a target node associated with the corresponding container group from the at least two task processing nodes based on the required resource amount of each container group and the remaining allocable resource amount of each task processing node, so that the corresponding container group runs on the target node.

[0017] Thirdly, embodiments of this application also provide an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the task processing method provided by any possible implementation of the first aspect.

[0018] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the task processing method provided by any possible implementation of the first aspect.

[0019] Fifthly, embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the task processing method provided by any possible implementation of the first aspect. Attached Figure Description

[0020] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.

[0021] Figure 1a is a schematic diagram of the application environment of a task processing method provided in an embodiment of this application;

[0022] Figure 1b is a schematic diagram of an architecture of a Kubernetes system provided in an embodiment of this application;

[0023] Figure 1c is a schematic diagram of the application environment for another task processing method provided in this application embodiment;

[0024] Figure 2 is a schematic flowchart of a task processing method provided in an embodiment of this application;

[0025] Figure 3 is a flowchart illustrating a task processing method according to an embodiment of this application.

[0026] Figure 4 is a flowchart of another task processing method provided in an embodiment of this application;

[0027] Figure 5 is a schematic diagram of a task processing device provided in an embodiment of this application;

[0028] Figure 6 is a schematic diagram of the device structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0029] The embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the embodiments described below with reference to the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions of the embodiments of this application.

[0030] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the terms “comprising” and “including” as used in embodiments of this application mean that the corresponding feature can be implemented as the presented feature, information, data, step, operation, element, and / or component, but do not exclude implementation as other features, information, data, step, operation, element, component, and / or combinations thereof supported by the art. It should be understood that when we say that an element is “connected” or “coupled” to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element establish a connection relationship through an intermediate element. Furthermore, “connected” or “coupled” as used herein can include wireless connection or wireless coupling. The term “and / or” as used herein indicates at least one of the items defined by the term; for example, “A and / or B” can 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 explicitly defined, the multiple items can refer to one, several or all of the multiple items. For example, the description of "parameter A includes A1, A2, A3" can be implemented as parameter A includes A1 or A2 or A3, or it can be implemented as parameter A includes at least two of the three items A1, A2 and A3.

[0031] To better understand the embodiments provided in this application, some terms are explained below:

[0032] Kubernetes is an open-source application used to manage containerized applications across multiple hosts in a cloud platform. Kubernetes aims to make deploying containerized applications simple and powerful, providing a mechanism for application deployment, planning, updating, and maintenance. Kubernetes defines a series of building blocks in its design structure, designed to provide a mechanism for deploying, maintaining, and scaling applications. The components that make up Kubernetes are designed to be loosely coupled and scalable, allowing them to meet a variety of workloads. Scalability is largely provided by the Kubernetes API, which is primarily used as an extension of internal components and as containers running on Kubernetes. See Figure 1a, which is a schematic diagram of the architecture of a Kubernetes system provided in an embodiment of this application. As shown in Figure 1b, a Kubernetes system typically contains one master node and multiple compute nodes. The master node shown here can be the enhanced scheduling node described below. The master node includes an API Server, a Scheduler, a Controller manager, and etcd. The API Server is the external interface of the entire system, accessible to clients and other components. The Scheduler is responsible for scheduling resources within the cluster. The Controller manager is the controller responsible for management. etcd is a distributed, reliable key-value store used to store data. Nodes include Pods, Docker, kubelet, kube-proxy, and Fluentd. A Pod is the most basic unit of operation in Kubernetes. A Pod represents a process running in the cluster, and it encapsulates one or more closely related containers. Docker is used to create containers, kubelet is responsible for detecting Pods assigned to its Node, including creating, modifying, and deleting them, kube-proxy is responsible for providing a proxy for Pod objects, and Fluentd is responsible for log collection, storage, and querying.

[0033] Pod: The basic unit of scheduling in Kubernetes is called a "pod." This abstraction allows higher-level abstractions to be added to containerized components. A pod typically contains one or more containers, ensuring they remain on the host and can share resources. Each pod in Kubernetes is assigned a unique (within the cluster) IP address, allowing applications to use the same port without conflicts. A pod can define a volume, such as a local disk directory or network disk, and expose it within a container within the pod. Pods can be managed manually via the Kubernetes API or delegated to a controller for automated management.

[0034] A Node, also known as a Worker, Minion, or simply a node, is a single machine (or virtual machine) that deploys containers (workloads). Each node in a cluster must have a container runtime environment, such as Docker.

[0035] Application Programming Interface Service (APIServer): Provides Kubernetes resource representational state transfer (HTTP REST) ​​interfaces for creating, deleting, modifying, querying, and retrieving various resource objects. It serves as the data bus and data center for the entire system. APIServer's functions include: (1) providing REST API (Application Programming Interface) interfaces for cluster management (including authentication and authorization, data verification, and cluster state changes); (2) serving as a hub for data interaction and communication between other modules (other modules can query or modify data through APIServer); (3) acting as the entry point for resource quota control; and (4) possessing a complete cluster security mechanism.

[0036] Cosine similarity is a metric used to measure the similarity between two vectors. It determines their similarity by calculating the cosine of the angle between the two vectors. The value of cosine similarity ranges from -1 to 1. When the two vectors are in the same direction, the cosine similarity is 1; when they are in opposite directions, the cosine similarity is -1; and when their directions are completely unrelated, the cosine similarity is 0. In natural language processing, recommender systems, and other fields, cosine similarity is often used to measure the similarity between text, users, or items. For example, in text mining, each article can be represented as a vector in a high-dimensional space, where each dimension corresponds to a term, and the value of the dimension represents the weight of that term in the article. By calculating the cosine similarity of the vectors of two articles, their content similarity can be obtained.

[0037] 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 calculated by determining the straight-line distance between two points, and its formula is based on the Pythagorean theorem.

[0038] For two points A(x1,y1) and B(x2,y2) on a two-dimensional plane, the Euclidean distance between them can be calculated using the following formula:

[0039] distance=sqrt((x2-x1)^2+(y2-y1)^2);

[0040] In high-dimensional space, the Euclidean distance between two points can be calculated using a similar formula: simply sum the squared differences of each dimension and then take the square root.

[0041] Euclidean distance has wide applications in many fields, such as data mining, machine learning, and image processing. In these fields, Euclidean distance is often used to measure the similarity or difference between samples.

[0042] A component is a functional module of a mini-program's view, also known as a front-end component. These include buttons, titles, tables, sidebars, content, and footers on a page. Components contain modular code that can be reused across different pages of a mini-program.

[0043] Workload: A workload is a type of application that can contain multiple replica instances.

[0044] In related technologies, there are also methods to schedule container groups (pods) based on the current actual utilization of a node, but not based on the actual resource needs of the container group. Consider the following scenario: the actual resource needs of the container group at time t + the actual resource utilization of the node at time t > the total resources of the node * the target scheduling watermark (t can be any time). In this scenario, the container group will still be scheduled onto the node. After scheduling, this could potentially lead to insufficient available resources on the node, resulting in stability issues.

[0045] A container is a runtime environment for at least one application. In some embodiments, a container is a runtime environment that encapsulates an application and all its dependencies (runtime environment, system tools, libraries, etc.).

[0046] This application provides a method for staggered deployment based on actual resource requirements, which can support the same scale of business with fewer resources, or reduce resource contention while keeping the total resource specifications unchanged, thus improving scheduling reliability. This application can be applied to Kubernetes clusters, but is not limited to Kubernetes clusters.

[0047] Optionally, the solutions provided in this application embodiment may involve cloud technology and database processing technology. For example, the solutions in this application embodiment can be executed by a server, wherein the server can be a cloud server. The data processing involved in the implementation of this solution can be implemented based on cloud technology, and the data storage involved in the implementation can adopt cloud storage. For example, calculating the Euclidean distance between the resource requirements corresponding to each container group to be scheduled and the remaining allocable resources corresponding to each task processing node can be implemented using cloud technology, and storing the required resource amount corresponding to each container group can be done using cloud storage, stored in a cloud server.

[0048] Specifically, a database can be simply viewed as an electronic filing cabinet—a place to store electronic files, where users can perform operations such as adding, querying, updating, and deleting data. A "database" is a collection of data stored together in a certain way, shared by multiple users, with minimal redundancy, and independent of application programs. A Database Management System (DBMS) is a computer software system designed to manage databases, generally possessing basic functions such as storage, retrieval, security, and backup. DBMSs can be classified according to the database model they support, such as relational or Extensible Markup Language (XML); or according to the type of computer they support, such as server clusters or mobile phones; or according to the query language used, such as SQL (Structured Query Language) or XQuery; or according to performance priorities, such as maximum scale or maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMSs can cross categories, for example, simultaneously supporting multiple query languages.

[0049] Cloud computing is a computing model that distributes computing tasks across a resource pool composed of a large number of computers, enabling various application systems to access computing power, storage space, and information services as needed. The network providing these resources is called the "cloud." From the user's perspective, the resources in the "cloud" are infinitely scalable, readily available, on-demand, expandable, and pay-as-you-go.

[0050] As a provider of basic cloud computing capabilities (i.e., a cloud vendor), a cloud computing resource pool (referred to as a cloud platform, generally called an IaaS (Infrastructure as a Service) platform) is established. Various types of virtual resources are deployed in the resource pool for external customers to choose from. The cloud computing resource pool mainly includes: computing devices (virtualized machines containing operating systems), storage devices, and network devices.

[0051] Based on logical function, a PaaS (Platform as a Service) layer can be deployed on top of the IaaS (Infrastructure as a Service) layer, and a SaaS (Software as a Service) layer can be deployed on top of the PaaS layer. Alternatively, SaaS can be deployed directly on top of IaaS. PaaS is a platform for running software, such as databases and web containers. SaaS refers to various types of business software, such as web portals and bulk SMS senders. Generally speaking, SaaS and PaaS are upper layers compared to IaaS.

[0052] Cloud technology is a collective term for network technology, information technology, integration technology, management platform technology, and application technology applied to the cloud computing business model. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Cloud storage, on the other hand, is a new concept that extends and develops from cloud computing. A distributed cloud storage system (hereinafter referred to as a storage system) refers to a storage system that uses cluster applications, grid technology, and distributed storage file systems to aggregate a large number of various types of storage devices (also called storage nodes) in a network to work collaboratively, providing data storage and business access functions.

[0053] Cloud products refer to cloud computing products that provide cloud services. There are many types of cloud computing products, widely used in various fields such as transportation, healthcare, and energy. Different products have different characteristics and application scenarios. For example, cloud management products are used to manage and deploy cloud computing resources, achieving unified management of cloud resources; cloud storage products provide storage services based on cloud computing platforms, offering massive storage space and high-speed access; cloud security products involve protecting the network security of the cloud computing environment, providing robust security protection functions; and cloud communication products provide communication services based on cloud computing platforms, enabling data transmission and providing a more convenient and efficient communication method.

[0054] It should be noted that, in the optional embodiments of this application, the data related to object information (tasks to be processed, etc.) requires the permission or consent of the object when the embodiments of this application are applied to specific products or technologies. Furthermore, the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. In other words, if the embodiments of this application involve data related to an object, it must be obtained with the object's authorization and consent, the authorization and consent of relevant departments, and in accordance with the relevant laws, regulations, and standards of the country and region. If the embodiments involve personal information, the acquisition of all personal information requires the individual's consent. If sensitive information is involved, the separate consent of the information subject is required. The embodiments also need to be implemented with the object's authorization and consent.

[0055] This application provides an application environment for a task processing method, as shown in Figure 1a. This 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 the accessing device, and the second device 102 is the accessed device. The first device 101 is the device where the data processing task initiator is located; it can be an application server, a terminal where the application client is located, an in-vehicle device, a smart speaker, etc., without specific limitations. The second device 102 can be the master node in a cluster system. The server can be an independent physical server, a server cluster composed of multiple physical servers, or a distributed system. It can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The cluster system is, for example, the Kubernetes system shown in Figure 1b. Nodes can be devices without public IP addresses, such as smart cars, smart speakers, and smartwatches, but are not limited to these. Nodes and servers can be connected directly or indirectly via wired or wireless communication, and this application does not impose any restrictions on this.

[0056] Specifically, based on Figure 1a, a more detailed scenario is shown in Figure 1c, where the aforementioned master node is deployed in a cluster system as shown in Figure 1b. Figure 1c is a schematic diagram of an application scenario according to an embodiment of this application. As shown in Figure 1c, this application scenario includes a cluster system 110 and a first device 120. The cluster system 110 includes an enhanced scheduling node 111 (which can be the master node shown above) and multiple task processing nodes (the first task processing node 112 and the second task processing node 113 are exemplarily shown in Figure 1c). Each task processing node is equipped with a graphics processing unit (GPU) and / or a central processing unit (CPU), etc., and one or more container groups can run on each GPU and / or each CPU. The enhanced scheduling node 111 is used for resource scheduling; specifically, it can schedule container groups to run on the GPUs and / or CPUs of the corresponding task processing nodes according to the method of this application.

[0057] The first device 120 refers to the device where the data processing task initiator is located; it can be the application server of the application, or the terminal where the application client is located, in-vehicle equipment, smart speakers, etc., without specific limitations. The data 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., without specific limitations. It should be noted that the GPU (CPU) mentioned below refers to a GPU and / or CPU, which will not be elaborated in the following embodiments.

[0058] The enhanced scheduling node 111 (also known as the master node) in the cluster system 110 can also be responsible for communicating with external devices. After receiving a task processing request initiated by the first device 120, the enhanced scheduling node 111 allocates available GPUs (CPUs) for the task processing request based on the resource requirements requested in the task processing request and the remaining resources of the GPUs (CPUs) in each task processing node. Then, it can request the creation of container groups for the data processing tasks indicated by the task processing request. Subsequently, the enhanced scheduling node 111 can schedule the container groups according to the method of this application to schedule the container groups to be scheduled to run on the GPUs (CPUs) in the task processing nodes to utilize the resources in the GPUs (CPUs) for task processing. Figure 1c exemplarily shows container groups I and II running on the GPU of the first task processing node 112, and container group III running on the GPU of the second task processing node 113. After the running container groups finish running, the task processing nodes can return the task processing results to the enhanced scheduling node 111, and the enhanced scheduling node 111 sends the task processing results to the first device 120.

[0059] It should be noted that if the cluster system 110 is a Kubernetes cluster, the container group can be referred to as a pod; furthermore, although the above description uses GPU and / or CPU as examples to introduce resources, the resources shown in the embodiments of this application are not limited to GPU and / or CPU. Any resources required to run a container group to perform the corresponding data processing tasks are within the protection scope of the embodiments of this application.

[0060] To facilitate a better understanding and explanation of the methods provided in the embodiments of this application, the optional implementation methods of the methods provided in this application will first be described below with reference to a specific scenario embodiment. Under the system architecture shown above, the embodiments of this application provide a task processing method, which can be executed by the enhanced scheduling node shown above. In this embodiment, the enhanced scheduling node can be a virtual node located in a server, or it can be a physical node, as shown in Figure 2. The method may include:

[0061] Step S201: Determine at least one container group. Each container group is used to process at least one data processing task. Each container group includes at least one container.

[0062] Specifically, for a Kubernetes cluster, a container group can be called a pod. A pod contains an application container (or in some cases multiple containers), storage resources, a unique network IP address, and some options that determine how the container should run. A pod container group represents a single running instance of an application in Kubernetes, which may consist of a single container or several tightly coupled containers. In the embodiments of this application, each container group is used to process at least one data processing task; that is, a container group can host at least one data processing task to run.

[0063] Specifically, in the embodiments of this application, the data processing task may include: training task, calculation task, and data search task, etc. Any task that can be executed on the node is within the protection scope of the embodiments of this application.

[0064] Step 202: Obtain the resource requirements of each container group within a preset time period.

[0065] In this embodiment of the application, the preset time period can be pre-set, that is, it can be pre-set by the administrator or determined based on the administrator's input. In this embodiment of the application, the preset time period can be any time period; for example, a day or a month can be used as the preset time period.

[0066] Specifically, if the preset time period is one day, that is, for each container group to be scheduled, obtain the required resource amount of the container group to be scheduled within one day.

[0067] In this embodiment, the resource demand of a container group within a preset time period is predicted based on the historical resource usage of that container group. That is, the resource demand of a container group within a preset time period (within that day) is predicted based on the historical resource usage of that container group. The historical resource usage of each container group refers to the resource usage of the corresponding container group during its runtime. For example, the resource demand is the average of the amount of resources used over multiple runtime periods. As another example, a preset time period includes at least two unit time periods, and the resource demand of each container group includes the resource demand of the corresponding container group in each unit time period within the preset time period. The resource demand in each unit time period is the average of the amount of resources used in the corresponding unit time period over multiple runtime periods, but is not limited to this.

[0068] In some embodiments of this application, the resource requirements of each container group within a preset time period can be pre-stored in a database. When a container group needs to be scheduled, its resource requirements within the preset time period are retrieved from the database. In some embodiments of this application, the resource requirements of a container group within a preset time period can be predicted based on its historical resource usage.

[0069] In some embodiments of this application, the method can also obtain the historical resource usage of each container group. The historical resource usage of each container group refers to the resource usage of the corresponding container group during its runtime. Then, based on the historical resource usage of each container group, the required resource amount for each container group is predicted. Subsequently, the required resource amount for each container group is stored.

[0070] It should be noted that the resource demand of a container group within a preset time period can be predicted by the enhanced scheduling node shown above, or by other devices. For example, it can be predicted by a prediction component set in other devices.

[0071] Step 203: Determine the remaining allocable resources for each task processing node in the task processing node cluster during the preset time period.

[0072] The task processing node cluster includes at least two task processing nodes, and the remaining allocable resources are the remaining allocable resources of each task processing node in the task processing node cluster within a preset time period. For example, the task processing node cluster may deploy task processing node 1 and task processing node 2, that is, calculate the remaining allocable resources of task processing node 1 within one day (within that day), and the remaining allocable resources of task processing node 2 within that day.

[0073] It should be noted that steps S201-S202 can be executed before step S203, after step S203, or simultaneously with step S202. This application embodiment does not impose any limitations on these steps.

[0074] Step 204: Based on the resource requirements of each container group and the remaining allocable resources of each task processing node, select the target node associated with the corresponding container group from the at least two task processing nodes, so that the corresponding container group runs on the target node.

[0075] Taking a preset time period of one day as an example, step 204 can select the target node associated with the corresponding container group from at least two task processing nodes based on the predicted resource demand of the container group and the remaining allocable resources of each task processing node during that day. In some embodiments, step 204 selects the node with the optimal compact packing for the corresponding container group as the target node to optimize scheduling decisions.

[0076] Furthermore, once a target node is identified for a container group, that target node is used as the final task processing node bound to the container group, so that the corresponding container group can be run on that target node to execute at least one data processing task associated with the corresponding container group.

[0077] Compared with related technologies, in this embodiment, when determining the task processing node for scheduling a container group from multiple task processing nodes in a task processing node cluster for a container group to be scheduled, the target task node is determined based on the relationship between the resource demand of the container group to be scheduled within a preset time period and the remaining allocable resources of each task processing node within the preset time period. This allows the container group to be scheduled to execute corresponding tasks, thereby improving the accuracy of node allocation for the container group to be scheduled and minimizing load imbalance. Furthermore, since the resource demand of the container group to be scheduled within the preset time period is based on its historical resource usage, the accuracy of the resource demand is higher, further improving the accuracy of node allocation and thus enhancing load balancing.

[0078] In this embodiment, as shown in Figure 3, for a Kubernetes cluster, an enhanced scheduler component can be deployed in the cluster. This enhanced scheduler component can be deployed in the enhanced scheduling node shown above. The cluster also includes an API Server, meaning the enhanced scheduler component can detect the creation event of a pod object (container group) without a nodename from the API Server. Furthermore, the scheduler component specified by this pod object creation event is the enhanced scheduler component, thus identifying the pod object without a nodename as a container group to be scheduled (specifically, the container group to be scheduled can be detected through the API Server). In this embodiment, the method for creating a new pod and specifying the enhanced scheduler component is as follows:

[0079] Furthermore, in this embodiment of the application, as shown in Figure 3, for the Kubernetes cluster, a detection component can be deployed in the cluster. This detection component may or may not be deployed in the enhanced scheduling node mentioned above. Further, in this embodiment of the application, a database component and a prediction component can also be deployed. These components may or may not be located in the Kubernetes cluster, as shown in Figure 3, where the database component and prediction component are not located in the Kubernetes cluster. The detection component can periodically collect resource usage data corresponding to each container group in the cluster and store the collected resource usage data for each container group in the database component. The prediction component can obtain historical resource usage data corresponding to each container group from the database component to predict the required resource amount for each container group within a preset time period and store this prediction data in the database component. Subsequently, after the enhanced scheduler component determines the container group to be scheduled, it obtains the required resource amount for each container group to be scheduled within the preset time period from the database component. As shown in Figure 3, the prediction component periodically obtains historical resource usage data for each container group, predicts the demand matrix for each container group, and stores it in the database component.

[0080] Furthermore, when the prediction component is set up in the Kubernetes cluster, the prediction component and the enhanced scheduler component can be deployed on a single device, namely, on the enhanced scheduling node shown above. This enhanced scheduling node periodically obtains the historical resource usage corresponding to each container group. Each container group includes the container group to be scheduled and each container group running on each task processing node. The historical resource usage corresponding to any container group is the resource usage occupied by that container group when running historical data processing tasks. Then, based on the historical resource usage corresponding to each container group, the required resource amount corresponding to each container group is predicted, and then the required resource amount corresponding to each container group is stored. In this embodiment, the required resource amount corresponding to each container group is stored in the database component.

[0081] In some embodiments, the preset time period includes at least two unit time periods, each unit time period having a duration of a preset time unit. The resource requirements of each container group include the resource requirements of the corresponding container group in each unit time period within the preset time period. The remaining allocable resources of each task processing node include the remaining allocable resources of the corresponding task processing node in each unit time period within the preset time period. For example, if the preset time period is one day and the preset time unit is 1 hour, then the resource requirements of a container group include: the resource requirements of the container group in each hour of that day.

[0082] In some embodiments, determining the remaining allocatable resources of each task processing node in the task processing node cluster during the preset time period may include: obtaining the resource requirements of each container group running by each task processing node during the preset time period; determining the allocated resources of the corresponding task processing node based on the resource requirements of each container group running by each task processing node during the preset time period; obtaining the initial allocatable resources of each task processing node; wherein the initial allocatable resources of each task processing node are the allocatable resources when the corresponding task processing node is not running any container groups; and determining the remaining allocatable resources of the task processing node during the preset time period based on the initial allocatable resources and the allocated resources of each task processing node.

[0083] In this embodiment, each task processing node may already be running at least one container group. Therefore, for any task processing node, when determining the remaining allocatable resources of the task processing node within a preset time period, the resource requirements of each container group running in the task processing node (i.e., the resource requirements of each container group to be run within the preset time period) are obtained. Then, the resource requirements of each container group are summed to obtain the allocated resources of the task processing node. Finally, the remaining allocatable resources of the task processing node are determined based on the initial allocatable resources of the task processing node and the allocated resources of the task processing node. In this embodiment, the initial allocatable resources of the task processing node can be obtained first, followed by the resource requirements of each container group running in the task processing node; alternatively, the resource requirements of each container group running in the task processing node can be obtained first, followed by the initial allocatable resources of the task processing node. Alternatively, the resource requirements of each container group running in the task processing node and the initial allocatable resources of the task processing node can be obtained simultaneously, which is not limited in this embodiment.

[0084] As can be seen from the above, the preset time period includes at least two unit time periods. That is, the resource requirements corresponding to each container group running in the task processing node, the initial allocatable resources of the task processing node, the allocated resources of the task processing node, and the remaining allocatable resources of the task processing node can all include the remaining allocatable resources in each unit time period within the preset time period. Specifically, the resource requirements of each container group running in the task processing node include the resource requirements in each unit time period within the preset time period; the initial allocatable resources of the task processing node can include the initial allocatable resources in each unit time period within the preset time period; the allocated resources of the task processing node can include the allocated resources in each unit time period within the preset time period; and the remaining allocatable resources of the task processing node include the remaining allocatable resources corresponding to each unit time period within the preset time period.

[0085] Taking a preset time period of one day and a unit time period of one hour as an example, the resource requirements corresponding to each container group running in the task processing node include: the resource requirements corresponding to each hour from 0 to 24 hours in that day; the initial allocatable resources of the task processing node may include: the initial allocatable resources corresponding to each hour from 0 to 24 hours in that day; the allocated resources of the task processing node may include: the allocated resources corresponding to each hour from 0 to 24 hours in that day; the remaining allocatable resources of the task processing node include: the remaining allocatable resources corresponding to each hour from 0 to 24 hours in that day.

[0086] Further, after obtaining the allocatable resource amount corresponding to each unit time period of each task processing node within the preset time period, step S204 selects the target node associated with the corresponding container group from the at least two task processing nodes based on the required resource amount of each container group and the remaining allocatable resource amount of each task processing node, so that the corresponding container group runs in the target node. Specifically, this may include: filtering at least one candidate node that meets the required resource amount of the corresponding container group from the at least two task processing nodes based on the remaining allocatable resource amount of each task processing node; and selecting the target node associated with the corresponding container group from the at least one candidate node based on the required resource amount of the corresponding container group and the remaining allocatable resource amount of each of the at least one candidate node.

[0087] In this embodiment, the resource requirements of the container group to be scheduled and the remaining allocable resources of each task processing node are respectively the resource amounts for each unit time period within a preset time period. That is, the predicted resource requirements of the container group to be scheduled are the resource requirements for each unit time period within the preset time period, and the remaining allocable resources of any task processing node are the remaining allocable resources for that task processing node in each unit time period within the preset time period. The resource requirements for each unit time period are matched with the remaining allocable resources in the corresponding unit time period to determine the target node, ensuring high accuracy of the target node. This allows for off-peak deployment of services based on actual resource requirements, maximizing resource utilization and reducing resource contention.

[0088] Specifically, in the embodiments of this application, the remaining allocable resources and the required resources of the corresponding container group can be obtained through the above embodiments, so as to select at least one task processing node whose remaining allocable resources are not less than the required resources of the container group to be scheduled as a candidate node.

[0089] Specifically, as described above, the preset time period includes at least two unit time periods, each unit time period having a duration of a preset time unit. The resource requirements of each container group include the resource requirements of the corresponding container group in each unit time period within the preset time period. The remaining allocable resources of each task processing node include the remaining allocable resources of the corresponding task processing node in each unit time period within the preset time period. In this embodiment, selecting at least one candidate node that meets the resource requirements of the corresponding container group from the at least two task processing nodes based on the remaining allocable resources of each task processing node in each unit time period may include: selecting at least one candidate node from the at least two task processing nodes based on the remaining allocable resources of each task processing node in each unit time period and the resource requirements of the corresponding container group in each unit time period. Wherein, for each unit time period, the remaining allocable resources of each candidate node in that unit time period are greater than the resource requirements of the corresponding container group in that unit time period.

[0090] As shown in Figure 3, a unit time period is one hour. The enhanced scheduler component filters out nodes with insufficient resources in any hour. For example, the remaining allocable resources for each task processing node in each unit time period are the remaining allocable resources corresponding to that task node at each hour from 0 to 24. The resource requirements of the container group to be scheduled in each unit time period are the resource requirements corresponding to that container at each hour from 0 to 24. For a task processing node, the remaining allocable resources corresponding to that task processing node at each hour from 0 to 23 are compared with the resource requirements of the container to be scheduled at each hour from 0 to 24. The resource demand corresponding to each of the four hours is compared one by one according to the hourly correspondence. The remaining allocable resources corresponding to each hour are selected to be no less than the resource demand corresponding to them. That is, the remaining allocable resources corresponding to the hour from 0:00 to 1:00 are no less than the resource demand corresponding to the hour from 0:00 to 1:00, the remaining allocable resources corresponding to the hour from 1:00 to 2:00 are no less than the resource demand corresponding to the hour from 1:00 to 2:00, and so on. In addition, the remaining allocable resources corresponding to the hour from 23:00 to 24:00 are no less than the resource demand corresponding to the hour from 23:00 to 24:00.

[0091] Furthermore, through the above embodiments, some task processing nodes are first filtered out because the remaining allocable resources of these task processing nodes may be less than the resource demand at certain times. This is to obtain candidate nodes in which the remaining allocable resources in each unit time period are greater than the resource demand corresponding to that unit time period, thereby improving the accuracy of subsequent target node selection and reducing the computational load of subsequent target node selection.

[0092] In another possible implementation of this application embodiment, step S204, based on the required resource amount of each container group and the remaining allocable resource amount of each task processing node, selects a target node associated with the corresponding container group from the at least two task processing nodes so that the corresponding container group runs on the target node. Specifically, this may include: determining the resource matching degree between each task processing node and the corresponding container group based on the required resource amount of the corresponding container group and the remaining allocable resource amount of each task processing node; and determining the target node associated with the corresponding container group from the at least two task processing nodes based on the resource matching degree.

[0093] In some embodiments, the resource matching degree between each task processing node and the corresponding container group is determined based on the required resource quantity of the corresponding container group and the remaining allocable resources of each task processing node. Specifically, this may include: constructing a required resource matrix for the corresponding container group based on its required resource quantity over the at least two unit time periods, wherein the required resource matrix characterizes the resource quantity of at least one resource type of the corresponding container group over each unit time period; constructing a remaining allocable resource matrix for each task processing node based on its remaining allocable resources over the at least two unit time periods, wherein the remaining allocable resource matrix characterizes the remaining allocable resources of at least one resource type of the corresponding task processing node over each unit time period; determining at least one similarity index between each task processing node and the corresponding container group based on the required resource matrix of the corresponding container group and the remaining allocable resource matrix of each task processing node; and determining the resource matching degree between each task processing node and the corresponding container group based on the at least one similarity index.

[0094] Specifically, the resource requirements of each container group are represented by a resource matrix. The number of columns in the resource matrix is ​​equal to the number of time periods included in the preset time period, and the number of rows is equal to the number of resource types required by the corresponding container group to run data processing tasks. For example, the resource requirements of a container group can be represented by the following resource matrix R, where the resource matrix R is shown below:

[0095] In this matrix, each row represents a different type of resource, and each column represents the amount of resources used in different time periods. The first column of the R matrix represents the amount of resources used by the corresponding container group in one hour from 0:00 to 1:00, the second column represents the amount of resources used by the corresponding container group in one hour from 1:00 to 2:00, and so on, until the last column represents the amount of resources used by the corresponding container group in one hour from 23:00 to 24:00. For example, the first row represents the amount of GPU resources required by the corresponding container group, and c0 can represent the amount of GPU resources required by the container group to be scheduled in one hour from 0:00 to 1:00.

[0096] The remaining allocable resources of a task processing node can also be represented by a remaining allocable resource matrix. Taking task processing node j as an example, the remaining allocable resource matrix corresponding to task processing node j is represented by S. j Characterization is performed, where S j As shown below:

[0097] Among them, S j Each column of the matrix represents: the amount of allocable resources remaining in each time period from 0 to 24 hours; and the amount of allocable resources remaining for each type of resource in each row. For example, the S above... j The first row of the matrix still represents the amount of GPU resources, specifically representing the amount of allocable resources remaining for task processing node j at different times, S. j,m1 The remaining allocable resources of type m corresponding to task processing node j within one hour from point 1 to 2.

[0098] Furthermore, after obtaining the demand resource matrix of the corresponding container group and the remaining allocable matrix corresponding to each task processing node, based on the demand resource matrix and the remaining allocable resource matrix, at least one similarity index between the task processing node and the corresponding container group is determined by at least one method. Then, based on at least one similarity index, the resource matching degree between the task processing node and the container group is determined.

[0099] Specifically, at least one method may include: Euclidean distance and / or cosine similarity, i.e., 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.

[0100] Specifically, based on the following formula 1, the Euclidean distance between the remaining allocable resource matrix S of node j and the resource demand matrix R of the corresponding container group is calculated:

[0101] Where d is the Euclidean distance between the remaining allocable resource matrix S of computing node j and the demand resource matrix R of the container group.

[0102] Specifically, when calculating the cosine similarity between the remaining allocable resource matrix S of node j and the demand resource matrix R of the container group, the two matrices are first flattened into vectors before calculation. Specifically, the cosine similarity between the remaining allocable resource matrix S of node j and the demand resource matrix R of the container group is calculated based on the following formula 2:

[0103] in

[0104] The W matrix is ​​user-defined based on the importance of the resources. The W in this embodiment is merely one possible implementation and is not intended to limit the scope. Taking 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 weight of network resources is 1; that is, CPU weight = 2, MEM weight = 1, and network weight = 1.

[0105] Furthermore, after obtaining the Euclidean distance between the remaining allocable resource matrix S of node j and the demand resource matrix R of the container group, and the cosine similarity between the remaining allocable resource matrix S of node j and the demand resource matrix R of the container group, the score of node j is calculated based on the following formula 3 to characterize the degree of resource matching between the task processing node j and the container group, wherein,

[0106] Where f represents the cosine similarity between the remaining allocable resource matrix S of node j and the demand resource matrix R of the container group; d is the Euclidean distance between the remaining allocable resource matrix S of node j and the demand resource matrix R of the container group; score j The score representing node j.

[0107] Furthermore, the scores between each task processing node and its corresponding container group can be obtained through the above method.

[0108] Furthermore, the node with the highest score among the task processing nodes and their respective container groups is selected as the final node bound to that container group. Specifically, as shown in Figure 3, the enhanced scheduler component selects the node with the highest score as the final node bound to the corresponding container group.

[0109] Furthermore, the bind interface is invoked to submit the corresponding container group and the node that the container group is ultimately bound to to the application interface server (Apiserver) to complete the scheduling process.

[0110] In some embodiments, the resource requirement of a container group is predicted based on the historical resource usage of that container group. If the predicted resource requirement of the container group is not obtained when determining the target node associated with the container group, a preset resource requirement for the container group is obtained. This preset resource requirement includes the quantity of each type of resource. The preset resource requirement is determined as the resource requirement of the container group within a preset time period.

[0111] The preset resource quantity of the container group is represented by a matrix, and each column of data represents the preset resource quantity of each type of resource for the data processing task.

[0112] Furthermore, after setting the preset resource amount of the container group as the required resource amount of the container group within a preset time period, the method of determining the target node corresponding to the container group based on the required resource amount of the container group within the preset time period is detailed in the above embodiments and will not be repeated here.

[0113] The following embodiments illustrate the task processing method shown in the embodiments of this application through specific examples. In this example, a Kubernetes cluster is used as an example, wherein the Kubernetes cluster includes multiple task processing nodes, as shown in the following embodiment, as shown in Figure 4:

[0114] Step 1: Deploy the enhanced scheduler component as a pod in the Kubernetes cluster;

[0115] Step 2: Enhance the scheduler component to construct the allocable resource matrix T for all nodes in the cluster. Taking node j as an example, the Tj matrix is ​​as follows:

[0116] In this matrix, each row represents a resource dimension, and each column represents the resource specifications for each hour. Since the node specifications remain unchanged, the values ​​in each row are consistent.

[0117] Step 3: The enhanced scheduler component detects the creation event of the specified enhanced scheduler pod object without a nodename from the ApiServer in the Kubernetes cluster;

[0118] Step 4: Enhance the scheduler component to handle pod scheduling after detecting events related to the pod;

[0119] (1) Prefiltering stage: Retrieve the demand matrix R of the pre-scheduled pods from the database. Each row of this matrix represents a resource dimension, indicating different types of resources, and each column represents the resource demand for a specific hour, indicating the amount of resources required within that hour.

[0120] The process involves obtaining the resource requirement matrix R of the pre-scheduled pod, which is the requirement matrix of the pods in the workload to which the pod resides. If the pod requirement matrix of the workload can be successfully obtained, the process proceeds to the next stage. If the pod requirement matrix of the same workload cannot be found, the resource requirement of each column is initialized to the resource specifications declared by the pod.

[0121] (2) Filtering stage:

[0122] ① Calculate the allocated resource matrix U of node J. Specifically, the method for calculating the allocated resource matrix U of node J includes: obtaining the K container groups (Pods) of the current node J. Then, the allocated resource matrix U of node J is the sum of k R matrices. Taking node j as an example, the Uj matrix is ​​as follows:

[0123] If R cannot be obtained k If the value is , then R needs to be adjusted. k The resource requirements are initialized to the resource specifications declared by the pod. Each column of resource requirements is initialized to the resource specifications declared by the pod.

[0124] ② Calculate the remaining allocable resource matrix S for each node. Taking node j as an example, the remaining allocable resource matrix Sj for node j is calculated using the following formula, where S j =T j -U j ;

[0125] in,

[0126] ③ Filter out nodes that are resource-insufficient at any given time. That is, the nodes obtained after filtering must satisfy the following condition:

[0127] Resource dimension d:

[0128] (3) Scoring stage:

[0129] If there are fewer than 2 filtered nodes, the Score stage is skipped; if there are 2 or more filtered nodes, the Score stage can be executed. In this embodiment, the score of each node is calculated.

[0130] Specifically, taking node j as an example, the scoring method for node j is introduced, including:

[0131] The Euclidean distance between the remaining allocable resource matrix S of node j and the demand resource matrix R of the container group is calculated using the following formula, where,

[0132] Where d(R, Sj) represents the Euclidean distance between the remaining allocable resource matrix S of node j and the demand resource matrix R of the container group;

[0133] Specifically, when calculating the Euclidean distance between the remaining allocable resource matrix S of node j and the demand resource matrix R of the container group, Sj and R need to be flattened into vectors before calculation.

[0134] The cosine similarity between the remaining allocable resource matrix S of node j and the demand resource matrix R of the container group can be calculated using the following formula, where,

[0135] in,

[0136] The W matrix is ​​user-defined based on the importance of the resources. The W in this embodiment is only one possible implementation and is not intended to be limiting. Taking the resource types 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 weight of network resources is 1, that is, cpu weight=2, mem weight=1, network weight=1.

[0137] Specifically, when calculating the cosine similarity between the Euclidean distance of the remaining resources Sj of node j and the pre-scheduled pod demand R, Sj and R need to be flattened into vectors before calculation.

[0138] Based on the Euclidean distance between the remaining allocable resource matrix S of node j and the demand resource matrix R of the container group, and the cosine similarity between the remaining allocable resource matrix S of node j and the demand resource matrix R of the container group, the final score of node j is calculated using the following formula; where,

[0139] Where f is the cosine similarity between the remaining allocable resource matrix S of node j and the demand resource matrix R of the container group, as shown above; d is the Euclidean distance between the remaining allocable resource matrix S of node j and the demand resource matrix R of the container group, as shown above; and score j Let be the final score of node j.

[0140] Furthermore, the score for each node is calculated in the Score phase, and the node with the highest score is selected as the final node to be bound to the container group.

[0141] Finally, the bind interface is called to submit the pod and the final scheduling result to the application interface server (apiserver) to complete the scheduling process.

[0142] Based on the same principle as the task processing method provided in the embodiments of this application, the embodiments of this application also provide a task processing apparatus, as shown in FIG5. The apparatus 50 may include: a first determining module 51, a first acquiring module 52, a second determining module 53, and a third determining module 54, wherein...

[0143] The first determining module 51 is used to determine at least one container group, wherein each container group is used to process at least one data processing task.

[0144] The first acquisition module 52 is used to acquire the resource demand of each container group within a preset time period.

[0145] The second determining module 53 is used to determine the remaining allocable resources of each task processing node in the task processing node cluster during the preset time period; wherein the cluster includes at least two task processing nodes.

[0146] The third determining module 54 is used to select a target node associated with the corresponding container group from the at least two task processing nodes based on the required resource amount of each container group and the remaining allocable resource amount of each task processing node, so that the corresponding container group runs in the target node.

[0147] This application provides a task processing apparatus. Compared with related technologies, in this embodiment, when determining the task processing node for scheduling a container group from multiple task processing nodes in a task processing node cluster for a container group to be scheduled, the target task node is determined based on the relationship between the resource demand of the container group to be scheduled within a preset time period and the remaining allocable resources of each task processing node within the preset time period. This allows the container group to be scheduled to execute corresponding tasks, thereby improving the accuracy of node allocation to the container group and minimizing load imbalance. Furthermore, since the resource demand of the container group to be scheduled within the preset time period is based on its historical resource usage, the accuracy of the resource demand is higher, further improving the accuracy of node allocation and thus enhancing load balancing.

[0148] The apparatus in this application embodiment can execute the method provided in this application embodiment, and the implementation principle is similar. The actions performed by each module in the apparatus of each embodiment of this application correspond to the steps in the method of each embodiment of this application. For detailed functional descriptions of each module of the apparatus, please refer to the descriptions in the corresponding methods shown above, which will not be repeated here.

[0149] Figure 6 shows a schematic diagram of the structure of an electronic device to which an embodiment of this application applies. As shown in Figure 6, 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 this application.

[0150] As shown in Figure 6, the electronic device 2000 mainly includes at least one processor 2001 (one is shown in Figure 6), a memory 2002, a communication module 2003, and an input / output interface 2004, etc. Optionally, the components can be connected and communicate with each other through a bus 2005. It should be noted that the structure of the electronic device 2000 shown in Figure 6 is only schematic and does not constitute a limitation on the electronic device to which the method provided in the embodiments of this application is applicable.

[0151] The memory 2002 can be used to store operating systems and applications, etc. The applications can include computer programs that implement the methods shown in the embodiments of the present invention when invoked by the processor 2001, and can also include programs for implementing other functions or services. The memory 2002 can be ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices that can store information and computer programs, or it can be EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto.

[0152] Processor 2001 is connected to memory 2002 via bus 2005, and implements corresponding functions by calling application programs stored in memory 2002. Processor 2001 can 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. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this invention. Processor 2001 can 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.

[0153] Electronic device 2000 can connect to a network via communication module 2003 (which may include, but is not limited to, components such as a network interface) to communicate with other devices (such as user terminals or servers) through the network and achieve data interaction, such as sending data to or receiving data from other devices. Communication module 2003 may include wired network interfaces and / or wireless network interfaces, meaning the communication module may include at least one of wired or wireless communication modules.

[0154] Electronic device 2000 can connect to required input / output devices, such as keyboards and display devices, via input / output interface 2004. Electronic device 2000 itself may have a display device, and other display devices can also be connected externally via interface 2004. Optionally, storage devices, such as hard drives, can also be connected via interface 2004 to store data from electronic device 2000, retrieve data from storage devices, or store data from storage devices into memory 2002. It is understood that input / output interface 2004 can be a wired interface or a wireless interface. Depending on the actual application scenario, the device connected to input / output interface 2004 can be a component of electronic device 2000 or an external device connected to electronic device 2000 when needed.

[0155] The bus 2005 used to connect the various components may include a pathway for transmitting information between these components. The bus 2005 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Depending on its function, the bus 2005 can be divided into address bus, data bus, control bus, etc.

[0156] Optionally, for the solution provided in the embodiments of this application, the memory 2002 can be used to store a computer program that executes the solution of this application, and the processor 2001 runs the computer program. When the processor 2001 runs the computer program, it implements the operation of the method or apparatus provided in the embodiments of this application.

[0157] Based on the same principle as the method provided in the embodiments of this application, the embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, can implement the corresponding content of the aforementioned method embodiments.

[0158] This application also provides a computer program product, which includes a computer program that, when executed by a processor, can implement the corresponding content of the aforementioned method embodiments.

[0159] It should be noted that the terms "first," "second," "third," "fourth," "1," "2," etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that shown in the figures or text.

[0160] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0161] It should be understood that although arrows indicate various operation steps in the flowcharts of this application's embodiments, the order in which these steps are implemented is not limited to the order indicated by the arrows. Unless explicitly stated herein, in some implementation scenarios of this application's embodiments, the implementation steps in each flowchart can be executed in other orders as required. Furthermore, some or all steps in each flowchart, based on the actual implementation scenario, may include multiple sub-steps or multiple stages. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage can also be executed at different times. In scenarios where execution times differ, the execution order of these sub-steps or stages can be flexibly configured according to requirements, and this application's embodiments do not limit this.

[0162] The above description is only an optional implementation method for some implementation scenarios of this application. It should be noted that for those skilled in the art, other similar implementation methods based on the technical concept of this application without departing from the technical concept of this application also fall within the protection scope of the embodiments of this application.

Claims

1. A method for task processing, executed in an electronic device, the method comprising: Identify at least one container group, wherein each container group is used to process at least one data processing task; Obtain the resource requirements of each container group within a preset time period; Determine the remaining allocable resources for each task processing node in the task processing node cluster during the preset time period; wherein, the task processing node cluster includes at least two task processing nodes. Based on the resource requirements of each container group and the remaining allocable resources of each task processing node, a target node associated with the corresponding container group is selected from the at least two task processing nodes, so that the corresponding container group runs on the target node.

2. The method according to claim 1, wherein, The step of selecting a target node associated with a corresponding container group from the at least two task processing nodes, based on the resource requirements of each container group and the remaining allocable resources of each task processing node, so as to run the corresponding container group on the target node, includes: Based on the remaining allocable resources of each task processing node, at least one candidate node that meets the resource requirements of the corresponding container group is selected from the at least two task processing nodes. Based on the required resources of the corresponding container group and the remaining allocable resources of each of the at least one candidate node, the target node associated with the corresponding container group is selected from the at least one candidate node.

3. The method according to claim 2, wherein, The preset time period includes at least two unit time periods, the duration of each unit time period is a preset time unit, the required resource amount of each container group includes the required resource amount of the corresponding container group in each unit time period within the preset time period, and the remaining allocable resource amount of each task processing node includes the remaining allocable resource amount of the corresponding task processing node in each unit time period within the preset time period. The step of selecting at least one candidate node from the at least two task processing nodes that meets the resource requirements of the corresponding container group based on the remaining allocable resources of each task processing node includes: Based on the remaining allocable resources of each task processing node in each unit time period, and the resource requirements of the corresponding container group in each unit time period, at least one candidate node is selected from the at least two task processing nodes. Specifically, for each unit of time period, the remaining allocable resources of each candidate node in that unit of time period are greater than the resource requirements of the corresponding container group in that unit of time period.

4. The method according to any one of claims 1 to 3, wherein, The step of selecting a target node associated with a corresponding container group from at least two task processing nodes, based on the resource requirements of each container group and the remaining allocable resources of each task processing node, so as to run the corresponding container group on the target node, includes: Based on the required resources of the corresponding container group and the remaining allocable resources of each task processing node, determine the degree of resource matching between each task processing node and the corresponding container group. Based on the resource matching degree, the target node associated with the corresponding container group is determined from the at least two task processing nodes.

5. The method according to claim 4, wherein, The preset time period includes at least two unit time periods, the duration of each unit time period is a preset time unit, the required resource amount of each container group includes the required resource amount of the corresponding container group in each unit time period within the preset time period, and the remaining allocable resource amount of each task processing node includes the remaining allocable resource amount of the corresponding task processing node in each unit time period within the preset time period. The determination of the resource matching degree between each task processing node and the corresponding container group based on the required resource amount of the corresponding container group and the remaining allocable resources of each task processing node includes: Based on the resource demand of the corresponding container group in the at least two unit time periods, a resource demand matrix for the corresponding container group is constructed, wherein the resource demand matrix is ​​used to characterize the resource quantity of at least one resource type of the corresponding container group in each unit time period. Based on the remaining allocable resources of each task processing node in the at least two unit time periods, a remaining allocable resource matrix for the corresponding task processing node is constructed, wherein the remaining allocable resource matrix is ​​used to characterize the remaining allocable resources of at least one resource type for the corresponding task processing node in each unit time period. Based on the required resource matrix of the corresponding container group and the remaining allocable resource matrix of each task processing node, at least one similarity index between each task processing node and the corresponding container group is determined. Based on the at least one similarity index, the degree of resource matching between each task processing node and the corresponding container group is determined.

6. The method according to any one of claims 1-5, wherein, Determining the remaining allocable resources for each task processing node in the task processing node cluster during the preset time period includes: Obtain the resource requirements of each container group running in the preset time period for each task processing node; Based on the resource requirements of each container group running in the preset time period, determine the allocated resource amount of the corresponding task processing node. Obtain the initial allocable resources for each task processing node; wherein, the initial allocable resources for each task processing node are the allocable resources when the corresponding task processing node is not running any container group; Based on the initial allocatable resources of each task processing node and the allocated resources of each task processing node, the remaining allocatable resources of each task processing node during the preset time period are determined.

7. The method according to any one of claims 1-6, further comprising: Obtain the historical resource usage of each container group; where the historical resource usage of each container group is the resource usage of the corresponding container group during the runtime period; Based on the historical resource usage of each container group, predict the resource demand of each container group; The required resource quantity for each of the container groups is stored.

8. The method according to any one of claims 1-7, wherein, The resource requirements of each container group are represented by a resource matrix, where the number of columns in the resource matrix is ​​equal to the number of unit time periods included in the preset time period, and the number of rows is equal to the number of resource types required by the corresponding container group to run data processing tasks. The method further includes: If the required resource quantity for a container group is not obtained, then the preset resource quantity for that container group is obtained; wherein, the preset resource quantity includes the quantity of each type of resource; The preset resource quantity is determined as the resource requirement of the container group within a preset time period.

9. A task processing apparatus, the apparatus comprising: A first determining module is used to determine at least one container group, wherein each container group is used to process at least one data processing task. The first acquisition module is used to acquire the resource requirements of each container group within a preset time period. The second determining module is used to determine the remaining allocable resources of each task processing node in the task processing node cluster during the preset time period; wherein, the task processing node cluster includes at least two task processing nodes. The third determining module is used to select a target node associated with the corresponding container group from the at least two task processing nodes based on the required resource amount of each container group and the remaining allocable resource amount of each task processing node, so that the corresponding container group runs on the target node.

10. An electronic device, wherein, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the task processing method according to any one of claims 1 to 8 when running the computer program.

11. A computer-readable storage medium, wherein, The storage medium stores a computer program, which, when executed by a processor, implements the task processing method according to any one of claims 1 to 8.

12. A computer program product comprising a computer program, wherein, When the computer program is executed by a processor, it implements the task processing method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Task deployment method and device in container cluster

    CN112783607A

  • Container scheduling method, electronic equipment and storage medium

    CN114840304A

  • Resource demand prediction method, device and equipment and computer readable storage medium

    CN116820739A

  • Task processing method and device, electronic equipment, storage medium and program product

    CN118860587A

  • Migrating containers across non-uniform memory access (NUMA) nodes of a processor device

    US20230305874A1