Main task perception type container resource dynamic scheduling method

By calculating the hash value of container units and using a dual-depth Q-network to select the optimal deployment node, the problem of uneven resource allocation in existing container scheduling methods is solved, and efficient scheduling and resource utilization of critical tasks in the power system are achieved.

CN121636057APending Publication Date: 2026-03-10ELECTRIC POWER RES INST CHINA SOUTHERN POWER GRID CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-09
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing Kubernetes container scheduling methods lack the ability to identify the priority of primary tasks and dynamically respond to resource status in power systems, resulting in uneven resource allocation, delayed response to critical tasks, and decreased operational efficiency.

Method used

A task-aware container resource dynamic scheduling method is adopted. By calculating the hash value of the container unit, the target container unit is determined and resources are released. Combined with a pre-trained dual-deep Q network, the optimal deployment node is selected and node resources are allocated to the new main task.

Benefits of technology

It achieves efficient and reliable resource utilization in multi-task concurrency and cross-node elastic deployment environments, improves task scheduling response speed and system operating efficiency, and ensures that critical tasks receive sufficient computing power support.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121636057A_ABST
    Figure CN121636057A_ABST
Patent Text Reader

Abstract

The main task sensing type container resource dynamic scheduling method provided by the invention comprises the following steps: when the number of main tasks in a current scheduling period is greater than 1, if a new main task arrives and node resources are insufficient, calculating a hash value of each container unit on each node; according to the hash value of each container unit, determining a target elimination container unit, and releasing node resources of each target elimination container unit to obtain nodes for scheduling and container units to be scheduled; combining the state of the node capable of being scheduled and the state of the container unit to be scheduled to obtain a joint state vector, and inputting the joint state vector into a pre-trained double-depth Q network to obtain an optimal deployment node; and if the available resources of the optimal deployment node are sufficient, allocating node resources to the new main task. Therefore, intelligent dynamic allocation of the container resources is realized, the response speed of task scheduling and the system operation efficiency are remarkably improved, and the utilization rate of the container resources is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of power systems, and particularly relates to a main task perception type container resource dynamic scheduling method. BACKGROUND

[0002] With the development of power grid simulation, state estimation and fault prediction, the power system gradually introduces containerization and micro-service architecture to support multi-task parallel running and cross-node elastic deployment. However, due to the significant heterogeneity of computing nodes in computing power, network latency and energy consumption characteristics, the task scheduling strategy directly determines the resource utilization efficiency and business reliability. Under this background, container resource scheduling has become a key link for the efficient operation of the power system micro-service platform.

[0003] The existing Kubernetes container scheduling method generally adopts a static resource division strategy, and the scheduling rules are fixed, lacking the ability to identify the priority of main tasks and the ability to dynamically respond to resource states. In the case of a sharp increase in the number of main tasks or tight computing resources, the existing scheduling strategy is difficult to adjust resource allocation in a timely manner, resulting in insufficient computing power support for critical tasks, while lightweight tasks may occupy high-performance node resources, thereby causing problems such as uneven resource utilization, task scheduling delay and system load fluctuation.

[0004] Therefore, the existing container scheduling technology exhibits phenomena such as uneven resource allocation, delayed response of critical tasks and decreased running efficiency in the application of power systems, fully reflecting the insufficient resource scheduling ability for power business scenarios. SUMMARY

[0005] The present application aims to at least solve one of the above technical defects, particularly the technical defect of insufficient resource scheduling ability for power business scenarios in the prior art.

[0006] In a first aspect, the present application provides a main task perception type container resource dynamic scheduling method, the method comprising:

[0007] When the number of main tasks in the current scheduling period is greater than 1, if a new main task arrives and the node resources are insufficient, the hash value of each container unit on each node is calculated;

[0008] According to the hash value of each container unit, a target eliminated container unit is determined, and the node resources of each target eliminated container unit are released to obtain a schedulable node and a to-be-scheduled container unit;

[0009] The state of the schedulable node and the state of the to-be-scheduled container unit are combined to obtain a joint state vector, and the joint state vector is input into a pre-trained double deep Q network to obtain an optimal deployment node;

[0010] If the available resources of the optimal deployment node are sufficient, allocate node resources for the new master task.

[0011] In one embodiment, the step of determining the target elimination container unit according to the hash value of each container unit comprises:

[0012] The container unit with a hash value higher than the preset threshold is taken as the target elimination container unit.

[0013] In one embodiment, the step of determining the target elimination container unit according to the hash value of each container unit comprises:

[0014] The container unit with a hash value higher than the preset threshold is taken as the candidate elimination container unit;

[0015] According to the resource usage intensity and the current task progress of each candidate elimination container unit, the migration cost of each candidate elimination container unit is calculated.

[0016] Based on the required node resources of the new master task, the target elimination container unit is selected in the order of the migration cost of each candidate elimination container unit from small to large.

[0017] In one embodiment, the step of calculating the migration cost of each candidate elimination container unit according to the resource usage intensity and the current task progress of each candidate elimination container unit comprises:

[0018] The migration cost is calculated by using the following formula:

[0019]

[0020] wherein, , , and are adjustment factors for controlling the weights of different indicators, is the proportion of the CPU core number required by the i th elimination container unit to the total CPU core number of the node where the i th elimination container unit is located; is the proportion of the memory resource required by the i th elimination container unit to the total memory resource of the node where the i th elimination container unit is located; is the proportion of the disk occupancy of the i th elimination container unit to the total disk resource of the node where the i th elimination container unit is located; is the task progress, and the closer to 1 indicates the closer to completion, and the higher the migration cost. In one embodiment, the training process of the double deep Q network comprises:

[0021] In one embodiment, the training process of the double deep Q network comprises:

[0022] ​​determine a joint state sample, and according to the joint state sample, iteratively train network parameters of the double deep Q network by using a preset reward function, wherein the reward function is used to minimize inter-node load imbalance, task delay after scheduling, and energy consumption per unit time.

[0023] In one embodiment, the reward function is:

[0024]

[0025] wherein, is the reward function, represents a time point, is the inter-node load imbalance, is the task delay after scheduling, is the energy consumption per unit time, , and are hyperparameters, and satisfy .

[0026] In one embodiment, the method further comprises:

[0027] If the available resources of the optimal deployment node are insufficient, a new target container unit is selected, and the optimal deployment node is updated until the available resources of the updated optimal deployment node meet the required node resources of the new main task.

[0028] In a second aspect, the application provides a main task-aware container resource dynamic scheduling device, which comprises:

[0029] A main task-aware module is configured to, when the number of main tasks in the current scheduling period is greater than 1, calculate a hash value of each container unit on each node if a new main task arrives and node resources are insufficient.

[0030] A target container unit determination module is configured to determine a target container unit according to the hash value of each container unit, release node resources of each target container unit, and obtain schedulable nodes and to-be-scheduled container units.

[0031] An optimal deployment node determination module is configured to combine the states of the schedulable nodes and the to-be-scheduled container units to obtain a joint state vector, input the joint state vector into a pre-trained double deep Q network, and obtain an optimal deployment node.

[0032] A node resource allocation module is configured to, if the available resources of the optimal deployment node are sufficient, allocate node resources for the new main task.

[0033] In a third aspect, the present application provides a storage medium, the storage medium storing computer readable instructions, the computer readable instructions being executed by one or more processors to cause the one or more processors to perform the steps of the task-aware container resource dynamic scheduling method in any of the above embodiments.

[0034] In a fourth aspect, the present application provides a computer device, comprising: one or more processors, and a memory;

[0035] The memory stores computer readable instructions, the computer readable instructions being executed by one or more processors to perform the steps of the task-aware container resource dynamic scheduling method in any of the above embodiments.

[0036] From the above technical solutions, the embodiments of the present application have the following advantages:

[0037] The task-aware container resource dynamic scheduling method provided by the present application realizes intelligent dynamic allocation of container resources by monitoring the number of main tasks and the state of node resources in real time within the scheduling period. When the number of main tasks within the scheduling period is greater than 1 and a new main task arrives, if the node resources are insufficient, the hash value of each container unit on each node is calculated first to scientifically determine the target eliminated container unit and release the node resources occupied by it, thereby freeing up necessary computing resources for critical tasks. Subsequently, the state combination of the available scheduling nodes and container units forms a joint state vector, which is input into the pre-trained double-depth Q network to intelligently select the optimal deployment node and allocate sufficient node resources for the new main task. In this process, resource allocation can be dynamically adjusted according to real-time resource state to ensure that critical tasks have priority to obtain computing power support, while avoiding the occupation of high-performance node resources by light tasks, thereby achieving balanced utilization of node resources. Through the above mechanism, the method can significantly improve the response speed of task scheduling and the efficiency of system operation, improve the utilization rate of container resources, and realize efficient and reliable operation of the power system micro-service platform in a multi-task concurrent and cross-node elastic deployment environment. BRIEF DESCRIPTION OF DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the description of the embodiments or the prior art will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained without creative labor based on these drawings.

[0039] Figure 1 The flowchart of the task-aware container resource dynamic scheduling method provided by the embodiments of the present application is shown in the figure.

[0040] Figure 2An example diagram of a Pod exit mechanism provided by an embodiment of the present application is shown in FIG. 1.

[0041] Figure 3 An example diagram of a structure of a main task-aware container resource dynamic scheduling device provided by an embodiment of the present application is shown in FIG. 2.

[0042] Figure 4 An example diagram of an internal structure of a computer device provided by an embodiment of the present application is shown in FIG. 3. DETAILED DESCRIPTION

[0043] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.

[0044] The present application provides a main task-aware container resource dynamic scheduling method. The following embodiments are described by taking the operation of the method on a computer device based on a container orchestration and resource management platform as an example. It can be understood that the computer device can be various devices with data processing functions, such as a single server, a server cluster, a personal notebook computer, a desktop computer, etc., and the container orchestration and resource management platform can be deployed in any of the above devices or a combination thereof to provide container orchestration and resource management capabilities. It should be noted that the container orchestration and resource management platform includes Kubernetes, K3s, etc. As shown in FIG. 1, the method includes: Figure 1

[0045] S101: If the number of main tasks in the current scheduling period is greater than 1, and a new main task arrives and the node resources are insufficient, calculate the hash value of each container unit on each node.

[0046] The main task refers to a core computing task with high requirements for computing real-time performance and resource guarantee degree in power simulation, state estimation, fault prediction, etc. The scheduling period represents the periodic time window of the container orchestration and resource management platform when executing container resource scheduling decisions. The container unit is a computing unit for executing a plurality of subtasks (possibly in the order of millions) split from the main task. The hash value is a fixed-length hash value generated according to the container unit identifier, which is used to realize deterministic sorting or screening in the case of multiple containers coexisting. The node resources refer to the available CPU, memory, etc. allocable resources of different computing nodes in the cluster. The arrival of a new main task indicates that a new critical business task is submitted to the container platform for scheduling and execution in the current scheduling period.

[0047] ​In specific implementation, the master task queue and node resource status are continuously monitored within the scheduling period. When the number of master tasks exceeds the preset threshold and a new master task enters the scheduling queue, the resource shortage processing procedure is triggered. First, the snapshot of the current list of nodes participating in scheduling and the resource available amount information of each node is collected. The snapshot is collected by reading the resource view of the container orchestration platform in read-only query mode to avoid affecting normal operation during read-write concurrency. The snapshot content includes the identifier, available CPU, available memory, node label, and topology information of each node, and the timestamp of the reading time is recorded to ensure that the subsequent operations are based on the same time view for decision-making. If the snapshot shows that the overall available resources of the cluster are insufficient to meet the estimated demand of the new master task, container unit scanning is performed on each node in the snapshot.

[0048] Container unit scanning is completed by traversing the running container units on each node in the snapshot. For each container unit, a set of fields for identification and stable sorting is extracted as the hash input, including but not limited to the unique identifier of the container unit in the orchestration platform, namespace, image name and version, creation timestamp, allocated request and limit value, and key business-related labels. During the extraction process, the fields are standardized, such as uniform timestamp format, and labels are concatenated in lexicographical order, to ensure the deterministic output of the hash function under the same input set. For short-life cycle or terminated container units, they should be excluded or separately marked during scanning to avoid including instances that will exit soon into the elimination candidate set.

[0049] The hash calculation uses an authenticated hash algorithm to ensure uniform output distribution and low collision probability. It is preferred to use a strong hash function to generate a longer bit string and then truncate it to a fixed length as the hash value, to balance the calculation efficiency and discrimination ability. The hash function input is the standardized field string mentioned above, and the output is numerically processed for sorting. To deal with collision or numerical equality, deterministic decision rules are designed as supplementary comparison factors, which include the creation time of the container unit, business label priority, and request size, etc. in order of priority, to ensure that a repeatable sorting result can be obtained even in the case of the same hash value. The hash calculation process supports batch processing and concurrent calculation in implementation, and the calculation tasks can be executed in parallel in local memory and the results can be aggregated into a node-level container unit hash table.

[0050] It should be noted that the scheduler running on the Kubernetes platform first performs task awareness operation before starting each scheduling cycle, counts the number of currently running main tasks, and uses the counting result as the basis for subsequent resource allocation strategy and Pod exit mechanism. When the counting result shows that there is only 1 main task, the scheduler enters the centralized resource allocation mode, and allocates the available resources to the main task as a whole to guarantee the real-time requirement of the main task; when the number of main tasks is greater than 1, the scheduler switches to the elastic resource allocation mode, and allocates resources to multiple main tasks according to the preset weight or average principle to maintain the running stability under the condition of multiple task parallelism. On this basis, the scheduler continuously monitors whether a new main task arrives, and when a new main task enters the scheduling queue and the target node is insufficient in resources, the Pod exit strategy process is automatically triggered, and whether the new main task exists and whether there is an old task executing on the node are determined in the preset decision order. After confirming that there are Pods that can be selected in the node, the scheduler extracts the identification information of each Pod in the node, calculates the hash value of each Pod according to the preset hash function, and uses the generated hash value to establish a stable order of the Pods in the node, which provides a deterministic basis for the subsequent selection of the candidate Pod to be exited, so as to release necessary resources in a resource shortage environment, thereby guaranteeing the smooth scheduling of the new main task.

[0051] It can be understood that, in the case that the number of main tasks increases and the node resources are insufficient, the hash value of each container unit on the node is calculated, in order to establish a fast, stable and distinguishable ordering method for the container units in a resource shortage environment, so as to accurately identify the container units that can be preferentially recycled under the condition of a large number of coexisting containers and complex task priorities. Through this processing method, the selection result fluctuation caused by relying on complex resource indicators or temporary state judgment can be avoided, thereby ensuring the determinacy and consistency of the resource release process, enabling the newly arrived main task to obtain necessary running space under the support of controllable and efficient resource recycling strategy, and improving the scheduling timeliness of the key task in the high concurrency scenario and the running stability of the overall system.

[0052] S102: determining a target eliminated container unit according to the hash value of each container unit, and releasing the node resources of each target eliminated container unit to obtain a schedulable node and a to-be-scheduled container unit.

[0053] The target eliminated container unit refers to a container unit that is selected to release its occupied resources under the condition of insufficient resources. The schedulable node refers to a node that has deployable space after releasing the resources of part of the container units. The to-be-scheduled container unit refers to a running instance on which a new task will be deployed.

[0054] During scheduling, when insufficient node resources are detected to support a new main task, the hash values ​​generated in the previous stage are read and sorted accordingly. All container units within the same node are arranged in order according to their corresponding hash values, ensuring each container unit occupies a stable and reproducible position in the sorted sequence. This sorting process does not rely on complex metrics such as actual container resource usage or runtime state; it establishes a deterministic sequence solely through the unique and fixed value of the hash value, providing a clear reference order for subsequent resource processing. Once sorting is complete, an ordered list reflecting the relative positions of all container units is obtained, ensuring consistency and controllability of the scheduling logic even with a large number of containers or high concurrency.

[0055] When performing resource reclamation based on the sorting results, each container unit at a specified position in the sorting sequence will be exited one by one. The exit operation triggers the release of resources occupied by the container unit, including reclaiming the CPU quota allocated to it on the node, releasing unused memory segments, and cleaning up temporary data space generated during operation. After resource reclamation is complete, the available resources of the nodes are recalculated, allowing nodes that were previously unable to accommodate new primary tasks to regain scheduling capability after resource release, thus becoming schedulable nodes. Simultaneously, once a node has available resources, the new primary task is marked as a container unit to be scheduled, entering the subsequent scheduling decision process to achieve closed-loop control of the scheduling process.

[0056] It is understandable that by determining the target container unit to be evicted based on the hash value of each container unit, and then releasing the node resources it occupies, the resource reclamation process can use hash values ​​as a unified standard for selection. This avoids reliance on complex or volatile operational metrics and ensures the stability and repeatability of the selection criteria. After the target container unit is released, the node's available resources are restored, enabling nodes that were previously unable to handle new tasks to regain scheduling capabilities, and allowing newly arriving tasks to smoothly enter the subsequent process as container units to be scheduled. Through this method, a clear and coherent execution chain is formed between resource reclamation, node restoration, and the entry of new tasks into the scheduling phase, improving node resource utilization efficiency and ensuring that the scheduling process remains coherent, deterministic, and effective even in resource-constrained scenarios.

[0057] S103: Combine the states of the available scheduling nodes and the states of the container units to be scheduled to obtain a joint state vector, and input the joint state vector into a pre-trained dual-depth Q network to obtain the optimal deployment node.

[0058] The state of a schedulable node can be represented by the numerical characteristics of the CPU, memory, and other schedulable resources currently available to that node. The state of a container unit to be scheduled includes features such as the task's demand for computing resources, priority, and estimated workload. The joint state vector is a vectorized representation formed by concatenating the two states in the same data structure; this vector is used to fully describe the correspondence between node supply capacity and task demand. The dual-deep Q-network is a reinforcement learning network model pre-trained using historical scheduling data. Its input is a state vector, and its output is an estimate of the action value of the available nodes, providing optimal deployment decisions for container units in a multi-node parallel environment. The optimal deployment node represents the computing node selected as the current new primary task deployment target after evaluation by the scheduling algorithm; its available resources include allocable CPU, memory, storage space, and network bandwidth.

[0059] In forming the joint state vector, the status of schedulable nodes is first collected to obtain their current available resource information, including schedulable indicators such as CPU availability, remaining memory, storage space, and network bandwidth. Simultaneously, the node's operating load, the number of deployed containers, and node tag information are recorded to comprehensively describe the node's supply capacity. After data collection, the various resource quantities of the nodes are standardized, normalizing the raw values ​​according to a preset range to ensure they are on the same dimension or numerical scale as the resource requirements of the container units to be scheduled. Next, the resource request information, task priority, estimated runtime, and load requirements of the container units to be scheduled are combined with the node status in a fixed order into the same vector structure to form the joint state vector. In this way, the joint state vector simultaneously reflects the operating conditions of both the task demand side and the node supply side, maintaining information order and feature integrity, providing unified and structured input data for subsequent intelligent decision-making.

[0060] After the joint state vector is generated, it is input into a pre-trained dual-deep Q-network for processing. The dual-deep Q-network first performs multi-layer feature extraction on the joint state vector, including independent encoding of node resource features and task requirement features, as well as fusion of their interaction features, resulting in a set of high-dimensional representation vectors. Subsequently, the dual-deep Q-network uses a Q-value estimation strategy to generate a corresponding action value for each schedulable node, representing the potential benefit or scheduling effect of deploying the task to that node in the current state. After obtaining the action values ​​for all nodes, the optimal deployment node is determined through a maximum value selection strategy, i.e., the node with the highest Q-value is selected as the task deployment target. This optimal deployment node achieves the best overall effect of highest resource utilization efficiency, optimal task matching, and optimal scheduling benefit in the current scheduling state, thus providing a direct basis for the actual deployment of container units and ensuring efficient and stable scheduling execution in environments with dynamic resource changes and multi-task concurrency.

[0061] It is understandable that combining the states of available schedulable nodes with the states of container units to be scheduled to form a joint state vector is intended to simultaneously reflect the available resources of nodes and the resource requirements of tasks within the same input structure, enabling scheduling decisions to comprehensively consider the matching relationship between resource supply and task demand. Inputting this joint state vector into a pre-trained dual-depth Q-network allows the network to evaluate the matching degree between nodes and tasks, thereby selecting the node that is optimal in terms of resource utilization efficiency, task deployment rationality, and scheduling benefits. This approach ensures that scheduling decisions are deterministic and stable under conditions of multi-task concurrency and dynamic changes in node resources, increases the probability of new tasks obtaining suitable nodes, optimizes overall resource allocation efficiency, and ensures that the container scheduling process is efficient, reliable, and controllable.

[0062] S104: If the optimal deployment node has sufficient available resources, then allocate node resources to the new primary task.

[0063] Specifically, after determining the optimal deployment node, the latest available resource information of that node is first read and compared with the resource requirements of the new primary task. If the node's CPU, memory, and other necessary resources meet the requirements of the new primary task, the corresponding resources are allocated to the task, including allocating CPU cores, reserving memory capacity, establishing necessary storage space, and configuring network bandwidth. During the resource allocation process, the node status information is updated simultaneously, deducting occupied resources from the available resources, and recording the timestamp and task identifier of the allocation operation so that the remaining available resources can be accurately calculated in subsequent scheduling cycles or when the task changes. After the resource allocation is completed, the new primary task is marked as deployed, and the task startup process is triggered, allowing the task to run smoothly on the node according to the allocated resources.

[0064] It is understandable that by directly allocating the necessary node resources for the new primary task to the optimal deployment node when resources are sufficient, it is possible to ensure that critical tasks receive full computing power support, avoiding task delays or scheduling failures due to insufficient resources. This approach guarantees the determinism and controllability of resource allocation operations, enabling the new primary task to start and run within the expected timeframe, while simultaneously achieving efficient utilization of node resources and avoiding resource idleness or waste. In scenarios with multi-task concurrency and dynamic changes in node resources, this method can maintain the stability and reliability of system scheduling, improve the execution efficiency of critical tasks, and optimize the overall resource allocation effect of the container cluster.

[0065] In the above embodiments, intelligent dynamic allocation of container resources is achieved by monitoring the number of main tasks and the status of node resources in real time during the scheduling cycle. When the number of main tasks is greater than 1 and a new main task arrives during the scheduling cycle, if node resources are insufficient, the hash value of each container unit on each node is first calculated to scientifically determine the target container unit to be eliminated and release the node resources it occupies, thereby freeing up necessary computing resources for critical tasks. Subsequently, the states of available scheduling nodes and container units are combined to form a joint state vector, which is then input into a pre-trained dual-depth Q-network to intelligently select the optimal deployment node and allocate sufficient node resources to the new main task. In this process, resource allocation can be dynamically adjusted according to the real-time resource status to ensure that critical tasks receive priority computing power support, while avoiding lightweight tasks from occupying high-performance node resources, thus achieving balanced utilization of node resources. Through the above mechanism, this method can significantly improve the response speed of task scheduling and system operating efficiency, enhance container resource utilization, and achieve efficient and reliable operation of the power system microservice platform in a multi-task concurrent and cross-node elastic deployment environment.

[0066] In one embodiment, the step of determining the target container unit to be evicted based on the hash value of each container unit includes:

[0067] Containers with hash values ​​higher than a preset threshold are targeted for elimination.

[0068] Specifically, during the scheduling process, the hash value of each container unit on the node is first read and compared with a preset threshold. Container units with hash values ​​greater than the threshold are identified and designated as target eviction containers. Subsequently, resource release operations are performed on the target container units, including returning occupied CPU quotas, releasing unused memory space, and cleaning up temporary data generated during operation. This process ensures that release objects can be selected according to deterministic rules when node resources are scarce, avoiding inconsistencies in selection due to temporary states or fluctuations in complex indicators, while freeing up necessary resource space for scheduling new tasks.

[0069] In one example, such asFigure 2 As shown, in the Kubernetes platform, before each scheduling cycle begins, the task identification module first counts the number of currently running master tasks. When an increase in the number of master tasks compared to the previous cycle is detected, it is determined that a resource contention mode has been entered, and the scheduler automatically initiates a Pod exit mechanism to optimize resource allocation. The exit strategy follows a hierarchical decision-making process. First, it checks if any new master tasks have been added. If no new master tasks are found, the scheduler maintains the original state and makes no adjustments. If a new master task arrives, it further checks whether there are still tasks to be processed in the task queue. When the task queue is empty, all running Pods can exit directly after completing their current task, releasing the computing resources they occupy. When there are still tasks in the queue, the hash value of all running Pods on the current node is calculated. This hash value can be generated based on information such as the Pod's name, priority, and CPU / memory usage. Pods with hash values ​​greater than a preset threshold are marked as exitable and exit after completing their current task. Pods with hash values ​​lower than the threshold are retained and continue to process tasks. This ensures continuous task execution while reclaiming node resources, achieving a balance between resource utilization efficiency and critical task execution stability.

[0070] It is understandable that by determining the target eviction container unit based on hash value and preset threshold, the release object can be selected quickly and stably when node resources are insufficient, ensuring the repeatability and determinism of the resource reclamation process. This approach avoids the uncertainty of complex calculations or dynamic indicators, ensuring that resource release behavior remains consistent and controllable in a multi-task concurrent environment. This ensures that new tasks can obtain the required node resources in a timely manner, improves the scheduling response speed of critical tasks, optimizes the overall node resource utilization, and maintains the stability and efficiency of cluster scheduling.

[0071] In one embodiment, the step of determining the target container unit to be evicted based on the hash value of each container unit includes:

[0072] Containers with hash values ​​higher than a preset threshold are considered as candidate containers to be eliminated.

[0073] Calculate the migration cost of each candidate container unit based on its resource usage intensity and current task progress.

[0074] Based on the node resources required for the new primary task, the target container unit is selected in ascending order of migration cost for each candidate container unit to be replaced.

[0075] Among them, candidate culling container units refer to the set of container units selected as potential resource releases under node resource constraints, for further decision-making. Migration cost represents a quantitative indicator of the combined resource consumption and task delays incurred by releasing or migrating candidate container units from the current node.

[0076] During scheduling, the hash value of each container on a node is first read and compared with a pre-set threshold. Containers with hash values ​​greater than the threshold are identified as candidate for eviction and used for subsequent resource reclamation decisions. Each candidate container is then individually evaluated for its migration cost, which considers its current resource usage and task execution progress, including CPU utilization, memory usage, storage usage, and task completion percentage. A lower migration cost means that releasing the container will have less impact on the current task execution and less interference with overall scheduling stability.

[0077] After calculating the migration cost of all candidate container units, these units are sorted in ascending order of migration cost, forming a priority release sequence. This sorting process ensures that the container unit with the least impact is considered first during resource reclamation, while providing an explicit and repeatable decision order to maintain consistency in a multi-task concurrent node environment. Subsequently, based on the amount of node resources required by the new primary task, container units with lower migration costs are selected sequentially from the sorted sequence until the accumulated released resources can meet the computational needs of the new primary task. The selected container units are finally determined as the target eviction container units and are prepared for resource release operations, including reclaiming CPU quotas, releasing memory, clearing storage space, and updating the node's available resource status.

[0078] In one example, during the Pod exit phase, to avoid excessive disruption to system services during resource reclamation, an exit ratio control algorithm based on a minimum migration cost priority strategy is introduced. This algorithm selects the most suitable Pods for exit from the pool of exitable Pods. First, the algorithm calculates the migration cost for all candidate Pods and sorts them in ascending order of cost. Starting with the Pod with the lowest cost, Pods are added sequentially to the exitable Pod list until the accumulated released resources meet the current main task's scheduling requirements. If the total released resources are still insufficient, the forced exit of lower-level Pods is triggered. This approach prioritizes the exit of lightweight Pods with low resource consumption and less complex tasks, while minimizing the migration of long-running or resource-intensive core tasks, thus ensuring efficient resource reclamation while reducing interference with critical tasks. This exit strategy can dynamically adjust the total exit amount based on the current resource gap, achieving on-demand control and gradual release of the exit ratio. During the scheduling cycle, this intelligent Pod exit strategy serves as a prerequisite for the reinforcement learning scheduling strategy. By releasing resources in advance and compressing the space occupied by low-priority tasks, it provides the DDQN scheduling strategy with realistic and feasible resource state inputs, ensuring the executability of scheduling actions. The overall mechanism forms a closed loop of "resource preparation - strategy output - scheduling implementation," effectively improving the success rate of main task scheduling and system resource utilization efficiency. It is particularly suitable for application scenarios with scarce resources and high real-time requirements, such as power systems, and has significant engineering practical value.

[0079] In this embodiment, by first selecting container units with hash values ​​higher than a preset threshold as candidate elimination container units, potential release targets can be quickly screened when node resources are scarce, ensuring the stability and repeatability of the selection process. Furthermore, by calculating migration costs and sorting them in ascending order of cost, the impact on running tasks can be minimized while releasing resources, achieving a balance between resource reclamation and task continuity. Selecting target elimination container units based on the resource requirements of the new primary task ensures that critical tasks can obtain sufficient computing resources in a timely manner, while optimizing node resource utilization efficiency, improving the overall stability and efficiency of the scheduling process, and ensuring stable and reliable system operation in a multi-task concurrent environment.

[0080] In one embodiment, the step of calculating the migration cost of each candidate replacement container unit based on its resource usage intensity and current task progress includes:

[0081] The migration cost is calculated using the following formula:

[0082]

[0083] in, , , and To control the adjustment factors for the weights of different indicators, For the first The proportion of CPU cores required by each obsolete container unit to the total number of CPU cores on its node; For the first The proportion of memory resources required by each discarded container unit to the total memory resources of its node. For the first The proportion of disk usage of a discarded container unit to the total disk resources of its node; The progress indicator is 1, which represents the time closer to completion and the higher the migration cost.

[0084] In this embodiment, the migration cost calculation formula quantifies the resource consumption and task completion status of each container unit into a single value by weighting and combining indicators such as CPU, memory, disk usage ratios, and task progress. This allows for a comprehensive evaluation of candidate container units to be phased out. Each weighting factor adjusts the relative importance of different resource indicators in the migration cost, allowing for flexible adjustments based on actual application needs, such as minimizing the impact on certain resources or prioritizing task completion. Introducing task progress indicators avoids frequent migrations of near-completion tasks, reducing interference with critical tasks and potential execution delays during scheduling. Overall, this migration cost calculation method provides quantifiable and comparable selection criteria based on a multi-dimensional comprehensive evaluation of resource and task status. This enables the priority release of container units with minimal impact when node resources are strained, improving resource recovery efficiency while ensuring continuous execution of critical tasks and system scheduling stability, thereby significantly improving overall resource utilization and task scheduling success rate.

[0085] In one embodiment, the training process of a dual-depth Q-network includes:

[0086] Determine the joint state samples, and based on the joint state samples, iteratively train the network parameters of the dual deep Q network using a pre-defined reward function. The reward function is used to minimize the load imbalance between nodes, the task delay after scheduling, and the energy consumption per unit time.

[0087] The joint state sample represents vectorized data combining the states of schedulable nodes and container units to be scheduled within the current scheduling cycle. It includes information such as the available resources, network bandwidth, and load of nodes, as well as the resource requirements, task priorities, and task progress of container units. The reward function is a mathematical function used to quantify the effectiveness of the scheduling strategy; its output reflects the scheduling results in terms of load balancing, task latency, and energy consumption. Network parameters refer to the weights and biases in the dual-depth Q-network, which are continuously adjusted during training to optimize the reward function output.

[0088] Specifically, during training, the state information of each computing node and the resource requirements, task priorities, and task progress of the container units to be scheduled are first collected. This information is then combined into a complete joint state sample vector according to a predefined feature order. This joint state sample can simultaneously reflect the available resource status on the node supply side and the task characteristics on the container unit demand side, providing comprehensive input information for the scheduling strategy. After obtaining the joint state sample, it is input into a pre-built and initialized dual-depth Q-network. The network performs multi-layer feature extraction on the input vector and outputs the estimated value corresponding to each executable scheduling action.

[0089] Next, the value of the actions output by the network is evaluated using a pre-defined reward function. This reward function comprehensively considers multiple performance metrics, including load balancing between nodes, task completion latency after scheduling, and energy consumption per unit time, outputting a quantified feedback value for each action. By comparing the action value predicted by the network with the actual effect calculated by the reward function, the network prediction error can be quantified. Based on this error, the network parameters of the dual-depth Q-network, including network weights and biases, are updated iteratively. Each iteration fine-tunes the network parameters, allowing the network to continuously optimize during training, learn and memorize scheduling actions under different joint states, and thus gradually approach the optimal scheduling strategy.

[0090] During training, the feedback signal provided by the reward function guides the network to consider multi-objective optimization when updating parameters, achieving a reasonable balance between node load balancing, task response speed, and energy consumption control. Through this iterative training, the dual-deep Q-network can predict the optimal scheduling action in complex environments with multiple nodes, multiple tasks, and dynamically changing resources. This makes scheduling decisions not only executable but also efficient, and provides a reliable basis for maximizing resource utilization, minimizing task latency, and optimizing energy consumption in actual system operation.

[0091] It is understandable that by determining joint state samples and iteratively training the network parameters of a dual-deep Q-network using a pre-defined reward function, a comprehensive understanding of node resource states and container unit task requirements can be achieved, enabling the network to learn the optimal scheduling strategy under different joint states. The reward function provides a clear multi-objective optimization direction for the training process by simultaneously minimizing load imbalance between nodes, post-scheduling task latency, and energy consumption per unit time. This guides network parameter updates to prioritize scheduling actions that balance node load while reducing task latency and energy consumption. This approach can predict and execute efficient and feasible scheduling strategies in complex environments with multiple nodes, multiple tasks, and dynamically changing resources, thereby significantly improving the response speed of critical tasks and node resource utilization, ensuring system stability and overall scheduling efficiency.

[0092] In one embodiment, the reward function is:

[0093]

[0094] in, For the reward function, Indicates time, This refers to the load imbalance between nodes. To delay the task after scheduling, Energy consumption per unit time , and For hyperparameters, satisfying .

[0095] In this embodiment, the reward function quantifies the effectiveness of the scheduling strategy by combining the load imbalance between nodes, task latency, and energy consumption per unit time into a single value according to weights. The weighting factor adjusts the relative importance of each indicator in the overall evaluation, thus balancing load balancing while controlling task latency and energy consumption during optimization. As scheduling times change, the reward function dynamically reflects changes in the system state, providing continuous and feedback-based optimization signals for network training. In this way, the dual-deep Q-network can gradually learn the optimal scheduling actions under different states during training, prioritizing strategies that balance node load, reduce task latency, and lower energy consumption. This significantly improves the overall resource utilization and task scheduling efficiency of the system, while ensuring the continuous execution of critical tasks and the feasibility of scheduling decisions.

[0096] In one example, a Double Deep Q-Network (DDQN) algorithm is used as the policy learning engine to achieve dynamic scheduling and resource allocation of container tasks in a container orchestration and resource management platform. This enables continuous optimization of resource utilization and scheduling performance in scenarios with strong real-time requirements and high load volatility, such as power systems. This module includes key components such as state definition, action space construction, reward function design, neural network architecture, policy update, and training processes.

[0097] In each scheduling cycle System status The state vector is defined as a joint feature vector of the current node resource status and the requirements of the tasks to be scheduled. Each node's state includes current CPU utilization, memory usage, network bandwidth usage, service latency metrics, and power consumption per unit. The state of the tasks to be scheduled includes resource request information such as required CPU, memory, and latency tolerance. All state information is concatenated into a fixed-dimensional input vector, which is then fed into the Q-network as state input. The entire state vector... It is a length of The vector, where The dimension of each node's state. For each Pod task state dimension, this state vector is input into the neural network and used by the DDQN policy decision module to select scheduling actions.

[0098]

[0099]

[0100]

[0101] in, Indicates the first The complete system state perceived by the scheduler during each scheduling cycle is the input for the reinforcement learning agent to make action decisions. Indicates the current system's [number]th Resource status information of each schedulable computing node, with each node's state vector consisting of... composition; Represents a node Current CPU utilization (in percentage form, a floating-point number between 0 and 1); Represents a node Current memory usage; Represents a node The current average task response latency, in milliseconds (ms); This indicates the current power consumption of the node, in Watts. This indicates the number of Pods waiting to be processed in the scheduling queue of this node, reflecting its current queuing load; Indicates the number of times the current event to be scheduled is... The resource requirement status of each container task, where... Indicates the number or percentage of CPU cores requested by the Pod; Represents the memory resources requested by the Pod; This represents the task's tolerance for response latency (which can be represented by the deadline). This represents the priority of the task (e.g., 0–3 levels, with higher values ​​indicating higher priority). This represents the number of currently schedulable nodes.

[0102] Action space It consists of the set of all schedulable nodes. That is, each scheduling decision by the system involves selecting a node to deploy the currently scheduled Pod. In each round of scheduling, the KDDQN scheduler selects the optimal action from this set of actions. This means assigning the current Pod to a node. The action space is defined as follows:

[0103]

[0104] With multi-objective scheduling optimization as the goal, the following reward function is constructed to guide the Q-network to learn a reasonable resource allocation strategy. The scheduling objective is set as minimizing the load imbalance between nodes. Task delay after scheduling Energy consumption per unit time The reward function is defined as follows:

[0105]

[0106] in, , and For hyperparameters, satisfying .

[0107] The Q network consists of an input layer, two hidden layers, and an output layer. The input to the input layer is a state vector. ,in The dimension is the concatenation of the total number of nodes and the task state; the first hidden layer uses 128-dimensional neurons and employs the ReLU activation function; the second hidden layer uses 64-dimensional neurons and also employs ReLU; the output of the output layer is the Q-value of each node in the action space, used to select the optimal action, without an activation function.

[0108] To improve learning stability and suppress excessive bias in Q-value estimation, the DDQN architecture employs two independent Q-networks: a policy network and a policy network. With the target network The parameters of the target network in this strategy are not completely replaced with the policy network parameters each time, but are partially updated using an exponential moving average method. The target network structure is the same as the policy network, and the parameter updates use a soft update mechanism as follows:

[0109]

[0110] in, This represents the set of parameters of the Policy Network, used for real-time learning of Q-value estimation and participation in action selection; This represents the set of parameters for the target network, used to calculate the TD target value. To stabilize the training process; This represents the soft update factor, which controls the update speed of the target network.

[0111] The aforementioned soft update mechanism achieves stable updates of the target network by progressively transferring some weights from the policy network to the target network, thus avoiding oscillations and Q-value overestimation during training.

[0112] To improve sample utilization efficiency and avoid the impact of temporal correlation on learning results, the system uses an experience replay buffer to store historical scheduling experience quadruples. In each round of training, the system randomly samples a fixed number of samples from the experience pool to form a mini-batch for updating the Q-network parameters.

[0113] The system is trained using the Temporal-Difference (TD) method. The loss function is defined as the squared error between the current Q-value and the target Q-value:

[0114]

[0115]

[0116] in, The target Q-value represents the Q-value in the current state. Take action below Then, the estimated expected cumulative return that may be obtained in the future; For the policy network Q function in state Next action The estimated Q value, network parameters are ; The immediate reward for environmental feedback reflects the action chosen in the current state. The immediate effect after execution is typically used to measure the weighted overall performance of indicators such as load balancing, latency, and energy consumption. This serves as a discount factor, measuring the importance of future rewards. Indicates the next state In this process, the action corresponding to the maximum Q value selected by the policy network (i.e., the optimal action) is used as the input action for the target network.

[0117] The system employs an ε-greedy strategy to maintain exploratory behavior during policy training, randomly selecting actions with probability ε, and otherwise selecting the action with the largest current Q value. In order to conduct training The exploration rate of a round represents the probability with which the agent performs random exploration actions to prevent getting trapped in local optima. The ε value decays exponentially with training.

[0118]

[0119] in, This is the initial exploration rate. In the early stages of training, this value is typically high to ensure the agent has sufficient exploration capabilities to cover the entire action space; The final exploration rate represents the degree of exploration capability that the agent retains after training has stabilized. It is generally taken as a small value to prevent the strategy from being overly greedy. Indicates the current number of steps or rounds in the training session; This indicates the exploration decay control factor, which controls the decay rate of the ε value from the initial to the final value. The smaller the value, the faster the decay, and the larger the value, the slower the decay.

[0120] Once the number of samples in the experience buffer meets a preset threshold, the system begins training the policy network parameters: randomly sampling mini-batches of samples; calculating the TD error between the current policy network output and the target value; updating the Q network parameters using gradient descent; and performing soft updates every fixed number of steps to partially transfer the policy network parameters to the target network. This process continues after each scheduling cycle, gradually converging to the optimal scheduling policy.

[0121] In one embodiment, the method further includes:

[0122] If the available resources of the optimal deployment node are insufficient, a new target is selected to evict the container unit, and the optimal deployment node is updated until the available resources of the updated optimal deployment node meet the node resources required by the new main task.

[0123] Specifically, the process first determines whether the available resources of the selected optimal deployment node meet the node resource requirements of the new primary task. If insufficient resources are found, a new batch of target container units are selected for retirement based on the resource occupancy of existing container units on the node, task priority, and migration cost. These container units are then marked as available for retirement to release resources. Subsequently, the available resource status of the optimal deployment node is updated, and the released node resources are re-included in the total available resources to ensure that the latest resource status of the node is reflected in the next round of scheduling. This process can be repeated until the updated available resources of the optimal deployment node reach or exceed the node resources required by the new primary task, thereby ensuring that the new primary task can be successfully scheduled.

[0124] This approach is adopted to ensure that new primary tasks can still obtain sufficient resources for deployment under high load and resource constraints, while minimizing interference with the operation of existing tasks. By dynamically selecting target container units for replacement and updating node resource status in real time, the scheduling bottleneck caused by insufficient node resources can be effectively alleviated without resource allocation conflicts. This method makes node resource management continuous and controllable, ensuring the executability of scheduling decisions and the optimization of overall system resource utilization efficiency, and is particularly suitable for scenarios such as power systems with high requirements for task real-time performance and reliability.

[0125] To facilitate understanding of the scheme in this application, specific examples are provided below.

[0126] The task execution and resource management process begins with the task awareness phase. Before each scheduling cycle starts, the number of currently running main tasks is counted, marking the starting point of the entire scheduling process. This is followed by the resource allocation phase. When there is only one main task, a centralized resource allocation model is used, allocating all available resources to that main task. When there are more than one main task, an elastic resource allocation model is used, allocating node resources based on task weight or average value. If a new main task is detected arriving but the target node lacks sufficient resources, a local Pod exit mechanism is automatically triggered. This selects only low-priority or low-utilization Pods on the target node to exit, releasing the necessary resources and ensuring the new main task can be deployed.

[0127] After resource partitioning and Pod exit are completed, the process enters the reinforcement learning policy decision-making phase. Information such as the current node state, Pod resource requests, and historical scheduling feedback are encoded into a joint state vector, input into the KDDQN policy network, and the optimal scheduling action is output to select a suitable node for deploying the Pod to be scheduled. Subsequently, the action execution phase begins. Container control executes operations such as container scheduling, Pod migration, and node resource allocation based on the information output by the policy network. If the target node still lacks sufficient resources, the process locally activates the Pod exit logic to release resources and then retry the action, forming a closed-loop process of "action attempt—resource release—retry," ensuring fine-grained dynamic resource response without affecting global scheduling.

[0128] After task execution, the system enters the feedback and learning phase, collecting metrics such as node load, container latency, and unit energy consumption to calculate the reinforcement learning reward function and update the policy network weights accordingly, achieving dynamic optimization of the scheduling strategy. At the end of each scheduling cycle, it checks if there are still main tasks or ordinary tasks to be scheduled. If so, it proceeds to the next scheduling cycle; otherwise, it enters a listening state, waiting for new tasks to trigger the next round of scheduling. This process ensures the continuity of task scheduling, the efficiency of resource utilization, and the adaptive optimization of the scheduling strategy.

[0129] The following describes the task-aware container resource dynamic scheduling device provided in the embodiments of this application. The task-aware container resource dynamic scheduling device described below can be referred to in correspondence with the task-aware container resource dynamic scheduling method described above. Figure 3 As shown, this application provides a task-aware container resource dynamic scheduling device, the device comprising:

[0130] The main task awareness module 201 is used to calculate the hash value of each container unit on each node when the number of main tasks in the current scheduling period is greater than 1, if a new main task arrives and node resources are insufficient.

[0131] The target vacated container unit determination module 202 is used to determine the target vacated container unit based on the hash value of each container unit, and release the node resources of each target vacated container unit to obtain the schedulable nodes and the container units to be scheduled.

[0132] The optimal deployment node determination module 203 is used to combine the state of the available schedulable nodes and the state of the container units to be scheduled to obtain a joint state vector, and input the joint state vector into a pre-trained dual-depth Q network to obtain the optimal deployment node;

[0133] The node resource allocation module 204 is used to allocate node resources to the new main task if the available resources of the optimal deployment node are sufficient.

[0134] In one embodiment, the target decommissioning container unit determination module 202 includes:

[0135] The target elimination container unit is used to identify container units with hash values ​​higher than a preset threshold as target elimination container units.

[0136] In one embodiment, the target decommissioning container unit determination module 202 includes:

[0137] The candidate elimination container unit is used to identify container units with hash values ​​higher than a preset threshold as candidate elimination container units.

[0138] The migration cost calculation unit is used to calculate the migration cost of each candidate elimination container unit based on the resource usage intensity and current task progress.

[0139] The target replacement container unit is used to select the target replacement container unit based on the node resources required by the new main task, in ascending order of the migration cost of each candidate replacement container unit.

[0140] In one embodiment, the migration cost calculation unit includes:

[0141] The migration cost calculation subunit is used to calculate the migration cost using the following formula:

[0142]

[0143] in, , , and To control the adjustment factors for the weights of different indicators, For the first The proportion of CPU cores required by each obsolete container unit to the total number of CPU cores on its node; For the first The proportion of memory resources required by each discarded container unit to the total memory resources of its node. For the first The proportion of disk usage of a discarded container unit to the total disk resources of its node; The progress indicator is 1, which represents the time closer to completion and the higher the migration cost.

[0144] In one embodiment, the optimal deployment node determination module 203 includes:

[0145] The dual-deep Q-network training unit is used to determine joint state samples and iteratively train the network parameters of the dual-deep Q-network based on the joint state samples and a pre-set reward function. The reward function is used to minimize the load imbalance between nodes, the task delay after scheduling, and the energy consumption per unit time.

[0146] In one embodiment, the reward function is:

[0147]

[0148] in, For the reward function, Indicates time, This refers to the load imbalance between nodes. To delay the task after scheduling, Energy consumption per unit time , and For hyperparameters, satisfying .

[0149] In one embodiment, the apparatus further includes:

[0150] The optimal deployment node update module is used to select a new target to evict container units and update the optimal deployment node if the available resources of the optimal deployment node are insufficient, until the available resources of the updated optimal deployment node meet the node resources required by the new main task.

[0151] In one embodiment, this application also provides a storage medium storing computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the task-aware container resource dynamic scheduling method as described in any of the above embodiments.

[0152] In one embodiment, this application also provides a computer device storing computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the task-aware container resource dynamic scheduling method described in any of the above embodiments.

[0153] Indicatively, such as Figure 4 As shown, Figure 4 This is a schematic diagram of the internal structure of a computer device 300 provided in an embodiment of this application. The computer device 300 can be provided as a server. (Refer to...) Figure 4The computer device 300 includes a processing component 302, which further includes one or more processors, and memory resources represented by memory 301 for storing instructions, such as application programs, that can be executed by the processing component 302. The application programs stored in memory 301 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 302 is configured to execute instructions to perform the task-aware container resource dynamic scheduling method of any of the above embodiments.

[0154] The computer device 300 may also include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input / output (I / O) interface 305. The computer device 300 may operate on an operating system stored in memory 301, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or similar.

[0155] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0156] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. In this document, "a," "an," "the," "the," and "its" may also include plural forms unless the context clearly indicates otherwise. "Multiple" refers to at least two, such as 2, 3, 5, or 8, etc. "And / or" includes any and all combinations of the related listed items.

[0157] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.

[0158] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for dynamic scheduling of container resources based on main task awareness, characterized in that, The method comprises: when the number of master tasks in the current scheduling period is greater than 1, if a new master task arrives and node resources are insufficient, calculating a hash value of each container unit on each node; determining a target eliminated container unit according to the hash value of each container unit, releasing node resources of each target eliminated container unit, and obtaining schedulable nodes and to-be-scheduled container units; combining the state of the schedulable nodes and the state of the to-be-scheduled container units to obtain a joint state vector, and inputting the joint state vector into a pre-trained double-depth Q network to obtain an optimal deployment node; if the available resources of the optimal deployment node are sufficient, allocating node resources for the new master task.

2. The method of claim 1, wherein, The step of determining the target eliminated container unit according to the hash value of each container unit comprises: the container unit with a hash value higher than a preset threshold is taken as the target eliminated container unit.

3. The method of claim 1, wherein, The step of determining the target eliminated container unit according to the hash value of each container unit comprises: the container unit with a hash value higher than a preset threshold is taken as a candidate eliminated container unit; calculating a migration cost of each candidate eliminated container unit according to the resource usage intensity and the current task progress of each candidate eliminated container unit; based on the required node resources of the new master task, selecting the target eliminated container unit in the order of the migration cost of each candidate eliminated container unit from small to large.

4. The method of claim 3, wherein, The step of calculating the migration cost of each candidate eliminated container unit according to the resource usage intensity and the current task progress of each candidate eliminated container unit comprises: the migration cost is calculated by using the following formula: in, , , and To control the adjustment factors for the weights of different indicators, For the first The proportion of CPU cores required by each obsolete container unit to the total number of CPU cores on its node; For the first The proportion of memory resources required by each discarded container unit to the total memory resources of its node. For the first The proportion of disk usage of a discarded container unit to the total disk resources of its node; The progress indicator is 1, which represents the time closer to completion and the higher the migration cost.

5. The method of claim 1, wherein, The training process of the double-depth Q network comprises: determining a joint state sample, and iteratively training network parameters of the double-depth Q network by using a pre-set reward function according to the joint state sample, wherein the reward function is used to minimize the inter-node load imbalance degree, the task delay after scheduling, and the energy consumption per unit time.

6. The method of claim 5, wherein, The reward function is: wherein, is the reward function, denotes the time instant, is the load imbalance degree between nodes, is the task delay after scheduling, is the energy consumption per unit time, , and are hyperparameters satisfying .

7. The method of claim 1 to 6, wherein, The method further comprises: if the available resources of the optimal deployment node are insufficient, selecting a new target eliminated container unit and updating the optimal deployment node until the available resources of the updated optimal deployment node meet the required node resources of the new master task.

8. A master task-aware container resource dynamic scheduling apparatus, characterized in that, The device comprises: a master task awareness module configured to, when the number of master tasks in the current scheduling period is greater than 1, calculate a hash value of each container unit on each node if a new master task arrives and node resources are insufficient; a target eliminated container unit determination module configured to determine a target eliminated container unit according to the hash value of each container unit, and release node resources of each target eliminated container unit to obtain schedulable nodes and to-be-scheduled container units; an optimal deployment node determination module configured to combine the state of the schedulable nodes and the state of the to-be-scheduled container units to obtain a joint state vector, and input the joint state vector into a pre-trained double-depth Q network to obtain an optimal deployment node; A node resource allocation module is configured to allocate node resources for the new master task if available resources of the optimal deployment node are sufficient.

9. A storage medium characterized by: The storage medium stores computer readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the master task-aware container resource dynamic scheduling method of any one of claims 1 to 7.

10. A computer device, comprising: Comprising: one or more processors, and a memory; The memory stores computer readable instructions, which, when executed by the one or more processors, perform the steps of the master task-aware container resource dynamic scheduling method of any one of claims 1 to 7.