CN114398163A - Thread pool management method and device, computer equipment and storage medium - Google Patents

Thread pool management method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN114398163A
CN114398163A CN202210036392.1A CN202210036392A CN114398163A CN 114398163 A CN114398163 A CN 114398163A CN 202210036392 A CN202210036392 A CN 202210036392A CN 114398163 A CN114398163 A CN 114398163A
Authority
CN
China
Prior art keywords
thread pool
interface
response time
adjustment
information table
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
CN202210036392.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.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202210036392.1A priority Critical patent/CN114398163A/en
Publication of CN114398163A publication Critical patent/CN114398163A/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
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to the technical field of computers, and discloses a thread pool management method, a thread pool management device, computer equipment and a storage medium, wherein the method comprises the steps of obtaining a configuration information table; according to the configuration information table, acquiring the response time of each interface and the running condition of each thread pool at regular time; inputting the target response time in the configuration information table and the response time of each interface into an adjustment model, and adjusting and judging the thread pool corresponding to each interface through the adjustment model to obtain an adjustment result; determining a specific adjustment scheme of the thread pool corresponding to each interface according to the adjustment result and the running condition of the thread pool; according to the specific adjustment scheme of the thread pool corresponding to each interface, correspondingly adjusting the thread pool, and updating the configuration information table; the application also relates to a blockchain technology, and the configuration information table is stored in a blockchain. The application realizes that the response speed to the request is improved.

Description

Thread pool management method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for thread pool management, a computer device, and a storage medium.
Background
With the development of intelligent terminals and the popularization of network environments, users can access networks through various application clients installed on the terminals, and when accessing, various requests are sent to related servers, so that the servers face a large number of access requests. In order to guarantee the user experience, the server needs to guarantee a certain response time, so the number of threads needs to be reasonably distributed. In the prior art, the response speed is usually improved by adding a cache or using a plurality of thread pools for parallel processing, but the resource consumption is too high, so how to improve the response speed of the request under the condition that the resource consumption is kept low becomes a problem to be solved urgently.
Disclosure of Invention
The application provides a thread pool management method, a thread pool management device, computer equipment and a storage medium, which are used for solving the problem that the response speed of a request is low when the resource consumption is kept stable in the prior art.
In order to solve the above problem, the present application provides a thread pool management method, including:
acquiring a configuration information table;
according to the configuration information table, acquiring the response time of each interface and the running condition of each thread pool at regular time;
inputting the target response time in the configuration information table and the response time of each interface into an adjustment model, and adjusting and judging the thread pool corresponding to each interface through the adjustment model to obtain an adjustment result;
determining a specific adjustment scheme of the thread pool corresponding to each interface according to the adjustment result and the running condition of the thread pool;
and correspondingly adjusting the thread pool according to the specific adjustment scheme of the thread pool corresponding to each interface, and updating the configuration information table.
Further, the obtaining the configuration information table includes:
sending a calling request to a preset knowledge base, wherein the calling request carries a signature checking token;
and receiving a signature verification result returned by the knowledge base, and calling the configuration information table in the preset knowledge base when the signature verification result is passed, wherein the signature verification result is obtained by verifying the knowledge base in an RSA (rivest-Shamir-Adleman) asymmetric encryption mode according to the signature verification token.
Further, before the obtaining the configuration information table, the method further includes:
acquiring historical response time corresponding to each interface and the number of corresponding thread pools;
calculating historical average response time of each interface according to the historical response time corresponding to each interface;
and according to the number of the thread pools corresponding to each interface, performing weighted summation on the historical average response time of each interface to obtain the target response time.
Further, the inputting the target response time in the configuration information table and the response time of each interface into an adjustment model, and performing adjustment judgment on the thread pool corresponding to each interface through the adjustment model to obtain an adjustment result includes:
calculating the average response time of each interface according to a plurality of response times corresponding to each interface;
and inputting the response time, the average response time and the target response time corresponding to each interface into the adjustment model to obtain the adjustment result, wherein the adjustment model is obtained based on the training of a decision tree model.
Further, the determining, according to the adjustment result and the running condition of the thread pool, a specific adjustment scheme of the thread pool corresponding to each interface includes:
when the adjustment result is to be adjusted, comparing the queue condition in the running condition of the thread pool with a first preset threshold value;
if the queue condition is less than or equal to the first preset threshold, determining that the specific adjustment scheme of the thread pool corresponding to the interface is not adjusted;
and if the queue condition is greater than the first preset threshold, determining that the specific adjustment scheme of the thread pool corresponding to the interface is to increase the thread pool.
Further, the determining, according to the adjustment result and the running condition of the thread pool, a specific adjustment scheme of the thread pool corresponding to each interface includes:
when the adjustment result is adjustable, comparing the queue condition in the running condition of the thread pool with a second preset threshold value;
if the queue condition is smaller than the second preset threshold, determining that the specific adjustment scheme of the thread pool corresponding to the interface is to reduce the thread pool;
and if the queue condition is greater than or equal to the second preset threshold, determining that the specific adjustment scheme of the thread pool corresponding to the interface is not adjusted.
Further, the performing, according to the specific adjustment scheme of the thread pool corresponding to each interface, the corresponding adjustment of the thread pool includes:
according to the specific adjustment scheme of the thread pool corresponding to each interface, carrying out internal distribution on the thread pool;
if the idle thread pool does not exist, distributing a newly-built thread pool to the interface lacking the thread pool for processing;
and if the idle thread pool exists, performing offline processing on the idle thread pool.
In order to solve the above problem, the present application further provides a thread pool management apparatus, including:
the acquisition module is used for acquiring the configuration information table;
the timing extraction module is used for acquiring the response time of each interface and the running condition of each thread pool at fixed time according to the configuration information table;
the first judgment module is used for inputting the target response time in the configuration information table and the response time of each interface into an adjustment model, and performing adjustment judgment on the thread pool corresponding to each interface through the adjustment model to obtain an adjustment result;
the second judgment module is used for determining a specific adjustment scheme of the thread pool corresponding to each interface according to the adjustment result and the running condition of the thread pool;
and the adjusting module is used for correspondingly adjusting the thread pools according to the specific adjusting schemes of the thread pools corresponding to the interfaces and updating the configuration information table.
In order to solve the above problem, the present application also provides a computer device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the thread pool management method as described above.
To solve the above problem, the present application also provides a non-volatile computer-readable storage medium having stored thereon computer-readable instructions which, when executed by a processor, implement the thread pool management method as described above.
Compared with the prior art, the thread pool management method, the thread pool management device, the computer equipment and the storage medium provided by the embodiment of the application have at least the following beneficial effects:
acquiring response time of each interface in a configuration information table and operation conditions of each thread pool at fixed time according to the configuration information table by acquiring the configuration information table; inputting the target response time in the configuration information table and the response time of each interface into an adjustment model, adjusting and judging the thread pool corresponding to each interface through the adjustment model to obtain an adjustment result, and determining a specific adjustment scheme of the thread pool corresponding to each interface according to the adjustment result and the operation condition of the thread pool to improve the utilization rate of thread pool resources and avoid waste.
Drawings
In order to more clearly illustrate the solution of the present application, a brief description will be given below of the drawings required for describing the embodiments of the present application, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without inventive effort.
Fig. 1 is a schematic flowchart of a thread pool management method according to an embodiment of the present application;
FIG. 2 is a flowchart of one embodiment of step S3 of FIG. 1;
FIG. 3 is a flowchart of one embodiment of step S5 of FIG. 1;
fig. 4 is a block diagram of a thread pool management apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. One skilled in the art will explicitly or implicitly appreciate that the embodiments described herein can be combined with other embodiments.
The application provides a thread pool management method. Referring to fig. 1, fig. 1 is a schematic flowchart of a thread pool management method according to an embodiment of the present disclosure.
In this embodiment, the thread pool management method includes:
s1, acquiring a configuration information table;
in the present application, the configuration information table includes a thread pool management base table, an interface information table, an allocation relation table, a target response time, and the like; the thread pool management base table is used for recording information such as how many thread pools are created currently, the state (idle, reuse or offline) of each thread pool, the total length of a thread queue, the used length and the like; the interface information table is used for recording basic information of an interface, wherein the basic information comprises an interface number, a Chinese name, current response time and historical response time, the response time of each request corresponding to the interface is stored, and the interface information table is updated in real time according to the response time; the allocation relation table is used for recording the number of thread pools currently used by the interface, and when a request enters the server, the table is checked first so as to allocate the corresponding thread pools for the request to process.
Further, the obtaining the configuration information table includes:
sending a calling request to a preset knowledge base, wherein the calling request carries a signature checking token;
and receiving a signature verification result returned by the knowledge base, and calling the configuration information table in the preset knowledge base when the signature verification result is passed, wherein the signature verification result is obtained by verifying the knowledge base in an RSA (rivest-Shamir-Adleman) asymmetric encryption mode according to the signature verification token.
Specifically, the configuration information table may relate to private data, so that historical operating data is stored in a preset database, and when the configuration information table is acquired, the database performs a signature verification step, so that the safety of data is ensured, and the problems of data leakage and the like are avoided.
The whole process is that the client calculates a first message digest of the message m, encrypts the first message digest by using an RSA asymmetric encryption mode (by using a private key of the client) to obtain a signature s, reuses the message m and the signature s by using a public key of a knowledge base to obtain a ciphertext c, sends the ciphertext c to the knowledge base, decrypts the ciphertext c by using the private key of the knowledge base to obtain the message m and the signature s, and decrypts the signature s by using the public key of the client by using the knowledge base to obtain the first message digest; meanwhile, the knowledge base extracts the message m by the same method to obtain a second message abstract, judges whether the first message abstract and the second message abstract are the same, and if the first message abstract and the second message abstract are the same, the verification is successful; otherwise, the authentication fails.
Through encrypting and storing the configuration information table, the signature verification step is carried out during extraction, so that the safety of the data of the configuration information table is ensured, and the leakage is avoided.
Further, before the obtaining the configuration information table, the method further includes:
acquiring historical response time corresponding to each interface and the number of corresponding thread pools;
calculating historical average response time of each interface according to the historical response time corresponding to each interface;
and according to the number of the thread pools corresponding to each interface, performing weighted summation on the historical average response time of each interface to obtain the target response time.
Specifically, because of the interface information table in the configuration information table, the response time of each interface corresponding to the request is recorded; and the number of thread pools allocated to each interface is recorded in an allocation relation table in the configuration information table. And calculating according to the historical response time corresponding to each interface, wherein the historical average response time of each interface in the preset time is calculated, and since the response time is strongly related to the distribution number of the thread pools corresponding to each interface, the historical average response time of each interface is subjected to weighted summation according to the number of the thread pools corresponding to each interface to obtain the target response time. The historical response time refers to response time data of the previous day or the previous preset number of days.
By calculating the target response time, the thread pool corresponding to the interface can be adjusted conveniently, so that the response time corresponding to each interface is shortened, and the consumed resources are kept small.
S2, acquiring the response time of each interface and the running condition of each thread pool at fixed time according to the configuration information table;
specifically, a timing task is set, that is, executed once every preset time, according to the number of the assigned thread pools corresponding to each interface recorded in the configuration information table, and the response time of each interface in the interface information in the configuration information table and the running condition of the thread pool, that is, the used queue length of the thread pool, are obtained. The response time is a period of time for which a request enters the thread pool to be processed to obtain a result and is output.
S3, inputting the target response time in the configuration information table and the response time of each interface into an adjustment model, and adjusting and judging the thread pool corresponding to each interface through the adjustment model to obtain an adjustment result;
specifically, the target response time and the response time of each interface are input into an adjustment model, and the adjustment model is used for adjusting and judging the thread pool corresponding to each interface to obtain an adjustment result corresponding to each interface, wherein the adjustment model is obtained by training based on a decision tree model, and the decision tree model has strong interpretability and can well obtain the adjustment result.
Further, as shown in fig. 2, the inputting the target response time in the configuration information table and the response time of each interface into an adjustment model, and performing adjustment judgment on the thread pool corresponding to each interface through the adjustment model to obtain an adjustment result includes:
calculating the average response time of each interface according to a plurality of response times corresponding to each interface;
and inputting the response time, the average response time and the target response time corresponding to each interface into the adjustment model to obtain the adjustment result, wherein the adjustment model is obtained based on the training of a decision tree model.
Specifically, a plurality of response times within a preset time are obtained from the table by obtaining a plurality of response times corresponding to each interface, that is, by a timing task, for example, if the timing task is performed once every 10 minutes, the response times corresponding to a plurality of requests within the previous 10 minutes are obtained, and the average response time of each interface within the preset time (that is, 10 minutes in this embodiment) is calculated respectively; and inputting the response time, the average response time and the target response time corresponding to each interface into the adjustment model to obtain an adjustment result corresponding to each interface, wherein the average response time is longer than the target response time.
Specifically, the average response time and the target response time may be specifically considered as a straight line or a broken line, and the response time corresponding to each interface is one, and the corresponding response time is expressed as a point; and judging the position relation by using the adjustment model, wherein the adjustment model can also obtain an adjustment result aiming at various special conditions, and the adjustment model is obtained based on the training of a decision tree model. Specifically, the adjustment result is obtained by determining, according to the average response time and the target response time, the position relationship between the average response time and the response time corresponding to the plurality of requests acquired by the timed task, and the specific adjustment result and the corresponding determination mode may be obtained according to the following modes:
the adjustment results corresponding to the thread pool can be divided into three types, namely to-be-adjusted, adjustable and to-be-off-line;
when the response time exceeds a preset percentage of the target response time but does not exceed the average response time corresponding to the interface, the adjustment result obtained by the adjustment model is to be adjusted, and the specific preset percentage is obtained by training according to the decision tree model and historical data;
when the response time does not exceed the preset percentage of the target response time and does not exceed the average response time corresponding to the interface, the adjustment result obtained by the adjustment model is adjustable;
when the average response time is 0, since the average response time is an average value of a plurality of response times within a preset time, and since the average response time is 0, it is proved that no request enters within the preset time, the adjustment result obtained by the adjustment model is to be offline.
An adjustment model is obtained by training through the decision tree, and data such as response time and the like are judged through the adjustment model to obtain a corresponding adjustment result, so that the response speed of the request is improved.
S4, determining the specific adjustment scheme of the thread pool corresponding to each interface according to the adjustment result and the running condition of the thread pool;
specifically, since the adjustment result obtained by the judgment only through one dimension of the response time may be relatively single, the adjustment result is uniformly judged in combination with other dimensions, the specific adjustment scheme of the thread pool is determined according to the adjustment result and the running condition of the thread pool, and the running condition is compared with the first preset threshold or the second threshold specifically according to the adjustment result, so that the final specific adjustment scheme is obtained.
Further, the determining, according to the adjustment result and the running condition of the thread pool, a specific adjustment scheme of the thread pool corresponding to each interface includes:
when the adjustment result is to be adjusted, comparing the queue condition in the running condition of the thread pool with a first preset threshold value;
if the queue condition is less than or equal to the first preset threshold, determining that the specific adjustment scheme of the thread pool corresponding to the interface is not adjusted;
and if the queue condition is greater than the first preset threshold, determining that the specific adjustment scheme of the thread pool corresponding to the interface is to increase the thread pool.
Specifically, when the adjustment result is to be adjusted, comparing a queue condition in the running condition of the thread pool with a first preset threshold, wherein the queue condition is a ratio of a used queue length to a total queue length of the thread pool; if the queue condition is less than or equal to the first preset threshold, determining that the specific adjustment scheme of the thread pool is not adjusted; if the queue condition is greater than the first preset threshold, it is determined that a specific adjustment scheme of the thread pool corresponding to the interface is to increase the thread pool, specifically, one more thread pool is allocated to the interface, and in this embodiment, the first preset threshold may be 70%.
The adjustment result and the queue condition are comprehensively judged, so that the effect of obtaining the specific adjustment scheme is improved, the final specific adjustment scheme can reduce resource consumption and improve the response speed to the request.
Further, the determining, according to the adjustment result and the running condition of the thread pool, a specific adjustment scheme of the thread pool corresponding to each interface includes:
when the adjustment result is adjustable, comparing the queue condition in the running condition of the thread pool with a second preset threshold value;
if the queue condition is smaller than the second preset threshold, determining that the specific adjustment scheme of the thread pool corresponding to the interface is to reduce the thread pool;
and if the queue condition is greater than or equal to the second preset threshold, determining that the specific adjustment scheme of the thread pool corresponding to the interface is not adjusted.
Specifically, when the adjustment result is adjustable, comparing a queue condition in the running condition of the thread pool with a second preset threshold, where the second preset threshold is smaller than the first preset threshold;
if the queue condition is smaller than the second preset threshold, determining that a specific adjustment scheme of the thread pool corresponding to the interface is to reduce the thread pool, specifically to reduce one thread pool;
and if the queue condition is greater than or equal to the second preset threshold, determining that the specific adjustment scheme of the thread pool corresponding to the interface is not adjusted. In an embodiment of the present application, the second preset threshold may be 20%.
The adjustment result and the queue condition are comprehensively judged, so that the effect of obtaining the specific adjustment scheme is improved, the final specific adjustment scheme can reduce resource consumption and improve the response speed to the request.
S5, according to the specific adjustment scheme of the thread pool corresponding to each interface, correspondingly adjusting the thread pool, and updating the configuration information table.
Specifically, since a specific adjustment scheme of the thread pools corresponding to the interfaces is obtained, the increase or decrease of the number of the total thread pools is determined, if the number of the total thread pools needs to be increased, the built thread pools are internally allocated, after internal allocation, the number required to be increased is newly established, and the thread pools are allocated to the interfaces lacking the thread pools; and if the total number of the thread pools is reduced, performing offline processing on redundant thread pools after internal distribution. And synchronizing the thread pool distribution relation corresponding to each adjusted interface into the configuration information table. Specifically, the thread pool allocation relations corresponding to the interfaces are synchronized to the allocation relation table in the configuration information table, and the stored allocation relations are updated. When a subsequent request enters, the latest allocation relation table in the configuration information table is firstly inquired to determine which thread pool the request enters for processing.
Further, as shown in fig. 3, the performing, according to the specific adjustment scheme of the thread pool corresponding to each interface, the corresponding adjustment of the thread pool includes:
according to the specific adjustment scheme of the thread pool corresponding to each interface, carrying out internal distribution on the thread pool;
if the idle thread pool does not exist, distributing a newly-built thread pool to the interface lacking the thread pool for processing;
and if the idle thread pool exists, performing offline processing on the idle thread pool.
Specifically, according to a specific adjustment scheme of a thread pool corresponding to each interface, internal allocation among the interfaces is firstly carried out;
for example, existing interfaces 1,2, 3; the number of the current distributed thread pools is 1,2 and 3; when the specific adjustment scheme corresponding to the allocation of each interface is increase, increase or decrease, internal allocation is firstly performed, that is, the thread pool of the interface 3 is allocated to any one of the interface 1 or the interface 2, at this time, after the internal allocation, a thread pool is lacked, that is, when other idle thread pools do not exist, at this time, a thread pool needs to be newly established and allocated to the interface 1 or the interface 2, and an interface of the thread pool is not allocated in the internal allocation, so that the final interfaces 1,2 and 3 are realized; the corresponding thread pool is 2,3, 2.
Similarly, after the internal allocation is finished, when redundant thread pools exist, namely idle thread pools exist, the idle thread pools are offline, so that resources are saved.
And correspondingly adjusting the thread pool corresponding to each interface according to the specific adjustment scheme corresponding to each interface, so that the response speed to the request is improved under the condition of keeping low resource consumption.
It is emphasized that, in order to further ensure the privacy and security of the data, the enterprise training data and the evaluation result data corresponding to the enterprise to be evaluated may also be stored in the nodes of a block chain.
The block chain referred by the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Acquiring response time of each interface in a configuration information table and operation conditions of each thread pool at fixed time according to the configuration information table by acquiring the configuration information table; inputting the target response time in the configuration information table and the response time of each interface into an adjustment model, adjusting and judging the thread pool corresponding to each interface through the adjustment model to obtain an adjustment result, and determining a specific adjustment scheme of the thread pool corresponding to each interface according to the adjustment result and the operation condition of the thread pool to improve the utilization rate of thread pool resources and avoid waste.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
The present embodiment further provides a thread pool management apparatus, as shown in fig. 4, which is a functional block diagram of the thread pool management apparatus according to the present application.
The thread pool management apparatus 100 may be installed in an electronic device. According to the implemented functions, the thread pool management apparatus 100 may include an obtaining module 101, a timing extraction module 102, a first judgment module 103, a second judgment module 104, and an adjustment module 105. A module, which may also be referred to as a unit in this application, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
an obtaining module 101, configured to obtain a configuration information table;
further, the obtaining module 101 includes a calling request sending submodule and a calling submodule;
the calling request sending submodule is used for sending a calling request to a preset knowledge base, and the calling request carries a signature checking token;
the calling submodule is used for receiving the signature verification result returned by the knowledge base and calling the configuration information table in the preset knowledge base when the signature verification result passes, and the signature verification result is obtained by verifying the knowledge base in an RSA asymmetric encryption mode according to the signature verification token.
The configuration information table is encrypted and stored through the matching of the calling request sending submodule and the calling submodule, and the signature checking step is carried out during extraction, so that the safety of the data of the configuration information table is ensured, and the leakage is avoided.
Further, the thread pool management apparatus 100 further includes a historical data obtaining module, a first processing module and a second processing module;
the historical data acquisition module is used for acquiring historical response time corresponding to each interface and the number of corresponding thread pools;
the first processing module is used for calculating historical average response time of each interface according to the historical response time corresponding to each interface;
and the second processing module is used for performing weighted summation on the historical average response time of each interface according to the number of the thread pools corresponding to each interface to obtain the target response time.
Through the cooperation of the historical data acquisition module, the first processing module and the second processing module, the target response time is calculated, the thread pool corresponding to the interfaces is conveniently adjusted subsequently, the response time corresponding to each interface is shortened, and consumed resources are kept small
A timing extraction module 102, configured to obtain response time of each interface and operation conditions of each thread pool at regular time according to the configuration information table;
a first determining module 103, configured to input a target response time in the configuration information table and a response time of each interface into an adjustment model, and perform adjustment and determination on a thread pool corresponding to each interface through the adjustment model to obtain an adjustment result;
further, the first determining module 103 includes a calculating sub-module and a model processing sub-module;
the calculation submodule is used for calculating the average response time of each interface according to a plurality of response times corresponding to each interface;
and the model processing submodule is used for inputting the response time, the average response time and the target response time corresponding to each interface into the adjustment model to obtain the adjustment result, and the adjustment model is obtained based on the training of a decision tree model.
Through the cooperation of the calculation submodule and the model processing submodule, the decision tree is used for training to obtain an adjustment model, the adjustment model is used for judging data such as response time and the like to obtain a corresponding adjustment result, and the response speed of the request is improved.
A second determining module 104, configured to determine a specific adjustment scheme of the thread pool corresponding to each interface according to the adjustment result and the running condition of the thread pool;
further, the second determining module 104 includes a first comparing sub-module, a first determining sub-module, and a second determining sub-module;
the first comparison sub-module is used for comparing the queue condition in the running condition of the thread pool with a first preset threshold value when the adjustment result is to be adjusted;
the first determining submodule is configured to determine that a specific adjustment scheme of the thread pool corresponding to the interface is not adjusted if the queue condition is less than or equal to the first preset threshold;
and the second determining submodule is configured to determine that the specific adjustment scheme of the thread pool corresponding to the interface is to increase the thread pool if the queue condition is greater than the first preset threshold.
Through the cooperation of the first comparison submodule, the first determination submodule and the second determination submodule, the adjustment result and the queue condition are comprehensively judged, the effect of obtaining a specific adjustment scheme is improved, and the final specific adjustment scheme can reduce resource consumption and improve the response speed to the request.
Further, the second determining module 104 includes a second comparing sub-module, a third determining sub-module, and a fourth determining sub-module;
the second comparison submodule is used for comparing the queue condition in the running condition of the thread pool with a second preset threshold value when the adjustment result is adjustable;
the third determining submodule is configured to determine that the specific adjustment scheme of the thread pool corresponding to the interface is to reduce the thread pool if the queue condition is smaller than the second preset threshold;
and the fourth determining submodule is configured to determine that the specific adjustment scheme of the thread pool corresponding to the interface is not adjusted if the queue condition is greater than or equal to the second preset threshold.
Through the cooperation of the second comparison submodule, the third determination submodule and the fourth determination submodule, the adjustment result and the queue condition are comprehensively judged, the effect of obtaining a specific adjustment scheme is improved, and the final specific adjustment scheme can reduce resource consumption and improve the response speed to the request.
And the adjusting module 105 is configured to correspondingly adjust the thread pool according to a specific adjusting scheme of the thread pool corresponding to each interface, and update the configuration information table.
Further, the adjusting module 105 includes a corresponding allocating sub-module and a corresponding processing sub-module;
the corresponding distribution submodule is used for carrying out internal distribution on the thread pool according to the specific adjustment scheme of the thread pool corresponding to each interface; (ii) a
The corresponding processing submodule is used for allocating a newly-built thread pool to an interface lacking a thread pool for processing if the idle thread pool does not exist; and if the idle thread pool exists, performing offline processing on the idle thread pool.
And the thread pool corresponding to each interface is correspondingly adjusted according to the specific adjustment scheme corresponding to each interface by matching the corresponding distribution submodule and the corresponding processing submodule, so that the response speed to the request is improved under the condition of keeping the consumption resource low.
By adopting the above device, the thread pool management device 100 obtains the configuration information table by matching the obtaining module 101, the timing extraction module 102, the first judging module 103, the second judging module 104 and the adjusting module 105, and obtains the response time of each interface in the configuration information table and the operation condition of each thread pool in a timing manner according to the configuration information table; inputting the target response time in the configuration information table and the response time of each interface into an adjustment model, adjusting and judging the thread pool corresponding to each interface through the adjustment model to obtain an adjustment result, and determining a specific adjustment scheme of the thread pool corresponding to each interface according to the adjustment result and the operation condition of the thread pool to improve the utilization rate of thread pool resources and avoid waste.
The embodiment of the application also provides computer equipment. Referring to fig. 5, fig. 5 is a block diagram of a basic structure of a computer device according to the present embodiment.
The computer device 4 comprises a memory 41, a processor 42, a network interface 43 communicatively connected to each other via a system bus. It is noted that only computer device 4 having components 41-43 is shown, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 41 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 4. Of course, the memory 41 may also include both internal and external storage devices of the computer device 4. In this embodiment, the memory 41 is generally used for storing an operating system installed in the computer device 4 and various types of application software, such as computer readable instructions of a thread pool management method. Further, the memory 41 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 42 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is configured to execute computer readable instructions stored in the memory 41 or process data, for example, execute computer readable instructions of the thread pool management method.
The network interface 43 may comprise a wireless network interface or a wired network interface, and the network interface 43 is generally used for establishing communication connection between the computer device 4 and other electronic devices.
The present embodiment implements the steps of the thread pool management method in the above embodiments when the processor executes the computer readable instructions stored in the memory, and by acquiring the configuration information table, the response time of each interface in the configuration information table and the operation condition of each thread pool are periodically acquired according to the configuration information table; inputting the target response time in the configuration information table and the response time of each interface into an adjustment model, adjusting and judging the thread pool corresponding to each interface through the adjustment model to obtain an adjustment result, and determining a specific adjustment scheme of the thread pool corresponding to each interface according to the adjustment result and the operation condition of the thread pool to improve the utilization rate of thread pool resources and avoid waste.
The embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores computer-readable instructions, where the computer-readable instructions are executable by at least one processor, so as to enable the at least one processor to execute the steps of the thread pool management method as described above, and by acquiring a configuration information table, according to the configuration information table, periodically acquiring response time of each interface in the configuration information table and an operation condition of each thread pool; inputting the target response time in the configuration information table and the response time of each interface into an adjustment model, adjusting and judging the thread pool corresponding to each interface through the adjustment model to obtain an adjustment result, and determining a specific adjustment scheme of the thread pool corresponding to each interface according to the adjustment result and the operation condition of the thread pool to improve the utilization rate of thread pool resources and avoid waste.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
The thread pool management apparatus, the computer device, and the computer-readable storage medium according to the embodiments of the present application have the same technical effects as the thread pool management method according to the embodiments, and are not expanded herein.
It is to be understood that the above-described embodiments are merely illustrative of some, but not restrictive, of the broad invention, and that the appended drawings illustrate preferred embodiments of the invention and do not limit the scope of the invention. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.

Claims (10)

1. A method for thread pool management, the method comprising:
acquiring a configuration information table;
according to the configuration information table, acquiring the response time of each interface and the running condition of each thread pool at regular time;
inputting the target response time in the configuration information table and the response time of each interface into an adjustment model, and adjusting and judging the thread pool corresponding to each interface through the adjustment model to obtain an adjustment result;
determining a specific adjustment scheme of the thread pool corresponding to each interface according to the adjustment result and the running condition of the thread pool;
and correspondingly adjusting the thread pool according to the specific adjustment scheme of the thread pool corresponding to each interface, and updating the configuration information table.
2. The thread pool management method according to claim 1, wherein said obtaining the configuration information table comprises:
sending a calling request to a preset knowledge base, wherein the calling request carries a signature checking token;
and receiving a signature verification result returned by the knowledge base, and calling the configuration information table in the preset knowledge base when the signature verification result is passed, wherein the signature verification result is obtained by verifying the knowledge base in an RSA (rivest-Shamir-Adleman) asymmetric encryption mode according to the signature verification token.
3. The thread pool management method according to claim 1, further comprising, before said obtaining the configuration information table:
acquiring historical response time corresponding to each interface and the number of corresponding thread pools;
calculating historical average response time of each interface according to the historical response time corresponding to each interface;
and according to the number of the thread pools corresponding to each interface, performing weighted summation on the historical average response time of each interface to obtain the target response time.
4. The method according to claim 1, wherein the inputting the target response time in the configuration information table and the response time of each interface into an adjustment model, and performing adjustment judgment on the thread pool corresponding to each interface through the adjustment model to obtain an adjustment result comprises:
calculating the average response time of each interface according to a plurality of response times corresponding to each interface;
and inputting the response time, the average response time and the target response time corresponding to each interface into the adjustment model to obtain the adjustment result, wherein the adjustment model is obtained based on the training of a decision tree model.
5. The method according to claim 1, wherein the determining a specific adjustment scheme for the thread pool corresponding to each interface according to the adjustment result and the running condition of the thread pool comprises:
when the adjustment result is to be adjusted, comparing the queue condition in the running condition of the thread pool with a first preset threshold value;
if the queue condition is less than or equal to the first preset threshold, determining that the specific adjustment scheme of the thread pool corresponding to the interface is not adjusted;
and if the queue condition is greater than the first preset threshold, determining that the specific adjustment scheme of the thread pool corresponding to the interface is to increase the thread pool.
6. The method according to claim 1, wherein the determining a specific adjustment scheme for the thread pool corresponding to each interface according to the adjustment result and the running condition of the thread pool comprises:
when the adjustment result is adjustable, comparing the queue condition in the running condition of the thread pool with a second preset threshold value;
if the queue condition is smaller than the second preset threshold, determining that the specific adjustment scheme of the thread pool corresponding to the interface is to reduce the thread pool;
and if the queue condition is greater than or equal to the second preset threshold, determining that the specific adjustment scheme of the thread pool corresponding to the interface is not adjusted.
7. The method according to claim 1, wherein the performing the corresponding adjustment on the thread pool according to the specific adjustment scheme of the thread pool corresponding to each interface comprises:
according to the specific adjustment scheme of the thread pool corresponding to each interface, carrying out internal distribution on the thread pool;
if the idle thread pool does not exist, distributing a newly-built thread pool to the interface lacking the thread pool for processing;
and if the idle thread pool exists, performing offline processing on the idle thread pool.
8. An apparatus for thread pool management, the apparatus comprising:
the acquisition module is used for acquiring the configuration information table;
the timing extraction module is used for acquiring the response time of each interface and the running condition of each thread pool at fixed time according to the configuration information table;
the first judgment module is used for inputting the target response time in the configuration information table and the response time of each interface into an adjustment model, and performing adjustment judgment on the thread pool corresponding to each interface through the adjustment model to obtain an adjustment result;
the second judgment module is used for determining a specific adjustment scheme of the thread pool corresponding to each interface according to the adjustment result and the running condition of the thread pool;
and the adjusting module is used for correspondingly adjusting the thread pools according to the specific adjusting schemes of the thread pools corresponding to the interfaces and updating the configuration information table.
9. A computer device, characterized in that the computer device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores computer readable instructions which, when executed by the processor, implement the thread pool management method of any of claims 1 to 7.
10. A computer-readable storage medium having computer-readable instructions stored thereon which, when executed by a processor, implement the thread pool management method of any of claims 1 to 7.
CN202210036392.1A 2022-01-11 2022-01-11 Thread pool management method and device, computer equipment and storage medium Pending CN114398163A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210036392.1A CN114398163A (en) 2022-01-11 2022-01-11 Thread pool management method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210036392.1A CN114398163A (en) 2022-01-11 2022-01-11 Thread pool management method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114398163A true CN114398163A (en) 2022-04-26

Family

ID=81230405

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210036392.1A Pending CN114398163A (en) 2022-01-11 2022-01-11 Thread pool management method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114398163A (en)

Similar Documents

Publication Publication Date Title
CN109246176B (en) Multi-controller synchronization method and device based on block chain in software defined network
CN111949672B (en) Block chain storage method for supporting incremental update of Internet-of-things data
CN107729137B (en) Server, block chain signature verification decryption method and storage medium
CN109600377B (en) Method and device for preventing unauthorized use computer device and storage medium
US10432622B2 (en) Securing biometric data through template distribution
CN104951712A (en) Data safety protection method in Xen virtualization environment
CN106357694B (en) Access request processing method and device
CN113867782A (en) Gray scale distribution method and device, computer equipment and storage medium
CN112084486A (en) User information verification method and device, electronic equipment and storage medium
US20190384905A1 (en) Image based authentication code method, server, and authentication code system
CN113361913A (en) Communication service arranging method, device, computer equipment and storage medium
CN114996675A (en) Data query method and device, computer equipment and storage medium
CN108833133A (en) Network configuration management method, apparatus and storage medium based on system for cloud computing
CN112256760B (en) Data prediction method and device, computer equipment and storage medium
CN110990790A (en) Data processing method and equipment
CN113259429A (en) Session keeping control method, device, computer equipment and medium
CN111277626B (en) Server upgrading method and device, electronic equipment and medium
CN110381114B (en) Interface request parameter processing method and device, terminal equipment and medium
CN114398163A (en) Thread pool management method and device, computer equipment and storage medium
CN114697132B (en) Method, device, equipment and storage medium for intercepting repeated access request attack
CN111953633A (en) Access control method and access control device based on terminal environment
CN114221964B (en) Access request processing method, device, computer equipment and storage medium
CN111860847B (en) Quantum computation-based data encryption method
CN112104625B (en) Process access control method and device
CN111367573B (en) Equipment login method, device, storage medium and computer equipment

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