Method, apparatus, medium and program product for scheduling computing resources
By obtaining task priorities and dynamically adjusting resource configuration in a distributed computing system, the problem of long queue times for high-priority video processing tasks when computing resources are insufficient is solved, achieving efficient resource utilization and rapid task processing.
Patent Information
- Application Number
- CN202410733274.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2024-09-24
AI Technical Summary
Existing distributed computing systems fail to effectively consider the priority order of tasks in task scheduling. As a result, high-priority video processing tasks cannot be allocated resources for processing in a timely manner in scenarios where computing resources are insufficient, resulting in long queuing times.
By obtaining the priority information of the pending tasks, determine the matching target computing resources based on the priority and resource configuration information, and set the elastic part as a buffer in the low-priority resource pool to dynamically adjust the resource configuration to ensure that high-priority tasks obtain Sufficient resources and use the heap sort algorithm to optimize the order of task processing.
It effectively reduces the queuing time of high-priority tasks, improves resource utilization, and flexibly adjusts resource configuration under different circumstances to ensure rapid processing of each priority task.
Smart Images

Figure CN118689601A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, computer-readable medium, and computer program product for scheduling computing resources. Background Art
[0002] Distributed computing systems based on the prior art generally do not consider the priority order of the tasks themselves when scheduling resources for tasks.
[0003] For example, with the explosive growth of video content and the massive increase in video processing demand, more and more video production companies have chosen and applied the Kubernetes component distributed computing system to handle large-scale computing tasks. However, Kubernetes's processing logic for resource priority cannot be applied to the production process of video manuscripts, resulting in high-priority video processing tasks not being allocated resources for processing in a timely manner in scenarios such as business peaks when computing resources are insufficient. Summary of the invention
[0004] Multiple aspects of the present application provide a method, an apparatus, a computer-readable medium, and a computer program product for scheduling computing resources.
[0005] In one aspect of the present application, a method for scheduling computing resources is provided, wherein the method comprises:
[0006] Get the priority information corresponding to the tasks to be processed;
[0007] Based on the priority information and the current resource configuration information, determine a target computing resource that matches the priority of the task to be processed, wherein the target computing resource includes available computing resources of a cluster having the same priority level as the task to be processed, and / or available computing resources of one or more clusters having a lower priority level than the task to be processed;
[0008] A computing resource for processing the task to be processed is selected from the target computing resources.
[0009] In one aspect of the present application, a device for scheduling computing resources is provided, wherein the device comprises:
[0010] A device for obtaining priority information corresponding to the task to be processed;
[0011] means for determining, based on the priority information and current resource configuration information, a target computing resource matching the priority of the task to be processed, the target computing resource comprising available computing resources of a cluster having the same priority level as the task to be processed, and / or available computing resources belonging to one or more clusters having a lower priority level than the task to be processed;
[0012] Means for selecting a computing resource from the target computing resources for processing the task to be processed.
[0013] Another aspect of the present application provides an electronic device, the electronic device comprising:
[0014] at least one processor; and
[0015] a memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of the embodiment of the application.
[0017] In another aspect of the present application, a computer-readable storage medium is provided, on which computer program instructions are stored. The computer program instructions can be executed by a processor to implement the method of the embodiment of the application.
[0018] Another aspect of the present application provides a computer program product, including a computer program, which implements the method of the embodiment of the application when executed by a processor.
[0019] The solution provided by the embodiment of the present application is to classify the computing resources of the distributed computing system according to priority and set up an elastic part for processing high-priority tasks in the low-priority resource pool as a buffer, thereby reserving enough processing resources for high-priority tasks to avoid the situation where high-priority tasks have to queue for a long time before being processed; dynamically adjust the resource configuration based on the current resource usage, so as to flexibly adjust the resource configuration of different priorities in different situations, while improving resource utilization and ensuring that the queuing processing time of tasks of various priorities is reduced; store tasks waiting to be processed in a heap, and sort these tasks according to a preset sorting strategy based on priority, so as to further reduce the queuing waiting time of high-priority tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0021] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0022] Figure 1A schematic diagram of a process for scheduling computing resources provided by an embodiment of the present application is shown;
[0023] Figure 2 A schematic flow chart of a method for adding a task to be processed to a heap according to an embodiment of the present application is shown;
[0024] Figure 3 A schematic diagram showing an exemplary resource pool according to an embodiment of the present application is shown;
[0025] Figure 4 A schematic diagram of an exemplary stack according to an embodiment of the present application is shown;
[0026] Figure 5 A schematic diagram of the structure of a device for scheduling computing resources provided in an embodiment of the present application is shown;
[0027] Figure 6 A schematic diagram of the structure of a device for adding a task to be processed to a stack according to an embodiment of the present application is shown;
[0028] Figure 7 A schematic diagram of the structure of a device suitable for implementing the solution in the embodiment of the present application is shown.
[0029] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0031] In a typical configuration of the present application, the terminal and the equipment of the service network each include one or more processors (CPU), input / output interface, network interface and memory.
[0032] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0033] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer program instructions, data structures, modules of programs or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0034] The following is an explanation of the terms involved in the embodiments of the present application.
[0035] Distributed system: A system consisting of multiple computer nodes that are interconnected through a network and work together to complete a task or service.
[0036] Kubernetes: Kubernetes refers to the container cluster management system. It is an open source container orchestration platform for automating the deployment, expansion and management of containerized applications. Kubernetes groups the containers that make up the application into logical units for easy management and discovery. Kubernetes can manage multiple containerized applications and provide load balancing, automatic scaling, automatic recovery and other functions, making the deployment and management of containerized applications simpler and more efficient.
[0037] Pod: Pod refers to a container unit. Kubernetes' Pod is the smallest deployable unit in Kubernetes. A Pod is a collection of one or more containers that run on the same node and share network and storage resources. Containers in a Pod can share the same network namespace, so they can communicate using localhost, or they can share the same storage volume to share data. A Pod can also be viewed as a logical host with its own IP address and port. It can communicate between containers internally, and can also be exposed to the outside world through a Kubernetes Service to access the Pod.
[0038] Figure 1 A flow chart of a method for scheduling computing resources provided in an embodiment of the present application is shown. The method at least includes step S101, step S102 and step S103.
[0039] In actual scenarios, the execution subject of the above method can be any one or more nodes in a distributed computing system. The specific implementation of the node may include a user device, a network device, or a device formed by integrating a user device and a network device through a network, and may also be a program running on the above device. The user device includes but is not limited to various terminal devices such as computers, mobile phones, and tablet computers. The network device includes but is not limited to network hosts, single network servers, multiple network server sets, or computer sets based on cloud computing. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing (Cloud Computing), where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computer sets.
[0040] Among them, the computing resources of the embodiments of the present application include but are not limited to a central processing unit (CPU) or a graphics processing unit (GPU).
[0041] In the scenario of processing video manuscripts, the method according to this embodiment can be executed by a server for scheduling resources, which interacts with each computing resource in a computing resource cluster through a network connection. Among them, the method grades the computing resources according to the priority of the video manuscript to be processed, thereby dividing the computing resources into multiple clusters corresponding to different priorities. The server can collect the usage of computing resources in each cluster in real time, and dynamically adjust the configuration of computing resources in clusters of various levels based on the collected information. Among them, the computing resources of the embodiment of the present application can be deployed using containers. The computing resources can be a Pod composed of one or more containers. Pod is the smallest scheduling unit in Kubernetes, and the containers in the Pod share network and storage resources.
[0042] Refer to the following Figure 1 To illustrate, in step S101, the priority information corresponding to the task to be processed is obtained.
[0043] The tasks to be processed may include various types of tasks that require computing resources to process. In the video processing scenario, the tasks to be processed are video manuscripts to be processed.
[0044] The priority information includes various information that can be used to indicate the priority order, for example, priority levels such as "high", "medium", and "low".
[0045] For video manuscripts, their priority is determined by the tags carried by the contributors and is generated when the task is issued. For example, video manuscripts from People's Daily Online and Xinhuanet are of high priority, video manuscripts from large-volume and high-viscosity bloggers are of medium priority, and video manuscripts from ordinary low-activity bloggers are of low priority.
[0046] In step S102, based on the priority information and the current resource configuration information, a target computing resource matching the priority of the task to be processed is determined.
[0047] The method of the embodiment of the present application grades the computing resources of the system according to the priority of the tasks to be processed, thereby dividing the computing resources into multiple clusters corresponding to different priorities.
[0048] Furthermore, the method configures an elastic part for one or more clusters of lower priority except the highest level, and the elastic part is used to process tasks with a priority higher than the current cluster level.
[0049] The target computing resources are computing resources that can meet the resource requirements of the task to be processed. The target computing resources include available computing resources of clusters with the same priority level as the task to be processed, and / or available computing resources of one or more clusters with a lower priority level than the task to be processed.
[0050] For example, the priorities of the video processing tasks to be processed are divided into three levels: high, medium, and low. In addition, the computing resources used to process the video processing tasks are also divided into three levels, corresponding to the three priorities of high, medium, and low. The resource pool after classification is shown in the figure. Figure 3 , the computing resources in the computing system resource pool include high-priority resources, medium-priority resources and low-priority resources, corresponding to high-priority, medium-priority and low-priority video processing tasks respectively. In addition, the "elastic high-priority" part is configured for the medium-priority resources, so that the medium-priority resources belonging to the "elastic high-priority" part can also process high-priority video processing tasks under specific circumstances. Similarly, the "elastic medium-priority" part is configured for the low-priority resources, so that the low-priority resources belonging to the "elastic medium-priority" part can also process medium-priority or even high-priority video processing tasks under specific circumstances, thereby ensuring that high-priority video processing tasks have enough resources to process. Among them, after being marked as a "high-priority resource", the cluster will no longer receive medium-priority tasks. If there are medium-priority tasks being executed when it is marked, the resources will be released after the task is completed or after the task execution times out.
[0051] The resource configuration information includes information for indicating computing resources that can be used to process pending tasks of various priorities.
[0052] Optionally, the resource configuration information includes information about the number of available resources in clusters of various current levels. For one or more clusters other than the highest priority level, the resource configuration information also includes the number of available resources corresponding to the elastic part in the cluster.
[0053] In step S103, a computing resource for processing the task to be processed is selected from the target computing resources.
[0054] The method of selecting computing resources for processing the pending task includes but is not limited to any of the following:
[0055] 1) Randomly select available resources from the target computing resources to process the pending tasks;
[0056] 2) Prioritize computing resources in the cluster with the same priority level as the task to be processed; for example, refer to Figure 3 In the resource pool shown, assuming that the priority of the current task to be processed is "high priority", if both the "high priority resources" and the "elastic high priority" of the medium priority resources in the resource pool have idle resources to process the task, the computing resources in the "high priority resources" are preferentially selected for processing.
[0057] After selecting computing resources for the task to be processed, the method further includes step S104.
[0058] In step S104, the to-be-processed task is sent to the cluster where the selected computing resource is located, so that the task can be processed by the corresponding computing resource.
[0059] According to an example, when sending a task to be processed, the method determines whether there are any tasks with a higher priority level than the task to be processed that have not been sent successfully. If so, wait until these higher-level tasks are sent successfully before sending the task to be processed to the cluster where the selected computing resources are located.
[0060] For example, for high-priority or medium-priority tasks, the total number of tasks stored in the heap and the total number of resources required are carried in the request header when the task is issued, and the resource strategy is dynamically adjusted based on the number of resource stockpiles. For low-priority tasks, the stockpiling continues and the tasks with high, medium and low priority are issued only after all the tasks have been successfully issued.
[0061] According to one embodiment, the method further includes step S105 and step S106.
[0062] In step S105, current resource usage status information is obtained.
[0063] The resource usage status information includes information indicating the amount of available resources in clusters of various levels.
[0064] Optionally, the resource usage status information may further include usage status information such as CPU usage, memory usage, etc.
[0065] In step S106, resource configuration is adjusted based on the resource usage status information.
[0066] Optionally, the method of adjusting resource configuration is but not limited to at least any one of the following:
[0067] 1) Adjust the number of resources of clusters at each level;
[0068] Optionally, based on the amount of free resources of clusters at each level, the amount of resources of clusters at each level is configured according to a preset configuration rule.
[0069] For example, continuing to refer to the resource pool shown in Figure 3, through the preset configuration rules, if the ratio of the number of idle resources in high-priority resources to the total number of current high-priority resources is less than a predetermined threshold, the number of resources in the "high-priority resources" cluster is appropriately increased.
[0070] 2) For clusters other than the highest priority cluster, adjust the proportion of elastic resources in the cluster;
[0071] Specifically, the proportion of the number of elastic resources in the cluster is increased or decreased based on the ratio of the number of idle resources in the clusters of each level to the number of all resources in the cluster.
[0072] For example, continue to refer to Figure 3 The resource pool shown, through the preset configuration rules, if the ratio of the number of idle resources in the high-priority resources to the number of all resources of the current high-priority resources is less than the predetermined threshold, the proportion of "elastic high-priority" resources in the "medium-priority resources" cluster is increased accordingly, so that more medium-priority resources can handle high-priority tasks.
[0073] If the ratio of the number of idle resources in high-priority resources to the number of all current high-priority resources is greater than a predetermined threshold, the proportion of "elastic high-priority" resources in the "medium-priority resources" cluster is reduced accordingly so that these resources can be used to process medium-priority tasks.
[0074] Similarly, if the ratio of the number of idle resources in the medium-priority resources to the number of all resources in the current medium-priority resources is greater than a predetermined threshold, the proportion of "elastic medium-priority" resources in the "low-priority resources" cluster will be reduced accordingly so that this part of the resources can be used to process low-priority tasks.
[0075] Optionally, the method periodically executes step S105 and step S106 to adjust resource configuration. Alternatively, the method executes step S105 and step S106 in a preset time period to adjust resource configuration. For example, a scheduling server for allocating computing resources for video manuscript tasks executes step S105 and step S106 in a preset video manuscript peak time period to adjust resource configuration.
[0076] According to the method of the embodiment of the present application, the computing resources of the distributed computing system are graded according to priority and an elastic part for processing high-priority tasks is set in the low-priority resource pool as a buffer, thereby reserving sufficient processing resources for high-priority tasks to avoid the situation where high-priority tasks have to queue for a long time before being processed; based on the current resource usage, the resource configuration is dynamically adjusted, so that the resource configuration of different priorities can be flexibly adjusted in different situations, thereby improving resource utilization while ensuring that the queuing processing time of tasks of each priority is reduced.
[0077] Figure 2 A schematic flow chart of a method for adding a to-be-processed task to a heap according to an embodiment of the present application is shown. The method comprises step S201, step S202 and step S203.
[0078] According to the method of this embodiment, multiple pending tasks are stored in a heap waiting to be processed, and the pending tasks taken from the top of the heap will be allocated corresponding computing resources for processing. The method is based on a heap sorting algorithm to sort the multiple pending tasks stored in the heap.
[0079] Reference Figure 2 In step S201, the priority information corresponding to the task to be processed is obtained.
[0080] In step S202, based on a predetermined stack sorting strategy and priority information of the tasks to be processed, sorting indication information of the tasks to be processed in the stack is obtained.
[0081] The sorting indication information is used to indicate the arrangement position of the tasks to be processed in the pile, and the arrangement position determines the processing order of the tasks to be processed.
[0082] Optionally, the heap sorting strategy includes but is not limited to at least any one of the following:
[0083] 1) The higher the priority, the higher the ranking;
[0084] 2) The earlier the task is created, the higher it is ranked.
[0085] For example, the sorting strategy may include: for tasks with different priorities, the task with a higher priority is sorted first; for tasks with the same priority, the task with an earlier creation time is sorted first.
[0086] For example, refer to Figure 4The stack shown is used to store video manuscript processing tasks submitted in the same batch. There is a high-priority task ("high-priority task") at the top of the stack, which will be taken out first and distributed to the corresponding computing resources for processing. The high-priority task and the medium-priority task in the middle of the stack, and the two low-priority tasks at the bottom of the stack will be taken out for processing in turn.
[0087] In step S203, the to-be-processed tasks are added to corresponding positions in the heap according to the sorting indication information.
[0088] For the pending task taken from the top of the stack, the above step S102 is executed to determine the target computing resource that matches the priority of the pending task based on the priority information of the pending task and the current resource configuration information.
[0089] Next, the above step S103 is executed to select a computing resource for processing the task to be processed from the target computing resources.
[0090] This process has been described in the above steps S102 and S103 and will not be repeated here.
[0091] According to one embodiment, the method further includes step S204.
[0092] In step S204, for the pending tasks that failed to be sent, the pending tasks are added back to the pile to wait for sending.
[0093] Optionally, in a manner similar to the above step S202 and step S203, the sorting indication information of the to-be-processed task that failed to be sent is determined and added to a corresponding position in the heap based on the sorting indication information.
[0094] Optionally, when determining the sorting position of the pending task that failed to be sent in the stack, the tasks are sorted based on the task creation time, so as to ensure that the pending task that failed to be sent obtains resources to be processed as soon as possible.
[0095] According to one embodiment, the method further includes step S205 and step S206.
[0096] In step S205, for the task in which the exception occurs, the cause of the exception is determined.
[0097] In step S206, if the exception is caused by a system error, the task is added back to the stack to wait for delivery and an alarm notification is issued. If the exception is caused by the business logic of the computing task, the relevant business party is notified for processing.
[0098] Among them, the anomalies caused by system errors include but are not limited to the anomaly of a certain node in the computing system, server downtime, etc.
[0099] According to the method of the embodiment of the present application, tasks waiting to be processed are stored in a pile, and these tasks are sorted according to a preset sorting strategy based on priority, thereby further reducing the queuing waiting time of high-priority tasks.
[0100] In addition, the present application also provides a device for scheduling computing resources, the structure of which is as follows: Figure 5 shown.
[0101] The device includes: a device for obtaining priority information corresponding to the task to be processed (hereinafter referred to as "information acquisition device 101"), a device for determining a target computing resource that matches the priority of the task to be processed based on the priority information and current resource configuration information (hereinafter referred to as "matching resource determination device 102"), and a device for selecting a computing resource for processing the task to be processed from the target computing resources (hereinafter referred to as "resource selection device 103").
[0102] Reference Figure 5 , the information acquisition device 101 acquires the priority information corresponding to the task to be processed.
[0103] The tasks to be processed may include various types of tasks that require computing resources to process. In the video processing scenario, the tasks to be processed are video manuscripts to be processed.
[0104] The priority information includes various information that can be used to indicate the priority order, for example, priority levels such as "high", "medium", and "low".
[0105] For video manuscripts, their priority is determined by the tags carried by the contributors and is generated when the task is issued. For example, video manuscripts from People's Daily Online and Xinhuanet are of high priority, video manuscripts from large-volume and high-viscosity bloggers are of medium priority, and video manuscripts from ordinary low-activity bloggers are of low priority.
[0106] The matching resource determining means 102 determines a target computing resource that matches the priority of the task to be processed based on the priority information and the current resource configuration information.
[0107] Among them, the device of the embodiment of the present application classes the computing resources of the system according to the priority of the tasks to be processed, thereby dividing the computing resources into multiple clusters corresponding to different priorities.
[0108] Furthermore, the device configures an elastic part for one or more clusters of lower priority except the highest level, and the elastic part is used to process tasks with a priority higher than the current cluster level.
[0109] The target computing resources are computing resources that can meet the resource requirements of the task to be processed. The target computing resources include available computing resources of clusters with the same priority level as the task to be processed, and / or available computing resources of one or more clusters with a lower priority level than the task to be processed.
[0110] For example, the priorities of the video processing tasks to be processed are divided into three levels: high, medium, and low. In addition, the computing resources used to process the video processing tasks are also divided into three levels, corresponding to the three priorities of high, medium, and low. The resource pool after classification is shown in the figure. Figure 3 , the computing resources in the resource pool include high-priority resources, medium-priority resources and low-priority resources, corresponding to high-priority, medium-priority and low-priority video processing tasks respectively. In addition, the "elastic high-priority" part is configured for the medium-priority resources, so that the medium-priority resources belonging to the "elastic high-priority" part can also process high-priority video processing tasks under specific circumstances. Similarly, the "elastic medium-priority" part is configured for the low-priority resources, so that the low-priority resources belonging to the "elastic medium-priority" part can also process medium-priority or even high-priority video processing tasks under specific circumstances, thereby ensuring that high-priority video processing tasks have enough resources to process. Among them, after being marked as a "high-priority resource", the cluster will no longer receive medium-priority tasks. If there are medium-priority tasks being executed when it is marked, the resources will be released after the task is completed or after the task execution times out.
[0111] The resource configuration information includes information for indicating computing resources that can be used to process pending tasks of various priorities.
[0112] Optionally, the resource configuration information includes information about the number of available resources in clusters of various current levels. For one or more clusters other than the highest priority level, the resource configuration information also includes the number of available resources corresponding to the elastic part in the cluster.
[0113] The resource selection device 103 selects a computing resource for processing the task to be processed from the target computing resources.
[0114] The method of selecting computing resources for processing the pending task includes but is not limited to any of the following:
[0115] 1) Randomly select available resources from the target computing resources to process the pending tasks;
[0116] 2) Prioritize computing resources in the cluster with the same priority level as the task to be processed; for example, refer to Figure 3In the resource pool shown, assuming that the priority of the current task to be processed is "high priority", if both the "high priority resources" and the "elastic high priority" of the medium priority resources in the resource pool have idle resources to process the task, the computing resources in the "high priority resources" are preferentially selected for processing.
[0117] After selecting computing resources for the task to be processed, the device also includes a task issuing device.
[0118] The resource selection device 103 sends the to-be-processed task to the cluster where the selected computing resource is located, so that the task can be processed by the corresponding computing resource.
[0119] According to an example, when sending a task to be processed, the method determines whether there are any tasks with a higher priority level than the task to be processed that have not been sent successfully. If so, wait until these higher-level tasks are sent successfully before sending the task to be processed to the cluster where the selected computing resources are located.
[0120] For example, for high-priority or medium-priority tasks, the total number of tasks stored in the heap and the total number of resources required are carried in the request header when the task is issued, and the resource strategy is dynamically adjusted based on the number of resource stockpiles. For low-priority tasks, the stockpiling continues and the tasks with high, medium and low priority are issued only after all the tasks have been successfully issued.
[0121] According to one embodiment, the device further includes a status acquisition device and a resource adjustment device.
[0122] The resource selection device 103 obtains current resource usage status information.
[0123] The resource usage status information includes information indicating the amount of available resources in clusters of various levels.
[0124] Optionally, the resource usage status information may further include usage status information such as CPU usage, memory usage, etc.
[0125] The resource adjustment device adjusts the resource configuration based on the resource usage status information.
[0126] Optionally, the method of adjusting resource configuration is but not limited to at least any one of the following:
[0127] 1) Adjust the number of resources of clusters at each level;
[0128] Optionally, based on the amount of free resources of clusters at each level, the amount of resources of clusters at each level is configured according to a preset configuration rule.
[0129] For example, continuing to refer to the resource pool shown in Figure 3, through the preset configuration rules, if the ratio of the number of idle resources in high-priority resources to the total number of current high-priority resources is less than a predetermined threshold, the number of resources in the "high-priority resources" cluster is appropriately increased.
[0130] 2) For clusters other than the highest priority cluster, adjust the proportion of elastic resources in the cluster;
[0131] Specifically, the resource adjustment device increases or decreases the proportion of the number of elastic resources in the cluster based on the ratio of the number of idle resources in the clusters of each level to the number of all resources in the cluster.
[0132] For example, continue to refer to Figure 3 The resource pool shown, through the preset configuration rules, if the ratio of the number of idle resources in high-priority resources to the number of all resources of current high-priority resources is less than a predetermined threshold, the resource adjustment device will accordingly increase the proportion of "elastic high-priority" resources in the "medium-priority resources" cluster, so that more medium-priority resources can handle high-priority tasks.
[0133] If the ratio of the number of idle resources in high-priority resources to the number of all current high-priority resources is greater than a predetermined threshold, the proportion of "elastic high-priority" resources in the "medium-priority resources" cluster is reduced accordingly so that these resources can be used to process medium-priority tasks.
[0134] Similarly, if the ratio of the number of idle resources in the medium-priority resources to the number of all resources in the current medium-priority resources is greater than a predetermined threshold, the proportion of "elastic medium-priority" resources in the "low-priority resources" cluster will be reduced accordingly so that this part of the resources can be used to process low-priority tasks.
[0135] Optionally, the state acquisition device and the resource adjustment device are operated periodically to adjust the resource configuration. Alternatively, the state acquisition device and the resource adjustment device are operated during a preset time period to adjust the resource configuration. For example, a scheduling server for allocating computing resources for video manuscript tasks performs the state acquisition device and the resource adjustment device to adjust the resource configuration during a preset video submission peak time period.
[0136] According to the device of the embodiment of the present application, the computing resources of the distributed computing system are graded according to priority and a flexible part for processing high-priority tasks is set in the low-priority resource pool as a buffer, thereby reserving sufficient processing resources for high-priority tasks to avoid the situation where high-priority tasks have to queue for a long time before being processed; based on the current resource usage, the resource configuration is dynamically adjusted, so that the resource configuration of different priorities can be flexibly adjusted in different situations, thereby improving resource utilization while ensuring that the queuing processing time of tasks of each priority is reduced.
[0137] Figure 6 A schematic diagram of the structure of a device for adding tasks to be processed to a stack according to an embodiment of the present application is shown.
[0138] The device includes: a device for obtaining priority information corresponding to the task to be processed (hereinafter referred to as "priority obtaining device 201"), a device for obtaining sorting indication information of the task to be processed in the heap based on a predetermined heap sorting strategy and the priority information of the task to be processed (hereinafter referred to as "sorting indication obtaining device 202"), and a device for adding the task to be processed to the corresponding position in the heap according to the sorting indication information (hereinafter referred to as "task adding device 203").
[0139] According to the method of this embodiment, multiple pending tasks are stored in a heap waiting to be processed, and the pending tasks taken from the top of the heap will be allocated corresponding computing resources for processing. The method is based on a heap sorting algorithm to sort the multiple pending tasks stored in the heap.
[0140] Reference Figure 6 , the priority acquisition device 201 acquires the priority information corresponding to the task to be processed.
[0141] The sorting indication obtaining means 202 obtains sorting indication information of the tasks to be processed in the heap based on a predetermined heap sorting strategy and priority information of the tasks to be processed.
[0142] The sorting indication information is used to indicate the arrangement position of the tasks to be processed in the pile, and the arrangement position determines the processing order of the tasks to be processed.
[0143] Optionally, the heap sorting strategy includes but is not limited to at least any one of the following:
[0144] 1) The higher the priority, the higher the ranking;
[0145] 2) The earlier the task is created, the higher it is ranked.
[0146] For example, the sorting strategy may include: for tasks with different priorities, the task with a higher priority is sorted first; for tasks with the same priority, the task with an earlier creation time is sorted first.
[0147] For example, refer to Figure 4 The stack shown is used to store video manuscript processing tasks submitted in the same batch. There is a high-priority task ("high-priority task") at the top of the stack, which will be taken out first and distributed to the corresponding computing resources for processing. The high-priority task and the medium-priority task in the middle of the stack, and the two low-priority tasks at the bottom of the stack will be taken out for processing in turn.
[0148] The task adding means 203 adds the to-be-processed tasks to the corresponding positions in the pile according to the sorting indication information.
[0149] For the pending task taken from the top of the stack, the operation of the matching resource determination device 102 is performed to determine the target computing resource that matches the priority of the pending task based on the priority information of the pending task and the current resource configuration information.
[0150] Next, the operation of the resource selection device 103 is executed to select a computing resource for processing the task to be processed from the target computing resources.
[0151] This process has been described in the above-mentioned matching resource determination device 102 and resource selection device 103, and will not be repeated here.
[0152] According to one embodiment, the device further comprises a failure handling device.
[0153] For pending tasks that fail to be sent, the failure processing device adds the pending tasks back to the pile to wait for sending.
[0154] Optionally, the failure processing device determines the sorting indication information of the to-be-processed task that failed to be sent and adds it to a corresponding position in the stack based on the sorting indication information in a manner similar to the operations of the sorting indication obtaining device 202 and the task adding device 203 described above.
[0155] Optionally, when determining the sorting position of the pending task that failed to be sent in the stack, the failure processing device sorts the tasks based on the task creation time to ensure that the pending task that failed to be sent obtains resources to be processed as soon as possible.
[0156] According to one embodiment, the device includes an abnormality cause determination device and an abnormality handling device.
[0157] The abnormality cause determination device determines the abnormality cause for the task in which the abnormality occurs.
[0158] If the exception is caused by a system error, the exception handling device will add the task back to the stack and wait for it to be sent down and issue an alarm notification. If the exception is caused by the business logic of the computing task, the exception handling device will notify the relevant business party to handle it.
[0159] Among them, the anomalies caused by system errors include but are not limited to the anomaly of a certain node in the computing system, server downtime, etc.
[0160] According to the solution of the embodiment of the present application, tasks waiting to be processed are stored in a pile, and these tasks are sorted according to a preset sorting strategy based on priority, thereby further reducing the queuing waiting time of high-priority tasks.
[0161] Based on the same inventive concept, an electronic device is also provided in an embodiment of the present application, and the method corresponding to the electronic device may be the method for scheduling computing resources in the aforementioned embodiment, and its principle of solving the problem is similar to that of the method. The electronic device provided in an embodiment of the present application includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the methods and / or technical solutions of the aforementioned multiple embodiments of the present application.
[0162] The electronic device may be a user device, or a device formed by integrating a user device and a network device through a network, or may be an application running on the above device. The user device includes but is not limited to various terminal devices such as computers, mobile phones, tablet computers, smart watches, and bracelets. The network device includes but is not limited to network hosts, single network servers, multiple network server sets, or cloud computing-based computer sets, which can be used to implement some processing functions when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing, where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computer sets.
[0163] Figure 7 The structure of a device suitable for implementing the method and / or technical solution in the embodiment of the present application is shown, and the device 1200 includes a central processing unit (CPU, Central Processing Unit) 1201, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM, Read Only Memory) 1202 or the program loaded from the storage part 1208 to the random access memory (RAM, Random Access Memory) 1203. In RAM1203, various programs and data required for system operation are also stored. CPU 1201, ROM 1202 and RAM 1203 are connected to each other through bus 1204. Input / output (I / O, Input / Output) interface 1205 is also connected to bus 1204.
[0164] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, a touch screen, a microphone, an infrared sensor, etc.; an output section 1207 including a cathode ray tube (CRT), a liquid crystal display (LCD), an LED display, an OLED display, etc., and a speaker, etc.; a storage section 1208 including one or more computer-readable media such as a hard disk, an optical disk, a magnetic disk, a semiconductor memory, etc.; and a communication section 1209 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1209 performs communication processing via a network such as the Internet.
[0165] In particular, the methods and / or embodiments in the embodiments of the present application may be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. When the computer program is executed by the central processing unit (CPU) 1201, the above functions defined in the method of the present application are executed.
[0166] Another embodiment of the present application further provides a computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the methods and / or technical solutions of any one or more embodiments of the present application described above.
[0167] Specifically, the present embodiment may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device, or device.
[0168] Computer readable signal media may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer readable program code. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than a computer readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0169] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0170] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0171] The flow chart or block diagram in the accompanying drawings shows the possible architecture, function and operation of the equipment, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated system for hardware that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0172] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0173] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or page components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0174] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0175] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0176] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
[0177] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
[0178] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in a device claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
Claims
1. A method for scheduling computing resources, in, The method comprises: Get the priority information corresponding to the tasks to be processed; Based on the priority information and the current resource configuration information, determine a target computing resource that matches the priority of the task to be processed, wherein the target computing resource includes available computing resources of a cluster having the same priority level as the task to be processed, and / or available computing resources of one or more clusters having a lower priority level than the task to be processed; A computing resource for processing the task to be processed is selected from the target computing resources.
2. The method according to claim 1, in, The method classifies the computing resources of the system according to the priorities of the tasks to be processed, thereby dividing the computing resources into a plurality of clusters corresponding to different priorities, and the method further comprises: An elastic part is configured for one or more clusters of lower priority other than the highest level, where the elastic part is used to process tasks with a priority higher than the current cluster level.
3. The method according to claim 1 or 2, in, The method comprises: Get the current resource usage status information; Based on the resource usage status information, resource configuration is adjusted.
4. The method according to claim 3, in, The adjusting process of resource configuration based on the resource usage status information includes: Adjust the number of resources for clusters at each level.
5. The method according to claim 3, in, The adjusting process of resource configuration based on the resource usage status information includes: For clusters other than the highest priority cluster, adjust the proportion of elastic resources in the cluster.
6. The method according to any one of claims 1 to 5, in, A plurality of pending tasks are stored in a pile waiting to be processed, and the method further comprises: Determine the ordering information of the tasks to be processed in the heap based on the predetermined heap ordering strategy and the priority information of the tasks to be processed; According to the sorting indication information, the to-be-processed tasks are added to corresponding positions in the heap.
7. The method according to claim 6, in, The heap sorting strategy includes at least any one of the following: The higher the priority, the higher the ranking; The earlier the task was created, the higher the ranking will be.
8. The method according to claim 6 or 7, in, The method further comprises: For pending tasks that fail to be delivered, the pending tasks are added back to the pile and wait for delivery.
9. A device for scheduling computing resources, in, The device comprises: A device for obtaining priority information corresponding to the task to be processed; means for determining, based on the priority information and current resource configuration information, a target computing resource matching the priority of the task to be processed, the target computing resource comprising available computing resources of a cluster having the same priority level as the task to be processed, and / or available computing resources belonging to one or more clusters having a lower priority level than the task to be processed; Means for selecting a computing resource from the target computing resources for processing the task to be processed.
10. An electronic device, wherein the electronic device include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
11. A computer readable medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the method according to any one of claims 1 to 8.
12. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
