Task scheduling method and device, non-volatile storage medium, and electronic device
By receiving task requests in the thread pool and obtaining historical time-consuming data, dynamically classifying and prioritizing tasks, the problem of low task processing efficiency in high concurrency scenarios is solved, and efficient task processing and system performance improvement is achieved.
Patent Information
- Application Number
- CN202210663395.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-13
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2042-06-13
AI Technical Summary
The existing thread pooling technology cannot respond to user requests in a timely manner in a server with instantaneously high concurrency, resulting in low task processing efficiency and difficulty in flexibly adjusting the thread pool size, resulting in long task waiting time and low processing efficiency.
By receiving task requests, obtaining historical time-consuming data required for processing, determining the matching target thread loop from multiple thread loops, and saving tasks into storage units with different priorities according to task type, and executing tasks in priority order. , realize dynamic classification and priority processing of tasks.
In scenarios where task processing volume is randomly distributed and the differences fluctuate greatly, the task processing sequence is reasonably arranged, memory usage is reduced, task blockage is avoided, emergency tasks are given priority, and processing efficiency of computer systems is improved.
Smart Images

Figure CN114936084B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a task scheduling method and device, a non-volatile storage medium, and an electronic device. Background Art
[0002] Currently, most tasks are executed using threads in the thread pool. The thread pool is a form of multi-threaded processing. In the initial stage of creation, the thread pool will create a certain number of threads. Each new request will be assigned an idle thread. When the task is completed, the thread will not be destroyed but will be turned into a waiting state, waiting for new requests and processing again; if all threads are busy, the task will be temporarily stored in the queue and wait. The thread pool technology avoids the frequent creation and destruction of threads, reduces the system resource consumption caused by the frequent creation and destruction of multiple threads, avoids excessive memory consumption due to too many threads, and improves server performance.
[0003] However, there are still some problems in the application of the existing thread pool technology, among which the more prominent problems are: the thread pool technology cannot be well applied in servers with instantaneous high concurrency. In the existing technology, the thread pool has a poor ability to adjust the number of threads according to requests, cannot respond to user requests in time, and may even cause request loss; and generally after the thread pool is configured, it is difficult to flexibly adjust and monitor the size of the thread pool. When a task requires a thread to execute, once there is no idle thread in the thread pool, the task can only wait for the thread that is executing the task in the thread pool to be released, and then use the released thread to execute the task. Under normal circumstances, when the task processing volume corresponding to the task processing request is randomly distributed and the difference fluctuates greatly, the traditional thread pool management method cannot improve the disorder of the task processing request occupying CPU resources, and this disorder will cause some task requests to occupy CPU resources continuously due to excessive processing volume, so that other task requests are always in a waiting state, resulting in a decrease in the rationality of task processing; there are problems such as long waiting time for tasks and low processing efficiency.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present application provide a task scheduling method and device, a non-volatile storage medium, and an electronic device to at least solve the technical problems of long task scheduling waiting time and low processing efficiency caused by the disorder of task processing requests occupying CPU resources.
[0006] According to one aspect of an embodiment of the present application, a task scheduling method is provided, comprising: receiving a task request, and obtaining first historical time-consuming data required for processing a task corresponding to the task request; determining a target thread ring matching the first historical time-consuming data from a plurality of thread rings, wherein each of the plurality of thread rings comprises a plurality of storage units of different types, and the priorities of the different types of storage units are different, and the storage units are used to store a set of tasks to be executed; determining a type of the task request; storing the task request in a plurality of different target storage units corresponding to the types of the task request; and executing the tasks in the target storage units in order of their priorities.
[0007] Optionally, the types of task requests include: a first request type and a second request type, wherein the priority of the first request type is higher than the priority of the second request type; and the processing priorities of task sets corresponding to multiple different types of storage units are different.
[0008] Optionally, the multiple different types of storage cells include: storage cells of a first unit type and storage cells of a second unit type, wherein the priority of the first unit type is higher than the priority of the second unit type, and the number of storage cells of the first unit type among the multiple different types of storage cells is less than the number of storage cells of the second unit type.
[0009] Optionally, the storage units of the second unit type are identified by numbers in a numbering order, and the storage units of the first unit type are identified by preset identifiers, which are different from the numbers.
[0010] Optionally, the above-mentioned task scheduling method also includes: when the task request type is a second request type, determining the remaining storage capacity of the storage units of the second unit type in sequence according to the order of numbers; and determining the target storage unit according to the remaining storage capacity, wherein, when the remaining storage capacity of the storage unit with a forward number is not 0, the storage unit with a forward number is preferentially used as the target storage unit; when the remaining storage capacity of the storage unit with a forward number is 0, continuing to determine the remaining storage capacity of the next storage unit in order of numbers until a storage unit with a remaining storage capacity that is not 0 is found.
[0011] Optionally, determining a target thread ring that matches the historical timing data from multiple thread rings includes: obtaining a first historical timing data set corresponding to the task request within a target statistical period in the historical records, and a second historical timing data set corresponding to each of the multiple thread rings, wherein the second historical timing data set is historical timing data corresponding to processing the same number of tasks as in the first historical timing data set; obtaining a correlation coefficient between the task request and the historical data in the second historical timing data set; comparing the sizes of all the obtained correlation coefficients; selecting a thread ring corresponding to the maximum value of all the correlation coefficients from the second historical timing data set, and using the thread ring corresponding to the maximum value as the target thread ring.
[0012] Optionally, obtaining the correlation coefficient between the task request and the historical data in the second historical time-consuming data set includes: performing covariance operations on the first historical time-consuming data set and the second historical time-consuming data corresponding to multiple thread rings to obtain operation results; and determining the correlation coefficient based on the operation results.
[0013] According to another aspect of an embodiment of the present application, a task scheduling device is also provided, which includes: an acquisition module, used to receive a task request and obtain a first historical time-consuming data required for processing the task corresponding to the task request; a first determination module, used to determine a target thread ring matching the first historical time-consuming data from multiple thread rings, wherein each of the multiple thread rings includes multiple storage units of different types, and the priorities of different types of storage units are different, and the storage units are used to store a set of tasks to be executed; a second determination module, used to determine the type of task request; a storage module, used to store the task request in multiple different target storage units corresponding to the task request type; and an execution module, used to execute the tasks in the target storage units according to the priority order of the target storage units.
[0014] According to another aspect of an embodiment of the present application, a non-volatile storage medium is also provided. The non-volatile storage medium includes a stored program, and when the program is running, the device where the storage medium is located is controlled to execute any of the above-mentioned task scheduling methods.
[0015] According to another aspect of an embodiment of the present application, an electronic device is further provided, comprising: a processor, a memory for storing processor-executable instructions, the processor being configured to execute instructions to implement any one of the above-mentioned task scheduling methods.
[0016] In the embodiment of the present application, a task request is received, and the first historical time-consuming data required for processing the task corresponding to the task request is obtained; a target thread ring matching the first historical time-consuming data is determined from multiple thread rings, wherein each thread ring in the multiple thread rings includes multiple different types of storage units, and the priorities of different types of storage units are different, and the storage unit is used to store the task set to be executed; the type of the task request is determined; the task request is stored in multiple different target storage units corresponding to the type of the task request; the task in the target storage unit is executed in the order of priority of the target storage unit, by adopting multiple thread rings, different task processing requests are classified according to the time consumption of processing requests, placed in different storage units, and the tasks in different storage units are executed according to the priority of the storage unit. The purpose of reasonably arranging the order of task processing is achieved in the scenario where the task processing amount corresponding to the task processing request is randomly distributed and the difference fluctuates greatly, thereby achieving the technical effect of reducing the memory occupied by task processing, avoiding the classification task blocking computing resources, giving priority to urgent tasks and improving the processing efficiency of the computer system, thereby solving the technical problems of long task scheduling waiting time and low processing efficiency caused by the disorder of CPU resources occupied by task processing requests. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] 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:
[0018] Figure 1 It is a schematic diagram of the working principle of a thread ring according to the related art;
[0019] Figure 2 is an optional emergency task allocation schematic diagram according to an embodiment of the present application;
[0020] Figure 3 is a structural diagram of an optional automatic switching thread ring device according to an embodiment of the present application;
[0021] Figure 4 is a flow chart of a task scheduling method according to the related art;
[0022] Figure 5 is a structural diagram of an optional task scheduling device according to an embodiment of the present application;
[0023] Figure 6 is a workflow diagram of an optional distributed task scheduling platform according to an embodiment of the present application;
[0024] Figure 7It is a schematic diagram of the working principle of an optional distributed task scheduling platform according to an embodiment of the present application. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the present application, the technical solutions 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 this application.
[0026] 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.
[0027] In order to better understand the embodiments of the present application, the technical terms involved in the embodiments of the present application are explained as follows:
[0028] Task processing capacity: The computer resources such as computer memory, number of CPU cores, etc. that need to be mobilized to process the tasks corresponding to the task request.
[0029] Thread ring: A circular thread module composed of multiple threads connected end to end. A thread is the smallest unit that the operating system can schedule operations on and is the basic unit for independent scheduling and dispatching.
[0030] Time consumption data: the length of time required to process a task.
[0031] In order to solve the problems mentioned in the background technology, the embodiment of the present application provides a device of automatic switching thread ring, which uses three thread rings to group requests of different tasks according to processing time, and realizes dynamic classification through a correlation coefficient device. Figure 1This is the working principle of the thread ring. A dedicated block (i.e. storage unit) is preset for the urgent task processing needs and marked with a special symbol. When an urgent task is received, the system first stores the urgent task request in the dedicated block, and then inserts the block into the front of the queue of the thread ring waiting to be executed. Figure 2 This is a schematic diagram of emergency task allocation according to the device of this embodiment. The above device formulates request processing rules from a business perspective, classifies task requests according to processing time, uses logical segmentation to reduce business processing complexity, and implements priority processing of emergency tasks; it utilizes the logical construction characteristics of the thread ring, which makes it easier to avoid the unreasonable phenomenon that requests with large task processing volume occupy CPU resources for too long due to disordered competition of task requests, resulting in too long waiting time for requests with small task volume; it fully considers user requests, reduces the overall task time consumption, and improves the overall user satisfaction. The above device is classified into four modules according to its function: Figure 3 It is a structural diagram of the above-mentioned automatic switching thread ring device.
[0032] According to an embodiment of the present application, a method embodiment of task scheduling is 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.
[0033] Figure 4 is a flowchart of a task scheduling method according to an embodiment of the present application, such as Figure 4 As shown, the method comprises the following steps:
[0034] Step S402: receiving a task request and acquiring first historical time-consuming data required for processing the task corresponding to the task request.
[0035] According to step S402, whenever a task request is received, the time consumption data of each request information is received and recorded, and the new task request is matched with the corresponding historical processing time consumption data.
[0036] Step S404, determining a target thread ring matching the first historical time-consuming data from a plurality of thread rings, wherein each of the plurality of thread rings includes a plurality of storage units of different types, and the priorities of the storage units of different types are different, and the storage units are used to store the task set to be executed.
[0037] Execute step S404 to open three thread rings for processing different tasks with different processing times, and the three thread rings correspond to task sets with different processing time consumptions; whenever a new task request is received, the request information and processing time consumption data are recorded, and the thread ring corresponding to the task request is determined based on the historical time consumption data of the task request; each thread ring contains different types of storage units, providing storage space for tasks corresponding to different types of task requests.
[0038] Step S406: determine the type of the task request.
[0039] The method steps provided in step S406 are executed to classify the task requests into two categories: urgent requests and non-urgent requests according to the historical time consumption data of task processing.
[0040] Step S408: storing the task request in a plurality of different target storage units corresponding to the types of the task request.
[0041] According to step S408, service queues with different task processing times are set, and task request processing rules characterized by randomly distributed task volumes are classified; a queue with the same processing task as the received processing request is selected from the service queue set, and the processing request is added to the selected queue.
[0042] Step S410, executing the tasks in the target storage unit according to the priority order of the target storage unit.
[0043] According to the method provided in step S410, the tasks to be executed are executed in sequence according to the priorities of the storage units storing the task request types.
[0044] Through the above steps, it is possible to reasonably arrange the order of task processing when high concurrency and randomly distributed requests occupy CPU resources in an unordered manner, thereby improving the processing efficiency of the computer system.
[0045] The above-mentioned time consumption data and historical time consumption data refer to
[0046] According to an optional embodiment of the present application, the types of task requests include a first request type and a second request type, wherein the priority of the first request type is higher than the priority of the second request type; and the processing priorities of the task sets corresponding to multiple different types of storage units are different.
[0047] For example, by calculating the historical time consumption data of task requests, the tasks corresponding to the task requests are divided into two types: urgent tasks and non-urgent tasks. Urgent tasks have a higher priority than non-urgent tasks. If there are requests for urgent tasks and non-urgent tasks at the same time, the requests for urgent tasks will be processed first.
[0048] According to another optional embodiment of the present application, multiple storage units of different types, such as: storage units of a first unit type and storage units of a second unit type, wherein the priority of the first unit type is higher than the priority of the second unit type, and the number of storage units of the first unit type among the multiple storage units of different types is less than the number of storage units of the second unit type.
[0049] In this optional embodiment, each thread ring dynamically opens multiple, such as n blocks, according to the number of task requests received, and reserves 1 block as a storage unit for urgent tasks, and the remaining (n-1) blocks are used as storage units for non-urgent tasks.
[0050] According to another optional embodiment of the present application, the storage units of the second unit type are numbered and identified in order of the numbers, and the storage units of the first unit type are identified by preset identifications, which are different from the numbers.
[0051] According to this optional embodiment, the storage unit (block) of the urgent task is marked as "e", and the storage unit (block) of the non-urgent task is marked in sequence from "0" to "n-2" (that is, they are marked in sequence from small to large according to the numbers corresponding to the numbers). According to the marking, it is judged whether the task request is an urgent task. If it is an urgent task, the task request is stored in the block marked as "e". If it is a non-urgent task, the task request is stored in the block queue.
[0052] According to another optional embodiment of the present application, the above-mentioned task scheduling method also includes: when the type of the task request is the second request type, determining the remaining storage capacity of the storage units of the second unit type in sequence according to the order of numbers; and determining the target storage unit according to the remaining storage capacity, wherein, when the remaining storage capacity of the storage unit with a forward number is not 0, the storage unit with a forward number is preferentially used as the target storage unit; when the remaining storage capacity of the storage unit with a forward number is 0, continuing to determine the remaining storage capacity of the next storage unit in order of numbers until a storage unit with a remaining storage capacity that is not 0 is found.
[0053] In this optional embodiment, if a non-urgent task is received, the task request is sequentially stored in the block queue. When a block is full, a new task request is arranged to be stored in the next adjacent unfull block, waiting for execution. When receiving a non-urgent task request, each thread ring sequentially takes out the task request loaded in the block marked as "0", uses CPU computing resources, and each time a block's task request is processed, the subscript of the unprocessed block under the current thread ring is sequentially increased by one. The processed blocks continue to queue in a round-robin order to wait for new task requests.
[0054] It should be noted that when a request for an urgent task is received, if the block marked with "e" is not empty, the task scheduling module will insert the block marked with "e" before the block marked with "1" and wait for execution first; when the urgent task carried by the block marked with "e" is processed, the system continues to execute the blocks in the queue of non-urgent tasks in sequence.
[0055] According to some optional embodiments of the present application, determining a target thread ring that matches historical timing data from multiple thread rings includes the following steps: Step 1, obtaining a first historical timing data set corresponding to a task request within a target statistical period in the historical record, and a second historical timing data set corresponding to each of the multiple thread rings, wherein the second historical timing data set is historical timing data corresponding to processing the same number of tasks as in the first historical timing data set; Step 2, obtaining a correlation coefficient between the task request and the historical data in the second historical timing data set; Step 3, comparing the sizes of all the obtained correlation coefficients, selecting a thread ring corresponding to the maximum value of all the correlation coefficients from the second historical timing data set, and taking the thread ring corresponding to the maximum value as the target thread ring.
[0056] According to this optional embodiment, determining a target thread ring matching the historical time-consuming data from multiple thread rings is achieved by the following steps:
[0057] Step 1: Retrieve the historical processing time data of new task requests to form a data set; if the number of new task requests retrieved is k, then the data set is Y k , the number of data is n k ;in,
[0058]
[0059] Step 2: Extract the same number of time-consuming data of historical task request processing of three thread rings respectively to form data sets X1, X2, and X3; if the number of time-consuming data extracted is n k , then:
[0060]
[0061]
[0062]
[0063] Step 3: Determine the correlation coefficient ρ of historical processing time data sk , for the correlation coefficient ρ sk Sort; select the correlation coefficient ρ sk The thread ring corresponding to the largest value assigns the kth new task request to the thread ring.
[0064] According to an optional embodiment of the present application, obtaining the correlation coefficient between the task request and the historical data in the second historical time-consuming data set includes: performing covariance operations on the first historical time-consuming data set and the second historical time-consuming data corresponding to multiple thread rings respectively to obtain operation results; and determining the correlation coefficient based on the operation results.
[0065] In this optional embodiment, the correlation coefficient ρ of the historical request processing time-consuming data is determined by the following method: sk :
[0066] The historical processing time dataset Y of new task requests k The covariance Cov(X s ,Y k ) calculation, where s = (1, 2, 3), is the mathematical expectation of the data set Xs, is the dataset Y k The mathematical expectation of yes The mathematical expectation is the probability of each possible outcome in the experiment multiplied by the sum of its outcomes.
[0067]
[0068] The correlation coefficient ρ between the kth new task request and the historical request processing time data of the three task sets is calculated by the following formula, where s = (1, 2, 3), Represents dataset Xs and dataset Y respectively k The standard deviation of .
[0069] ρ sk ∈[-1,1];
[0070] Figure 5 is a structural diagram of a task scheduling device provided according to an embodiment of the present application, such as Figure 5The device includes: an acquisition module 50, which is used to receive a task request and obtain the first historical time-consuming data required for processing the task corresponding to the task request; a first determination module 52, which is used to determine a target thread ring matching the first historical time-consuming data from multiple thread rings, wherein each of the multiple thread rings includes multiple different types of storage units, and the priorities of different types of storage units are different, and the storage units are used to store a set of tasks to be executed; a second determination module 54, which is used to determine the type of the task request; a storage module 56, which is used to store the task request in multiple different target storage units corresponding to the task request type; and an execution module 58, which is used to execute the tasks in the target storage units according to the priority order of the target storage units.
[0071] According to this embodiment, a specific implementation method is provided, and the method is applied to the construction of a highly available, high-performance, easily expandable and visual distributed task scheduling platform project. The distributed task scheduling platform supports multiple languages, cross-computer room scenarios, container scenarios, dynamic task modification, dynamic expansion and contraction, resource isolation and visual management and other functions, forming an omni-channel task project management specification to achieve the access of core projects. In the application process, it is found that the execution efficiency of some tasks varies greatly, affecting the timeliness of some core tasks. Through practice, a thread model that supports priority is derived, which further improves the execution speed of effective tasks. With the accumulation of applications, some tasks need to be processed in a timely manner. This situation is also called "queue jumping". Replacing the native thread model with a thread ring model that supports priority can meet the "queue jumping" business scenario. Figure 6 Workflow diagram of the distributed task scheduling platform.
[0072] Figure 7 This is a schematic diagram of the working principle of the distributed task scheduling platform; distributed task scheduling is mainly implemented through three modules: the first module for managing basic information, the second module for maintaining threads, and the third module for executing task processes. The first module manages and maintains executor tasks and logs, and the effects can be intuitively seen through the page; the core function of the second module is to manage and control registration threads, task execution threads, callback threads, etc.; the third module has a thread pool for executing tasks, which can execute scheduled tasks in the thread pool in sequence.
[0073] According to another optional embodiment of the present application, a non-volatile storage medium is also provided. The non-volatile storage medium includes a stored program, and when the program is running, the device where the storage medium is located is controlled to execute the above-mentioned task scheduling method.
[0074] Specifically, the above-mentioned storage medium is used to store program instructions for the following functions: receiving a task request and obtaining the first historical time-consuming data required for processing the task corresponding to the task request; determining a target thread ring that matches the first historical time-consuming data from multiple thread rings, wherein each of the multiple thread rings includes multiple storage units of different types, and the priorities of different types of storage units are different, and the storage units are used to store a set of tasks to be executed; determining the type of task request; storing the task request in multiple different target storage units corresponding to the types of task requests; and executing the tasks in the target storage units in order of their priorities.
[0075] According to another optional embodiment of the present application, an electronic device is further provided, which includes: a processor, a memory for storing processor-executable instructions, and the processor is configured to execute instructions to implement the above-mentioned task scheduling method.
[0076] Specifically, the electronic device executes the following procedures: receiving a task request and obtaining first historical time-consuming data required for processing the task corresponding to the task request; determining a target thread ring matching the first historical time-consuming data from multiple thread rings, wherein each of the multiple thread rings includes multiple storage units of different types, and different types of storage units have different priorities, and the storage units are used to store a set of tasks to be executed; determining the type of the task request; storing the task request in multiple different target storage units corresponding to the types of the task request; and executing the tasks in the target storage units in order of their priorities.
[0077] 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.
[0078] 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.
[0079] 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 can be 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.
[0080] 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 units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0081] 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.
[0082] 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.
[0083] 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 task scheduling method, characterized in that: include: Receive a task request, and obtain first historical time-consuming data required for processing the task corresponding to the task request; Determine a target thread ring matching the first historical time-consuming data from a plurality of thread rings, wherein each of the plurality of thread rings includes a plurality of storage units of different types, and the priorities of the storage units of different types are different, and the storage units are used to store a set of tasks to be executed, and the thread ring is a ring-shaped thread module composed of a plurality of threads connected end to end; determining a type of the task request; storing the task request in the plurality of target storage units that are different and correspond to the types; The tasks in the target storage units are executed according to the priority order of the target storage units.
2. The method according to claim 1, characterized in that The types of task requests include: a first request type and a second request type, wherein the priority of the first request type is higher than the priority of the second request type; and the processing priorities of the task sets corresponding to the multiple different types of storage units are different.
3. The method according to claim 2, characterized in that The multiple different types of storage cells include: storage cells of a first cell type and storage cells of a second cell type, wherein the priority of the first cell type is higher than the priority of the second cell type, and the number of storage cells of the first cell type in the multiple different types of storage cells is less than the number of storage cells of the second cell type.
4. The method according to claim 3, characterized in that The storage units of the second unit type are identified by numbers in a numbering order, and the storage units of the first unit type are identified by preset identifiers, which are different from the numbers.
5. The method according to claim 4, characterized in that The method further comprises: When the task request is of the second request type, the remaining storage capacity of the storage units of the second unit type is determined in sequence according to the numbering sequence; and the target storage unit is determined according to the remaining storage capacity, wherein, when the remaining storage capacity of the storage unit with a front number is not 0, the storage unit with a front number is preferentially used as the target storage unit; when the remaining storage capacity of the storage unit with a front number is 0, the remaining storage capacity of the next storage unit is continuously determined in accordance with the numbering sequence until a storage unit whose remaining storage capacity is not 0 is found.
6. The method according to claim 1, characterized in that Determining a target thread ring matching the historical time-consuming data from a plurality of thread rings includes: Acquire the first historical time-consuming data set corresponding to the task request within the target statistical period and the second historical time-consuming data sets corresponding to each of the multiple thread rings in the historical records, wherein the second historical time-consuming data set is the historical time-consuming data corresponding to processing the same number of tasks as in the first historical time-consuming data set; Obtaining a correlation coefficient between the task request and the historical data in the second historical time-consuming data set; Compare the sizes of all correlation coefficients obtained; A thread ring corresponding to a maximum value among all correlation coefficients is selected from the second historical time-consuming data set, and the thread ring corresponding to the maximum value is used as the target thread ring.
7. The method according to claim 6, characterized in that Obtaining a correlation coefficient between the task request and the historical data in the second historical time-consuming data set includes: Performing covariance calculation on the first historical time-consuming data set and the second historical time-consuming data corresponding to the multiple thread rings to obtain a calculation result; The correlation coefficient is determined based on the operation result.
8. A task scheduling device, characterized in that: include: An acquisition module, used for receiving a task request and acquiring first historical time-consuming data required for processing the task corresponding to the task request; a first determination module, configured to determine a target thread ring matching the first historical time-consuming data from a plurality of thread rings, wherein each of the plurality of thread rings includes a plurality of storage units of different types, and the priorities of the storage units of different types are different, and the storage units are used to store a set of tasks to be executed, and the thread ring is a ring-shaped thread module composed of a plurality of threads connected end to end; A second determining module, used to determine the type of the task request; A storage module, used for storing the task request in the plurality of target storage units corresponding to the types; An execution module is used to execute the tasks in the target storage unit according to the priority order of the target storage unit.
9. A non-volatile 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 task scheduling method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: A processor, and a memory for storing the processor-executable instructions, wherein the processor is configured to execute the instructions to implement the task scheduling method according to any one of claims 1 to 7.