Resource processing method, device and resource scheduling system

By obtaining the resource usage and release time of the task in the resource scheduling system, determining the load capacity parameters of the server, and selecting the appropriate target server, the problem of unbalanced resource scheduling is solved, the resource utilization rate is improved and resource deadlock is avoided.

CN112395075BActive Publication Date: 2025-02-28ALIBABA GROUP HOLDING LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201910754753.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-08-15
Publication Date
2025-02-28
Estimated Expiration
2039-08-15

AI Technical Summary

Technical Problem

In the prior art, unbalanced resource scheduling leads to low resource utilization of the system and may even lead to resource deadlock.

Method used

By obtaining the occupied resources corresponding to the tasks running on the server in the system and the remaining time required for the tasks to release resources, determine the resource parameters of the server, characterize the load capacity of the server, and select the target server from multiple servers based on these parameters to optimize resource allocation.

Benefits of technology

The balanced scheduling of system resources is realized, resource utilization is improved, resource deadlock is avoided, and the waiting time for resources to be allocated tasks is shortened.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112395075B_ABST
    Figure CN112395075B_ABST
Patent Text Reader

Abstract

The present application discloses a resource processing method, device and resource scheduling system. The method includes: obtaining the occupied resources corresponding to the tasks running on the server in the system and the remaining time required for the tasks to release the resources; determining the resource parameters of the server according to the occupied resources and the remaining time, wherein the resource parameters are used to represent the load capacity of the server; and determining the target server from multiple servers in the system according to the resource parameters of each server. The present application solves the technical problem in the prior art that the unbalanced resource scheduling leads to low resource utilization of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of resource management, and in particular, to a resource processing method, device and resource scheduling system. Background Art

[0002] In the computer field, resource schedulers can manage and allocate system resources. In practical applications, for example, in a distributed system, the total resources of the system are fixed, and the resources that can be used by each task group are also limited. The resources occupied by the tasks running in each server are usually different. Therefore, in order to improve the utilization of system resources, the resource scheduler needs to schedule system resources. However, in the prior art, when the resource scheduler dynamically schedules system resources, the resource scheduling is unbalanced, resulting in low resource utilization of the system and even resource deadlock.

[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0004] The embodiments of the present application provide a resource processing method, device and resource scheduling system to at least solve the technical problem in the prior art that unbalanced resource scheduling leads to low resource utilization of the system.

[0005] According to one aspect of an embodiment of the present application, a resource processing method is provided, including: obtaining occupied resources corresponding to tasks running on a server in the system, and the remaining time required for the task to release the resources; determining resource parameters of the server based on the occupied resources and the remaining time, wherein the resource parameters are used to represent the load capacity of the server; and determining a target server from multiple servers in the system based on the resource parameters of each server.

[0006] According to another aspect of an embodiment of the present application, a resource processing device is also provided, including: an acquisition module, used to obtain occupied resources corresponding to tasks running on a server in the system, and the remaining time required for the task to release the resources; a first determination module, used to determine the resource parameters of the server based on the occupied resources and the remaining time, wherein the resource parameters are used to represent the load capacity of the server; and a second determination module, used to determine a target server from multiple servers in the system based on the resource parameters of each server.

[0007] According to another aspect of an embodiment of the present application, a storage medium is further provided, which includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the above-mentioned resource processing method.

[0008] According to another aspect of an embodiment of the present application, a processor is further provided, the processor being used to run a program, wherein the above-mentioned resource processing method is executed when the program is running.

[0009] According to another aspect of an embodiment of the present application, a resource scheduling system is also provided, including: a processor; and a memory, connected to the processor, for providing the processor with instructions for processing the following processing steps: obtaining occupied resources corresponding to tasks running on a server in the system, and the remaining time required for the task to release the resources; determining resource parameters of the server based on the occupied resources and the remaining time, wherein the resource parameters are used to represent the load capacity of the server; and determining a target server from multiple servers in the system based on the resource parameters of each server.

[0010] In the embodiment of the present application, a method of determining the server to execute the task according to the load capacity of the server is adopted. After obtaining the occupied resources corresponding to the tasks running on the server in the system and the time required for the tasks to release the resources, the resource parameters characterizing the load capacity of the server are determined according to the occupied resources and the remaining time. Finally, the target server to execute the task to be assigned is determined according to the resource parameters of each server. It is easy to notice that the present application takes into account the resources occupied by the tasks running on the server and the time required for the tasks to release the resources in the process of determining the load capacity of the server. Therefore, the present application can balance the resources in the system, so that the tasks to be assigned have priority to wait for resources on the target server, shortening the waiting time for the tasks to be assigned to obtain resources.

[0011] It can be seen that the solution provided in the present application achieves the purpose of balanced scheduling of resources in the system, thereby achieving the technical effect of improving the resource utilization of the system, and further solving the technical problem of low resource utilization of the system caused by unbalanced resource scheduling in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0013] Figure 1 is a hardware structure block diagram of an optional computer terminal according to an embodiment of the present application;

[0014] Figure 2 is a flow chart of a method for processing resources according to an embodiment of the present application;

[0015] Figure 3 is an optional resource allocation schematic diagram according to an embodiment of the present application;

[0016] Figure 4 is a schematic diagram of an optional resource scheduling system according to an embodiment of the present application;

[0017] Figure 5 is a schematic diagram of a resource processing device according to an embodiment of the present application; and

[0018] Figure 6 It is a structural block diagram of a computer terminal according to an embodiment of the present application. DETAILED DESCRIPTION

[0019] In order to enable those skilled in the art to better understand the solution of the present application, 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 only 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 should fall within the scope of protection of the present application.

[0020] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0021] Example 1

[0022] According to an embodiment of the present application, an embodiment of a resource processing method is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0023] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 The hardware structure block diagram of a computer terminal (or mobile device) for implementing a resource processing method is shown. Figure 1As shown, the computer terminal 10 (or mobile device 10) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0024] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0025] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the resource processing method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, realizing the above-mentioned resource processing method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0026] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0027] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).

[0028] It should be noted that, in some optional embodiments, the above Figure 1 The computer device (or mobile device) shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. It should be noted that Figure 1 This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the above-described computer device (or mobile device).

[0029] Under the above operating environment, this application provides Figure 2 The processing method of the resource shown. Figure 2 : is a flowchart of a method for processing resources according to Embodiment 1 of the present application, the method comprising the following steps:

[0030] Step S202, obtaining the occupied resources corresponding to the tasks running on the server in the system, and the remaining time required for the tasks to release the resources.

[0031] Optionally, a resource scheduling system may be used as the execution subject in this embodiment, and the resource scheduling system may manage and allocate resources in the system, wherein the system in step S202 may be, but is not limited to, a distributed system.

[0032] It should be noted that when the server executes a task, it needs to occupy certain resources, where different tasks occupy different resources. For example, the resources occupied by accessing the content stored in the memory are different from the resources occupied by editing the image. Optionally, the occupied resources corresponding to the task may include the occupied CPU value, where the CPU value is a numerical value without a unit. Usually, the CPU value can be the product of the number of occupied CPU cores and a constant, and the constant can be but is not limited to 100; the occupied resources corresponding to the task can also be the occupied CPU value and the occupied memory value.

[0033] In an optional embodiment, the resource scheduling system has a monitoring unit, which can obtain the occupied resources corresponding to the tasks running in each server in the system, and the remaining time required for the task to release the resources. Optionally, before the server executes the task, the resource scheduling system determines the task type of the task, and then determines the size of the resources occupied by the task and the total time required to execute the task based on the task type. Then, during the process of the server executing the task, the monitoring unit monitors the length of time the task has been running in real time, and determines the remaining time for the task to be executed based on the total time. After the task is completed, the task will release the occupied resources.

[0034] Step S204, determining resource parameters of the server according to the occupied resources and the remaining time, wherein the resource parameters are used to represent the load capacity of the server.

[0035] In an optional embodiment, there may be multiple tasks running in the server. Therefore, the tasks running in the server can be divided into segments, and then the resource parameters corresponding to each segment are calculated separately. Finally, the resource parameters of the server are determined based on the resource parameters corresponding to all segments, where the resource parameters can be expressed in the form of numerical values. For example, the larger the numerical value corresponding to the resource parameter, the stronger the load capacity of the server.

[0036] Step S206, determining a target server from multiple servers in the system according to resource parameters of each server.

[0037] In step S206, the target server is the server that the task to be assigned is waiting for. After the target server is determined for the task to be assigned, the task to be assigned can wait in a waiting queue. When the resources in the target server are idle, the target server obtains the task to be assigned from the waiting queue and executes the task. Optionally, each server corresponds to a waiting queue. After the resource scheduling system determines the target server for the task to be assigned, the task to be assigned is set in the waiting queue corresponding to the target server.

[0038] Optionally, after determining the resource parameters of each server in the system, the resource scheduling system determines the server with the highest resource parameters as the target server. It is easy to notice that the size of the resource parameters represents the load capacity of the server, and the server with the highest resource parameters, that is, the server with the strongest load capacity, is preferably selected as the server for the task to be assigned. When the resources in the target server are idle, the resources are preferentially allocated to the tasks to be assigned that are waiting for resources in the target server. Since the target server has a strong load capacity, making the target server execute the task to be assigned can also achieve the purpose of improving the execution efficiency of the task.

[0039] Based on the scheme defined in the above steps S202 to S206, it can be learned that the method of determining the server to execute the task based on the load capacity of the server is adopted. After obtaining the occupied resources corresponding to the tasks running on the server in the system and the time required for the tasks to release the resources, the resource parameters characterizing the server load capacity are determined based on the occupied resources and the remaining time. Finally, the target server to execute the task to be assigned is determined based on the resource parameters of each server.

[0040] It is easy to notice that the present application takes into account the resources occupied by the tasks running on the server and the time required for the tasks to release the resources in the process of determining the load capacity of the server. Therefore, the present application can balance the resources in the system, so that the tasks to be assigned have priority in waiting for resources on the target server, thereby shortening the waiting time for the tasks to be assigned to obtain resources.

[0041] It can be seen that the solution provided in the present application achieves the purpose of balanced scheduling of resources in the system, thereby achieving the technical effect of improving the resource utilization of the system, and further solving the technical problem of low resource utilization of the system caused by unbalanced resource scheduling in the prior art.

[0042] In an optional embodiment, before obtaining the occupied resources corresponding to the tasks running on the server in the system, the resource scheduling system also obtains the resource request of the task to be assigned, and determines the target group to which the task to be assigned belongs, and then determines whether the remaining resources of the target group are greater than the resources required by the task to be assigned, and determines that the remaining resources of the target group are greater than the resources required by the task to be assigned, and then enters the step of obtaining the occupied resources corresponding to the tasks running on the server in the system, and the remaining time required for the task to release the resources.

[0043] In the above process, the resource request includes the resources required by the task to be assigned, and the resource request can be an AON (all or nothing) request, wherein the resource request is completed only when all resource requirements are successfully scheduled. Optionally, the client or server can send a resource request to the system, and the resource scheduling system determines the target group to which the task to be assigned belongs based on the resources required by the task to be assigned, wherein each group has a preset resource upper limit. The resource scheduling system detects the occupied resources in the target group, and then determines the remaining resources of the target group based on the resource upper limit and the occupied resources. In order to improve the success rate of resource allocation and avoid the problem of resource deadlock and waste caused by the task to be assigned using only part of the resources, the resource scheduling system executes step S202 only when the remaining resources of the target group are greater than the resources required by the task to be assigned.

[0044] Optionally, the resource scheduling system can determine the target group to which the task to be assigned belongs by detecting the task type to be assigned. In this scenario, different target groups contain different types of tasks. Optionally, the resource scheduling system can also determine the target group by detecting the size of the resources required by the task to be assigned. For example, if the remaining resources of the target group are greater than the resources required by the task to be assigned, it is determined that the task to be assigned belongs to the target group.

[0045] It should be noted that the target group may contain multiple tasks, and the total amount of resources used by the tasks in the target group is fixed, that is, the total amount of resources corresponding to the target group is fixed. In other words, the target group has an upper resource limit. In addition, the target group may also have a lower resource limit, that is, if the total amount of resources required by all tasks in the target group is less than the lower resource limit, the resource scheduling system automatically allocates resources with a total amount of the lower resource limit to the target group; if the total amount of resources required by all tasks in the target group is greater than or equal to the lower resource limit, the resource scheduling system allocates a preset total amount of resources to the target group, wherein the preset total amount of resources may be set according to actual needs, and optionally, the preset total amount of resources may be the lower resource limit.

[0046] In addition, it should be noted that at the same time, the total amount of resources required by different target groups is different. For example, at the same time, some target groups require more total amount of resources, while some target groups require less total amount of resources. In order to improve the utilization rate of system resources, the resource scheduling system needs to perform resource scheduling for each target group. In addition, since the total resources of the system are fixed, the resources available to each target group are also limited and compete with each other. When allocating resources, the resource scheduling system can configure a weight value for each target group. The larger the weight value, the larger the total amount of resources corresponding to the target group.

[0047] Furthermore, after obtaining the occupied resources corresponding to the tasks running on the server in the system and the remaining time required for the tasks to release the resources, the resource scheduling system determines the weight value of the task based on the remaining time, and then determines the product of the occupied resources of the task and the weight value of the task as the resource parameters of the task, and finally determines the sum of the resource parameters corresponding to all tasks running on the server as the resource parameters of the server.

[0048] Optionally, the remaining time is inversely proportional to the weight value, for example, Figure 3 The resource allocation diagram shown in Figure 3 In the figure, each vertical column represents a server. For example, the first column represents a physical server, and the second column represents a virtual server. The boxes with different lines represent the remaining time. The boxes corresponding to 0 to 60 seconds are solid-line boxes, and their corresponding weight value is 2. 9 The remaining time is 60 to 120 seconds, and the corresponding weight is 25 The remaining time is 120 to 180 seconds, and the corresponding weight is 2 1 The resource scheduling system can determine the weight value corresponding to the task according to the relationship between the remaining time and the weight value, and then use the product of the weight value corresponding to the task and the occupied resources as the resource parameter of the task, and finally sum up the resource parameters of all tasks in the server to obtain the resource parameters corresponding to the server.

[0049] Furthermore, the resource scheduling system may determine the weight value of the task according to the remaining time based on the wall time, wherein the wall time is stored in a core variable of the system, which records the time in the year-month-day format in the real world.

[0050] Specifically, the resource scheduling system determines the time period to which the current moment belongs, wherein the correspondence between the remaining time and the weight value is different in different time periods; then, based on the time period to which the current moment belongs, the correspondence between the remaining time and the weight value is obtained, and the weight value of the task is determined based on the remaining time and the correspondence.

[0051] It should be noted that different time periods have different task running characteristics. For example, the server executes more tasks in the time period from 8 am to 8 pm, and the server load capacity is relatively poor, while in the middle of the night, the server executes fewer tasks and the server load capacity is strong. Therefore, by determining the weight value corresponding to the task according to the time period to which the current moment belongs, the target server with free resources can be selected more accurately, shortening the waiting time for the assigned task to obtain resources.

[0052] In an optional embodiment, the resource scheduling system may also use the memory dimension to determine the resource parameters of the task. Specifically, the resource scheduling system obtains the first product of the CPU value occupied by the task and the weight value of the task, then obtains the second product of the memory value occupied by the task and the weight value of the task, and finally determines the sum of the first product and the second product as the resource parameter of the task.

[0053] Furthermore, after obtaining the resource parameters of the task, the resource scheduling system sums up the resource parameters of all tasks in the server to obtain the resource parameters of the server. After determining the resource parameters of each server, the resource scheduling system sorts the servers according to the size of the resource parameters and selects the server with the highest resource parameters as the target server to execute the task to be assigned.

[0054] In an optional embodiment, the resource scheduling system can also perform interactive preemption, wherein interactive preemption is a resource preemption protocol that combines inquiry and response, in which the resource scheduling system sends a preemption request to the task occupying the resources, and the task actively responds to the preemption request and returns part of the resources to realize resource preemption.

[0055] Specifically, after determining the target server from multiple servers in the system according to the resource parameters of each server, the resource scheduling system also detects the waiting time of the task to be assigned, wherein the waiting time of the task to be assigned is the time from the moment the task to be assigned is received to the current moment; if the waiting time of the task to be assigned exceeds the preset time, a preemption request is initiated to the target task in the target server; if a response information of the target task in response to the preemption request is received, the resources released by the target task are allocated to the task to be assigned.

[0056] In the above process, the target task is the task with the lowest priority running on the target server. In the process of allocating the resources released by the target task to the task to be allocated, the resource scheduling system detects the remaining resources of the target group to which the task to be allocated belongs, wherein each group has a preset resource upper limit; if the remaining resources of the target group are less than the remaining required resources, the resources allocated to the task to be allocated are recalled, wherein the remaining required resources are the resources required by the task to be allocated in addition to the resources allocated to the task to be allocated.

[0057] It should be noted that the resource scheduling system adopts an interactive preemption method. When the waiting time of the task to be assigned exceeds the preset time, a low-priority target task is selected from the target server with the highest resource parameters to issue an interactive preemption request, so that the running low-priority task will actively give up resources to be allocated to the task to be assigned, so as to achieve the result of accelerated allocation.

[0058] Specifically, after receiving a resource request, the resource scheduling system allocates resources according to the resource reservation plan, and in the process of allocating resources, selects the server with the highest resource parameters as the server for the task to be assigned. When the task to be assigned is waiting for the server, if it is detected that the available remaining resources in the target group cannot meet the needs of the task to be assigned, the resource scheduling system will actively recall some of the task resources that have been allocated, thereby avoiding resource deadlock caused by the dynamic adjustment of the target group.

[0059] In an optional embodiment, Figure 4 A schematic diagram of an optional resource scheduling system is shown. Figure 4 The default scheduler is the default scheduler in the system. The default scheduler can be used for resource allocation and can also store task information, resource occupancy information, and the remaining time required for tasks to release resources. Figure 4It can be seen that the scheduler includes a quota group management module Quota Manager, an available resource management module free res, an occupied resource management module Running Queue, a resource parameter processing module Virtual Mach, a task list management module Waiting QueueManager and a device management module Machine Manager. Among them, the quota group management module Quota Manager is used to manage the information of the target group to which the tasks to be assigned belong, and the target group is the quota group; the available resource management module free res is used to manage the available resources in the system; the occupied resource management module Running Queue is used to manage the occupied resources corresponding to the tasks running on the server in the system; the resource parameter processing module Virtual Mach is used to determine the resource parameters of the server according to the remaining time required for the task to release resources and in combination with the list of available machines; the task list management module Waiting Queue Manager is used to manage the list of tasks waiting for resources. In addition, in Figure 4 In the AON scheduler, the AON scheduler is a dedicated scheduler for processing large volume resources.

[0060] Specifically, the interaction process between the AON scheduler and the default scheduler is as follows: First, the AON scheduler sends a resource request to the default scheduler (such as Figure 4 At the same time, the AON scheduler, as an observer, obtains the remaining resources, resource usage, and resource parameters of each available server from the default scheduler. Figure 4 Finally, the AON scheduler makes a decision based on the resource parameters of each available server, so that the task to be assigned waits on the target server, that is, the server with the highest resource parameters is determined as the target server (e.g. Figure 4 in S44).

[0061] From the above content, it can be seen that the solution provided by the present application performs overall scheduling by combining the resources required by the tasks to be assigned with the target group as the granularity, thereby avoiding the waste of resources and deadlock caused by the overuse of resources required by each independent task. In addition, the target server with a high resource turnover rate (i.e., large resource parameters) is selected through the resource parameters of the server, and the tasks to be assigned are preferentially allowed to wait for resources on the target server, thereby shortening the waiting time for the tasks to obtain resources and improving the utilization rate of system resources.

[0062] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0063] Through the description of the above implementation methods, those skilled in the art can clearly understand that the resource processing method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0064] Example 2

[0065] According to an embodiment of the present application, a resource processing device for implementing the above resource processing method is also provided, such as Figure 5 As shown, the device 50 includes: an acquisition module 501 , a first determination module 503 and a second determination module 505 .

[0066] Among them, the acquisition module 501 is used to obtain the occupied resources corresponding to the tasks running on the server in the system, and the remaining time required for the tasks to release the resources; the first determination module 503 is used to determine the resource parameters of the server based on the occupied resources and the remaining time, wherein the resource parameters are used to represent the load capacity of the server; the second determination module 505 is used to determine the target server from multiple servers in the system based on the resource parameters of each server.

[0067] It should be noted that the acquisition module 501, the first determination module 503 and the second determination module 505 correspond to steps S202 to S206 in Example 1, and the three modules and the corresponding steps implement the same examples and application scenarios, but are not limited to the contents disclosed in the above-mentioned Example 1. It should be noted that the above-mentioned modules, as part of the device, can be run in the computer terminal 10 provided in Example 1.

[0068] In an optional embodiment, the resource processing device further includes: a first acquisition module, a third determination module, a judgment module, and a fourth determination module. The first acquisition module is used to obtain the resource request of the task to be assigned before obtaining the occupied resources corresponding to the task running on the server in the system, wherein the resource request includes the resources required for the task to be assigned; the third determination module is used to determine the target group to which the task to be assigned belongs, wherein each group has a preset resource upper limit; the judgment module is used to determine whether the remaining resources of the target group are greater than the resources required for the task to be assigned; the fourth determination module is used to determine whether the remaining resources of the target group are greater than the resources required for the task to be assigned, and enter the step of obtaining the occupied resources corresponding to the task running on the server in the system, and the remaining time required for the task to release the resources.

[0069] In an optional embodiment, the first determination module includes: a fifth determination module, a sixth determination module and a seventh determination module. The fifth determination module is used to determine the weight value of the task according to the remaining time, wherein the remaining time and the weight value are in inverse proportion; the sixth determination module is used to determine the product of the occupied resources of the task and the weight value of the task as the resource parameter of the task; and the seventh determination module is used to determine the sum of the resource parameters corresponding to all tasks running on the server as the resource parameter of the server.

[0070] In an optional embodiment, the fifth determination module includes: an eighth determination module, a second acquisition module and a ninth determination module. The eighth determination module is used to determine the time period to which the current moment belongs, wherein the correspondence between the remaining time and the weight value is different in different time periods; the second acquisition module is used to obtain the correspondence between the remaining time and the weight value according to the time period to which the current moment belongs; and the ninth determination module is used to determine the weight value of the task according to the remaining time and the correspondence.

[0071] Optionally, the occupied resources include: occupied CPU value.

[0072] In an optional embodiment, the occupied resources include: an occupied CPU value and an occupied memory value, wherein the sixth determination module includes: a third acquisition module, a fourth acquisition module, and a tenth determination module. The third acquisition module is used to obtain the first product of the occupied CPU value of the task and the weight value of the task; the fourth acquisition module is used to obtain the second product of the occupied memory value of the task and the weight value of the task; and the tenth determination module is used to determine that the sum of the first product and the second product is the resource parameter of the task.

[0073] In an optional embodiment, the second determination module includes: an eleventh determination module. The eleventh determination module is used to determine that the server with the highest resource parameter is the target server.

[0074] In an optional embodiment, the resource processing device further includes: a first detection module, a first processing module and an allocation module. The first detection module is used to detect the waiting time of the task to be assigned after determining the target server from multiple servers in the system according to the resource parameters of each server, wherein the waiting time of the task to be assigned is the time from the moment when the task to be assigned is received to the current moment; the first processing module is used to initiate a preemption request to the target task in the target server if the waiting time of the task to be assigned exceeds the preset time; the allocation module is used to allocate the resources released by the target task to the task to be assigned if the response information of the target task in response to the preemption request is received.

[0075] Optionally, the target task is the task with the lowest priority running on the target server.

[0076] In an optional embodiment, the resource processing device further includes: a second detection module and a second processing module. The second detection module is used to detect the remaining resources of the target group to which the task to be assigned belongs in the process of allocating the resources released by the target task to the task to be assigned, wherein each group has a preset resource upper limit; the second processing module is used to recall the resources allocated to the task to be assigned if the remaining resources of the target group are less than the remaining required resources, wherein the remaining required resources are the resources required by the task to be assigned in addition to the resources allocated to the task to be assigned.

[0077] Example 3

[0078] According to an embodiment of the present application, a resource scheduling system for implementing the above-mentioned resource processing method is also provided, and the system includes: a processor and a memory.

[0079] Among them, the memory is connected to the processor and is used to provide the processor with instructions for processing the following processing steps: obtaining the occupied resources corresponding to the tasks running on the server in the system, and the remaining time required for the tasks to release the resources; determining the resource parameters of the server based on the occupied resources and the remaining time, wherein the resource parameters are used to represent the load capacity of the server; and determining the target server from multiple servers in the system based on the resource parameters of each server.

[0080] From the above, it can be seen that the method of determining the server to execute the task based on the server's load capacity is adopted. After obtaining the occupied resources corresponding to the tasks running on the server in the system and the time required for the tasks to release the resources, the resource parameters that characterize the server's load capacity are determined based on the occupied resources and the remaining time. Finally, the target server to execute the task to be assigned is determined based on the resource parameters of each server.

[0081] It is easy to notice that the present application takes into account the resources occupied by the tasks running on the server and the time required for the tasks to release the resources in the process of determining the load capacity of the server. Therefore, the present application can balance the resources in the system, so that the tasks to be assigned have priority in waiting for resources on the target server, thereby shortening the waiting time for the tasks to be assigned to obtain resources.

[0082] It can be seen that the solution provided in the present application achieves the purpose of balanced scheduling of resources in the system, thereby achieving the technical effect of improving the resource utilization of the system, and further solving the technical problem of low resource utilization of the system caused by unbalanced resource scheduling in the prior art.

[0083] It should be noted that the resource scheduling system provided in this embodiment can execute the resource processing method in Embodiment 1, and the relevant content has been described in Embodiment 1 and will not be repeated here.

[0084] Example 4

[0085] The embodiment of the present application may provide a computer terminal, which may be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal may also be replaced by a terminal device such as a mobile terminal.

[0086] Optionally, in this embodiment, the computer terminal may be located in at least one network device among a plurality of network devices of the computer network.

[0087] In this embodiment, the above-mentioned computer terminal can execute the program code of the following steps in the resource processing method: obtaining the occupied resources corresponding to the tasks running on the server in the system, and the remaining time required for the tasks to release the resources; determining the resource parameters of the server based on the occupied resources and the remaining time, wherein the resource parameters are used to represent the load capacity of the server; determining the target server from multiple servers in the system based on the resource parameters of each server.

[0088] Optionally, Figure 6 is a structural block diagram of a computer terminal according to an embodiment of the present application. Figure 6 As shown, the computer terminal 10 may include: one or more (only one is shown in the figure) processors 602 , a memory 604 , and a peripheral interface 606 .

[0089] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the resource processing method and device in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned resource processing method. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories can be connected to the terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0090] The processor can call the information and application programs stored in the memory through the transmission device to perform the following steps: obtain the occupied resources corresponding to the tasks running on the server in the system, and the remaining time required for the tasks to release the resources; determine the resource parameters of the server based on the occupied resources and the remaining time, wherein the resource parameters are used to represent the load capacity of the server; determine the target server from multiple servers in the system based on the resource parameters of each server, wherein the target server is the server waiting for the task to be assigned, and the occupied resources include: the occupied CPU value.

[0091] Optionally, the processor may also execute program code for the following steps: obtaining a resource request for the task to be assigned before obtaining the occupied resources corresponding to the task running on the server in the system, wherein the resource request includes the resources required for the task to be assigned; determining the target group to which the task to be assigned belongs, wherein each group has a preset resource upper limit; judging whether the remaining resources of the target group are greater than the resources required for the task to be assigned; determining that the remaining resources of the target group are greater than the resources required for the task to be assigned, and entering the step of obtaining the occupied resources corresponding to the task running on the server in the system, and the remaining time required for the task to release the resources.

[0092] Optionally, the processor may also execute the program code of the following steps: determining the weight value of the task based on the remaining time, wherein the remaining time is inversely proportional to the weight value; determining the product of the occupied resources of the task and the weight value of the task as the resource parameter of the task; determining the sum of the resource parameters corresponding to all tasks running on the server as the resource parameter of the server.

[0093] Optionally, the processor may also execute the program code of the following steps: determining the time period to which the current moment belongs, wherein the correspondence between the remaining time and the weight value is different in different time periods; obtaining the correspondence between the remaining time and the weight value according to the time period to which the current moment belongs; and determining the weight value of the task according to the remaining time and the correspondence.

[0094] Optionally, the processor may also execute the program code of the following steps: obtaining a first product of an occupied CPU value of a task and a weight value of the task; obtaining a second product of an occupied memory value of a task and a weight value of the task; and determining the sum of the first product and the second product as a resource parameter of the task, wherein the occupied resources include: an occupied CPU value and an occupied memory value.

[0095] Optionally, the processor may also execute program code of the following steps: determining a server with the highest resource parameter as a target server.

[0096] Optionally, the processor may also execute the program code of the following steps: after determining the target server from multiple servers in the system according to the resource parameters of each server, detecting the waiting time of the task to be assigned, wherein the waiting time of the task to be assigned is the time from the moment when the task to be assigned is received to the current moment; if the waiting time of the task to be assigned exceeds the preset time, initiating a preemption request to the target task in the target server; if a response message of the target task in response to the preemption request is received, allocating the resources released by the target task to the task to be assigned, wherein the target task is the task with the lowest priority running on the target server.

[0097] Optionally, the processor may also execute program code for the following steps: in the process of allocating the resources released by the target task to the task to be assigned, detecting the remaining resources of the target group to which the task to be assigned belongs, wherein each group has a preset resource upper limit; if the remaining resources of the target group are less than the remaining required resources, recalling the resources that have been allocated to the task to be assigned, wherein the remaining required resources are the resources required by the task to be assigned in addition to the resources that have been allocated to the task to be assigned.

[0098] It can be understood by those skilled in the art that Figure 6 The structure shown is for illustration only, and the computer terminal may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a handheld computer, a mobile Internet device (Mobile Internet Devices, MID), a PAD, or other terminal devices. Figure 6 The structure of the electronic device is not limited. For example, the computer terminal 10 may also include Figure 6 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 6 Different configurations shown.

[0099] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0100] Example 5

[0101] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the resource processing method provided in the first embodiment.

[0102] Optionally, in this embodiment, the above storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.

[0103] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: obtaining occupied resources corresponding to tasks running on the server in the system, and the remaining time required for the task to release the resources; determining resource parameters of the server based on the occupied resources and the remaining time, wherein the resource parameters are used to represent the load capacity of the server; and determining a target server from multiple servers in the system based on the resource parameters of each server.

[0104] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: before obtaining the occupied resources corresponding to the task running on the server in the system, obtaining a resource request for the task to be assigned, wherein the resource request includes the resources required for the task to be assigned; determining the target group to which the task to be assigned belongs, wherein each group has a preset resource upper limit; judging whether the remaining resources of the target group are greater than the resources required for the task to be assigned; determining that the remaining resources of the target group are greater than the resources required for the task to be assigned, and entering the step of obtaining the occupied resources corresponding to the task running on the server in the system, and the remaining time required for the task to release the resources.

[0105] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps: determining a weight value of a task based on the remaining time, wherein the remaining time is inversely proportional to the weight value; determining the product of the occupied resources of the task and the weight value of the task as the resource parameter of the task; determining the sum of the resource parameters corresponding to all tasks running on the server as the resource parameter of the server.

[0106] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: determining the time period to which the current moment belongs, wherein the correspondence between the remaining time and the weight value is different in different time periods; obtaining the correspondence between the remaining time and the weight value based on the time period to which the current moment belongs; and determining the weight value of the task based on the remaining time and the correspondence.

[0107] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: obtaining a first product of an occupied CPU value of a task and a weight value of the task; obtaining a second product of an occupied memory value of the task and a weight value of the task; determining the sum of the first product and the second product as a resource parameter of the task, wherein the occupied resources include: an occupied CPU value and an occupied memory value.

[0108] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps: determining a server with the highest resource parameter as a target server.

[0109] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: after determining the target server from multiple servers in the system based on the resource parameters of each server, detecting the waiting time of the task to be assigned, wherein the waiting time of the task to be assigned is the time from the moment the task to be assigned is received to the current moment; if the waiting time of the task to be assigned exceeds the preset time, initiating a preemption request to the target task in the target server; if a response message of the target task in response to the preemption request is received, allocating the resources released by the target task to the task to be assigned, wherein the target task is the task with the lowest priority running on the target server.

[0110] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: in the process of allocating the resources released by the target task to the task to be assigned, detecting the remaining resources of the target group to which the task to be assigned belongs, wherein each group has a preset resource upper limit; if the remaining resources of the target group are less than the remaining required resources, recalling the resources allocated to the task to be assigned, wherein the remaining required resources are the resources required by the task to be assigned in addition to the resources allocated to the task to be assigned.

[0111] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0112] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0113] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, 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 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 through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0114] 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.

[0115] 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 software functional units.

[0116] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0117] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for processing resources, characterized in that: include: Obtaining the occupied resources corresponding to the task running on the server in the system, and the remaining time required for the task to release the resources, wherein the remaining time is used to represent the duration of the total duration required to execute the task, excluding the duration of the task already running, and the total duration is determined by the task type of the task; Determining a resource parameter of the server according to the occupied resources and the remaining time, wherein the resource parameter is used to represent the load capacity of the server; Determining a target server from among the plurality of servers of the system according to resource parameters of each of the servers; Among them, determining the resource parameters of the server according to the occupied resources and the remaining time includes: determining the weight value of the task according to the remaining time, wherein the remaining time and the weight value are inversely proportional; determining the product of the occupied resources of the task and the weight value of the task as the resource parameter of the task; determining the sum of the resource parameters corresponding to all tasks running on the server as the resource parameter of the server.

2. The method according to claim 1, characterized in that Before obtaining the occupied resources corresponding to the tasks running on the server in the system, the method further includes: Obtaining a resource request for a task to be assigned, wherein the resource request includes resources required by the task to be assigned; Determine the target group to which the task to be assigned belongs, wherein each group has a preset resource upper limit; Determine whether the remaining resources of the target group are greater than the resources required by the task to be assigned; Determine that the remaining resources of the target group are greater than the resources required by the task to be assigned, and enter the step of obtaining the occupied resources corresponding to the task running on the server in the system and the remaining time required for the task to release the resources.

3. The method according to claim 1, characterized in that Determining a weight value of the task according to the remaining time includes: Determine the time period to which the current moment belongs, wherein the corresponding relationship between the remaining time and the weight value is different in different time periods; According to the time period to which the current moment belongs, obtaining a corresponding relationship between the remaining time and the weight value; A weight value of the task is determined according to the remaining time and the corresponding relationship.

4. The method according to claim 1, characterized in that: The occupied resources include: the occupied CPU value.

5. The method according to claim 1, characterized in that The occupied resources include: an occupied CPU value and an occupied memory value, wherein determining the product of the occupied resources of the task and the weight value of the task as the resource parameter of the task includes: Obtaining a first product of an occupied CPU value of the task and a weight value of the task; Obtaining a second product of the occupied memory value of the task and the weight value of the task; The sum of the first product and the second product is determined as a resource parameter of the task.

6. The method according to claim 1, characterized in that Determining a target server from a plurality of servers in the system according to resource parameters of each server includes: The server with the highest resource parameter is determined as the target server.

7. The method according to claim 1, characterized in that After determining the target server from the plurality of servers of the system according to the resource parameters of each of the servers, the method further comprises: Detecting the waiting time of the task to be assigned, wherein the waiting time of the task to be assigned is the time from the moment when the task to be assigned is received to the current moment; If the waiting time of the task to be assigned exceeds the preset time, a preemption request is initiated to the target task in the target server; If response information of the target task in response to the preemption request is received, the resources released by the target task are allocated to the task to be allocated.

8. The method according to claim 7, characterized in that The target task is the task with the lowest priority running on the target server.

9. The method according to claim 7, characterized in that: In the process of allocating the resources released by the target task to the task to be allocated, the method further includes: Detecting the remaining resources of the target group to which the task to be assigned belongs, wherein each group has a preset resource upper limit; If the remaining resources of the target group are less than the remaining required resources, the resources allocated to the task to be allocated are recalled, wherein the remaining required resources are the resources required by the task to be allocated in addition to the resources allocated to the task to be allocated.

10. A resource processing device, characterized in that: include: An acquisition module, used for acquiring occupied resources corresponding to a task running on a server in the system, and a remaining time required for the task to release the resources, wherein the remaining time is used to represent the duration of the total duration required to execute the task, excluding the duration of the task already running, and the total duration is determined by the task type of the task; A first determination module, configured to determine a resource parameter of the server according to the occupied resources and the remaining time, wherein the resource parameter is used to represent the load capacity of the server; A second determination module, configured to determine a target server from the plurality of servers in the system according to resource parameters of each server; Among them, the first determination module is also used to determine the weight value of the task according to the remaining time, wherein the remaining time is inversely proportional to the weight value; determine the product of the occupied resources of the task and the weight value of the task as the resource parameter of the task; determine the sum of the resource parameters corresponding to all tasks running on the server as the resource parameter of the server.

11. A storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the resource processing method according to any one of claims 1 to 9.

12. A processor, characterized in that: The processor is used to run a program, wherein the program executes the resource processing method described in any one of claims 1 to 9 when running.

13. A resource scheduling system, comprising: processor; as well as A memory, connected to the processor, configured to provide the processor with instructions for processing the following processing steps: Obtaining the occupied resources corresponding to the task running on the server in the system, and the remaining time required for the task to release the resources, wherein the remaining time is used to represent the duration of the total duration required to execute the task, excluding the duration of the task already running, and the total duration is determined by the task type of the task; Determining a resource parameter of the server according to the occupied resources and the remaining time, wherein the resource parameter is used to represent the load capacity of the server; Determining a target server from a plurality of servers in the system according to resource parameters of each server; Among them, determining the resource parameters of the server according to the occupied resources and the remaining time includes: determining the weight value of the task according to the remaining time, wherein the remaining time and the weight value are inversely proportional; determining the product of the occupied resources of the task and the weight value of the task as the resource parameters of the task; determining the sum of the resource parameters corresponding to all tasks running on the server as the resource parameters of the server.

Citation Information

Patent Citations

  • Method and device for scheduling central processing unit (CPU) resource

    CN101984414A

  • Container distribution method and device, server and medium

    CN108170517A