A task processing method, apparatus and electronic device
By receiving task requests and obtaining server resource information, determining the server, time and resources for processing tasks, the problem of low server resource allocation efficiency is solved and task processing efficiency is improved.
Patent Information
- Application Number
- CN202111065840.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-10
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2041-09-10
AI Technical Summary
How to efficiently allocate server resources to handle service requests of electronic devices and improve task processing efficiency.
By receiving task processing requests, resource information of each server is obtained, and servers, time and resources for processing tasks are determined based on resource information and task information.
It realizes the rapid and efficient allocation of server resources, and improves the efficiency of task processing.
Smart Images

Figure CN113946414B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technologies, and in particular, to a task processing method, apparatus, and electronic device in the field of service technologies. Background Art
[0002] With the wide application of computer technologies, an electronic device will generate more and more service requests, and each service request corresponds to a task; for each task, how to allocate a server, time, and resources for processing the task to improve the task processing efficiency is an objective that has been pursued. Summary of the Invention
[0003] The present disclosure provides a task processing method, apparatus, and electronic device.
[0004] According to a first aspect of the present disclosure, there is provided a task processing method, including:
[0005] Receiving a task processing request, where the task processing request includes task information of a first task;
[0006] In response to the task processing request, obtaining resource information of each server;
[0007] Based on the resource information of each server and the task information of the first task, determining a first server for processing the first task;
[0008] Based on the resource information of the first server and the task information of the first task, determining the time and resources for the first server to process the first task.
[0009] According to a second aspect of the present disclosure, there is provided a task processing apparatus, including:
[0010] A receiving module, configured to receive a task processing request, where the task processing request includes task information of a first task;
[0011] An obtaining module, configured to obtain resource information of each server in response to the task processing request;
[0012] A first determining module, configured to determine a first server for processing the first task based on the resource information of each server and the task information of the first task;
[0013] A second determining module, configured to determine the time and resources for the first server to process the first task based on the resource information of the first server and the task information of the first task.
[0014] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0015] At least one processor; and a memory communicatively connected to the at least one processor;
[0016] Wherein,
[0017] the memory stores instructions executable 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 execute the above-mentioned task processing method.
[0018] According to a fourth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the above-mentioned task processing method.
[0019] According to a fifth aspect of the present disclosure, there is provided a computer program product, including a computer program / instructions, and the computer program / instructions implement the above-mentioned task processing method when executed by a processor.
[0020] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. Brief Description of the Drawings
[0021] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:
[0022] Figure 1 is an optional processing flow diagram of the task processing method provided by the present disclosure;
[0023] Figure 2 is a schematic diagram of the resource information of the server provided by the present disclosure;
[0024] Figure 3 is a specific processing process diagram of determining the first server for processing the first task provided by an embodiment of the present disclosure;
[0025] Figure 4 is a processing process diagram of determining the time and resources for the first server to process the first task provided by an embodiment of the present disclosure;
[0026] Figure 5a is an optional schematic diagram of the tasks to be processed by the server provided by an embodiment of the present disclosure;
[0027] Figure 5b is an optional schematic diagram of the tasks to be processed by the server provided by an embodiment of the present disclosure;
[0028] Figure 6 is a schematic diagram of the status information of the resources of the server provided by an embodiment of the present disclosure;
[0029] Figure 7 It is a schematic diagram of an optional component structure of a task processing device provided by an embodiment of the present disclosure;
[0030] Figure 8 It is a block diagram of an electronic device for implementing the method of task processing in an embodiment of the present disclosure. Detailed implementation manners
[0031] The following describes exemplary embodiments of the present disclosure with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, descriptions of well-known functions and structures are omitted below for clarity and conciseness.
[0032] In the following description, "some embodiments" are involved, which describe a subset of all possible embodiments. However, it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and they can be combined with each other without conflict.
[0033] In the following description, the terms "first / second / third" involved are only used to distinguish similar objects and do not represent a specific order for the objects. It can be understood that "first / second / third" can be interchanged with a specific order or sequence when allowed, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein.
[0034] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present disclosure belongs. The terms used herein are only for the purpose of describing the embodiments of the present disclosure and are not intended to limit the present disclosure.
[0035] Figure 1 It is a schematic diagram of an optional processing flow of the task processing method provided by the present disclosure. The task processing method may at least include the following steps:
[0036] Step S201, receiving a task processing request, where the task processing request includes task information of a first task.
[0037] In some embodiments, the task processing request includes task information of a first task; the task information of the first task may include: the duration required to process the first task, the size of the resources required to process the first task, and the task end time of the first task. Among them, the task end time of the first task may refer to the latest end time for processing the first task.
[0038] In some embodiments, the task processing request is used to request the processing of a first task.
[0039] Step S202, in response to the task processing request, obtain the resource information of each server.
[0040] In some embodiments, the resource information of the server may include the size of the target remaining resources of the server; wherein, the target remaining resources are unoccupied and allocable resources. By obtaining the resource information of each server, the server capable of processing the first task can be determined. Herein, the resource may refer to the memory of the server. Correspondingly, the target remaining resources may refer to the unoccupied memory.
[0041] In some embodiments, the specific implementation process of obtaining the resource information of each server may be: for each server, perform the following operations: determine the size of the candidate remaining resources of the server based on the difference between the size of the total available resources of the server and the size of the resources required by all pending tasks; determine the size of the target remaining resources of the server based on the sum of the size of the candidate remaining resources and the size of the resources released by the processed tasks; wherein, the resource information includes the size of the target remaining resources. Herein, the total available resources of the server refer to the available resources when the server has not processed any tasks, and can also be referred to as the initial resources allocated to the server. The target remaining resources of the server refer to the resources available for task processing after the server processes the currently being processed task and the pending tasks allocated to the server.
[0042] As an example, for the first server, if the size of the total available resources of the first server is M and the size of the resources required by the pending tasks of the first server is N; wherein, the pending tasks of the first server may refer to the tasks that have been allocated to the first server for processing, and thus, the resources required by the pending tasks of the first server may refer to the resources that have been reserved and allocated to the pending tasks; subtract the size of the resources required by the pending tasks of the first server, which is N, from the size of the total available resources of the first server, which is M, to obtain the size of the candidate remaining resources of the first server. Since the first server finishes processing a task, the resources occupied by processing the task will be released. Therefore, adding the size of the candidate remaining resources to the size of the resources released by the processed tasks gives the size of the target remaining resources of the server.
[0043] In some embodiments, the schematic diagram of the resource information of the server may be as Figure 2 shown, Figure 2 where the abscissa represents the remaining processing time required for the server to process a task, and the ordinate represents the size of the resources required for the server to process a task. Figure 2 The blank part in is the target remaining resources. In the embodiments of the present application, through Figure 2The model diagram shown represents the resource information of the server, which can clearly present the resource usage and remaining resources of the server.
[0044] If the total available resource size of the first server is M, R1 to R a are tasks being processed or to be processed, and the resource size required for each task is m i , and the remaining time required to process each task is t i , where i ∈ [1, a]. If a new task R a+1 is assigned to the first server, and the resource size required to process task R a+1 is m a+1 , and the end time T a+1 of processing task R is a+1 , and the time required to process task R a+1 is t a+1 (t a+1 <= T a+1 ), then the minimum waiting time t w1 of the message; then the target remaining resources of the server in a certain time interval [t n , t n+1 ) can be represented by M, the resources required for the tasks to be processed, and the resources occupied by the tasks currently being processed, as shown in the following formula:
[0045]
[0046] where M is the total available resource size of the first server, m' n represents the target remaining resources, a is the number of tasks to be processed, and n is a time node.
[0047] Step S203, based on the resource information of each server and the task information of the first task, determine the first server for processing the first task.
[0048] In some embodiments, based on the resource information of each server and the task information of the first task, the specific processing process of determining the first server for processing the first task can be as Figure 3 shown, and at least includes the following steps: [[ID=5I]]
[0049] Step S203a, based on the resource information of each server and the task information of the first task, determine the candidate servers that can process the first task.
[0050] In some embodiments, for each server, according to the duration required to process the first task, the end time of the first task, and the resource size required to process the first task included in the task information of the first task, as well as the size of the target remaining resources of the server, determine the candidate servers that can process the first task.
[0051] In specific implementation, the size of the target remaining resources of the candidate servers capable of processing the first task is greater than or equal to the size of the resources required to process the first task, and the termination time for the candidate servers capable of processing the first task to complete the first task is less than or equal to the task end time of the first task. Therefore, it is possible to first determine the termination time for each server to complete the first task, and determine the servers corresponding to the termination times that are less than the task end time indicated by the task information as candidate servers. If the termination times for all servers to complete the first task are greater than the task end time indicated by the task information, it is determined that there are no candidate servers capable of processing the first task.
[0052] In response to determining that there are no candidate servers capable of processing the first task, the task processing method may further include: sending a task processing request response message to the electronic device corresponding to the first task, where the task processing request response message includes a waiting time timeout; here, the waiting time timeout means that the termination time for the processing server to complete the first task is greater than the task end time of the first task. The task processing request response message may further include the time for resending the processing request. As an example, the time for resending the processing request may be the shortest waiting time among the waiting times of all servers for processing the first task, or the average value of the waiting times of all servers for processing the first task, or the longest waiting time among the waiting times of all servers for processing the first task. In this way, it is possible to avoid unnecessary task processing waiting for the electronic device corresponding to the first task when all servers are unable to process the first task.
[0053] In some embodiments, the termination time for completing the first task can be obtained by adding the start time when the server starts to process the first task and the duration required to process the first task. The start time when the server starts to process the first task can be determined based on the remaining duration required for the task that the server is currently processing and the total duration of the pending tasks whose processing times are before the first task; for example, the time obtained by adding the current time, the remaining duration required for the task that the server is currently processing, and the total duration of the pending tasks whose processing times are before the first task is the start time when the server starts to process the first task.
[0054] Step S203b, determine the waiting time for each candidate server to process the first task.
[0055] In some embodiments, the waiting time for each candidate server to process the first task is determined based on the remaining duration required for the task that each candidate server is currently processing and the total duration of the pending tasks whose processing times are before the first task.
[0056] In specific implementation, the remaining duration required for the tasks currently being processed by each candidate server is added to the total duration of the pending tasks before the first task to obtain the waiting time for each candidate server to process the first task.
[0057] Step S203c: Determine the candidate server corresponding to the minimum waiting time among the waiting times as the first server.
[0058] In some embodiments, if there are multiple candidate servers, select the server with the minimum waiting time for processing the first task as the first server, and the first server is used to process the first task. In this way, the first task can be processed at the fastest speed, improving the processing efficiency of the first task.
[0059] Step S204: Based on the resource information of the first server and the task information of the first task, determine the time and resources for the first server to process the first task.
[0060] In some embodiments, if there are no pending tasks and tasks currently being processed on the first server, determine the start time for the first server to process the first task as the current time, and the resources for the first server to process the first task as the currently available resources of the first server.
[0061] In some other embodiments, if there are pending tasks on the first server, the process of determining the time and resources for the first server to process the first task based on the resource information of the first server and the task information of the first task may be as Figure 4 shown, and at least includes:
[0062] Step S204a: Sort the pending tasks according to the task end times of each pending task to generate a pending task sequence.
[0063] In specific implementation, the first pending task in the pending task sequence is the task with the earliest end time in the pending task sequence; the first pending task in the pending task sequence is the task with the latest end time in the pending task sequence.
[0064] Step S204b: According to the size of the resources required to process the first task in the task information, determine that there are resources available on the first server for processing the first task within the first time interval.
[0065] In some embodiments, if the first server has idle resources within the first time interval and the size of the idle resources is greater than or equal to the size of the resources required to process the first task in the task information, it can be determined that there are resources available on the server for processing the first task within the first time interval.
[0066] Step S204c, adjust the order of the first task and the second task in the to-be-processed task sequence so that the processing time of the first task is within the first time interval.
[0067] In some embodiments, a greedy algorithm can be used to adjust the order of the first task and the second task in the to-be-processed task sequence; the corresponding strategy of the greedy algorithm can include maximizing the resource utilization rate of the server, shortening the waiting time for processing the first task, the sum of the waiting times of the first task and the second task after adjusting the order is less than the sum of the waiting times of the first task and the second task before adjusting the order, and after adjusting the order of the second task in the to-be-processed task sequence, the termination time for completing the second task is less than or equal to the task end time of the second task.
[0068] In some embodiments, the sorting of all to-be-processed tasks in the to-be-processed task sequence can be adjusted to select the to-be-processed task sequence with the shortest average waiting time. However, when there are many to-be-processed tasks, the computational amount is large and the required time is long.
[0069] In other embodiments, the order of the last X tasks in the to-be-processed task sequence can be adjusted, that is, the first task and the second task can be two of the last X tasks in the to-be-processed task sequence; where X is a positive integer, and the value of X can be flexibly set according to the actual application scenario. Thus, by adjusting the order of the last X tasks in the to-be-processed task sequence, the sum of the waiting times of the first task and the second task after adjusting the order is less than the sum of the waiting times of the first task and the second task before adjusting the order, so that the resources of the server can be effectively utilized. Adjusting the order of the last X tasks in the to-be-processed task sequence can reduce the computational amount compared with adjusting the order of all tasks in the to-be-processed task sequence.
[0070] An optional schematic diagram of the to-be-processed tasks of the server is as Figure 5a shown. The abscissa represents the remaining time required for the server to process a task, and the ordinate represents the size of the resources required for the server to process a task. By sorting the to-be-processed tasks in the to-be-processed task sequence through the task processing method provided by the embodiments of the present application, another optional schematic diagram of the to-be-processed tasks of the server as Figure 5b shown is obtained; by comparing Figure 5a and Figure 5b it can be determined that Figure 5b the resources of the server in are fully utilized in an orderly manner, so that the resources of the server are maximally occupied. Figure 5b the resource utilization rate of the server in is higher than Figure 5a the resource utilization rate of the server in.
[0071] In some embodiments, after reordering the sequence of tasks to be processed, the status information of the resources of the server is re-determined; wherein, the status information of the resources of the server may refer to the configuration status of the resources of the server, such as the resources configured for the tasks to be processed and the tasks being processed. For Figure 5b the schematic diagram of the tasks to be processed of the server shown, the status information of the resources of the server may be as Figure 6 shown. If a new task processing request is received, then based on Figure 6 the status information of the resources of the server shown, calculate the waiting time for processing the task corresponding to the new task processing request, that is, step S201 above.
[0072] The embodiments of the present disclosure further provide a task processing device. A schematic diagram of an optional composition structure of the task processing device is as Figure 7 shown, including:
[0073] A receiving module 701, configured to receive a task processing request, where the task processing request includes task information of a first task;
[0074] An obtaining module 702, configured to obtain the resource information of each server in response to the task processing request;
[0075] A first determining module 703, configured to determine a first server for processing the first task based on the resource information of each server and the task information of the first task;
[0076] A second determining module 704, configured to determine the time and resources for the first server to process the first task based on the resource information of the first server and the task information of the first task.
[0077] In some embodiments, the obtaining module 702 is configured to perform the following operations for each server:
[0078] Based on the difference between the total available resources of the server and the resources required by all tasks to be processed, determine the size of the candidate remaining resources of the server;
[0079] Based on the sum of the size of the candidate remaining resources and the resources released by the processed tasks, determine the size of the target remaining resources of the server; wherein, the resource information includes the size of the target remaining resources.
[0080] In some embodiments, the first determining module 703 is configured to determine candidate servers capable of processing the first task based on the resource information of each server and the task information of the first task;
[0081] Determine the waiting time for each candidate server to process the first task;
[0082] Determine the candidate server corresponding to the minimum waiting time among the waiting times as the first server.
[0083] In some embodiments, the first determination module 703 is configured to determine the termination time when each of the servers can complete the first task;
[0084] Determine the servers corresponding to the termination times that are less than the task end time indicated by the task information as candidate servers.
[0085] In some embodiments, the first determination module 703 is configured to determine the termination time when each of the servers can complete the first task;
[0086] In response to determining that all the termination times are greater than the task end time indicated by the task information, determine that there is no candidate server capable of processing the first task.
[0087] In some embodiments, the first determination module 703 is further configured to send a task processing request response message to the electronic device corresponding to the first task, and the task processing request response message includes the waiting time for processing the first task.
[0088] In some embodiments, the second determination module 704 is configured to, in response to the first server currently having pending tasks, sort the pending tasks according to the task end time of each of the pending tasks to generate a pending task sequence; the pending task sequence includes the first task;
[0089] Determine that the first server has resources available for processing the first task within a first time interval according to the size of the resources required to process the first task in the task information;
[0090] Adjust the order of the first task and the second task in the pending task sequence so that the processing time of the first task is within the first time interval; the sum of the waiting times of the first task and the second task after the order adjustment is less than the sum of the waiting times of the first task and the second task before the order adjustment.
[0091] According to an embodiment of the present disclosure, the present disclosure further provides an electronic device, a readable storage medium, and a computer program product.
[0092] Figure 8FIG. 0 shows a schematic block diagram of an exemplary electronic device 800 that can be used to implement embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, personal digital processors, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely exemplary and are not intended to limit the implementations of the present disclosure described and / or claimed herein.
[0093] As Figure 8 shown, the electronic device 800 includes a computing unit 801 that can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0094] Multiple components in the electronic device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a magnetic disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0095] The computing unit 801 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 executes the various methods and processes described above, such as the task processing method. For example, in some embodiments, the task processing method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the task processing method described above can be executed. Alternatively, in other embodiments, the computing unit 801 can be configured as the task processing method by any other suitable means (e.g., by means of firmware).
[0096] Various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuitry, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special-purpose or general-purpose programmable processor, receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0097] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program codes can be executed entirely on the machine, partially on the machine, as a stand-alone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0098] In the context of this disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0099] In order to provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, speech input, or tactile input).
[0100] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0101] A computer system can include a client and a server. The client and the server are generally far apart from each other and typically interact through a communication network. The relationship between the client and the server is generated by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, can also be a server of a distributed system, or a server incorporating a blockchain.
[0102] It should be understood that the various forms of processes shown above can be used, with steps reordered, added or deleted. For example, the steps described in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and no limitations are imposed herein.
[0103] The above specific embodiments do not constitute a limitation on the protection scope of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub - combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this disclosure shall be included within the protection scope of this disclosure.
Claims
1. A task processing method, comprising: receiving a task processing request, wherein the task processing request includes task information of a first task; In response to the task processing request, obtaining resource information of each server; Determining a first server for processing the first task based on the resource information of each server and the task information of the first task; Determining the time and resources for the first server to process the first task based on the resource information of the first server and the task information of the first task; The determining, based on the resource information of the first server and the task information of the first task, the time and resources for the first server to process the first task includes: In response to the first server currently having tasks to be processed, the tasks to be processed are sorted according to the task end time of each task to be processed to generate a sequence of tasks to be processed; the sequence of tasks to be processed includes the first task; determining, based on the size of the resources required for processing the first task in the task information, that the first server has resources available for processing the first task within a first time interval; Adjust the order of the first task and the second task in the sequence of tasks to be processed so that the processing time of the first task is within the first time interval; the sum of the waiting time of the first task and the second task after the order is adjusted is less than the sum of the waiting time of the first task and the second task before the order is adjusted.
2. The method according to claim 1, wherein The obtaining of resource information of each server includes: For each server, perform the following steps: Determining the size of candidate remaining resources of the server based on the difference between the size of total available resources of the server and the size of resources required by all tasks to be processed; The target remaining resource size of the server is determined based on the sum of the size of the candidate remaining resources and the size of the resources released by the processed tasks; wherein the resource information includes the target remaining resource size.
3. The method according to claim 1, wherein determining the first server for processing the first task based on the resource information of each server and the task information of the first task comprises: Determining a candidate server capable of processing the first task based on the resource information of each server and the task information of the first task; determining a waiting time for each candidate server to process the first task; The candidate server corresponding to the minimum waiting time among the waiting times is determined to be the first server.
4. The method according to claim 3, wherein determining a candidate server capable of processing the first task based on the resource information of each server and the task information of the first task comprises: Determining a termination time at which each of the servers can complete the first task; A server corresponding to a termination time that is less than the task end time indicated by the task information is determined as a candidate server.
5. The method according to claim 3, wherein determining a candidate server capable of processing the first task based on the resource information of each server and the task information of the first task comprises: Determining a termination time at which each of the servers can complete the first task; In response to determining that all of the termination times are greater than the task end time indicated by the task information, it is determined that there is no candidate server capable of processing the first task.
6. The method according to claim 5, after determining that there is no candidate server capable of processing the first task, the method further comprises: A task processing request response message is sent to the electronic device corresponding to the first task, where the task processing request response message includes a waiting time for processing the first task.
7. The method according to any one of claims 1 to 6, wherein determining the time and resources for the first server to process the first task based on the resource information of the first server and the task information of the first task comprises: In response to the first server currently having no pending tasks and tasks being processed, the start time for the first server to process the first task is determined to be the current moment, and the resources for the first server to process the first task are determined to be the resources currently available to the first server.
8. A task processing device comprising: A receiving module, configured to receive a task processing request, wherein the task processing request includes task information of a first task; an acquisition module, configured to acquire resource information of each server in response to the task processing request; A first determining module, configured to determine a first server for processing the first task based on the resource information of the servers and the task information of the first task; a second determining module, configured to determine time and resources for the first server to process the first task based on resource information of the first server and task information of the first task; The second determining module is specifically configured to, in response to the first server currently having pending tasks, sort the pending tasks according to the task end time of each pending task to generate a pending task sequence; the pending task sequence includes the first task; determining, based on the size of the resources required for processing the first task in the task information, that the first server has resources available for processing the first task within a first time interval; Adjust the order of the first task and the second task in the sequence of tasks to be processed so that the processing time of the first task is within the first time interval; the sum of the waiting time of the first task and the second task after the order is adjusted is less than the sum of the waiting time of the first task and the second task before the order is adjusted.
9. An electronic device comprising: 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 7.
10. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 7.
11. A computer program product comprising a computer program / instructions, which implement the method according to any one of claims 1 to 7 when executed by a processor.
Citation Information
Patent Citations
Task scheduling method and device between terminal and server and scheduler
CN111651246A
Resource scheduling method and device, electronic equipment and computer readable storage medium
CN111694646A