CN115328625A - Thread pool parameter processing method, system, computer device, medium, and program product - Google Patents

Thread pool parameter processing method, system, computer device, medium, and program product Download PDF

Info

Publication number
CN115328625A
CN115328625A CN202210887242.1A CN202210887242A CN115328625A CN 115328625 A CN115328625 A CN 115328625A CN 202210887242 A CN202210887242 A CN 202210887242A CN 115328625 A CN115328625 A CN 115328625A
Authority
CN
China
Prior art keywords
thread pool
instance
configuration
management console
service system
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210887242.1A
Other languages
Chinese (zh)
Inventor
王佳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd
Original Assignee
Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd filed Critical Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd
Priority to CN202210887242.1A priority Critical patent/CN115328625A/en
Publication of CN115328625A publication Critical patent/CN115328625A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/547Messaging middleware

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to the technical field of thread processing, and discloses a thread pool parameter processing method, a thread pool parameter processing system, computer equipment and a storage medium, which are used for improving the modification efficiency of thread pool parameters. The method comprises the following steps: a service system loads thread pool configuration of the service system from a configuration database, and initializes thread pool instances and instance references corresponding to the thread pool instances through the thread pool configuration; the business system stores the thread pool instance and the instance reference in a target storage object of the business system in an associated manner; the management console responds to the configuration modification information and updates the thread pool configuration stored in the configuration database; and feeding back the parameter change message to a service system so that the service system acquires the thread pool instance corresponding to the instance reference and acquires the parameter for updating, configuring and changing the thread pool instance by the thread pool from the configuration database.

Description

Thread pool parameter processing method, system, computer device, medium, and program product
Technical Field
The present application relates to the field of thread processing technologies, and in particular, to a method, a system, a computer device, a storage medium, and a program product for processing thread pool parameters.
Background
Multithreading is an effective means for improving the utilization rate of system resources and the response speed, so the thread pool technology is developed at the same time. Thread pools are a form of multi-threaded processing in which tasks are added to a queue and then automatically started after threads are created, and the thread pools are threads that are all background. The thread pool of the JAVA development kit JDK is an implementation of the thread pool at present.
In the conventional scheme, once the thread pool provided by JDK is created, the thread pool cannot be adjusted, and if the relevant parameters of the thread pool are to be adjusted, the modified version can be released only by modifying the service system code, thereby reducing the modification efficiency of the thread pool parameters.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, a system, a computer device, a storage medium, and a program product for processing thread pool parameters, so as to solve the technical problem of relatively low efficiency in modifying thread pool parameters.
A method of thread pool parameter processing, the method comprising:
a service system loads thread pool configuration of the service system from a configuration database, and initializes thread pool instances and instance references corresponding to the thread pool instances through the thread pool configuration;
the business system stores the thread pool instance and the instance reference in a target storage object of the business system in an associated manner;
a management console receives configuration modification information for the thread pool instance;
the management console responds to the configuration modification information and updates the thread pool configuration stored in the configuration database to obtain thread pool update configuration;
after the updating is successful, the management console feeds back a parameter change message carrying the instance reference to the service system;
and the service system responds to the parameter change message, acquires the thread pool instance corresponding to the instance reference from the target storage object and acquires the thread pool update configuration from the configuration database, and changes the parameter of the thread pool instance according to the thread pool update configuration.
Optionally, the step of feeding back, by the management console, the parameter change message carrying the instance reference to the service system includes:
and the management console publishes the parameter change message to a target topic of a message queue so that the service system subscribed to the target topic receives the parameter change message.
Optionally, the feeding back, by the management console, a parameter change message carrying the instance reference to the service system includes:
and the management console transmits the parameter change message to a directory node corresponding to the service system in the zookeeper so that the service system monitors the parameter change message.
Optionally, the receiving, by the management console, configuration modification information for the thread pool instance includes:
the management console receives a starting instruction of a thread pool management interface and renders a login interface of the thread pool management console in response to the starting instruction;
the management console receives authentication information input by a user on the login interface;
when the verification information passes verification, rendering a thread pool management interface by the management console;
and the management console receives configuration modification information of the user aiming at the thread pool instance through the thread pool management interface.
Optionally, the method further comprises:
the management console monitors the running state of the thread pool corresponding to the thread pool instance;
when the running state of the thread pool of the management console meets an alarm condition, generating alarm information;
and the management console pushes the alarm information to the target application through a message notification interface of the target application.
Optionally, the target storage object includes a hash mapping table, and the service system stores the thread pool instance and the instance reference in association in the target storage object of the service system, including:
and the business system stores the thread pool instance and the instance reference association corresponding to the thread pool instance in the hash mapping table.
A thread pool parameter processing system, the thread pool parameter processing system comprises a management console, a service system, a configuration database and a thread pool parameter processing device, the thread pool parameter processing device comprises:
the creating module is arranged in the business system and used for loading the thread pool configuration of the business system from the configuration database and initializing the thread pool instance of the business system and the instance reference corresponding to the thread pool instance through the thread pool configuration;
the storage module is arranged in the business system and used for storing the thread pool instance and the instance reference in a target storage object of the business system in an associated manner;
a receiving module, disposed in the management console, configured to receive configuration modification information of the management console for the thread pool instance;
the updating module is arranged in the management console and used for responding to the configuration modification information and updating the thread pool configuration stored in the configuration database to obtain thread pool updating configuration;
a sending module, configured in the management console, configured to feed back, to the service system, a parameter change message carrying the instance reference after the thread pool configuration is updated successfully;
an obtaining module, configured to respond to the parameter change message, obtain, from the target storage object, the thread pool instance corresponding to the instance reference, and obtain, from the configuration database, the thread pool update configuration;
and the changing module is arranged in the service system and used for changing the parameters of the thread pool instance according to the thread pool updating configuration.
A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the thread pool parameter processing method as described in any one of the preceding claims when executing the computer program.
A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of managing a console or a business system in the thread pool parameter processing method according to any one of the preceding claims.
A computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements the steps of managing a console or business system in the thread pool parameter processing method according to any one of the preceding claims.
In one of the above-described implemented solutions, when the thread pool parameters of the thread pool need to be changed, the management console may modify the thread pool configuration and write the thread pool configuration into the configuration database, notify the service system to obtain the latest parameter configuration from the data configuration database, and change the thread pool instance created in advance and stored, so as to achieve the purpose of changing the thread pool parameters. Compared with the traditional scheme, the method and the device have the advantages that the thread pool parameters of the running thread pool can be dynamically adjusted, so that the thread pool can reach the optimal running state, a complex correction mode that the service system is reissued after the service code is modified is not needed, the correction process of the thread pool parameters is simpler and more convenient, the dynamic adjustment can be realized, and the correction efficiency is higher.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments of the present application will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive exercise.
FIG. 1 is a system diagram of a thread pool parameter processing system according to an embodiment of the present application;
FIG. 2 is a flow chart illustrating a method for processing process pool parameters according to an embodiment of the present application;
FIG. 3 is another flow chart illustrating a process pool parameter processing method according to an embodiment of the present application;
FIG. 4 is a block diagram of a thread pool parameter processing apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a computer device in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
As shown in fig. 1, fig. 1 is a thread pool parameter processing system provided in this embodiment of the present application, where the thread pool parameter processing system includes a service system, a management console, and a configuration database, and in some embodiments, the thread pool parameter processing system may further include message middleware. The functions or functions of the modules are described as follows:
the service system is a system for providing a specific service application, a specific service application range is not limited, the thread pool parameter processing system in the embodiment of the present application may include at least one service system, that is, may include one or more service systems, and the service system may communicate with the configuration database, the management console, and the message middleware.
The management console is a control platform for providing a thread pool management interface and configuring thread pool parameters, and the thread pool parameters may include, for example, but are not limited to, a thread pool name, a core thread number, a maximum thread number, a thread idle survival time, a blocking queue, an alarm threshold, and other parameters; the management console can communicate with the business system, the configuration database and the message middleware.
The configuration database is a database for storing the thread pool configuration of one or more service systems, and may be in the form of a memory database such as Redis or a database such as Mysql database, which is not particularly limited. The thread pool configuration is written into the configuration database through the management console, the service system can acquire the thread pool configuration from the configuration database for initializing parameters of the created thread pool instance, and the configuration database can be communicated with the service system and the management console.
Message middleware, which is an intermediate component for processing and forwarding parameter change messages, may be implemented by a Message Queue (MQ) in some embodiments, or may implement real-time change notification of parameters by, for example, zookeeper, nacos, etc., and may communicate with the management console and the service system. It should be noted that, in some embodiments, the message middleware may also be omitted, and the message change notification is directly fed back to the service system through the management console, which is not limited specifically. But the adoption of the message middleware can relieve the working pressure of the management console.
The service system may be implemented by an independent server or a server cluster composed of a plurality of servers, and the management console may be implemented by a terminal having a display interface, including a computer, a mobile phone, and other terminal devices, which are not limited specifically.
The following respectively stands on the management console and the service system side, and details a thread pool parameter processing method provided in the embodiment of the present application are described.
In an embodiment, as shown in fig. 2, a method for processing thread pool parameters is provided, which is described by taking the management console in fig. 1 as an example, and includes the following steps:
s10: the management console receives configuration modification information of a thread pool instance, and the thread pool instance is stored in a target storage object of the business system.
S20: and the management console responds to the configuration modification information and updates the thread pool configuration of the thread pool instance stored in the configuration database to obtain the thread pool update configuration.
The thread pool is a multi-thread processing form, generally, in the process of processing a service task, a service system adds tasks to be processed to a task queue, then the service system automatically starts the tasks after creating the thread pool, threads in the thread pool are background threads of the service system and are used for executing the tasks, the thread pool maintains a plurality of threads, the service system is waited to distribute tasks which can be executed concurrently, and one or more thread pools can exist when the service system processes the tasks.
It can be understood that too many threads in the thread pool may bring about scheduling overhead, and further affect the overall performance of the service system, too few threads in the thread pool may not meet service use requirements, and may also affect the performance, and the thread pool not only can ensure the full utilization of the kernel, but also can prevent over-scheduling. The number of threads available depends on the number of concurrent processors, processor cores, memory, networks, etc. of the business system available. Therefore, the parameters of the thread pool are very critical.
In this embodiment, the thread pool created by the business system exists in the form of an instance, and the created thread pool instance and the instance reference association corresponding to the thread pool instance are stored in a target storage object local to the business system. It should be noted that the instance reference is a reference of the thread pool instance, and is used for subsequently querying the thread pool instance from a target storage object local to the business system.
In this embodiment, a management console is defined, where the management console may be a control platform that is interfaced with one or more service systems, and the management console may manage, through a thread pool management interface, thread pool configurations of any one or more thread pool instances of the service system, and write the thread pool configurations into a configuration database, that is, the configuration database stores the thread pool configurations of the one or more thread pool instances of the service system. Specifically, the management console receives configuration modification information of a user for any one of the thread pool instances, and after receiving the configuration modification information, updates the thread pool configuration of the thread pool instance in the configuration database in response to the configuration modification information, so as to obtain a thread pool update configuration.
For example, after receiving the configuration modification information of the user for the thread pool instance a, the management console updates the thread pool configuration of the thread pool instance a in the configuration database according to the configuration modification information of the thread pool instance a, so as to obtain the thread pool update configuration of the thread pool instance a.
In some embodiments, the configuration modification information is used to indicate modification of one or more of the following thread pool parameters: the thread pool name, the core thread number, the maximum thread number, the survival time after the thread is idle, the blocking queue, the alarm threshold value and other parameters.
S30: and the management console generates a parameter change message, wherein the parameter change message carries the instance reference corresponding to the thread pool instance.
S40: and the management console feeds back the parameter change message to a service system so that the service system responds to the parameter change message, acquires the thread pool instance corresponding to the instance reference, and acquires the parameters for updating, configuring and changing the thread pool instance from the configuration database.
After changing the parameters of the thread pool instance in the configuration database, the management console generates a parameter change message, where the parameter change message carries an instance reference corresponding to the thread pool instance to indicate that the parameters of the thread pool instance are changed, and then feeds back the parameter change message to the service system in a preset manner, so that the service system analyzes the parameter change message to obtain the instance reference, then obtains the thread pool instance corresponding to the instance reference from a target storage object, and obtains the latest parameters of the thread pool instance obtained by updating the configuration from the configuration database, thereby achieving the purpose of changing the thread pool parameters in real time.
It can be seen that, in this embodiment, a method for processing thread pool parameters is provided, in which a management console is used to interface a service system and a configuration database, and thread pool parameters of the service system are stored in a target storage object in an instance form, and when the thread pool parameters of a thread pool need to be changed, the management console is used to modify thread pool configuration and write the thread pool configuration into the configuration database, so that the service system obtains a thread pool instance created by the latest parameter configuration change, thereby achieving the purpose of changing the thread pool parameters. Compared with the traditional scheme, the method and the device have the advantages that the thread pool parameters of the running thread pool can be dynamically adjusted, so that the thread pool can reach the optimal running state, a complex correction mode that the service system is reissued after the service code is modified is not needed, the correction process of the thread pool parameters is simpler and more convenient, the dynamic adjustment can be realized, and the correction efficiency is higher.
As explained in the foregoing, the thread pool parameter processing system in the embodiment of the present application may further include message middleware including a message queue MQ or zookeeper. Based on the system, a plurality of different parameter change message notification mechanisms are further provided.
In an embodiment, the feeding back, by the management console, a parameter change message carrying the instance reference to the service system includes: and the management console publishes the parameter change message to a target topic of a message queue so that the business system subscribed to the target topic receives the parameter change message.
In this embodiment, a message middleware is defined, and forwarding of the parameter change message is implemented by the message middleware, which is specifically a message queue MQ. The message queue MQ can establish a publish-subscribe relationship with a service system and a management console based on a theme mode, specifically, the message queue MQ is provided with different themes, wherein the different themes correspond to different service systems, the different service systems can subscribe corresponding themes, the management console serves as a message producer, the service system serves as a message consumer, and when a parameter of a certain thread pool instance of the service system is changed, a parameter change message of the thread pool instance is sent to be published to a target theme corresponding to the service system in the message queue MQ.
For example, after the management console changes the parameter of the thread pool instance a of the service system S1 in the configuration database, the management console generates a parameter change message M1 of the thread pool instance a, and then issues the parameter change message M1 to the topic 1 corresponding to the message queue MQ, so that the service system S1 can obtain the parameter change message M1 from the topic 1.
In this embodiment, a parameter change message issuing method is provided, which improves the implementability of the scheme, and meanwhile, since a general service system has multiple thread pools, it is convenient to manage the change processing of parameters of the multiple thread pools, and also can decouple the management console from the service system, which is convenient to expand the management of the service system.
In an embodiment, the feeding back, by the management console, a parameter change message carrying the instance reference to the service system includes: and the management console transmits the parameter change message to a directory node corresponding to the service system in the zookeeper so that the service system monitors the parameter change message.
In this embodiment, a message middleware is defined, and forwarding of the parameter change message is implemented by the message middleware, where the message middleware is specifically zookeeper (distributed application coordination service software). zookeeper is a distributed, open source distributed application coordination service. The data model of the zookeeper is similar to a tree in a data structure, the tree is composed of nodes, the data storage of the zookeeper is also based on the nodes, the nodes are called Znode, the zookeeper provides Application Programming Interfaces (API), and the API can realize operations including node creation, node deletion, node existence judgment, node data acquisition and the like. In this embodiment, the service system serves as a monitoring client and may be configured to monitor one or more nodes therein, the embodiment of the present application is not set as a directory node, and the management console serves as a server and issues a parameter change message to the directory node corresponding to the service system in the zookeeper, so that the service system monitors the parameter change message on the directory node.
For example, after the management console changes the parameter of the thread pool instance a of the service system S1 in the configuration database, the management console generates a parameter change message M1 of the thread pool instance a, and then issues the parameter change message M1 to the directory node 1 of the zookeeper, so that the service system S1 can monitor the parameter change message M1 from the directory node 1.
In the embodiment, another parameter change message issuing mode is provided, the implementability of the scheme is improved, and meanwhile, due to the fact that a plurality of thread pools exist in a common service system, the change of parameters of the thread pools can be managed conveniently through the implementation mode, the management console and the service system can be decoupled, the management of the service system is expanded conveniently, the service system receives the parameter change message asynchronously, and the processing efficiency is high.
It should be noted that, in some other embodiments, other implementation parameter change messages may also be issued, for example, the parameter change messages may also be modified to implement real-time change of the parameter change messages in combination with other message middleware Nacos (open source dynamic service platform), and the like.
In one embodiment, the management console receives configuration modification information of a user for a thread pool instance, and the configuration modification information comprises:
s11: and the management console receives a starting instruction of the thread pool management interface and renders a login interface of the thread pool management console in response to the starting instruction.
S12: and the management console receives the authentication information input by the user on the login interface.
S13: and when the verification information passes the verification, rendering a thread pool management interface by the management console.
S14: and the management console receives the configuration modification information of the user aiming at the thread pool instance through the thread pool management interface.
In this embodiment, the management console provides a thread pool management interface, and a manager user of any service system can input a start instruction of the thread pool management interface through the thread management console, so that the management console receives and responds to the start instruction to render a login interface of the thread pool management console. The login interface prompts the user to enter corresponding authentication information. Illustratively, the verification information includes an account number or account information, and key information corresponding to the account number or account information. The user can input the authentication information through the login interface, and the management console authenticates the input authentication information after receiving the authentication information, wherein the specific authentication mode depends on the authentication information form, and is not limited herein. For example, whether the key information corresponding to the account number or the account information is the same as the pre-stored key information is verified, if so, the verification is passed, otherwise, the verification is not passed.
After verification, rendering a thread pool management interface corresponding to the service system, and receiving configuration modification information of a user for a certain thread pool instance through the thread pool management interface by the user. For example, after a manager of the service system S1 logs in, the management console renders a thread pool management interface corresponding to the service system S1, so that the user can modify any thread pool instance of the service system S1. Specifically, the user can find the corresponding thread pool instance through the thread pool name, then modify the parameters of the thread pool instance, update the parameters of the thread pool instance in the configuration database after modification, and send a parameter change message to the service system.
In the embodiment, a visual thread pool management interface is provided, real-time configuration can be performed on the basis of the thread pool management interface, account numbers of different business systems are configured, the thread pool can be managed conveniently and uniformly, and the method is more visual.
In one embodiment, the method further comprises the steps of:
s50: and the management console monitors the running state of the thread pool corresponding to the thread pool instance.
S60: and when the running state of the thread pool corresponding to the thread pool instance meets the alarm condition, the management console generates alarm information.
S70: and the management console pushes the alarm information to the target application through a message notification interface of the target application.
In this embodiment, the management console may monitor the running state of the thread pool corresponding to the thread pool instance of the service system due to the fact that the management console is interfaced with the service system, and for example, the running state of the thread pool includes that the number of queue tasks in the thread pool approaches a preset threshold, the number of queue tasks exceeds the threshold, the task waiting time in the task blocking queue of the thread pool and/or whether the task blocking queue is full, and the like. It should be noted that the above examples are only illustrative and do not limit the embodiments of the present application.
When the running state of the thread pool corresponding to the thread pool instance meets the alarm condition, alarm information is generated, and then the alarm information is pushed to the target application through a message notification interface of the target application, so that a user can quickly obtain an alarm instruction through the target application, and after receiving the alarm instruction, the user can check, check the system condition, make corresponding adjustment in time, and conveniently make corresponding changes to the thread pool parameters.
It should be noted that the target application may be an application installed in a terminal (for example, a mobile phone) used by a user, or may be an applet, and the target english is generally an application with a relatively high user frequency.
In the embodiment, under the abnormal state of the thread pool, the invention can provide a thread pool alarm mechanism, send alarm indication to a user in real time, play a role in monitoring, play a role in positioning and alarming the abnormality of each thread pool, provide a solution for the problem that the thread pools with different service scenes cannot be effectively managed, and avoid great accidents to a service system.
It should be noted that the foregoing embodiment is described from the perspective of a management console, and the following describes in detail the thread pool parameter processing method provided in the embodiment of the present application from the perspective of a service system.
In an embodiment, as shown in fig. 3, a method for processing a thread pool parameter is provided, which is described by taking the service system in fig. 1 as an example, and includes the following steps:
s101: and the service system loads the thread pool configuration of the service system from the configuration database, and initializes the thread pool instance and the instance reference corresponding to the thread pool instance through the thread pool configuration.
S102: and the business system stores the thread pool instance and the instance reference corresponding to the thread pool instance in a target storage object in an associated manner.
After the service system is started, the thread pool configuration corresponding to the service system is loaded from the configuration database, then the thread pool is initialized through the loaded thread pool configuration, and a thread pool instance corresponding to the thread pool is created, wherein the initialized content includes but is not limited to setting a thread pool name, a core thread number, a maximum thread number, thread survival time after idle and the like. The business system adds the tasks to be processed to the task queue in the process of processing the tasks, then the business system automatically starts the tasks after creating the thread pool, and the business system can have the thread pool when processing the tasks, so that a thread pool instance corresponding to the thread pool can be created through the thread pool configuration.
And after the service system creates the thread pool instance, storing the thread pool instance and the instance reference association corresponding to the thread pool instance in a target storage object. In this embodiment, the thread pool created by the business system exists in the form of an instance, and the created thread pool instance and the instance reference corresponding to the thread pool instance are stored in a target storage object local to the business system in an associated manner. It should be noted that the instance reference is a reference of the thread pool instance, and is used for subsequently querying the thread pool instance from a target storage object local to the business system.
Illustratively, the thread pool instance created by the business system may be a ThreadPoolExecutor instance.
In an embodiment, the target storage object includes a hash map (HashMap), and the service system stores the thread pool instance and the instance reference corresponding to the thread pool instance in the target storage object in an associated manner, including: and the business system stores the thread pool instance and the instance reference association corresponding to the thread pool instance in the hash mapping table.
In this embodiment, the business system creates a HashMap, and then serves as a target storage object for storing all created thread pool instances, since the interior of the HashMap uses an array to store elements, and the positions where the elements are stored are determined by subscript numbers generated by a hashing algorithm according to the return value of the hashcode () method of the key value. Therefore, when the elements are inquired, the HashMap can calculate the corresponding subscript by depending on the return value of the given key Hashcode () method, and then directly access the corresponding elements through the subscript, so that the process of traversing the array is omitted.
S103: and the service system receives the parameter change message carrying the instance reference.
After changing the parameters of the thread pool instance in the configuration database, the management console generates a parameter change message carrying an instance reference corresponding to the thread pool instance to indicate that the parameters of the thread pool instance are changed, and then feeds back the parameter change message to the service system in a preset mode. The functions of the management console side can be referred to the foregoing embodiments, and are not described repeatedly here.
S104: and the service system responds to the parameter change message to acquire the thread pool instance corresponding to the instance reference from the target storage object and acquire the thread pool update configuration of the thread pool instance from the configuration database.
After receiving the parameter change message, the service system responds to the parameter change message, analyzes the parameter change message to obtain an instance reference, then obtains the thread pool instance corresponding to the instance reference from a target storage object, and obtains the latest thread pool update configuration from the configuration database to change the parameters of the thread pool instance, thereby achieving the purpose of changing the parameters of the thread pool in real time.
S105: and the service system changes the thread pool parameters of the thread pool instance through the thread pool updating configuration.
For example, after receiving configuration modification information of a user for a thread pool instance a, a management console updates the parameter configuration of the thread pool instance a in a configuration database according to the configuration modification information of the thread pool instance a, generates a parameter change message As that changes the thread pool parameters of the thread pool instance a after the update is completed, and after receiving the parameter change message As, a service system finds the thread pool instance a from a target storage object by using an instance reference carried by the parameter change message As, acquires the latest thread pool parameter configuration from the configuration database, and changes the parameter configuration of the thread pool instance a, thereby achieving the purpose of updating the thread pool parameters.
It can be seen that, in this embodiment, a method for processing thread pool parameters is provided, where a management console is used to interface a service system and a configuration database, and thread pool parameters of the service system are stored in a target storage object in an instance form, and when the thread pool parameters of a thread pool need to be changed, the management console is used to modify thread pool configuration and write the thread pool configuration into the configuration database, so that the service system obtains a thread pool instance created by the latest parameter configuration change, thereby achieving the purpose of changing the thread pool parameters. Compared with the traditional scheme, the method and the device have the advantages that the thread pool parameters of the running thread pool can be dynamically adjusted, so that the thread pool can reach the optimal running state, a complex correction mode that the service system is reissued after the service code is modified is not needed, the correction process of the thread pool parameters is simpler and more convenient, the dynamic adjustment can be realized, and the correction efficiency is higher.
In one embodiment, from the perspective of interaction, a method for processing thread pool parameters is provided, which includes the following steps:
s201: a service system loads thread pool configuration of the service system from a configuration database, and initializes thread pool instances and instance references corresponding to the thread pool instances through the thread pool configuration;
s202: the business system stores the thread pool instance and the instance reference in a target storage object of the business system in an associated manner;
s203: the management console receives configuration modification information aiming at the thread pool instance;
s204: the management console responds to the configuration modification information and updates the thread pool configuration stored in the configuration database to obtain thread pool update configuration;
s205: after the updating is successful, the management console feeds back a parameter change message carrying the instance reference to the service system;
s206: and the service system responds to the parameter change message, acquires the thread pool instance corresponding to the instance reference from the target storage object and acquires the thread pool update configuration from the configuration database, and changes the parameter of the thread pool instance according to the thread pool update configuration.
The details of each step can be correspondingly referred to the corresponding description in the foregoing embodiments, and are not described here.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by functions and internal logic of the process, and should not constitute any limitation to the implementation process of the embodiments of the present application.
In one embodiment, a thread pool parameter processing system is provided, the thread pool parameter processing system includes a management console, a business system, a configuration database, and a thread pool parameter processing apparatus, as shown in fig. 4, the thread pool parameter processing apparatus 10 includes:
a creating module 101, configured in the service system, configured to load a thread pool configuration of the service system from the configuration database, and initialize a thread pool instance of the service system and an instance reference corresponding to the thread pool instance through the thread pool configuration;
a storage module 102, disposed in the business system, and configured to store the thread pool instance and the instance reference in a target storage object of the business system in an associated manner;
a receiving module 103, disposed in the management console, configured to receive configuration modification information of the management console for the thread pool instance;
an updating module 104, disposed in the management console, and configured to update the thread pool configuration stored in the configuration database in response to the configuration modification information, so as to obtain a thread pool update configuration;
a sending module 105, configured in the management console, and configured to feed back, to the service system, a parameter change message carrying the instance reference after the thread pool configuration is updated successfully;
an obtaining module 106, configured to respond to the parameter change message, obtain the thread pool instance corresponding to the instance reference from the target storage object, and obtain the thread pool update configuration from the configuration database;
and a changing module 107, arranged in the service system, for changing the parameter of the thread pool instance according to the thread pool update configuration.
The details or steps of the implementation of each module of the thread pool parameter processing apparatus may be referred to the description in the foregoing method embodiment, and in order to avoid redundancy, the description is not repeated here.
In one embodiment, a computer device for implementing the steps of managing a console or implementing the steps of a business system side is provided, and the internal structure diagram can be as shown in fig. 5. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The computer device also includes a computer-readable storage medium, a memory. The network interface of the computer device is used for communicating with an external service system through network connection. The computer readable instructions are executed by a processor to implement functions or steps of a management console side in a thread pool parameter processing method, or implement functions or steps of a business system side. The computer-readable storage media provided by the present embodiments include non-volatile readable storage media and volatile readable storage media.
In one embodiment, a computer device is provided, which includes a memory, a processor, and computer readable instructions stored in the memory and executable on the processor, and when the processor executes the computer readable instructions, the steps of the management console side or the business system side in the thread pool parameter processing method are implemented.
In one embodiment, a computer readable storage medium is provided, which stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the management console side or the business system side in the thread pool parameter processing method as described above.
A computer program product comprising a computer program which, when executed by a processor, implements the steps of the management console side, or the business system side, of a thread pool parameter processing method as described above.
It should be noted that, for more details about the implementation of the computer device or the computer readable storage medium, reference may be made to the foregoing embodiments, and detailed descriptions thereof are not repeated here.
It will be understood by those of ordinary skill in the art that all or part of the processes of the methods of the above embodiments may be implemented by hardware related to computer readable instructions, which may be stored in a non-volatile readable storage medium or a volatile readable storage medium, and when executed, the computer readable instructions may include processes of the above embodiments of the methods. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), rambus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the embodiments of the present application, and they should be construed as being included in the present application.

Claims (10)

1. A method for processing thread pool parameters, the method comprising:
a service system loads thread pool configuration of the service system from a configuration database, and initializes thread pool instances and instance references corresponding to the thread pool instances through the thread pool configuration;
the business system stores the thread pool instance and the instance reference in a target storage object of the business system in an associated manner;
a management console receives configuration modification information for the thread pool instance;
the management console responds to the configuration modification information and updates the thread pool configuration stored in the configuration database to obtain thread pool update configuration;
after the updating is successful, the management console feeds back a parameter change message carrying the instance reference to the service system;
and the service system responds to the parameter change message, acquires the thread pool instance corresponding to the instance reference from the target storage object and acquires the thread pool update configuration from the configuration database, and changes the parameter of the thread pool instance according to the thread pool update configuration.
2. The thread pool parameter processing method of claim 1, wherein the step of the management console feeding back a parameter change message carrying the instance reference to the service system comprises:
and the management console publishes the parameter change message to a target topic of a message queue so that the business system subscribed with the target topic receives the parameter change message.
3. The thread pool parameter processing method of claim 1, wherein the step of the management console feeding back a parameter change message carrying the instance reference to the service system comprises:
and the management console transmits the parameter change message to a directory node corresponding to the service system in the zookeeper so that the service system monitors the parameter change message.
4. The thread pool parameter processing method of claim 1, wherein the management console receiving configuration modification information for the thread pool instance comprises:
the management console receives a starting instruction of a thread pool management interface and renders a login interface of the thread pool management console in response to the starting instruction;
the management console receives authentication information input by a user on the login interface;
when the verification information passes verification, rendering a thread pool management interface by the management console;
and the management console receives configuration modification information of the user aiming at the thread pool instance through the thread pool management interface.
5. The thread pool parameter processing method of any of claims 1-4, wherein the method further comprises:
the management console monitors the running state of the thread pool corresponding to the thread pool instance;
when the management console monitors that the running state of the thread pool meets the alarm condition, generating alarm information;
and the management console pushes the alarm information to the target application through a message notification interface of the target application.
6. The thread pool parameter processing method of any of claims 1-4, wherein the business system saves the thread pool instance and the instance reference in association in a target storage object of the business system, comprising:
and the service system stores the thread pool instance and the instance reference association in a hash mapping table of the service system.
7. A thread pool parameter processing system is characterized in that the thread pool parameter processing system comprises a management console, a service system, a configuration database and a thread pool parameter processing device, and the thread pool parameter processing device comprises:
the creating module is arranged in the business system and used for loading the thread pool configuration of the business system from the configuration database and initializing the thread pool instance of the business system and the instance reference corresponding to the thread pool instance through the thread pool configuration;
the storage module is arranged in the business system and used for storing the thread pool instance and the instance reference in a target storage object of the business system in a related manner;
a receiving module, configured in the management console, for receiving configuration modification information of the management console for the thread pool instance;
the updating module is arranged in the management console and used for responding to the configuration modification information and updating the thread pool configuration stored in the configuration database to obtain thread pool updating configuration;
a sending module, configured in the management console, for feeding back, to the service system, a parameter change message carrying the instance reference after the thread pool configuration is updated successfully;
an obtaining module, arranged in the service system, for responding to the parameter change message, obtaining the thread pool instance corresponding to the instance reference from the target storage object, and obtaining the thread pool update configuration from the configuration database;
and the changing module is arranged in the service system and used for changing the parameters of the thread pool instance according to the thread pool updating configuration.
8. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the thread pool parameter processing method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, in which a computer program is stored, which computer program, when being executed by a processor, carries out the steps of the thread pool parameter processing method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements the steps of the thread pool parameter processing method of any one of claims 1 to 6.
CN202210887242.1A 2022-07-26 2022-07-26 Thread pool parameter processing method, system, computer device, medium, and program product Pending CN115328625A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210887242.1A CN115328625A (en) 2022-07-26 2022-07-26 Thread pool parameter processing method, system, computer device, medium, and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210887242.1A CN115328625A (en) 2022-07-26 2022-07-26 Thread pool parameter processing method, system, computer device, medium, and program product

Publications (1)

Publication Number Publication Date
CN115328625A true CN115328625A (en) 2022-11-11

Family

ID=83919289

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210887242.1A Pending CN115328625A (en) 2022-07-26 2022-07-26 Thread pool parameter processing method, system, computer device, medium, and program product

Country Status (1)

Country Link
CN (1) CN115328625A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115794449A (en) * 2023-02-10 2023-03-14 中科源码(成都)服务机器人研究院有限公司 Dynamic thread pool construction method, remote procedure calling method and device
CN115794391A (en) * 2022-11-24 2023-03-14 灵犀科技有限公司 Method and system for dynamically modifying thread pool parameter configuration on line

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115794391A (en) * 2022-11-24 2023-03-14 灵犀科技有限公司 Method and system for dynamically modifying thread pool parameter configuration on line
CN115794449A (en) * 2023-02-10 2023-03-14 中科源码(成都)服务机器人研究院有限公司 Dynamic thread pool construction method, remote procedure calling method and device
CN115794449B (en) * 2023-02-10 2023-10-03 中科源码(成都)服务机器人研究院有限公司 Dynamic thread pool construction method, remote procedure call method and device

Similar Documents

Publication Publication Date Title
US10540351B2 (en) Query dispatch and execution architecture
CN115328625A (en) Thread pool parameter processing method, system, computer device, medium, and program product
CN110968603B (en) Data access method and device
CN113626286B (en) Multi-cluster instance processing method and device, electronic equipment and storage medium
CN108055322B (en) Request message processing method and device
US20220283846A1 (en) Pod deployment method and apparatus
US10649765B2 (en) Systems and methods for preventing service disruption during software updates
CN113204353B (en) Big data platform assembly deployment method and device
US9081604B2 (en) Automatic discovery of externally added devices
CN111897633A (en) Task processing method and device
US20230275976A1 (en) Data processing method and apparatus, and computer-readable storage medium
CN112882738A (en) Configuration information updating method and device under micro-service architecture and electronic equipment
CN110611707A (en) Task scheduling method and device
CN110569124A (en) Task allocation method and device
CN113626211A (en) Switching method and switching system of message queue, electronic equipment and storage medium
CN114138434A (en) Big data task scheduling system
CN115357403A (en) Micro-service system for task scheduling and task scheduling method
CN113946427A (en) Task processing method, processor and storage medium for multi-operating system
US11900119B2 (en) System and method for automatically controlling operating state of an application
CN106897128B (en) Distributed application quitting method, system and server
WO2024108995A1 (en) Data exchange method and apparatus, and computer device and storage medium
CN117076096A (en) Task flow execution method and device, computer readable medium and electronic equipment
CN112187570A (en) Risk detection method and device, electronic equipment and readable storage medium
CN109005465B (en) Bullet screen message distribution method, device, equipment and storage medium
CN115981826A (en) Task scheduling processing method and device, computer equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination