Intelligent task allocation method based on multi-thread group
By initializing the thread pool in the system and monitoring key indicators in real time, dynamically adjusting the thread pool size, the problems of low resource utilization and insufficient response capabilities in the existing technology are solved, and the system self-detection and self-adjustment are realized, and processing capabilities are improved. Reduced operation and maintenance intervention.
Patent Information
- Application Number
- CN202411282633.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2024-12-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to effectively adjust the thread pool size according to the real-time operating state of the system, resulting in low resource utilization and insufficient system response capabilities, especially when handling a large number of concurrent asynchronous tasks.
By initializing the thread pool, the monitor is designed to monitor the response time, CPU occupancy, memory occupancy and task queue size in real time, define the evaluator and threshold, and implement the adjuster to dynamically adjust the thread pool size according to the evaluation results and preset policies to adapt to the system. Load changes.
The system self-detection and self-adjustment are realized, the resource utilization rate and system processing capabilities are improved, the operation and maintenance intervention is reduced, and a graphical delivery interface for real-time viewing is provided.
Smart Images

Figure CN119201391A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of information technology, and in particular relates to an intelligent task allocation method based on a multi-thread group. Background Art
[0002] The software system needs to handle a large number of concurrent asynchronous tasks through multi-threading. In the actual business process, the concurrency gradually increases, and multiple business asynchronous tasks have staggered peaks. In order to better utilize resources, a mechanism is implemented that can dynamically adjust the thread pool size according to the real-time operating status of the system (including response time, CPU occupancy, memory occupancy, and task queue size). By monitoring these indicators in real time and making decisions based on preset strategies, the thread pool size can be adaptively adjusted to improve system performance and responsiveness. Summary of the invention
[0003] In order to solve the problems raised in the above background technology, the present invention provides an intelligent task allocation method based on multi-thread groups, which comprises the following steps: Step 1: Initialize the thread pool and set the appropriate initial size, maximum size, and queue capacity; Step 2: Implement a monitor to monitor the system's response time, CPU usage, memory usage, and queue size in real time; Step 3: Implement the evaluator, define the evaluation algorithm and threshold, and regularly evaluate the system load; Step 4: Implement the adjuster to dynamically adjust the thread pool size based on the evaluation results and preset strategies; Step 5: During system operation, continuously monitor and evaluate the system status, and dynamically adjust the thread pool size to adapt to load changes.
[0004] As an intelligent task allocation method based on multi-thread groups of the present invention, preferably, in step 1: configuration of the thread pool: - Initially, set the appropriate initial size (`corePoolSize`), maximum size (`maximumPoolSize`), and queue capacity (`workQueue`) for the thread pool based on the system hardware and initial requirements; -The thread pool should maintain a reasonable expansion and reduction strategy to avoid excessive expansion or frequent creation / destruction of threads.
[0005] As an intelligent task allocation method based on multi-thread groups of the present invention, preferably, in step 2: the design of the monitor: -Response time: The average response time can be calculated by recording the time difference between task submission and completion; -CPU usage: Use Java's `OperatingSystemMXBean` or third-party libraries (such as OSHI) to obtain CPU usage; -Memory usage: Use Java's MemoryMXBean or call native methods through JNI to obtain memory usage information; -Queue size: Get the number of currently queued tasks directly from the thread pool's `workQueue`.
[0006] As an intelligent task allocation method based on multi-threaded groups of the present invention, preferably, in step 3: the design of the evaluator: - The evaluator should define a set of thresholds (such as response time threshold, CPU utilization threshold, memory utilization threshold and queue size threshold); -The evaluator should collect monitoring data regularly and evaluate the current system load based on this data; -The evaluation result can be a score or grade to guide subsequent adjuster operations.
[0007] As an intelligent task allocation method based on multi-thread groups of the present invention, preferably, in step 4: the design of the adjuster: - The adjuster should receive the evaluation results of the evaluator and decide whether to adjust the thread pool size according to the preset strategy; - The adjustment strategy can be based on simple threshold judgments (such as increasing the number of threads when the response time exceeds the threshold) or more complex algorithms (such as machine learning algorithms); - The tuner should ensure that the thread pool size is within a reasonable range and avoid over-expansion or frequent adjustments.
[0008] Compared with the prior art, the present invention has the following beneficial effects: The system of the present invention self-detects and self-adjusts, improves resource utilization, enhances system processing capabilities, and reduces operation and maintenance intervention; a graphical delivery interface is provided for real-time viewing. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings: Figure 1 It is a flow chart of the steps of the present invention. DETAILED DESCRIPTION
[0010] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. Example
[0011] like Figure 1 As shown; An intelligent task allocation method based on multi-thread groups.
[0012] In this implementation scheme: In order to solve the technical problems existing in this prior art, as disclosed in the background technology above, "the software system needs to process a large number of concurrent asynchronous tasks through multi-threading. In the actual business process, the concurrency gradually increases, and multiple business asynchronous tasks have staggered peaks. In order to better utilize resources, a mechanism is implemented that can dynamically adjust the thread pool size according to the real-time operating status of the system (including response time, CPU occupancy, memory occupancy and task queue size). By monitoring these indicators in real time and making decisions based on preset strategies, adaptive adjustment of the thread pool size is achieved to improve system performance and responsiveness." Combined with actual use, this problem is obviously a real problem that exists and is relatively difficult to solve. In view of this, in order to solve this technical problem, an intelligent task allocation method based on a multi-thread group is provided.
[0013] like Figure 1 As shown; In combination with the above content, the following steps are included: Step 1: Initialize the thread pool and set the appropriate initial size, maximum size, and queue capacity; Step 2: Implement a monitor to monitor the system's response time, CPU usage, memory usage, and queue size in real time; Step 3: Implement the evaluator, define the evaluation algorithm and threshold, and regularly evaluate the system load; Step 4: Implement the adjuster to dynamically adjust the thread pool size based on the evaluation results and preset strategies; Step 5: During system operation, continuously monitor and evaluate the system status, and dynamically adjust the thread pool size to adapt to load changes.
[0014] In an optional embodiment, in step 1: configuration of the thread pool: - Initially, set the appropriate initial size (`corePoolSize`), maximum size (`maximumPoolSize`), and queue capacity (`workQueue`) for the thread pool based on the system hardware and initial requirements; -The thread pool should maintain a reasonable expansion and reduction strategy to avoid excessive expansion or frequent creation / destruction of threads.
[0015] In an optional embodiment, in step 2: design of the monitor: -Response time: The average response time can be calculated by recording the time difference between task submission and completion; -CPU usage: Use Java's `OperatingSystemMXBean` or third-party libraries (such as OSHI) to obtain CPU usage; -Memory usage: Use Java's MemoryMXBean or call native methods through JNI to obtain memory usage information; -Queue size: Get the number of currently queued tasks directly from the thread pool's `workQueue`.
[0016] In an optional embodiment, in step 3: design of the evaluator: - The evaluator should define a set of thresholds (such as response time threshold, CPU utilization threshold, memory utilization threshold and queue size threshold); -The evaluator should collect monitoring data regularly and evaluate the current system load based on this data; -The evaluation result can be a score or grade to guide subsequent adjuster operations.
[0017] In an optional embodiment, in step 4: design of the regulator: - The adjuster should receive the evaluation results of the evaluator and decide whether to adjust the thread pool size according to the preset strategy; - The adjustment strategy can be based on simple threshold judgments (such as increasing the number of threads when the response time exceeds the threshold) or more complex algorithms (such as machine learning algorithms); - The tuner should ensure that the thread pool size is within a reasonable range and avoid over-expansion or frequent adjustments.
[0018] The system of the present invention self-detects and self-adjusts, improves resource utilization, enhances system processing capabilities, and reduces operation and maintenance intervention; a graphical delivery interface is provided for real-time viewing.
[0019] Finally, it should be noted that the above are only preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein with equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. An intelligent task allocation method based on multi-thread groups, characterized in that: The following steps are involved: Step 1: Initialize the thread pool and set the appropriate initial size, maximum size, and queue capacity; Step 2: Implement a monitor to monitor the system's response time, CPU usage, memory usage, and queue size in real time; Step 3: Implement the evaluator, define the evaluation algorithm and threshold, and regularly evaluate the system load; Step 4: Implement the adjuster to dynamically adjust the thread pool size based on the evaluation results and preset strategies; Step 5: During system operation, continuously monitor and evaluate the system status, and dynamically adjust the thread pool size to adapt to load changes.
2. The intelligent task allocation method based on multi-threaded groups according to claim 1 is characterized in that: In step 1: Configuration of thread pool: - Initially, set the appropriate initial size (`corePoolSize`), maximum size (`maximumPoolSize`), and queue capacity (`workQueue`) for the thread pool based on the system hardware and initial requirements; -The thread pool should maintain a reasonable expansion and reduction strategy to avoid excessive expansion or frequent creation / destruction of threads.
3. The intelligent task allocation method based on multi-threaded groups according to claim 1 is characterized in that: In step 2: Design of monitor: -Response time: The average response time can be calculated by recording the time difference between task submission and completion; -CPU usage: Use Java's `OperatingSystemMXBean` or third-party libraries (such as OSHI) to obtain CPU usage; -Memory usage: Use Java's MemoryMXBean or call native methods through JNI to obtain memory usage information; -Queue size: Get the number of currently queued tasks directly from the thread pool's `workQueue`.
4. The intelligent task allocation method based on multi-thread groups according to claim 1 is characterized in that: In step 3: Design of evaluator: - The evaluator should define a set of thresholds (such as response time threshold, CPU utilization threshold, memory utilization threshold and queue size threshold); -The evaluator should collect monitoring data regularly and evaluate the current system load based on this data; -The evaluation result can be a score or grade to guide subsequent adjuster operations.
5. The intelligent task allocation method based on multi-thread groups according to claim 1 is characterized in that: In step 4: Design of the regulator: - The adjuster should receive the evaluation results of the evaluator and decide whether to adjust the thread pool size according to the preset strategy; - The adjustment strategy can be based on simple threshold judgments (such as increasing the number of threads when the response time exceeds the threshold) or more complex algorithms (such as machine learning algorithms); - The tuner should ensure that the thread pool size is within a reasonable range and avoid over-expansion or frequent adjustments.
Citation Information
Patent Citations
Method and device for adjusting thread pool, storage medium and computer equipment
CN108874550A
Power grid information communication server thread pool performance optimization method and system
CN111930484A
Cited By
Database thread pool dynamic capacity expansion and contraction method and device and electronic equipment
CN120743883A
Intelligent side station supervision system and method for computing power adaptive scheduling
CN122111683A
An intelligent on-site monitoring system and method for adaptive computing power scheduling
CN122111683B