Thread pool scheduling method, apparatus, device, and readable storage medium

By using a thread pool scheduling method, the load status value is determined based on the task quantity ratio, average time consumption, and thread utilization rate. The thread pool allocation strategy is optimized, which solves the problem of inconsistent signaling response in the dynamic environment system and improves information processing efficiency and concurrent communication capabilities.

CN114461385BActive Publication Date: 2026-03-24SHENZHEN ZTE NETVIEW TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-28
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

In the environmental monitoring system, the different types of user terminal devices lead to inconsistent signaling response speeds and untimely task processing, which increases the information processing pressure on hardware devices and reduces information processing efficiency.

Method used

By using thread pool scheduling methods, we obtain the task quantity ratio, average execution time, and thread utilization rate to determine the load status value. Based on the load status value and other parameters, we set the thread pool allocation strategy, including releasing, creating, and prioritizing thread pools to optimize signaling task allocation.

Benefits of technology

It improves the information processing efficiency of the environmental system, avoids signal loss and hardware overload, and enhances concurrent communication capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114461385B_ABST
    Figure CN114461385B_ABST
Patent Text Reader

Abstract

The application provides a thread pool scheduling method, device and equipment and a readable storage medium. After preprocessing signaling tasks, the task quantity ratio between the amount of tasks to be processed and the total amount of tasks in the thread pool, the average time for processing tasks and the thread usage rate are obtained. The load state value of each thread pool is determined according to the task quantity ratio, the average time and the thread usage rate. The thread pool allocation strategy corresponding to the load state value, the task quantity ratio, the average time and the thread usage rate is determined, and the thread pool corresponding to the signaling task is allocated according to the thread pool allocation strategy. The thread pool allocation strategy includes releasing the thread pool according to the load state value and the average time, and creating the thread pool according to at least one of the task quantity ratio, the average time and the thread usage rate. The ability of concurrent communication of the service device is improved, and the problem of low information processing efficiency of the dynamic system is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and in particular to a thread pool scheduling method, apparatus, device, and readable storage medium. Background Technology

[0002] The power and environmental system is primarily used to monitor the operating status and parameters of various system devices. Upon detecting component failures or parameter anomalies, it immediately triggers multiple alarm methods, records historical data and alarm events, and provides powerful functions such as intelligent expert diagnostic suggestions, remote monitoring and management, and web browsing. This simplifies and simplifies monitoring operations, allowing for control from a single screen, thus enabling unattended operation and saving on human resource costs.

[0003] Environmental monitoring systems typically need to frequently send signaling tasks to user-end hardware devices, and the real-time requirements for these signaling tasks are high. However, due to the different types of user-end terminal devices and the influence of hardware and network factors on devices from different manufacturers, the response speed to signaling varies. When the number of tasks sent is large and the hardware response speed is slow, the untimely task processing leads to poor service response, increases the information processing pressure on the hardware devices, and reduces the information processing efficiency of the environmental monitoring system.

[0004] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main objective of this invention is to provide a thread pool scheduling method, which aims to solve the problem of low information processing efficiency in dynamic environmental systems.

[0006] To achieve the above objectives, the present invention provides a thread pool scheduling method, the thread pool scheduling method comprising:

[0007] After preprocessing the signaling tasks, obtain the ratio of the number of tasks to be processed in the thread pool to the total number of tasks, the average time to process the tasks, and the thread utilization rate.

[0008] The load status value of each thread pool is determined based on the task quantity ratio, the average time consumption, and the thread utilization rate.

[0009] A thread pool allocation strategy is determined corresponding to the load status value, the task quantity ratio, the average time consumption, and the thread utilization rate. The thread pool corresponding to the signaling task is allocated according to the thread pool allocation strategy. The thread pool allocation strategy includes determining the release of the thread pool based on the load status value and the average time consumption, and determining the creation of the thread pool based on at least one of the task quantity ratio, the average time consumption, and the thread utilization rate.

[0010] Optionally, before the steps of obtaining the ratio of the number of tasks to the total number of tasks in the thread pool, the average time spent processing tasks, and the thread utilization rate, the method further includes:

[0011] Upon receiving the signaling task, the signaling parameters in the signaling task are obtained, wherein the signaling parameters include at least one of the following: task issuance time, task response time, task type, device, keyword, and sequence number;

[0012] The signaling is preprocessed according to the signaling identifier, wherein the preprocessing includes analysis, filtering and / or merging.

[0013] Optionally, the step of determining the load state value of each thread pool based on the task quantity ratio, the average time consumption, and the thread utilization rate includes:

[0014] The weighted thresholds corresponding to the task quantity ratio, the average time consumption, and the thread utilization rate are determined based on the server configuration, wherein the weighted thresholds are positive values;

[0015] The load status value is determined based on the weighted threshold, the task quantity ratio, the average time consumed, and the thread utilization rate.

[0016] Optionally, after the step of determining the load state value of each thread pool based on the task quantity ratio, the average time consumption, and the thread utilization rate, the method further includes:

[0017] When thread pools with the same load status value are found, the thread pool with the higher priority is determined by a hash algorithm.

[0018] Optionally, the step of determining the thread pool allocation strategy corresponding to the load status value, the task quantity ratio, the average time consumption, and the thread utilization rate, and allocating the thread pool corresponding to the signaling task according to the thread pool allocation strategy includes:

[0019] Detect the load status value, the task quantity ratio, the average time consumption, and the thread utilization rate;

[0020] When the load status value and the average time consumption meet the first scheduling condition, it is determined that the thread pool is idle, and the sub-thread pools in the thread pool are released to reduce the signaling occupation;

[0021] When the ratio of thread utilization to the number of tasks meets the second scheduling condition, it is determined that the thread pool is busy, and a new sub-thread pool is created in the thread pool to prevent signaling loss.

[0022] When the thread utilization rate and the average execution time meet the third scheduling condition, it is determined that the thread pool is executing abnormally, and a new sub-thread pool is created to isolate the signaling.

[0023] When the ratio of the load status value to the number of tasks meets the fourth scheduling condition, it is determined that the thread pool is saturated, and the signaling is returned to the user terminal so that the signaling that the thread pool cannot handle is returned to the user terminal.

[0024] Optionally, the first allocation condition is that the load status value is equal to 0 and the average time consumption is equal to 0; the second allocation condition is that the thread utilization rate is equal to 1 and the task quantity ratio is greater than 0.8; the third allocation condition is that the thread utilization rate is greater than 0.8 and the average time consumption is greater than 3 seconds; the fourth allocation condition is that the load status value is equal to 1 and the task quantity ratio is equal to 1.

[0025] Optionally, after determining the thread pool allocation strategy corresponding to the load status value, the task quantity ratio, the average time consumption, and the thread utilization rate, and allocating the thread pool corresponding to the signaling task according to the thread pool allocation strategy, the method further includes:

[0026] The signaling task is processed according to the allocated thread pool, and the task result obtained after processing the signaling task is fed back to the user terminal.

[0027] Furthermore, to achieve the above objectives, the present invention also provides a thread pool scheduling device, the thread pool scheduling device comprising:

[0028] The parameter acquisition module is used to obtain the ratio of the number of tasks to be processed in the thread pool to the total number of tasks, the average time to process tasks, and the thread utilization rate after the signaling tasks are preprocessed.

[0029] The load status value determination module determines the load status value of each thread pool based on the task quantity ratio, the average time consumption, and the thread utilization rate.

[0030] The thread pool scheduling module allows the user to determine the thread pool allocation strategy corresponding to the load status value, the task quantity ratio, the average time consumption, and the thread utilization rate, and allocate the thread pool corresponding to the signaling task according to the thread pool allocation strategy.

[0031] In addition, to achieve the above objectives, the present invention also provides a thread pool scheduling device, which includes a memory, a processor, and a thread pool scheduler stored in the memory and executable on the processor. When the thread pool scheduler is executed by the processor, it implements the various steps of the thread pool scheduling method described above.

[0032] In addition, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing a thread pool scheduler, which, when executed by a processor, implements the various steps of the thread pool scheduling method as described in any of the preceding claims.

[0033] This invention provides a thread pool scheduling method, apparatus, device, and computer-readable storage medium. After preprocessing signaling tasks, the method obtains the ratio of the number of tasks to be processed in the thread pool to the total number of tasks, the average processing time, and the thread utilization rate. It then determines the load state value of each thread pool based on the task ratio, the average processing time, and the thread utilization rate. Finally, it determines a thread pool allocation strategy corresponding to the load state value, the task ratio, the average processing time, and the thread utilization rate, and allocates the thread pool corresponding to the signaling task according to the allocation strategy. The thread pool allocation strategy includes determining the release of the thread pool based on the load state value and the average processing time, and determining the creation of the thread pool based on at least one of the task ratio, the average processing time, and the thread utilization rate. By defining three parameters that reflect the current workload of the thread pool—the task quantity ratio, average latency, and thread utilization rate—and defining standard load status values ​​that reflect the health status of each thread pool based on these three parameters, the relationship between the four thresholds and the four parameters is determined by the load status threshold, task quantity ratio threshold, average latency threshold, and / or thread utilization rate threshold set in the preset scheduling conditions, and the corresponding thread pool allocation strategy is invoked. This improves the concurrent communication capability of the service device and solves the problem of low information processing efficiency in the environmental system. Attached Figure Description

[0034] Figure 1 This is a schematic diagram of the hardware structure of the thread pool scheduling device according to an embodiment of the present invention;

[0035] Figure 2 This is a flowchart illustrating the first embodiment of the thread pool scheduling method of the present invention;

[0036] Figure 3 This is a flowchart illustrating a second embodiment of the thread pool scheduling method of the present invention;

[0037] Figure 4 This is a detailed flowchart of step S10 in the third embodiment of the thread pool scheduling method of the present invention;

[0038] Figure 5 This is a flowchart illustrating the fourth embodiment of the thread pool scheduling method of the present invention;

[0039] Figure 6 This is a detailed flowchart of step S30 in the fifth embodiment of the thread pool scheduling method of the present invention;

[0040] Figure 7 This is a flowchart illustrating the sixth embodiment of the thread pool scheduling method of the present invention;

[0041] Figure 8 This is a schematic diagram of the architecture of the thread pool scheduling device of the present invention.

[0042] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0043] It should be understood that exemplary embodiments of the invention are shown in the accompanying drawings, and the invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the invention and to fully convey the scope of the invention to those skilled in the art.

[0044] In the initial stage of task execution, the load of each thread pool randomly processes the task signals sent by the client. This leads to an uneven workload among the thread pools, resulting in varying response speeds of the dynamic environment system to the task signals. Slow response speeds affect the program's task processing speed. Therefore, this invention proposes to improve the concurrent communication capability by setting priority conditions to achieve ordered calls to the thread pools based on multithreading and setting priority conditions.

[0045] As one implementation scheme, the hardware architecture of the thread pool scheduling device can be as follows: Figure 1 As shown.

[0046] The present invention relates to a thread pool scheduling device, which includes: a processor 101, such as a CPU, a memory 102, and a communication bus 103. The communication bus 103 is used to implement communication between these components.

[0047] Memory 102 can be high-speed RAM or stable memory (non-volatile memory), such as disk storage. Figure 1 As shown, the memory 102, which is a computer-readable storage medium, may include a thread pool scheduling program; and the processor 101 may be used to call the thread pool scheduling program stored in the memory 102 and perform the following operations:

[0048] After preprocessing the signaling tasks, obtain the ratio of the number of tasks to be processed in the thread pool to the total number of tasks, the average time to process the tasks, and the thread utilization rate.

[0049] The load status value of each thread pool is determined based on the task quantity ratio, the average time consumption, and the thread utilization rate.

[0050] A thread pool allocation strategy is determined corresponding to the load status value, the task quantity ratio, the average time consumption, and the thread utilization rate. The thread pool corresponding to the signaling task is allocated according to the thread pool allocation strategy. The thread pool allocation strategy includes determining the release of the thread pool based on the load status value and the average time consumption, and determining the creation of the thread pool based on at least one of the task quantity ratio, the average time consumption, and the thread utilization rate.

[0051] In one embodiment, processor 101 can be used to invoke a thread pool scheduler stored in memory 102 and perform the following operations:

[0052] Upon receiving the signaling task, the signaling parameters in the signaling task are obtained, wherein the signaling parameters include at least one of the following: task issuance time, task response time, task type, device, keyword, and sequence number;

[0053] The signaling is preprocessed according to the signaling identifier, wherein the preprocessing includes analysis, filtering and / or merging.

[0054] In one embodiment, processor 101 can be used to invoke a thread pool scheduler stored in memory 102 and perform the following operations:

[0055] The weighted thresholds corresponding to the task quantity ratio, the average time consumption, and the thread utilization rate are determined based on the server configuration, wherein the weighted thresholds are positive values;

[0056] The load status value is determined based on the weighted threshold, the task quantity ratio, the average time consumed, and the thread utilization rate.

[0057] In one embodiment, processor 101 can be used to invoke a thread pool scheduler stored in memory 102 and perform the following operations:

[0058] When thread pools with the same load status value are found, the thread pool with the higher priority is determined by a hash algorithm.

[0059] In one embodiment, processor 101 can be used to invoke a thread pool scheduler stored in memory 102 and perform the following operations:

[0060] Detect the load status value, the task quantity ratio, the average time consumption, and the thread utilization rate;

[0061] When the load status value and the average time consumption meet the first scheduling condition, it is determined that the thread pool is idle, and the sub-thread pools in the thread pool are released to reduce the signaling occupation;

[0062] When the ratio of thread utilization to the number of tasks meets the second scheduling condition, it is determined that the thread pool is busy, and a new sub-thread pool is created in the thread pool to prevent signaling loss.

[0063] When the thread utilization rate and the average execution time meet the third scheduling condition, it is determined that the thread pool is executing abnormally, and a new sub-thread pool is created to isolate the signaling.

[0064] When the ratio of the load status value to the number of tasks meets the fourth scheduling condition, it is determined that the thread pool is saturated, and the signaling is returned to the user terminal so that the signaling that the thread pool cannot handle is returned to the user terminal.

[0065] In one embodiment, processor 101 can be used to invoke a thread pool scheduler stored in memory 102 and perform the following operations:

[0066] The signaling tasks are processed according to the allocated thread pool, and the processed task results are fed back to the user terminal.

[0067] Based on the hardware architecture of the thread pool scheduling device based on the above-mentioned communication technology, an embodiment of the thread pool scheduling method of the present invention is proposed.

[0068] Reference Figure 2 In the first embodiment, the thread pool scheduling method includes the following steps:

[0069] Step S10: After preprocessing the signaling tasks, obtain the ratio of the number of tasks to be processed in the thread pool to the total number of tasks, the average processing time of the tasks, and the thread utilization rate.

[0070] In this embodiment, the current workload of the thread pool is reflected by data such as the ratio of the number of pending tasks in the thread pool to the total number of tasks, the average time to process tasks in the most recent minute, and the percentage of the thread pool that processes tasks to the total thread pool. These data are quantified into three different parameters: task quantity ratio, average processing time, and thread utilization rate.

[0071] Step S20: Determine the load status value of each thread pool based on the task quantity ratio, the average time consumption, and the thread utilization rate;

[0072] In this embodiment, a linear function is constructed using three parameters: task quantity ratio, average time consumption, and thread utilization rate. The value of this linear function is defined as the load status value. The load status value integrates these three parameters and serves as the standard for judging the health status of each thread pool.

[0073] Step S30: Determine the thread pool allocation strategy corresponding to the load status value, the task quantity ratio, the average time consumption, and the thread utilization rate, and allocate the thread pool corresponding to the signaling task according to the thread pool allocation strategy. The thread pool allocation strategy includes determining the release of the thread pool according to the load status value and the average time consumption, and determining the creation of the thread pool according to at least one of the task quantity ratio, the average time consumption, and the thread utilization rate.

[0074] In this embodiment, the preset scheduling conditions are one or more preset programs, including parameter thresholds such as load status threshold, task quantity ratio threshold, average time consumption threshold and / or thread utilization rate threshold, and a linear pool allocation strategy is determined based on the relationship between these parameters and the thresholds. The allocation strategy increases or decreases the corresponding number of linear pools for processing signaling tasks based on the load status value, task quantity ratio, average time consumption and / or thread utilization rate parameters, so that the linear pool has the ability to "automatically scale".

[0075] In the technical solution provided in this embodiment, three parameters that reflect the current workload of the thread pool are defined: the task quantity ratio, the average time consumption, and the thread utilization rate. Based on these three parameters, a standard load status value reflecting the health status of each thread pool is defined. Finally, the relationship between the four thresholds and the four parameters is determined according to the load status threshold, task quantity ratio threshold, average time consumption threshold, and / or thread utilization rate threshold set in the preset scheduling conditions, and the corresponding thread pool allocation strategy is invoked. This improves the concurrent communication capability of the service device and solves the problem of low information processing efficiency in the environmental system.

[0076] Reference Figure 3 In the second embodiment, based on the first embodiment, before step S10, the following steps are further included:

[0077] Step S40: Upon receiving the signaling task, obtain the signaling parameters in the signaling task, wherein the signaling parameters include at least one of the following: task issuance time, task response time, task type, device, keyword, and sequence number;

[0078] Step S50: Preprocess the signaling according to the signaling identifier, wherein the preprocessing includes analysis, filtering and / or merging.

[0079] Optionally, before obtaining the task quantity ratio, average execution time, and thread utilization rate in each thread pool, when the service device receives the signaling, it obtains parameter information from the signaling, including task issuance time, task response time, task type, device, keyword, and / or sequence number, and preprocesses the signaling task. Preprocessing may include analyzing the signaling task to determine if it is executable, filtering out unexecutable task signaling, and finally merging duplicate / redundant task signaling. The specific preprocessing is not described in detail in this embodiment, but it is important to emphasize that signaling preprocessing is also a means to reduce thread pool load and improve communication parallelism.

[0080] In the technical solution provided in this embodiment, by acquiring the signaling parameters in the received signaling before acquiring the workload data of the linear pool, and preprocessing these signaling parameters according to the task issuance time, task response time, task type, device, keyword and / or sequence number in the signaling, the thread pool load is reduced and the information processing efficiency of the dynamic environment system is improved.

[0081] Reference Figure 4 In the third embodiment, based on the above embodiments, step S10 includes:

[0082] Step S11: Determine the weighted thresholds corresponding to the task quantity ratio, the average time consumption, and the thread utilization rate based on the server configuration, wherein the weighted thresholds are positive values;

[0083] Step S12: Determine the load status value based on the weighted threshold, the task quantity ratio, the average time consumption, and the thread utilization rate.

[0084] Optionally, this embodiment provides a method for defining the load state of a thread pool. Server configuration may include the number of processor cores and memory size in the server. The weighted thresholds differ depending on the server configuration. For example, a server with more than 16 CPU cores and more than 32GB of memory is defined as a high-performance server. In this case, the weighted thresholds are determined as follows: task quantity ratio weighted threshold P1 = 0.4, average time consumption weighted threshold P2 = 0.4, and thread utilization weighted threshold P3 = 0.2. P1, P2, and P3 satisfy the condition P1 + P2 + P3 = 1, P1 > 0, P2 > 0, and P3 > 0. Conversely, when the server configuration does not meet the above conditions, the weighted thresholds are defined as: P1 = 0.25, P2 = 0.25, and P3 = 0.5. It is important to emphasize that the weighted thresholds are not immutable after setting and can be automatically adjusted based on subsequent server performance. Furthermore, after determining the weighted threshold, a linear function is constructed based on parameters such as the weighted threshold, the proportion of tasks, the average time consumption, and the thread utilization rate. The load status is then quantified based on the value of the linear function. For example, if the load status of the thread pool is set to H, then H = C*P1 + AC*P2 + TAV*P3. The larger the value of H, the greater the workload of the current thread pool, and the worse the "health status" of the thread pool. In subsequent thread pool scheduling, the thread pool with the worse "health status" will have a lower scheduling priority.

[0085] In the technical solution provided in this embodiment, a weighted threshold is determined based on the server configuration, and the load status is determined by combining the weighted threshold, the proportion of task quantity, the average time consumption, and the thread utilization rate. The threshold is reasonably planned according to the server configuration so that the generated load status value can more reasonably reflect the "health status" of the server thread pool.

[0086] Reference Figure 5 In the fourth embodiment, based on the above embodiments, after step S12, the method further includes:

[0087] Step S60: When thread pools with the same load status value are found, the thread pools with the same status value are determined by a hash algorithm to identify the thread pool with higher priority.

[0088] Optionally, this embodiment provides a selection scenario when thread pools have the same load status value. When thread pools with the same load status value are present, a hash algorithm is used to prioritize these thread pools. A hash algorithm is a key-indexed data storage structure. By simply inputting the value to be searched (i.e., the key), its corresponding value can be found. For example, the device number and task type of the thread pool can be used as keys. The server uses a hash algorithm to reallocate thread pools with the same health status, determining the thread pool with higher priority among these thread pools.

[0089] In the technical solution provided in this embodiment, a hash algorithm is introduced to allocate thread pools with the same load status value, thereby avoiding the situation where thread pools with the same load status value cannot be scheduled.

[0090] Reference Figure 6 In the fifth embodiment, based on the above embodiments, step S30 includes:

[0091] Step S31: Detect the load status value, the task quantity ratio, the average time consumption, and the thread utilization rate;

[0092] Step S32: When the load status value and the average time consumption meet the first scheduling condition, it is determined that the thread pool is idle, and the sub-thread pools in the thread pool are released to reduce the signaling occupation; when the thread utilization rate and the task quantity ratio meet the second scheduling condition, it is determined that the thread pool is busy, and a new sub-thread pool is created in the thread pool to prevent signaling loss; when the thread utilization rate and the average time consumption meet the third scheduling condition, it is determined that the thread pool is abnormal, and a new sub-thread pool is established to isolate the signaling; when the load status value and the task quantity ratio meet the fourth scheduling condition, it is determined that the thread pool is saturated, and the signaling is returned to the user terminal so that the signaling that the thread pool cannot handle is returned to the user terminal.

[0093] Optionally, this embodiment provides a thread pool allocation strategy. Preset scheduling conditions are one or more pre-defined procedures, including parameter thresholds such as load status threshold, task quantity ratio threshold, average latency threshold, and / or thread utilization rate threshold. An allocation strategy for the linear pool is determined based on the relationship between these parameters and the thresholds. The allocation strategy increases or decreases the corresponding number of linear pools processing signaling tasks based on the load status value, task quantity ratio, average latency, and / or thread utilization rate parameters, enabling the linear pool to have "automatic scaling" capability.

[0094] For example, let's set the debt status value as H, the average processing time as AC, the task quantity ratio as C, and the thread utilization rate as TAV. When H = 0 and AC = 0 (i.e., the number of tasks waiting to be processed in the queue = 0, the average processing time for tasks in the last minute is 0, and the thread utilization rate = 0), the first preset scheduling condition is met, meaning that the number of task signals is low. The current thread pool is considered idle. Since the thread pool also occupies processor memory, to maximize memory utilization, the child thread pools in the thread pool are released, while the core thread pool / main thread pool remains unchanged. When TAV = 1 and C > 0.8, the second preset scheduling condition is met, meaning that there are many task signals, but the thread pool can still continue to receive and process signals. To prevent task signals from being lost in the thread pool, a new child thread pool is created in memory to expand the number of thread pools and prevent this in advance. In the event of signaling loss, but to avoid excessive memory usage due to an excessive number of thread pools, it is usually necessary to limit the number of sub-thread pools to no more than 10. When TAV = 1 and AC > 3, the third preset scheduling condition is met. In environmental monitoring projects, the response time of the device is generally less than 2 seconds; a response time exceeding 3 seconds indicates an abnormality in the monitoring device's operation. To prevent this from causing a backlog of signaling tasks and consuming significant processor resources, a new sub-thread pool is created in memory to isolate the original thread pool. However, if the thread pool for one type of service is full, it will not affect the thread pools corresponding to other types of services. It is important to emphasize that the third and fourth preset scheduling conditions are mutually exclusive and will not occur simultaneously. Finally, when TAV = 1 and C = 1, i.e., when the fourth preset scheduling condition is met, it means that all thread pools are full, and the device cannot process any more signaling requests. To prevent a large backlog of signaling tasks from causing abnormal damage or loss of signaling, the signaling request is returned to the user with a message such as "The server is currently busy; please resend later."

[0095] In the technical solution provided in this embodiment, four preset scheduling conditions are set to schedule the thread pool and / or process signaling for four different situations: few signaling requests, many signaling requests, signaling processing errors, and thread pool saturation. This avoids wasting memory space and preventing damage or loss caused by a large accumulation of signaling, thereby improving the information processing efficiency of the environmental system.

[0096] Reference Figure 7 In the sixth embodiment, based on any of the above embodiments, after step S30, the method further includes:

[0097] Step S70: Process the signaling task according to the allocated thread pool, and feed back the processed task result to the user terminal.

[0098] Optionally, this embodiment provides a method after allocating a thread pool. After allocating the thread pool according to a preset scheduling policy, the corresponding signaling tasks are processed according to the allocated thread pool, and the processed signaling tasks are fed back to the user terminal. For example, the feedback result may include information with similar meanings such as "the task / signaling is being processed", "the task / signaling is waiting to be processed", "the server is currently busy, please resend later", etc. The user terminal determines the processing status of the signaling task based on the feedback result.

[0099] In the technical solution provided in this embodiment, by sending a processing completion message to the user after the environmental protection device has finished processing the signaling, the user terminal is prevented from being unable to know the processing status of the receiving end due to an abnormality in the receiving end's processing of the signaling after sending a task request.

[0100] In addition, refer to Figure 8 This embodiment also proposes a thread pool scheduling device, which includes:

[0101] The parameter acquisition module 100 is used to obtain the ratio of the number of tasks to be processed in the thread pool to the total number of tasks, the average time to process tasks, and the thread utilization rate after the signaling task is preprocessed.

[0102] The load status value determination module 200 is used to determine the load status value of each thread pool based on the task quantity ratio, the average time consumption, and the thread utilization rate.

[0103] The thread pool scheduling module 300 is used to determine the thread pool allocation strategy corresponding to the load status value, the task quantity ratio, the average time consumption and the thread utilization rate, and allocate the thread pool corresponding to the signaling task according to the thread pool allocation strategy.

[0104] In addition, the present invention also provides a thread pool scheduling device, the thread pool scheduling device including a memory, a processor and a thread pool scheduler stored in the memory and executable on the processor, wherein when the thread pool scheduler is executed by the processor, it implements the various steps of the thread pool scheduling method described above.

[0105] In addition, the present invention provides a computer-readable storage medium storing a thread pool scheduler, which, when executed by a processor, implements the various steps of the thread pool scheduling method described in the above embodiments.

[0106] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0107] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they 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 invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a computer-readable storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0108] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A thread pool scheduling method, characterized in that, The steps of the thread pool scheduling method include: Upon receiving a signaling task, obtaining signaling parameters in the signaling task, wherein the signaling parameters include at least one of task issuing time, task response time, task type, device, keyword, and serial number; According to the signaling identifier, pre-processing the signaling, wherein the pre-processing includes analysis, filtering, and / or merging; After pre-processing the signaling task, obtaining a task quantity ratio between the amount of tasks to be processed and the total amount of tasks in the thread pool, an average time consumption of processing tasks, and a thread usage rate; According to the server configuration, determining weighted threshold values corresponding to the task quantity ratio, the average time consumption, and the thread usage rate, wherein the weighted threshold values are positive values; According to the weighted threshold values and the task quantity ratio, the average time consumption, and the thread usage rate, determining a load state value, wherein a linear function is constructed by the three parameters, and the value of the linear function is defined as the load state value; Determining a thread pool allocation strategy corresponding to the load state value, the task quantity ratio, the average time consumption, and the thread usage rate, and allocating a thread pool corresponding to the signaling task according to the thread pool allocation strategy, wherein the thread pool allocation strategy includes determining the release of the thread pool according to the load state value and the average time consumption, and determining the creation of the thread pool according to at least one of the task quantity ratio, the average time consumption, and the thread usage rate.

2. The thread pool scheduling method of claim 1, wherein, After the step of determining the load state value of each thread pool according to the task quantity ratio, the average time consumption, and the thread usage rate, the method further includes: When the thread pools with the same load state value appear, determining a thread pool with a higher priority among the thread pools with the same load state value through a hash algorithm.

3. The thread pool scheduling method of claim 1, wherein, The step of determining the thread pool allocation strategy corresponding to the load state value, the task quantity ratio, the average time consumption, and the thread usage rate, and allocating a thread pool corresponding to the signaling task according to the thread pool allocation strategy includes: Detecting the load state value, the task quantity ratio, the average time consumption, and the thread usage rate; When the load state value and the average time consumption satisfy a first scheduling condition, judging that the thread pool execution is idle, releasing a child thread pool in the thread pool to reduce signaling occupation; When the thread usage rate and the task quantity ratio satisfy a second scheduling condition, judging that the thread pool execution is busy, creating a new child thread pool in the thread pool to prevent signaling loss; When the thread usage rate and the average time consumption satisfy a third scheduling condition, judging that the thread pool execution is abnormal, establishing a new child thread pool to isolate the signaling; When the load state value and the task quantity ratio satisfy a fourth scheduling condition, judging that the thread pool execution is saturated, returning the signaling to a user end, so that the signaling that cannot be processed by the thread pool is returned to the user end.

4. The thread pool scheduling method of claim 3, wherein, The first scheduling condition is that the load state value is equal to 0 and the average time consumption is equal to 0; the second scheduling condition is that the thread usage rate is equal to 1 and the task quantity ratio is greater than 0.8; the third scheduling condition is that the thread usage rate is greater than 0.8 and the average time consumption is greater than 3 seconds; and the fourth scheduling condition is that the load state value is equal to 1 and the task quantity ratio is equal to 1.

5. The thread pool scheduling method of claim 1, wherein, After the step of determining the thread pool allocation strategy corresponding to the load state value, the task quantity ratio, the average time consumption and the thread usage rate, and allocating the thread pool corresponding to the signaling task according to the thread pool allocation strategy, the method further comprises: processing the signaling task according to the allocated thread pool, and feeding back the task result obtained after processing to the user end.

6. A thread pool scheduling apparatus characterized by comprising: The thread pool scheduling device comprises: a parameter acquisition module, configured to acquire signaling parameters in the signaling task when the signaling task is received, wherein the signaling parameters comprise at least one of task issuing time, task response time, task type, device, keyword and serial number; and pre-process the signaling according to the signaling identifier, wherein the pre-processing comprises analysis, filtering and / or merging; and acquire a task quantity ratio between the amount of tasks to be processed and the total amount of tasks, an average time consumption of processing tasks and a thread usage rate after pre-processing the signaling task; a load state value determination module, configured to determine a weighted threshold value corresponding to the task quantity ratio, the average time consumption and the thread usage rate according to the server configuration, wherein the weighted threshold value is a positive value; and determine the load state value according to the weighted threshold value and the task quantity ratio, the average time consumption and the thread usage rate, wherein a linear function is constructed by the three parameters of the task quantity ratio, the average time consumption and the thread usage rate, and the value of the linear function is defined as the load state value; a thread pool scheduling module, configured to determine a thread pool allocation strategy corresponding to the load state value, the task quantity ratio, the average time consumption and the thread usage rate, and allocate the thread pool corresponding to the signaling task according to the thread pool allocation strategy, wherein the thread pool allocation strategy comprises determining the release of the thread pool according to the load state value and the average time consumption, and determining the creation of the thread pool according to at least one of the task quantity ratio, the average time consumption and the thread usage rate.

7. A thread pool scheduling device, characterized by The thread pool scheduling device comprises a memory, a processor and a thread pool scheduling program stored on the memory and executable on the processor, and the thread pool scheduling program is executed by the processor to implement the steps of the thread pool scheduling method in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a thread pool scheduling program, and the thread pool scheduling program is executed by the processor to implement the steps of the thread pool scheduling method in any one of claims 1-5.