A thread scheduling system, computer device and storage medium

Through the design thread scheduling system, the problem of unbalanced load load in the core business interface in the IT system is solved, the optimized distribution and elastic telescopic of thread resources are realized, the system stability and user experience are guaranteed, and the hardware cost is saved.

CN112445615BActive Publication Date: 2025-01-28GUANGDONG HAUCI NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011263178.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-12
Publication Date
2025-01-28
Estimated Expiration
2040-11-12

AI Technical Summary

Technical Problem

The existing technology cannot effectively solve the problem of unbalanced load of core business interfaces in IT systems, resulting in the seizing of non-core business resources that seriously affect the operation of core business and affect the user experience.

Method used

A thread scheduling system is designed, including cluster scheduling modules, data distribution modules, resource management modules and core modules. Through dynamic synchronous thread pool models, resource pooling, and thread creation and destruction, the elastic retractable and optimization of thread resources distribute.

Benefits of technology

The system crash and core business response due to uneven distribution of thread resources and the slow core business response, which guarantees the stability and user experience of the Internet medical platform, reduces the dependence on hardware resources and saves hardware costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112445615B_ABST
    Figure CN112445615B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a thread scheduling system, computer equipment and storage medium, including: a cluster scheduling module, a data distribution module, a resource management module and a core module; wherein the cluster scheduling module is used to synchronize the dynamic data of the thread pool model of any node of the business system to the middleware in real time, and then the middleware sends the changed data to other nodes; the data distribution module is used to obtain the node dynamic data from the middleware to adjust the thread pool model of the current node in real time; the resource management module is used for the resource management layer to pool the entire system resources, and all the resources of the thread pool are uniformly divided into various types of groups; the core module is used for the core layer to be responsible for the creation and destruction of threads. When the number of core threads meets the demand, the task will be executed by the idle thread; when the number of core threads is insufficient, a new thread will be created to execute the task; the dependence on hardware resources is reduced, saving hardware costs for the enterprise.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of mechanical technology, and in particular to a thread scheduling system, a computer device and a storage medium. Background Art

[0002] In the same IT system, the interfaces corresponding to core businesses will bear higher loads than those corresponding to non-core businesses. As businesses expand and the number of users increases, this load gap becomes more and more obvious. The occupation of system resources by non-core businesses seriously affects the normal operation of core businesses. When the balance threshold is exceeded, non-core businesses will respond normally while core businesses will respond slowly, which will eventually affect the stability of the medical system and bring extremely poor user experience to the terminals.

[0003] The current open source thread pool cannot divide resources according to the priority of the business. In order to solve the problem of unbalanced load of the core business interface, the industry generally adopts the method of splitting the core business into more subsystems and then expanding them horizontally. This approach not only destroys the original scalability of the system and makes it difficult to maintain in the future, but also requires more investment in hardware or software resources. The uneven distribution of thread resources leads to slow response of the core business. Summary of the invention

[0004] In view of the above problems, embodiments of the present invention are proposed to provide a thread scheduling system, a computer device and a storage medium that overcome the above problems or at least partially solve the above problems.

[0005] In order to solve the above problems, an embodiment of the present invention discloses a thread scheduling system, including:

[0006] Cluster scheduling module, data distribution module, resource management module and core module;

[0007] The cluster scheduling module is used to synchronize the dynamic data of the thread pool model of any node in the business system to the middleware in real time, and then the middleware sends the changed data to other nodes;

[0008] The data distribution module is used to obtain node dynamic data from the middleware and adjust the thread pool model of the current node in real time;

[0009] The resource management module is used for the resource management layer to pool the entire system resources and divide all resources of the thread pool into various types of groups;

[0010] The core module is used in the core layer to be responsible for the creation and destruction of threads. When the number of core threads meets the demand, the task will be executed by the idle thread; when the number of core threads is insufficient, a new thread will be created to execute the task.

[0011] Preferably, the data distribution module is also used to perform parameter verification and filtering on external requests, encapsulate the passed data into tasks, schedule corresponding system resources for the tasks, and transmit them to the resource management layer at the same time.

[0012] Preferably, the data distribution module is also used to recycle resources of tasks that have been executed at the bottom layer and trigger external callback logic after execution.

[0013] Preferably, the data distribution module is also used to pass the task to the core layer for execution when the group resources corresponding to the task are sufficient, otherwise it will be stored in the cache queue of the group waiting for execution. The group can be dynamically changed or destroyed according to business needs, thereby realizing elastic scaling of the thread pool.

[0014] Preferably, the core module is also used for, when the number of threads has reached a maximum limit, the task enters a cache queue and waits for execution.

[0015] Preferably, the thread pool group types include public pool, private pool, restricted mode private pool, reserved mode private pool;

[0016] The public pool is for initializing all thread resources of the thread pool. All types of group resources come from the public pool. When the group is destroyed, the resources will be recycled by the public pool.

[0017] The private pool is a dedicated pool that allocates a specified number of threads from the public pool. It can only be used for tasks in this group. When the number of tasks exceeds the reserved number, they enter the queue and can no longer compete with the public pool.

[0018] The restricted mode private pool is a shared pool that allocates a specified number of threads from the public pool. The number of threads consumed by this group cannot exceed the defined reserved number. When there is no task for this group, the threads can be used by the public pool.

[0019] The reserved mode private pool allocates a specified number of threads from the public pool, with exclusive and shared use coexisting.

[0020] The embodiment of the present invention further discloses a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned thread scheduling system when executing the computer program.

[0021] The embodiment of the present invention further discloses a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the thread scheduling system are implemented.

[0022] The embodiments of the present invention include the following advantages:

[0023] In an embodiment of the present invention, the thread scheduling system includes: a cluster scheduling module, a data distribution module, a resource management module and a core module; wherein the cluster scheduling module is used to synchronize the dynamic data of the thread pool model of any node of the business system to the middleware in real time, and then the middleware sends the changed data to other nodes; the data distribution module is used to obtain the node dynamic data from the middleware to adjust the thread pool model of the current node in real time; the resource management module is used for the resource management layer to pool the entire system resources, and to uniformly divide all the resources of the thread pool into various types of groups; the core module is used for the core layer to be responsible for the creation and destruction of threads. When the number of core threads meets the demand, the task will be executed by the idle thread; when the number of core threads is insufficient, a new thread will be created to execute the task; unified management of thread resources to avoid system crashes due to thread abuse; can prevent the problem of unbalanced load of the core business interface due to resource preemption, thereby causing system instability, and ensure that the Internet medical platform provides a good user experience; reduce dependence on hardware resources and save hardware costs for enterprises. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0025] Figure 1 It is a structural block diagram of a thread scheduling system embodiment of an embodiment of the present invention;

[0026] Figure 2 is a system hierarchy diagram of an embodiment of the present invention;

[0027] Figure 3 It is a hierarchical division diagram of a thread pool model of each node in an embodiment of the present invention;

[0028] Figure 4 It is a transformation diagram of a thread pool according to an embodiment of the present invention;

[0029] Figure 5 The diagram is a diagram of the internal structure of a computer device according to an embodiment. DETAILED DESCRIPTION

[0030] In order to make the technical problems, technical solutions and beneficial effects solved by the embodiments of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0031] Reference Figure 1 , shows a structural block diagram of a thread scheduling system embodiment of an embodiment of the present invention, which may specifically include the following modules:

[0032] Cluster scheduling module 301, data distribution module 302, resource management module 303 and core module 304;

[0033] The cluster scheduling module is used to synchronize the dynamic data of the thread pool model of any node in the business system to the middleware in real time, and then the middleware sends the changed data to other nodes;

[0034] The data distribution module is used to obtain node dynamic data from the middleware and adjust the thread pool model of the current node in real time;

[0035] The resource management module is used for the resource management layer to pool the entire system resources and divide all resources of the thread pool into various types of groups;

[0036] The core module is used in the core layer to be responsible for the creation and destruction of threads. When the number of core threads meets the demand, the task will be executed by the idle thread; when the number of core threads is insufficient, a new thread will be created to execute the task.

[0037] Specifically applied to the embodiment of the present invention, the data distribution module is also used to perform parameter verification and filtering on external requests, encapsulate the passed data into tasks, schedule corresponding system resources for the tasks, and transmit them to the resource management layer at the same time.

[0038] Furthermore, the data distribution module is also used to recycle resources of tasks that have been executed at the bottom layer and trigger external callback logic after execution.

[0039] In the embodiment of the present invention, the data distribution module is also used to pass the task to the core layer for execution when the group resources corresponding to the task are sufficient, otherwise the task will be stored in the cache queue of the group and wait for execution. The group can be dynamically changed or destroyed according to business needs, thereby realizing elastic scaling of the thread pool.

[0040] Specifically, the core module is also used for, when the number of threads has reached the maximum limit, the task enters the cache queue and waits for execution.

[0041] In a preferred embodiment of the present invention, the thread pool group types include a public pool, a private pool, a restricted mode private pool, and a reserved mode private pool;

[0042] The public pool is for initializing all thread resources of the thread pool. All types of group resources come from the public pool. When the group is destroyed, the resources will be recycled by the public pool.

[0043] The private pool is a dedicated pool that allocates a specified number of threads from the public pool. It can only be used by tasks in this group. When the number of tasks exceeds the reserved number, they enter the queue and can no longer compete with the public pool.

[0044] The restricted mode private pool is a shared pool that allocates a specified number of threads from the public pool. The number of threads consumed by this group cannot exceed the defined reserved number. When there is no task for this group, the threads can be used by the public pool.

[0045] The reserved mode private pool allocates a specified number of threads from the public pool, with exclusive and shared use coexisting.

[0046] In an embodiment of the present invention, the thread scheduling system includes: a cluster scheduling module, a data distribution module, a resource management module and a core module; wherein the cluster scheduling module is used to synchronize the dynamic data of the thread pool model of any node of the business system to the middleware in real time, and then the middleware sends the changed data to other nodes; the data distribution module is used to obtain the node dynamic data from the middleware to adjust the thread pool model of the current node in real time; the resource management module is used for the resource management layer to pool the entire system resources, and to uniformly divide all the resources of the thread pool into various types of groups; the core module is used for the core layer to be responsible for the creation and destruction of threads. When the number of core threads meets the demand, the task will be executed by the idle thread; when the number of core threads is insufficient, a new thread will be created to execute the task; unified management of thread resources to avoid system crashes due to thread abuse; can prevent the problem of unbalanced load of the core business interface due to resource preemption, thereby causing system instability, and ensure that the Internet medical platform provides a good user experience; reduce dependence on hardware resources and save hardware costs for enterprises.

[0047] In order to enable those skilled in the art to better understand the embodiments of the present invention, a specific example is provided below for explanation:

[0048] Reference Figure 2 , shows a system hierarchy diagram of an embodiment of the present invention, such as Figure 2 As shown, the system of the present invention includes four layers, namely, cluster scheduling layer, data distribution layer, resource management layer, and core layer from the top layer of the cluster to the bottom layer of the single system. The cluster scheduling layer uses the characteristics of cluster data consistency of Zookeeper (i.e., middleware) to synchronize the dynamic data of the thread pool model of any node in the business system to Zookeeper in real time, and then Zookeeper sends the changed data to other listening nodes, so as to achieve consistency of the thread pool model of all nodes in the entire business system cluster.

[0049] The data distribution layer obtains node dynamic data from Zookeeper to adjust the thread pool model of the current node in real time, performs parameter verification and filtering on external requests, encapsulates the passed data into Tasks, schedules the corresponding system resources for Tasks, and transmits them to the resource management layer. It recycles resources for Tasks that have been executed at the bottom layer and triggers external callback logic after execution.

[0050] The resource management layer pools the entire system resources and divides all the resources of the thread pool into various types of groups. It can monitor the operation and resource usage of each group in real time. When the group resources corresponding to the task are sufficient, the task will be passed to the core layer for execution, otherwise it will be stored in the cache queue of the group and wait for execution. The group can be dynamically changed or destroyed according to business needs, thereby realizing the elastic scaling of the thread pool. The resource management layer can also provide a snapshot of the system's resource operation so that the management background can provide a visual interface.

[0051] The core layer is responsible for the creation and destruction of threads. When the number of core threads meets the demand, the task will be executed by the idle thread; when the number of core threads is insufficient, a new thread will be created to execute the task; if the number of threads has reached the maximum limit, the task will enter the cache queue and wait for execution;

[0052] Reference Figure 3 , shows a hierarchical division diagram of the thread pool model of each node in an embodiment of the present invention. The thread pool model of each node in the cluster is dynamically stored in Zookeeper in four layers. The top layer Root is the root node marked as thread pool data; the System layer is a description of the business system, each business system corresponds to a node, and the calculate node is an automatic calculation system node; the Type layer is divided into the node address and the thread pool group type; the URL records the specific address of each node in the cluster and the specific type of the thread pool group.

[0053] Reference Figure 4 , showing a transformation diagram of a thread pool according to an embodiment of the present invention, there are four group types of thread pools, namely, a public pool, a private pool, a restricted mode private pool, and a reserved mode private pool.

[0054] Public pool: initializes all thread resources of the thread pool. Any type of group resources comes from the public pool. When the group is destroyed, the resources will be recycled by the public pool.

[0055] Private pool: A specified number of threads are allocated from the public pool. They are exclusive and can only be used for tasks in this group. When the number of tasks exceeds the reserved number, they enter the queue and can no longer compete with the public pool.

[0056] Restricted mode private pool: a specified number of threads are allocated from the public pool. The shared type means that the number of threads consumed by this group cannot exceed the defined reserved number. When there is no task for this group, the threads can be used by the public pool.

[0057] Reserved mode private pool: a specified number of threads are divided from the public pool, and exclusive and shared threads coexist. When the tasks of this group are executed, they are based on the principle of "first compete for private, then compete for public, first release public, then release private".

[0058] Each module in the above thread scheduling system can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0059] The thread scheduling system provided above can be used to execute the method steps corresponding to the thread scheduling system provided in any of the above embodiments, and has corresponding functions and beneficial effects.

[0060] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a thread scheduling system is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0061] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0062] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, Figures 1 to 4 The thread scheduling system corresponds to the steps.

[0063] In one embodiment, a computer-readable storage medium is provided on which a computer program is stored. When the computer program is executed by a processor, the following is achieved: Figures 1 to 4 The thread scheduling system corresponds to the steps.

[0064] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0065] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0066] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0067] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0068] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0069] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0070] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0071] The above is a detailed introduction to a thread scheduling system, a computer device and a storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for a person skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A thread scheduling system, characterized in that: include: Cluster scheduling module, data distribution module, resource management module and core module; wherein, the cluster scheduling module is used to synchronize the dynamic data of the thread pool model of any node in the business system to the middleware in real time, and then the middleware sends the dynamic data of the node thread pool model to other nodes; the data distribution module is used to obtain the dynamic data of the node thread pool model from the middleware to adjust the thread pool model of the current node in real time; the resource management module is used for the resource management layer to pool all the resources of the thread pool, and divide all the resources of the thread pool into various types of groups; the core module is used for the core layer to be responsible for the creation and destruction of threads. When the number of core threads meets the demand, the task will be executed by the idle thread; when the number of core threads is insufficient, a new thread will be created to execute the task.

2. The dispatching system according to claim 1, characterized in that: The data distribution module is also used to perform parameter verification and filtering on external requests, encapsulate the passed data into tasks, schedule corresponding system resources for the tasks, and transmit them to the resource management layer at the same time.

3. The dispatching system according to claim 2, characterized in that: The data distribution module is also used to recycle resources of tasks that have been executed at the bottom layer and trigger external callback logic after execution.

4. The dispatching system according to claim 1, characterized in that: The data distribution module is also used to pass the task to the core layer for execution when the group resources corresponding to the task are sufficient, otherwise the task will be stored in the group's cache queue waiting for execution. The group can be dynamically changed or destroyed according to business needs, thereby achieving elastic scaling of the thread pool.

5. The dispatching system according to claim 1, characterized in that: The core module is also used for, when the number of threads has reached the maximum limit, the task enters the cache queue and waits for execution.

6. The dispatching system according to claim 1, characterized in that: The thread pool group types include public pool, private pool, restricted mode private pool and reserved mode private pool; the public pool is for initializing all thread resources of the thread pool, and any type of group resources are derived from the public pool. When the group is destroyed, the resources will be recycled by the public pool; the private pool is for allocating a specified number of threads from the public pool, which is exclusive and can only be used for tasks of this group. When the number of tasks exceeds the reserved number, they enter the queue and can no longer compete with the public pool; the restricted mode private pool is for allocating a specified number of threads from the public pool, which is shared. The number of threads consumed by this group cannot exceed the defined reserved number. When there are no tasks for this group, the threads can be used by the public pool; the reserved mode private pool is for allocating a specified number of threads from the public pool, with both exclusive and shared use.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the thread scheduling system according to any one of claims 1 to 6 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the thread scheduling system according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • System and method for monitoring and scheduling of middleware threads

    CN103428272A

  • Multi-tasking queue scheduling method based on thread pool

    CN103473138A