Task processing method and device, storage medium and electronic equipment
By inserting a task table into the Kubernetes platform and calculating the amount of parallel task processing, container scheduling instructions are dynamically generated, solving the problem of low resource utilization when virtual machine load increases, and realizing dynamic collaboration between containers and virtual machines and efficient resource utilization.
Patent Information
- Application Number
- CN202511464588.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-14
- Publication Date
- 2026-02-10
AI Technical Summary
In existing technologies, the Kubernetes platform struggles to achieve dynamic collaboration between containers and virtual machines when virtual machine load increases, resulting in low resource utilization.
By obtaining the priority of the target task, inserting it into the virtual machine task table in the Kubernetes cluster, calculating the parallel task processing volume of the virtual machine, and dynamically generating container scheduling instructions based on the matching processing speed range in the historical processing records, the corresponding number of container processing tasks are scheduled.
It achieves rationality and elasticity in container scheduling, improves resource utilization, and ensures that tasks are completed on time and are predictable.
Smart Images

Figure CN121501413A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, specifically to a task processing method, apparatus, storage medium, and electronic device. Background Technology
[0002] With the rapid development of cloud computing and virtualization technologies, data center workloads are becoming increasingly diverse. Kubernetes, as a mainstream container orchestration platform, has been widely used for the automated deployment, scaling, and management of containerized applications. To achieve unified management and efficient utilization of resources, containers and virtual machines can be hybrid orchestrated and scheduled on the Kubernetes platform, thereby supporting complex and diverse business scenarios.
[0003] Currently, when virtual machine load increases, the system can indirectly trigger the scaling of containerized services through manual or metric-based scaling strategies to alleviate some of the computing pressure. However, there is still a lack of fine-grained control mechanisms for the dynamic collaboration between virtual machines and containers during task scheduling. It is difficult to dynamically decide the number and timing of container scheduling based on task characteristics and system load, resulting in low resource utilization. Summary of the Invention
[0004] In view of this, this application provides a task processing method, apparatus, storage medium and electronic device, the main purpose of which is to improve the current technical problem that it is difficult to dynamically decide the number and timing of container scheduling based on task characteristics and system load, resulting in low resource utilization.
[0005] Firstly, this application provides a task processing method, including: Obtain the target task to be processed; Based on the priority of the target task, the target task is inserted into the task table of the virtual machine in the Kubernetes cluster; Calculate the current parallel task processing volume of the virtual machine based on the task information in the task table; Based on the processing speed range corresponding to the parallel task processing volume in the historical processing records, determine the container scheduling instructions used to execute the target task; Based on the container scheduling instructions, a corresponding number of containers in the Kubernetes cluster are scheduled to process the target task.
[0006] Secondly, this application provides a task processing apparatus, comprising: The acquisition module is configured to acquire target tasks to be processed. The insertion module is configured to insert the target task into the task table of the virtual machine in the Kubernetes cluster based on the priority of the target task; The computing module is configured to calculate the current parallel task processing volume of the virtual machine based on the task information in the task table; The determination module is configured to determine the container scheduling instruction for executing the target task based on the processing speed range corresponding to the parallel task processing volume in the historical processing record. The processing module is configured to schedule a corresponding number of containers in the Kubernetes cluster to process the target task based on the container scheduling instructions.
[0007] Thirdly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0008] Fourthly, this application provides an electronic device including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect.
[0009] Fifthly, this application provides a computer program product having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0010] By employing the above technical solutions, this application provides a task processing method, apparatus, storage medium, and electronic device. First, it acquires the target task to be processed; then, based on the priority of the target task, it inserts the target task into the task table of a virtual machine in a Kubernetes cluster; based on the task information in the task table, it calculates the current parallel task processing volume of the virtual machine; then, based on the processing speed range corresponding to the parallel task processing volume in historical processing records, it determines the container scheduling instruction used to execute the target task; based on the container scheduling instruction, it schedules the corresponding number of containers in the Kubernetes cluster to process the target task. Compared with existing technologies, this application uses the virtual machine as the core node for task reception and scheduling. Based on all tasks before the insertion position in the task table, it calculates the total unfinished workload as the current parallel task processing volume of the virtual machine, and combines this with the processing speed range matching the parallel task processing volume in historical processing records. Based on this, it dynamically generates container scheduling instructions containing a corresponding number of containers, achieving dynamic configuration based on actual task requirements and historical system performance. This makes container scheduling more reasonable, flexible, and predictive, effectively improving resource utilization.
[0011] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0012] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0013] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0014] Figure 1 A flowchart illustrating a task processing method provided in an embodiment of this application is shown; Figure 2 A flowchart illustrating another task processing method provided in an embodiment of this application is shown; Figure 3 A flowchart illustrating an example provided in an embodiment of this application is shown; Figure 4 A flowchart illustrating an example provided in an embodiment of this application is shown; Figure 5 A schematic diagram of the structure of a task processing device provided in an embodiment of this application is shown. Detailed Implementation
[0015] The embodiments of this application will now be described in more detail with reference to the accompanying drawings. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0016] Kubernetes (K8s) is an open-source container orchestration platform for automating the deployment, scaling, and management of containerized applications. KubeVirt is an open-source project designed to extend Kubernetes' container orchestration capabilities to virtual machine management. It allows virtual machines to run and manage within a Kubernetes cluster, coexisting with containers and providing hybrid workload orchestration capabilities. KubeVirt is an extension of Kubernetes, focusing on managing and running virtual machines within a Kubernetes environment. It leverages Kubernetes' powerful container orchestration capabilities to provide virtual machines with container-like management and scheduling functionalities. With KubeVirt, unified management and orchestration of containers and virtual machines can be achieved within the same Kubernetes cluster, resulting in better resource utilization, simplified operations, and greater flexibility and scalability.
[0017] To address the current technical problem of low resource utilization caused by the inability to dynamically decide the number and timing of container scheduling based on task characteristics and system load, this embodiment provides a task processing method applicable to server-side applications such as virtual machine management platforms and container orchestration platforms. Figure 1 As shown, the method includes: Step 101: Obtain the target task to be processed.
[0018] In some examples, when submitting a task, users can simultaneously input key scheduling parameters related to that task, including its priority, workload, and required duration. Priority characterizes the urgency or importance of the task, determining its processing order in the task queue; tasks with higher values or higher priorities will be scheduled first. Workload quantifies the computational resources or workload required by the task, reflecting its complexity or data processing volume. Required duration indicates the maximum time window the user expects for the task to run from start to finish, i.e., the task's completion timeframe.
[0019] Step 102: Based on the priority of the target task, insert the target task into the task table of the virtual machine in the Kubernetes cluster.
[0020] For example, a Kubernetes cluster is a system for automatically deploying, scaling, and managing containerized applications. It consists of a set of nodes (also called servers or virtual machines) that work together to run container-based applications. Kubernetes clusters improve the scalability, reliability, and maintainability of applications by providing a flexible and efficient environment for managing containerized applications.
[0021] For example, if the data in the task table is sorted based on priority, then after inserting the target task into the table according to priority, the task that ranks before the target task is the task with higher priority.
[0022] Step 103: Calculate the current parallel task processing volume of the virtual machine based on the task information in the task table.
[0023] For example, task information may include the priority, workload, and required duration of one or more tasks in the task table.
[0024] In some examples, the parallel task processing volume can reflect the total computational load of other high-priority tasks that the system must advance in parallel before the target task is processed. As a key indicator of the current system pressure, it directly affects the subsequent estimation of task completion time and the decision-making process of whether to introduce container resources for collaborative processing. The larger the value, the heavier the computational burden that the virtual machine needs to share before processing new tasks, which is more likely to trigger the scheduling requirement of auxiliary containers.
[0025] Step 104: Determine the container scheduling instruction to execute the target task based on the processing speed range corresponding to the parallel task processing volume in the historical processing records.
[0026] For example, the historical processing records store the actual processing speed of completing tasks under different parallel task processing volumes. The processing speed range that matches or is similar to the current parallel task processing volume is extracted from these records. This range includes the corresponding minimum processing speed and maximum processing speed. The longest processing time required to complete the task is calculated based on the target task's workload and the minimum processing speed. At the same time, the shortest processing time required is calculated by combining the maximum processing speed, thereby forming an estimated time period.
[0027] For example, the user-specified required duration is compared with the time period. If the required duration is not less than the maximum processing duration, no additional containers need to be scheduled. If the required duration is less than the minimum processing duration, scheduling instructions for the maximum number of containers are generated to fully support task execution. If the required duration is between the minimum and maximum processing duration, the number of containers to be activated is calculated proportionally based on the time margin, and resource redundancy is enhanced by combining an amplification factor. Finally, a corresponding number of container scheduling instructions are generated, realizing dynamic scheduling decisions based on the collaborative judgment of task requirements and system capabilities.
[0028] Step 105: Based on container scheduling instructions, schedule the corresponding number of containers in the Kubernetes cluster to process the target task.
[0029] For example, container scheduling instructions are sent to each container. Upon receiving the instruction, each container determines whether it can execute it and sends the result back to the virtual machine as feedback, thereby adjusting the scheduling instructions. For instance, tasks originally planned for unavailable containers may be reassigned to other idle or low-load containers, or the number of containers to be activated may be recalculated based on overall feedback. This achieves closed-loop control and real-time optimization of the scheduling process, ensuring the rationality of task allocation and the continuity of execution.
[0030] In some examples, when a container receives a scheduling instruction or during execution, it monitors its own running status and discovers that it is not suitable to continue participating in the current or subsequent computing tasks. It then reports this status information as feedback to the scheduling control node, i.e., the virtual machine. Upon receiving this feedback, the virtual machine immediately updates the task allocation list, removes the computing tasks originally assigned to that container from its execution queue, and reallocates the tasks based on the current resource status of available containers. These tasks are then reassigned to other containers that are running normally and have spare processing capacity. This avoids interruption or delay in overall task execution due to performance degradation or failure of a single container, ensuring the continuity of task processing and the fault tolerance of the system. This mechanism also supports elastic scheduling in dynamic environments, allowing resource allocation to be flexibly adjusted according to the actual running status of containers.
[0031] Compared with existing technologies, the technical solution of this embodiment first obtains the target task to be processed; then, based on the priority of the target task, it is inserted into the task table of the virtual machine in the Kubernetes cluster; according to the task information in the task table, the current parallel task processing volume of the virtual machine is calculated; then, based on the processing speed range corresponding to the parallel task processing volume in the historical processing records, the container scheduling instruction for executing the target task is determined; based on the container scheduling instruction, the corresponding number of containers in the Kubernetes cluster are scheduled to process the target task. By using the virtual machine as the core node for task reception and scheduling, based on all tasks before the insertion position in the task table, the total workload of the tasks that have not yet been completed is calculated as the current parallel task processing volume of the virtual machine, and combined with the processing speed range matching the parallel task processing volume in the historical processing records, a container scheduling instruction containing a corresponding number of containers is dynamically generated. This achieves dynamic configuration based on the actual needs of the task and the historical performance of the system, making the container scheduling more reasonable, flexible, and predictive, effectively improving resource utilization.
[0032] To further illustrate the specific implementation process of the method in this embodiment, this embodiment provides a method such as... Figure 2 The method shown includes: Step 201: Obtain the target task to be processed.
[0033] For example, the target task may include information such as priority, workload, and required duration. The target task may be submitted by an external user or system to a specific virtual machine in the Kubernetes cluster. The virtual machine, as the receiving entity and main control unit of the task, is responsible for the initial parsing and processing planning of the task and undertakes the main computing responsibilities. In this architecture, the container is not an independently running task execution entity, but is designed as an auxiliary computing unit of the virtual machine. Its role is to respond to the scheduling instructions of the virtual machine and assist in completing some or all of the computing tasks.
[0034] Optionally, the method in this embodiment may further include: configuring virtual machine configuration files and container configuration files in the Kubernetes cluster based on the remaining resources of the server-side device; and monitoring the task table of the virtual machine and the occupancy information of each container in real time, wherein the task table includes task name, task quantity, priority and progress.
[0035] For example, such as Figure 3 As shown, configuring virtual machines and creating containers in a Kubernetes cluster allows you to obtain performance parameters for both the virtual machines and containers after configuration. During the application of virtual machines and containers, it's necessary to monitor their progress in real time, i.e., their usage information. The virtual machine's task table includes task name, task quantity, priority, and progress items. This usage information is represented as an array, where each element corresponds to a container, and the element value represents the container's usage rate. The data items in the task table are sorted in descending order of priority.
[0036] In some examples, a virtual machine configuration file is created based on the Kubernetes cluster. The purpose of this process is to create the virtual machine, which requires determining at least the virtual machine tag, memory size, CPU read / write speed, and disk size. Next, a container configuration file is created. The purpose of this process is to create containers, which at least include container tags, CPU limits, memory limits, CPU requests, and memory requests. After configuring a virtual machine, multiple containers need to be configured; the more containers, the better. However, since the main computer's performance is limited, the remaining resources of the computer device need to be obtained when adding container configuration files. When the remaining resources reach a preset threshold, the maximum number of containers is recorded. Finally, a data transfer channel is configured between the virtual machine and the containers to enable data transfer between them.
[0037] For example, when initializing the resource configuration of virtual machines and containers in a Kubernetes cluster environment, a virtual machine configuration file is first created based on the cluster's management framework. This configuration file defines the basic attributes and resource specifications of the virtual machine instance, including virtual machine tags for identification and classification, preset memory size, CPU processing power, and allocated disk storage capacity. These parameters together determine the virtual machine's running capabilities and scheduling strategy. Subsequently, the container environment is configured by creating container configuration files to set the resource constraints and requirements of each container instance. The configuration file includes container tags to support identification and selection, while explicitly defining CPU and memory limits as the upper limit of resource usage, and CPU and memory requests as the basis for resource reservation during scheduling, ensuring that containers can obtain the minimum resource guarantee required during runtime.
[0038] For example, the number of container configuration files can be continuously increased to deploy more container instances. At the same time, the remaining computing resources of the computer devices that host these instances are monitored in real time, including key indicators such as available CPU and memory. When the remaining resources are detected to be decreasing and reaching the preset resource threshold, it is determined that the current device is close to the resource carrying limit. At this time, the creation of new containers is stopped, and the total number of containers that have been successfully configured is recorded as the maximum number of containers in this environment for use in the resource limit control during subsequent scheduling. In some examples, to enable collaboration between virtual machines and containers, the system can configure a data transmission channel between them. This channel supports bidirectional interaction of task instructions, processing data, and status information, ensuring that the virtual machine can issue scheduling instructions to the container and receive execution results.
[0039] Step 202: Based on the priority of the target task, insert the target task into the task table of the virtual machine in the Kubernetes cluster.
[0040] For example, the data in the task table can be arranged in descending order according to task priority to form an ordered task queue. This allows the insertion of new tasks to be directly located to the appropriate position through priority comparison, ensuring that the orderliness of the queue is maintained.
[0041] For example, when a new target task is inserted into the task table according to its priority, the system only needs to traverse the existing task list and find the first task with a priority less than or equal to the current task's priority for insertion. After insertion, all tasks preceding the current task will be in a higher order in the queue than the current task, and their priorities will be greater than or equal to the current task.
[0042] Step 203: Calculate the current parallel task processing volume of the virtual machine based on the task information in the task table.
[0043] For example, based on the task volume and current processing progress of all tasks preceding the target task in the task table, the system calculates the unfinished work portion of each high-priority task item by item. Specifically, by subtracting the completed progress from the total task volume of each task, the remaining workload of each task is obtained. Since these tasks are regarded as being executed simultaneously using a parallel processing mechanism in the scheduling model, their remaining workload has the attribute of concurrent execution from the perspective of resource scheduling. Therefore, the system accumulates the sum of these remaining workloads, and the result is the amount of parallel processing that the current virtual machine needs to undertake simultaneously.
[0044] Optionally, step 203 may specifically include: identifying one or more tasks before the insertion position of the target task in the task table as a set of tasks to be processed with higher priority than the target task; obtaining the task quantity and corresponding task processing progress of each task in the set of tasks to be processed; calculating the total unfinished workload of all tasks to be processed based on the task quantity and corresponding task processing progress of each task; and determining the total workload as the current parallel task processing volume of the virtual machine.
[0045] For example, one or more tasks before the insertion position of the target task in the task table are identified as a set of tasks to be processed with higher priority than the target task. Since the tasks in the task table are arranged in descending order of priority, the tasks before the insertion position are the high-priority tasks that need to be processed in the current system.
[0046] In some examples, the system obtains the workload and corresponding processing progress of each task in the set. The workload represents the overall scale of the task, and the processing progress reflects the completed portion of the execution. For each task, the difference between its workload and processing progress is calculated to obtain the remaining workload for that task. The remaining workloads of all tasks are summed to obtain the total unfinished workload, which is then used as the virtual machine's current parallel task processing capacity, reflecting the computational load level that the virtual machine must simultaneously handle before processing new tasks.
[0047] Step 204: Query the first and second processing speeds corresponding to the parallel task processing volume in the historical processing records.
[0048] In some examples, historical processing records may include the number of parallel processes, the maximum speed, and the minimum speed for different parallel processes.
[0049] For example, the first processing speed is less than the second processing speed, where the first processing speed can be the minimum speed for querying parallel processing processes in the processing record, and the second processing speed can be the maximum speed for querying parallel processing processes in the processing record.
[0050] Step 205: Calculate the first required time to complete the target task based on the parallel task processing volume and the first processing speed, and calculate the second required time to complete the target task based on the parallel task processing volume and the second processing speed.
[0051] For example, different numbers of parallel processes correspond to different processing speeds. The longest duration, i.e., the first required duration, is calculated based on the user-input task volume and the minimum speed; the shortest duration, i.e., the second required duration, is calculated based on the task volume and the maximum speed.
[0052] Step 206: Based on the first and second demand durations, determine the time period required for parallel processing of the target task.
[0053] For example, the lower limit of this time period is the duration of the second demand, and the upper limit is the duration of the first demand.
[0054] Step 207: By comparing the time period required for parallel processing of the target task with the corresponding target requirement duration, determine the container scheduling instructions used to execute the target task.
[0055] Optionally, step 207 may specifically include: when the target demand duration is less than the first demand duration but greater than the second demand duration, calculating the difference between the target demand duration and the second demand duration; determining the target number of containers to execute the target task based on the difference, the preset maximum number of containers, and the preset ratio coefficient; randomly selecting containers of the target number of containers from the currently available containers and generating corresponding scheduling instructions.
[0056] For example, when the required duration is between the shortest and longest duration, the system calculates the difference between the required duration and the shortest duration, multiplies the difference by a preset maximum number of containers to obtain a number of containers corresponding to the time margin ratio, and then multiplies this number by a preset amplification ratio coefficient greater than 1 to increase redundant resource investment, improve the reliability of timely task completion, and uses the final value as the target number of containers. The system randomly selects a corresponding number of containers from the currently available and not sealed configured containers, generates and sends the corresponding container scheduling instructions, thereby achieving elastic resource allocation and efficient utilization while ensuring system stability.
[0057] Optionally, step 207 may further include: generating a scheduling instruction when the target demand duration is greater than or equal to the first demand duration; and generating a scheduling instruction for all available containers when the target demand duration is less than or equal to the second demand duration.
[0058] For example, when the maximum duration is less than or equal to the required duration, it indicates that under the current processing power of the virtual machine, even at the slowest historical processing speed, the target task can still be completed within the user-specified required duration. The system determines that no additional resources are needed, so it can generate a scheduling instruction or not generate a container scheduling instruction, and the task is processed independently by the virtual machine.
[0059] For example, when the shortest duration exceeds the required duration, it indicates that even at the historically best processing speed, the virtual machine alone cannot complete the target task within the required duration. The system determines that the task faces urgent time pressure and must call all available resources for collaborative processing. At this time, a container scheduling instruction equal to the maximum number of containers is generated to activate all containers that can participate in the computation, so as to maximize the parallel processing capability and ensure that the task can be as close as possible to or meet the user-set completion time limit.
[0060] In some examples, the container scheduling instruction generation process also includes optimization of resource constraints. The system pre-defines a candidate set of resource limits for scheduling, which contains at least one candidate resource limit value. Each resource limit value represents the maximum available resource amount under a possible resource allocation strategy or system operating mode. When the candidate set is not empty, the system selects the resource limit with the smallest value as the constraint for the current scheduling operation to ensure that the scheduling decision is made under the most conservative resource availability assumptions. Based on the selected minimum resource limit, the system comprehensively considers the container's resource requests, current load status, and task allocation balance to calculate the optimal solution for task scheduling of multiple containers under the constraints. This optimal solution represents the container scheduling scheme that achieves the most reasonable task allocation, the highest resource utilization, or the most balanced load while satisfying resource constraints. Based on this, the final container scheduling instruction is generated, thereby improving the resource adaptability and execution reliability of the scheduling process.
[0061] Step 208: Based on the container scheduling instructions, schedule the corresponding number of containers in the Kubernetes cluster to process the target task.
[0062] Optionally, the method in this embodiment may further include: receiving status information fed back by each container, the status information including the container's operating parameters; and dynamically adjusting the container scheduling instructions based on the status information.
[0063] For example, the virtual machine sends container scheduling instructions to each container. When a container receives a container scheduling instruction, it starts working and records its own running parameters in real time during the working process, including key indicators such as CPU utilization, memory usage, network I / O, and process status.
[0064] Optionally, the above-mentioned dynamic adjustment of container scheduling instructions based on status information may specifically include: analyzing the operating parameters of each container based on a preset anomaly judgment model to generate an anomaly degree characterizing the degree of operational anomaly; when the anomaly degree of any container reaches a preset anomaly threshold, marking the corresponding container as sealed and sending feedback information containing the sealed state to the virtual machine.
[0065] In some examples, such as Figure 4 As shown, the virtual machine, acting as the scheduling control node, sends the generated container scheduling instructions to each associated container. Upon receiving the instructions, each container begins executing the corresponding computation task. During operation, each container continuously collects its own operating parameters and inputs this real-time data into a pre-trained anomaly detection model. This model evaluates the current operating state based on historical normal and abnormal behavior samples and outputs an anomaly score representing the degree of deviation from the normal pattern. When the anomaly score calculated by a container reaches or exceeds a preset anomaly threshold, it is determined to be in an unstable or potentially faulty state. At this time, the container actively marks itself as in a sealed state and sends a feedback message containing this state information to the virtual machine. After receiving the feedback, the virtual machine updates its scheduling decision logic. When selecting containers to execute tasks in the future, it excludes containers that have entered the sealed state and sets their probability of being selected to zero, ensuring that scheduling instructions are no longer assigned to containers with abnormal operating states, thereby guaranteeing the stability of task execution and the effectiveness of resource scheduling.
[0066] Compared to existing technologies, this embodiment uses containers as lightweight "virtual machines" to assist the virtual machine's operation. This allows the virtual machine to call different numbers of containers based on the task itself, enabling most processing tasks to be completed within the required timeframe. Simultaneously, it provides flexible configuration strategies for containers and virtual machines, creating configurations or migrations based on these strategies. By using containers as auxiliary modules for virtual machines, this embodiment ensures security between containers and virtual machines while also improving physical resource utilization by incorporating the virtual machine's flexible scheduling strategy. Furthermore, it sets a candidate set of resource limits for scheduling, including at least one candidate resource limit; if the candidate set is not empty, it selects the minimum resource limit within the candidate set; it calculates the optimal solution for scheduling multiple containers under the selected minimum resource limit condition; and if all containers can be scheduled using the scheduling method corresponding to the optimal solution, it performs scheduling using the calculated scheduling method corresponding to the optimal solution.
[0067] Furthermore, as Figure 1 and Figure 2 To provide a specific implementation of the method shown, this embodiment offers a task processing device, such as... Figure 5As shown, the device includes: an acquisition module 31, an insertion module 32, a calculation module 33, a determination module 34, and a processing module 35.
[0068] Module 31 is configured to acquire the target task to be processed; Insertion module 32 is configured to insert the target task into the task table of the virtual machine in the Kubernetes cluster based on the priority of the target task; The calculation module 33 is configured to calculate the current parallel task processing volume of the virtual machine based on the task information in the task table; The determination module 34 is configured to determine the container scheduling instruction for executing the target task based on the processing speed range corresponding to the parallel task processing volume in the historical processing record. The processing module 35 is configured to schedule a corresponding number of containers in the Kubernetes cluster to process the target task based on the container scheduling instruction.
[0069] In some examples of this embodiment, the calculation module 33 is specifically configured to determine one or more tasks before the insertion position of the target task in the task table as a set of tasks to be processed with higher priority than the target task; obtain the task quantity and corresponding task processing progress of each task in the set of tasks to be processed; calculate the total unfinished workload of all tasks to be processed based on the task quantity and corresponding task processing progress of each task; and determine the total workload as the current parallel task processing volume of the virtual machine.
[0070] In some examples of this embodiment, the determining module 34 is specifically configured to: query the historical processing record for a first processing speed and a second processing speed corresponding to the parallel task processing volume; calculate the first required duration to complete the target task based on the parallel task processing volume and the first processing speed; calculate the second required duration to complete the target task based on the parallel task processing volume and the second processing speed; determine the time period required for parallel processing of the target task based on the first required duration and the second required duration; and determine the container scheduling instruction for executing the target task by comparing the time period required for parallel processing of the target task with the corresponding target required duration.
[0071] In some examples of this embodiment, the determining module 34 is further configured to: calculate the difference between the target demand duration and the second demand duration when the target demand duration is less than the first demand duration but greater than the second demand duration; determine the target number of containers to execute the target task based on the difference, the preset maximum number of containers and the preset ratio coefficient; randomly select the target number of containers from the currently available containers and generate corresponding scheduling instructions.
[0072] In some examples of this embodiment, the determining module 34 is further configured to generate a scheduling instruction when the target demand duration is greater than or equal to the first demand duration; and to generate a scheduling instruction for all available containers when the target demand duration is less than or equal to the second demand duration.
[0073] In some examples of this embodiment, the acquisition module 31 is further configured to configure virtual machine configuration files and container configuration files in the Kubernetes cluster based on the remaining resource quantity of the server device; and to monitor the task table of the virtual machine and the occupancy information of each container in real time. The task table includes task name, task quantity, priority and progress.
[0074] In some examples of this embodiment, the processing module 35 is further configured to receive status information fed back by each container, the status information including the operating parameters of the container; and dynamically adjust the container scheduling instructions according to the status information.
[0075] In some examples of this embodiment, the processing module 35 is further configured to analyze the operating parameters of each container based on a preset anomaly determination model, generate an anomaly degree that characterizes the degree of operational anomaly; when the anomaly degree of any container reaches a preset anomaly threshold, the corresponding container is marked as sealed, and feedback information containing the sealed state is sent to the virtual machine.
[0076] It should be noted that for other corresponding descriptions of the various functional units involved in the task processing device provided in this embodiment, please refer to... Figure 1 and Figure 2 The corresponding description in [the document] will not be repeated here.
[0077] Based on the above, Figure 1 and Figure 2 Accordingly, this embodiment also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method. Figure 1 and Figure 2 The method shown.
[0078] Based on this understanding, the technical solution of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as CD-ROM, USB flash drive, mobile hard drive, etc.) and includes several instructions to cause a computer device (such as personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of this application.
[0079] Based on the above, Figure 1 and Figure 2 The method shown, and Figure 5 To achieve the above objectives, the present application also provides an electronic device, such as a personal computer, server, laptop computer, intelligent robot, or other intelligent terminal, as illustrated in the virtual device embodiment. This device includes a storage medium and a processor; the storage medium stores a computer program; the processor executes the computer program to implement the above-described virtual device. Figure 1 and Figure 2 The method shown.
[0080] Optionally, the aforementioned physical devices may also include a user interface, a network interface, a camera, radio frequency (RF) circuitry, sensors, audio circuitry, a Wi-Fi module, etc. The user interface may include a display screen, input units such as a keyboard, etc., and optional user interfaces may also include USB interfaces, card reader interfaces, etc. The network interface may optionally include standard wired interfaces, wireless interfaces (such as Wi-Fi interfaces), etc.
[0081] Those skilled in the art will understand that the physical device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or combine certain components, or have different component arrangements.
[0082] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the aforementioned physical device, supporting the operation of information processing programs and other software and / or programs. The network communication module is used to enable communication between the various components within the storage medium, as well as communication with other hardware and software in the information processing physical device.
[0083] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms, or it can be implemented by hardware. By applying the solution of this embodiment, compared with the existing technology, this embodiment proposes a hybrid task processing architecture based on a Kubernetes cluster. In this architecture, the virtual machine, as the core execution entity, is responsible for receiving and processing target tasks, and undertakes the main scheduling decision and task management functions. Containers are built as auxiliary computing units of the virtual machine, and implement instruction issuance and result feedback through a dedicated data transmission channel established with the virtual machine, forming a collaborative processing mode with the virtual machine as the main body and containers as the auxiliary body. In this architecture, the virtual machine maintains a task table sorted by priority. Based on the task volume and processing progress of the high-priority tasks before the new task is inserted, the total workload that needs to be undertaken in parallel is calculated, and combined with the corresponding load interval in the historical processing records. The system determines the minimum and maximum processing speeds, estimates the time range for task completion, and dynamically generates container scheduling instructions based on user-defined duration requirements. When virtual machine resources are insufficient to ensure timely task completion, it proactively calls upon container resources for collaborative processing. The system also features an elastic management strategy, supporting dynamic configuration adjustments or migrations of containers and virtual machines, improving resource utilization while ensuring operational security isolation. Furthermore, by setting a candidate set of resource upper limits containing multiple candidate values and selecting the minimum resource upper limit as a constraint, the optimal solution for container scheduling under this constraint is calculated, ensuring the feasibility and efficiency of the scheduling scheme in resource-constrained scenarios. This achieves intelligent hybrid scheduling that is task-driven, state-aware, and resource-adaptive.
[0084] It should be noted that, in this document, relational terms such as "first" and "second" are used merely 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. Without further limitations, 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.
[0085] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement 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 described herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A task processing method, characterized in that, include: Obtain the target task to be processed; Based on the priority of the target task, the target task is inserted into the task table of the virtual machine in the Kubernetes cluster; Calculate the current parallel task processing volume of the virtual machine based on the task information in the task table; Based on the processing speed range corresponding to the parallel task processing volume in the historical processing records, determine the container scheduling instructions used to execute the target task; Based on the container scheduling instructions, a corresponding number of containers in the Kubernetes cluster are scheduled to process the target task.
2. The method according to claim 1, characterized in that, The step of calculating the current parallel task processing volume of the virtual machine based on the task information in the task table includes: One or more tasks preceding the insertion position of the target task in the task table are identified as a set of tasks to be processed with higher priority than the target task; Obtain the task quantity and corresponding task processing progress of each task in the set of tasks to be processed; Based on the workload and corresponding task processing progress of each task, calculate the total workload that is currently not completed among all pending tasks. The total workload is determined as the current parallel task processing volume of the virtual machine.
3. The method according to claim 1, characterized in that, The step of determining the container scheduling instruction for executing the target task based on the processing speed range corresponding to the parallel task processing volume in the historical processing records includes: In the historical processing record, query the first processing speed and the second processing speed corresponding to the parallel task processing volume, where the first processing speed is less than the second processing speed. The first required time to complete the target task is calculated based on the parallel task processing volume and the first processing speed, and the second required time to complete the target task is calculated based on the parallel task processing volume and the second processing speed. Based on the first required duration and the second required duration, determine the time period required for parallel processing of the target task; By comparing the time period required for parallel processing of the target task with the corresponding target requirement duration, a container scheduling instruction for executing the target task is determined.
4. The method according to claim 3, characterized in that, The step of determining the container scheduling instruction for executing the target task by comparing the time period required for parallel processing of the target task with the corresponding required duration includes: When the target demand duration is less than the first demand duration but greater than the second demand duration, the difference between the target demand duration and the second demand duration is calculated; Based on the difference, the preset maximum number of containers, and the preset ratio coefficient, the number of target containers used to perform the target task is determined. Randomly select the target number of containers from the currently available containers and generate corresponding scheduling instructions.
5. The method according to claim 3, characterized in that, The step of determining the container scheduling instruction for executing the target task by comparing the time period required for parallel processing of the target task with the corresponding required duration includes: When the target demand duration is greater than or equal to the first demand duration, an air conditioning time instruction is generated. When the target demand duration is less than or equal to the second demand duration, a scheduling instruction is generated for all available containers.
6. The method according to claim 1, characterized in that, Before obtaining the target task to be processed, the method further includes: Based on the remaining resources of the server-side device, configure virtual machine configuration files and container configuration files in the Kubernetes cluster; The task table of the virtual machine and the usage information of each container are monitored in real time. The task table includes task name, task quantity, priority and progress.
7. The method according to claim 1, characterized in that, After scheduling a corresponding number of containers in the Kubernetes cluster to process the target task based on the container scheduling instruction, the method further includes: Receive status information from each container, including the operating parameters of the container; The container scheduling instructions are dynamically adjusted based on the status information.
8. The method according to claim 7, characterized in that, The step of dynamically adjusting the container scheduling instruction based on the status information includes: Based on a pre-defined anomaly detection model, the operating parameters of each container are analyzed to generate an anomaly degree that characterizes the degree of operational anomaly. When the anomaly level of any container reaches the preset anomaly threshold, the corresponding container is marked as sealed, and feedback information containing the sealed status is sent to the virtual machine.
9. A task processing device, characterized in that, include: The acquisition module is configured to acquire target tasks to be processed. The insertion module is configured to insert the target task into the task table of the virtual machine in the Kubernetes cluster based on the priority of the target task; The computing module is configured to calculate the current parallel task processing volume of the virtual machine based on the task information in the task table; The determination module is configured to determine the container scheduling instruction for executing the target task based on the processing speed range corresponding to the parallel task processing volume in the historical processing record. The processing module is configured to schedule a corresponding number of containers in the Kubernetes cluster to process the target task based on the container scheduling instructions.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 8.
11. An electronic device, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 8.
12. A computer program product having a computer program stored thereon, characterized in that, When the computer program product is executed by a processor, it implements the method of any one of claims 1 to 8.