CN117453356A - Thread pool adjusting method, device, computer equipment and storage medium - Google Patents

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

Info

Publication number
CN117453356A
CN117453356A CN202311249810.6A CN202311249810A CN117453356A CN 117453356 A CN117453356 A CN 117453356A CN 202311249810 A CN202311249810 A CN 202311249810A CN 117453356 A CN117453356 A CN 117453356A
Authority
CN
China
Prior art keywords
thread pool
tasks
thread
parameter
adjustment result
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
CN202311249810.6A
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.)
Bank of China Ltd
Original Assignee
Bank of China 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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202311249810.6A priority Critical patent/CN117453356A/en
Publication of CN117453356A publication Critical patent/CN117453356A/en
Pending legal-status Critical Current

Links

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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

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 a thread pool adjusting method, a thread pool adjusting device, computer equipment, a storage medium and a computer program product, which can be used in the financial field or other fields to improve the resource utilization rate of a thread pool and the task execution efficiency. The method comprises the following steps: acquiring resource parameters associated with a thread pool; determining the number of submitted tasks and the number of executed tasks of a thread pool in a preset time period; obtaining a parameter adjustment result and a thread adjustment result of a thread pool according to the resource parameters, the number of submitted tasks and the number of executed tasks; and adjusting the thread pool according to the parameter adjustment result and the thread adjustment result.

Description

Thread pool adjusting method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technology, and in particular, to a thread pool adjustment method, apparatus, computer device, storage medium, and computer program product.
Background
In the field of financial technology, financial institutions such as banks may concurrently handle a large number of services or other tasks through multi-threading technology. Thread pool is an important technical means in the multithreading technology.
The existing thread pool is usually provided with a certain number of threads in advance, when the task is submitted, the idle thread execution task can be immediately obtained from the thread pool, the thread creation process is omitted, and after the task execution is finished, the thread is returned to the thread pool. However, this conventional thread pool configuration method may cause insufficient resources or waste conditions, and when the threads are too many, scheduling overhead is increased, and when the threads are too few, tasks are accumulated in a queue, so that task backlog is caused, and thus the processing performance of the system is reduced.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a thread pool adjustment method, apparatus, computer device, computer readable storage medium, and computer program product that can improve the resource utilization of a thread pool.
In a first aspect, the present application provides a thread pool adjustment method. The method comprises the following steps:
acquiring resource parameters associated with a thread pool;
determining the number of submitted tasks and the number of executed tasks of the thread pool in a preset time period;
obtaining a parameter adjustment result and a thread adjustment result of the thread pool according to the resource parameter, the number of submitted tasks and the number of executed tasks;
and adjusting the thread pool according to the parameter adjustment result and the thread adjustment result.
In one embodiment, obtaining the resource parameters associated with the thread pool includes:
extracting parameters of the thread pool to obtain thread pool resource parameters;
extracting parameters of a target application system corresponding to the thread pool to obtain application resource parameters;
extracting parameters of an operating system of the thread pool to obtain system resource parameters;
and taking the thread pool resource parameter, the application resource parameter and the system resource parameter as the resource parameters associated with the thread pool.
In one embodiment, determining the number of submitted tasks and the number of executed tasks of the thread pool within a preset time period includes:
determining the commit time information of each commit task and the execution time information of each execution task in the thread pool;
screening target submitting tasks and target executing tasks belonging to the preset time period from the submitting tasks and executing tasks of the thread pool according to the submitting time information and the executing time information;
and counting the target submitted tasks and the target execution tasks to obtain the number of submitted tasks and the number of execution tasks.
In one embodiment, after determining the number of submitted tasks and the number of executed tasks in the thread pool within the preset time period, the method further includes:
acquiring execution time information of the target execution task;
and generating the execution time distribution information of the target execution task according to the execution time information.
In one embodiment, obtaining the parameter adjustment result and the thread adjustment result of the thread pool according to the resource parameter, the number of submitted tasks and the number of executed tasks includes:
acquiring a pre-trained adjustment result prediction model;
and inputting the resource parameters, the number of submitted tasks, the number of executed tasks and the execution time distribution information into the adjustment result prediction model to obtain the parameter adjustment result and the thread adjustment result.
In one embodiment, adjusting the thread pool according to the parameter adjustment result and the thread adjustment result includes:
according to the parameter adjustment result, adjusting the thread pool resource parameter of the thread pool to obtain an adjusted thread pool;
and adjusting the thread quantity of the adjusted thread pool according to the thread adjusting result.
In a second aspect, the present application further provides a thread pool adjustment device. The device comprises:
the parameter acquisition module is used for acquiring the resource parameters associated with the thread pool;
the task statistics module is used for determining the number of submitted tasks and the number of executed tasks of the thread pool in a preset time period;
the adjustment analysis module is used for obtaining a parameter adjustment result and a thread adjustment result of the thread pool according to the resource parameter, the number of submitted tasks and the number of executed tasks;
and the thread pool adjusting module is used for adjusting the thread pool according to the parameter adjusting result and the thread adjusting result.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
acquiring resource parameters associated with a thread pool;
determining the number of submitted tasks and the number of executed tasks of the thread pool in a preset time period;
obtaining a parameter adjustment result and a thread adjustment result of the thread pool according to the resource parameter, the number of submitted tasks and the number of executed tasks;
and adjusting the thread pool according to the parameter adjustment result and the thread adjustment result.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
acquiring resource parameters associated with a thread pool;
determining the number of submitted tasks and the number of executed tasks of the thread pool in a preset time period;
obtaining a parameter adjustment result and a thread adjustment result of the thread pool according to the resource parameter, the number of submitted tasks and the number of executed tasks;
and adjusting the thread pool according to the parameter adjustment result and the thread adjustment result.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
acquiring resource parameters associated with a thread pool;
determining the number of submitted tasks and the number of executed tasks of the thread pool in a preset time period;
obtaining a parameter adjustment result and a thread adjustment result of the thread pool according to the resource parameter, the number of submitted tasks and the number of executed tasks;
and adjusting the thread pool according to the parameter adjustment result and the thread adjustment result.
The thread pool adjusting method, the thread pool adjusting device, the computer equipment, the storage medium and the computer program product acquire the resource parameters associated with the thread pool; determining the number of submitted tasks and the number of executed tasks of a thread pool in a preset time period; obtaining a parameter adjustment result and a thread adjustment result of a thread pool according to the resource parameters, the number of submitted tasks and the number of executed tasks; and adjusting the thread pool according to the parameter adjustment result and the thread adjustment result. By adopting the method, the resource parameter condition and the task condition of the current thread pool can be perceived, further, the dynamic adjustment of the thread pool is realized according to the change trend of the resource parameter and the task, and the resource utilization rate and the task execution efficiency of the thread pool are improved.
Drawings
FIG. 1 is a flow diagram of a thread pool adjustment method in one embodiment;
FIG. 2 is a flow chart of steps for determining the number of submitted tasks and the number of executed tasks in a thread pool within a predetermined time period in one embodiment;
FIG. 3 is a schematic diagram of interactions between a plurality of subroutines in one embodiment;
FIG. 4 is a flow chart of a method of thread pool adjustment in another embodiment;
FIG. 5 is a flow chart of a thread pool adjustment method in yet another embodiment;
FIG. 6 is a block diagram of a thread pool adjusting device in one embodiment;
fig. 7 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
It should be noted that the thread pool adjusting method and device provided in the present application may be used in the application of the financial field in the aspect of thread pool adjustment, and may also be used in any field other than the financial field, for example, the computer technical field, where the application field of the thread pool adjusting method and device is not limited.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, etc.) and the data (including, but not limited to, data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data are required to comply with the related laws and regulations and standards of the related countries and regions.
In one embodiment, as shown in fig. 1, a thread pool adjustment method is provided, where the method is applied to a terminal to illustrate the method, it is understood that the method may also be applied to a server, and may also be applied to a system including the terminal and the server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the steps of:
step S101, acquiring resource parameters associated with a thread pool.
Wherein the resource parameter refers to parameter information for configuring and managing resources.
Specifically, the terminal may obtain various resource parameters associated with the thread pool from different levels, such as obtaining a resource parameter of the thread pool, a resource parameter of an application system corresponding to the thread pool, a resource parameter of an application resource of the thread pool, and so on.
Step S102, determining the number of submitted tasks and the number of executed tasks of the thread pool in a preset time period.
Where the number of submitted tasks refers to the number of tasks submitted into the thread pool. The number of execution tasks refers to the number of tasks that the thread pool performs.
Specifically, the terminal may analyze the dynamic change condition of the task in the thread pool by taking the time period as a unit, for example, a preset time period is determined first, where the preset time period may be a time period closest to the current time. The terminal counts the number of tasks submitted in the thread pool within a preset time period, namely the number of submitted tasks, and the number of tasks executed in the thread pool within the preset time period, namely the number of executed tasks.
Step S103, obtaining a parameter adjustment result and a thread adjustment result of the thread pool according to the resource parameters, the number of submitted tasks and the number of executed tasks.
The parameter adjustment result is used for indicating adjustment information of the thread pool resource parameter. The thread adjustment result is used for indicating adjustment information on the thread number in the thread pool.
Specifically, the terminal may call the analysis and calculation subroutine to perform comprehensive analysis on the resource parameters, the number of submitted tasks and the number of executed tasks, and finally output an adjustment result of the thread pool, where the adjustment result mainly includes a parameter adjustment result and a thread adjustment result.
Step S104, adjusting the thread pool according to the parameter adjustment result and the thread adjustment result.
Specifically, the terminal adjusts the parameters of the thread pool according to the parameter adjustment result, and adjusts the current thread number of the thread pool according to the thread adjustment result, so as to realize the dynamic adjustment function of the thread pool.
In the thread pool adjusting method, the resource parameters associated with the thread pool are acquired; determining the number of submitted tasks and the number of executed tasks of a thread pool in a preset time period; obtaining a parameter adjustment result and a thread adjustment result of a thread pool according to the resource parameters, the number of submitted tasks and the number of executed tasks; and adjusting the thread pool according to the parameter adjustment result and the thread adjustment result. By adopting the method, the resource parameter condition and the task condition of the current thread pool can be perceived, further, the dynamic adjustment of the thread pool is realized according to the change trend of the resource parameter and the task, and the resource utilization rate and the task execution efficiency of the thread pool are improved.
In one embodiment, in step S101, the obtaining the resource parameter associated with the thread pool specifically includes the following: extracting parameters of the thread pool to obtain thread pool resource parameters; extracting parameters of a target application system corresponding to the thread pool to obtain application resource parameters; extracting parameters of an operating system corresponding to the thread pool to obtain system resource parameters; and taking the thread pool resource parameter, the application resource parameter and the system resource parameter as the associated resource parameters of the thread pool.
It should be noted that, the terminal includes a parameter extraction subroutine capable of extracting different resource parameters, and the parameter extraction subroutine includes a system resource parameter extraction subroutine, an application resource parameter extraction subroutine, and a thread pool parameter extraction subroutine.
Specifically, the terminal may call a system resource parameter extraction subroutine to extract a system resource parameter from the operating system in which the thread pool is located. In practical applications, the system resource parameters include the use of an operating system CPU (Central Processing Unit ) and the use of an operating system I/O. The terminal can also call an application resource parameter extraction subroutine to extract application resource parameters from the target application system corresponding to the thread pool. In practical application, the application resource parameters include the use condition of the application system CPU and the use condition of the application system I/O. The terminal may also call a thread pool parameter extraction subroutine to extract thread resource parameters from the thread pool. The thread resource parameters comprise the current core thread number of the thread pool, the maximum thread number, the waiting queue length and the idle thread survival time.
In this embodiment, by extracting parameters of the thread pool, the application resource and the application system respectively to obtain a thread pool resource parameter, a system resource parameter and a system resource parameter, the extracted resource parameter is used as a resource parameter associated with the thread pool, so that the resources of the thread pool can be analyzed and adjusted according to the resource parameter in the subsequent steps, which is helpful for improving the resource utilization rate of the thread pool.
In one embodiment, as shown in fig. 2, the step S102 determines the number of submitted tasks and the number of executed tasks in the thread pool within a preset time period, which specifically includes the following contents:
step S201, determining commit time information of each commit task and execution time information of each execution task in the thread pool.
Where commit tasks refer to tasks that commit to the thread pool. Executing a task refers to a task that the thread pool has executed.
Step S202, screening out target submitting tasks and target executing tasks belonging to a preset time period from the submitting tasks and executing tasks of the thread pool according to the submitting time information and the executing time information.
The target submitting task and the target executing task refer to the submitting task and the executing task of which the corresponding time information is located in a preset time period.
Step S203, counting the target submitted tasks and the target execution tasks to obtain the number of submitted tasks and the number of execution tasks.
The terminal comprises a task statistics subroutine capable of completing task execution condition statistics, wherein the task statistics subroutine comprises a task number statistics subroutine and a task execution time statistics subroutine. FIG. 3 is a schematic diagram of interactions between a plurality of subroutines.
Specifically, the terminal acquires the commit time information of each commit task in the thread pool and the execution time information of each execution task in the thread pool. And sequentially identifying whether the submitting time information of each submitting task and the executing time information of each executing task are in a preset time period, and setting the submitting task and the executing task in the preset time period as target submitting tasks and target executing tasks by the terminal. The terminal can call a task number statistics subroutine to respectively count the number of target submitted tasks and target execution tasks to obtain the number of submitted tasks and the number of execution tasks.
In this embodiment, according to the commit time information of each commit task and the execution time information of each execution task in the thread pool, the target commit task and the target execution task belonging to the preset time period are screened from the commit tasks and the execution tasks in the thread pool, and then the number of commit tasks and the number of execution tasks of the target commit task are counted, so that the number of commit tasks and the number of execution tasks in the preset time period can be used as basis for analyzing and adjusting the number of threads in the next preset time period in the thread pool in the subsequent step, and the task execution efficiency of the thread pool is improved.
In one embodiment, after determining the number of submitted tasks and the number of executed tasks in the thread pool in the preset time period in step S102, the method further includes: acquiring execution time information of a target execution task; and generating the execution time distribution information of the target execution task according to the execution time information.
Specifically, the terminal is further provided with a task execution time statistics subroutine capable of counting time distribution. The terminal can also input the execution time information of each target execution task into a task execution time statistics subroutine so as to convert the execution time information of all the target execution tasks into a time distribution mode through the task execution time statistics subroutine, and then the terminal obtains the execution time distribution information of the target execution tasks.
In this embodiment, the execution time distribution information of the target execution task is obtained by calling the task execution time statistics subroutine, so that the time distribution of the execution task can be considered when the thread pool adjustment result is processed later, threads are set in multiple times in a peak time period of the execution task, and the number of threads is reduced in a valley time period of the execution task, thereby achieving the effect of improving the task execution efficiency of the thread pool.
In one embodiment, the step S103 obtains a parameter adjustment result and a thread adjustment result of the thread pool according to the resource parameter, the number of submitted tasks and the number of executed tasks, and specifically includes the following contents: acquiring a pre-trained adjustment result prediction model; and inputting the resource parameters, the number of submitted tasks, the number of executed tasks and the execution time distribution information into an adjustment result prediction model to obtain a parameter adjustment result and a thread adjustment result.
The adjustment result prediction model is a model for predicting resource parameter setting and thread setting of the thread pool in the next preset time period.
Specifically, the terminal can train to obtain the adjustment result prediction model by utilizing the historical resource parameters, the number of the historical submitted tasks, the number of the historical execution tasks and the historical execution time distribution information of the thread pool in the historical time period. Under the condition that the resource parameters, the number of submitted tasks, the number of executed tasks and the execution time distribution information in the current preset time period are obtained, the terminal inputs the resource parameters, the number of submitted tasks, the number of executed tasks and the execution time distribution information into the adjustment result prediction model so as to output the resource parameter setting information and the thread setting information of the thread pool in the next preset time period through the adjustment result prediction model. And the terminal obtains a resource parameter adjustment result and a thread adjustment result according to the difference between the thread pool resource parameter and the thread number in the next preset time period and the thread pool resource parameter and the thread number in the current preset time period.
Furthermore, the terminal may further package the adjustment result prediction model into an analysis and calculation subroutine, and connect the analysis and calculation subroutine with the parameter extraction subroutine and the task statistics subroutine, respectively. The analysis and calculation subprogram receives the output results of the parameter extraction subprogram and the task statistics subprogram, takes the received output results as input, comprehensively calculates to obtain the parameter adjustment result and the thread adjustment result of the thread pool according to the statistics results of each level of resource condition and the task execution condition, and realizes the closed loop processing of the related parameter reading and the parameter adjustment of the thread pool.
In this embodiment, the change conditions of the thread pool are analyzed from two aspects of resource utilization trend and task execution trend by using the resource parameters, the number of submitted tasks, the number of executed tasks and the execution time distribution information, and the parameter adjustment result and the thread adjustment result are obtained, so that the adjusted thread pool can adapt to the changes of the two aspects of resources and tasks, and the resource utilization rate and the task execution efficiency of the thread pool are improved.
In one embodiment, the step S104 adjusts the thread pool according to the parameter adjustment result and the thread adjustment result, and specifically includes the following steps: according to the parameter adjustment result, adjusting the thread pool resource parameter of the thread pool to obtain an adjusted thread pool; and adjusting the thread quantity of the adjusted thread pool according to the thread adjusting result.
Specifically, the terminal may call the thread pool adjusting subroutine to increase or decrease the thread pool resource parameter of the thread pool in the next preset time period according to the parameter adjusting result, so as to obtain an adjusted thread pool. And the terminal adjusts the thread quantity of the adjusted thread pool in the next preset time period according to the thread adjusting result, for example, the thread quantity is increased in a certain peak time period in the next preset time period, and the thread quantity is reduced in a certain low-valley time period, so that the dynamic adjustment of the threads is realized.
In this embodiment, the thread pool resource parameters and the thread number of the thread pool are adjusted according to the parameter adjustment result and the thread adjustment result, so that the thread pool can be dynamically adjusted according to the change trend of the resource parameters and the task, and the resource utilization rate and the task execution efficiency of the thread pool are improved.
In one embodiment, as shown in fig. 4, another thread pool adjustment method is provided, and the method is applied to a terminal for illustration, and includes the following steps:
and S401, extracting parameters of the thread pool to obtain thread pool resource parameters.
And step S402, extracting parameters of a target application system corresponding to the thread pool to obtain application resource parameters.
Step S403, extracting parameters of the operating system of the thread pool to obtain system resource parameters.
Step S404, the thread pool resource parameter, the application resource parameter and the system resource parameter are used as the associated resource parameters of the thread pool.
Step S405, determining commit time information of each commit task and execution time information of each execution task in the thread pool.
Step S406, screening out target submitting tasks and target executing tasks belonging to a preset time period from the submitting tasks and executing tasks of the thread pool according to the submitting time information and the executing time information.
Step S407, counting the target submitted tasks and the target execution tasks to obtain the number of submitted tasks and the number of execution tasks.
Step S408, obtaining execution time information of a target execution task; and generating the execution time distribution information of the target execution task according to the execution time information.
Step S409, inputting the resource parameters, the number of submitted tasks, the number of executed tasks and the distribution information of the execution time into the adjustment result prediction model to obtain a parameter adjustment result and a thread adjustment result.
Step S410, adjusting the thread pool according to the parameter adjustment result and the thread adjustment result.
The thread pool adjusting method can realize the following beneficial effects: the method and the device can sense the resource parameter condition and the task condition of the current thread pool, further realize the dynamic adjustment of the thread pool according to the change trend of the resource parameter and the task, and improve the resource utilization rate and the task execution efficiency of the thread pool.
In order to more clearly illustrate the thread pool adjusting method provided by the embodiments of the present disclosure, a specific embodiment is described below specifically. As shown in fig. 5, a further thread pool adjustment method is provided, which can be applied to a terminal, and specifically includes the following contents:
step 1, starting an operating system of a target application system and a thread pool.
Step 2, periodically extracting resource parameters of each level through a parameter extraction subprogram and inputting the resource parameters into an analysis and calculation subprogram, wherein the step comprises the following steps: a) Extracting system resource parameters; b) Extracting application resource parameters; c) And (5) extracting thread pool parameters.
Step 3, the task statistics subroutine counts the submitting and executing conditions of the tasks in the thread pool according to the fixed period, and inputs the analysis calculation subroutine, comprising: a) Counting the number of tasks; b) And counting task execution time.
And 4, analyzing and calculating the input of the comprehensive parameter extraction subprogram and the task statistics subprogram of the calculation subprogram, analyzing and calculating according to the input data to obtain the adjustment result of the thread pool, and inputting the adjustment result into the thread Chi Diaojie subprogram.
And 5, the thread pool adjusting subprogram correspondingly adjusts the thread pool corresponding to the target application system according to the adjusting result input by the analysis and calculation subprogram, and comprises the following steps: and (3) adjusting the thread pool resource parameters and adjusting the number of threads.
In the embodiment, the resource parameter condition and the task condition of the current thread pool can be perceived, so that the thread pool can be dynamically adjusted according to the change trend of the resource parameter and the task, and the resource utilization rate and the task execution efficiency of the thread pool are improved.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a thread pool adjusting device for realizing the above-mentioned thread pool adjusting method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of the thread pool adjusting device or thread pool adjusting devices provided below may be referred to the limitation of the thread pool adjusting method hereinabove, and will not be described herein.
In one embodiment, as shown in FIG. 6, there is provided a thread pool adjustment device 600 comprising: a parameter acquisition module 601, a task statistics module 602, an adjustment analysis module 603, and a thread pool adjustment module 604, wherein:
the parameter obtaining module 601 is configured to obtain a resource parameter associated with a thread pool.
The task statistics module 602 is configured to determine the number of submitted tasks and the number of executed tasks in a thread pool within a preset time period.
The adjustment analysis module 603 is configured to obtain a parameter adjustment result and a thread adjustment result of the thread pool according to the resource parameter, the number of submitted tasks, and the number of executed tasks.
The thread pool adjusting module 604 is configured to adjust the thread pool according to the parameter adjustment result and the thread adjustment result.
In one embodiment, the parameter obtaining module 601 is further configured to perform parameter extraction on the thread pool to obtain a thread pool resource parameter; extracting parameters of a target application system corresponding to the thread pool to obtain application resource parameters; extracting parameters of an operating system of the thread pool to obtain system resource parameters; and taking the thread pool resource parameter, the application resource parameter and the system resource parameter as the associated resource parameters of the thread pool.
In one embodiment, the task statistics module 602 is further configured to determine commit time information of each commit task and execution time information of each execution task in the thread pool; screening target submitting tasks and target executing tasks belonging to a preset time period from submitting tasks and executing tasks of a thread pool according to the submitting time information and the executing time information; and counting the target submitted tasks and the target execution tasks to obtain the number of submitted tasks and the number of execution tasks.
In one embodiment, the thread pool adjusting device 600 further includes a distribution statistics module, configured to obtain execution time information of the target execution task; and generating the execution time distribution information of the target execution task according to the execution time information.
In one embodiment, the adjustment analysis module 603 is further configured to obtain a pre-trained adjustment result prediction model; and inputting the resource parameters, the number of submitted tasks, the number of executed tasks and the execution time distribution information into an adjustment result prediction model to obtain a parameter adjustment result and a thread adjustment result.
In one embodiment, the thread pool adjusting module 604 is further configured to adjust a thread pool resource parameter of the thread pool according to the parameter adjustment result, to obtain an adjusted thread pool; and adjusting the thread quantity of the adjusted thread pool according to the thread adjusting result.
The various modules in the thread pool adjustment apparatus described above may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a thread pool adjustment method. The display unit of the computer device is used for forming a visual picture, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 7 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, carries out the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (10)

1. A method of thread pool adjustment, the method comprising:
acquiring resource parameters associated with a thread pool;
determining the number of submitted tasks and the number of executed tasks of the thread pool in a preset time period;
obtaining a parameter adjustment result and a thread adjustment result of the thread pool according to the resource parameter, the number of submitted tasks and the number of executed tasks;
and adjusting the thread pool according to the parameter adjustment result and the thread adjustment result.
2. The method of claim 1, wherein the obtaining the thread pool associated resource parameter comprises:
extracting parameters of the thread pool to obtain thread pool resource parameters;
extracting parameters of a target application system corresponding to the thread pool to obtain application resource parameters;
extracting parameters of an operating system of the thread pool to obtain system resource parameters;
and taking the thread pool resource parameter, the application resource parameter and the system resource parameter as the resource parameters associated with the thread pool.
3. The method of claim 1, wherein determining the number of submitted tasks and the number of executed tasks of the thread pool within a preset time period comprises:
determining the commit time information of each commit task and the execution time information of each execution task in the thread pool;
screening target submitting tasks and target executing tasks belonging to the preset time period from the submitting tasks and executing tasks of the thread pool according to the submitting time information and the executing time information;
and counting the target submitted tasks and the target execution tasks to obtain the number of submitted tasks and the number of execution tasks.
4. The method of claim 3, further comprising, after determining the number of submitted tasks and the number of executed tasks for the thread pool within a preset time period:
acquiring execution time information of the target execution task;
and generating the execution time distribution information of the target execution task according to the execution time information.
5. The method of claim 4, wherein the obtaining the parameter adjustment result and the thread adjustment result of the thread pool according to the resource parameter, the number of submitted tasks, and the number of executed tasks comprises:
acquiring a pre-trained adjustment result prediction model;
and inputting the resource parameters, the number of submitted tasks, the number of executed tasks and the execution time distribution information into the adjustment result prediction model to obtain the parameter adjustment result and the thread adjustment result.
6. The method of claim 1, wherein said adjusting said thread pool based on said parameter adjustment results and said thread adjustment results comprises:
according to the parameter adjustment result, adjusting the thread pool resource parameter of the thread pool to obtain an adjusted thread pool;
and adjusting the thread quantity of the adjusted thread pool according to the thread adjusting result.
7. A thread pool adjustment apparatus, the apparatus comprising:
the parameter acquisition module is used for acquiring the resource parameters associated with the thread pool;
the task statistics module is used for determining the number of submitted tasks and the number of executed tasks of the thread pool in a preset time period;
the adjustment analysis module is used for obtaining a parameter adjustment result and a thread adjustment result of the thread pool according to the resource parameter, the number of submitted tasks and the number of executed tasks;
and the thread pool adjusting module is used for adjusting the thread pool according to the parameter adjusting result and the thread adjusting result.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202311249810.6A 2023-09-26 2023-09-26 Thread pool adjusting method, device, computer equipment and storage medium Pending CN117453356A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311249810.6A CN117453356A (en) 2023-09-26 2023-09-26 Thread pool adjusting method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311249810.6A CN117453356A (en) 2023-09-26 2023-09-26 Thread pool adjusting method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117453356A true CN117453356A (en) 2024-01-26

Family

ID=89595625

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311249810.6A Pending CN117453356A (en) 2023-09-26 2023-09-26 Thread pool adjusting method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117453356A (en)

Similar Documents

Publication Publication Date Title
US11106486B2 (en) Techniques to manage virtual classes for statistical tests
CN110647512A (en) Data storage and analysis method, device, equipment and readable medium
CN117035980A (en) Resource borrowing evaluation method, device, computer equipment and storage medium
CN117453356A (en) Thread pool adjusting method, device, computer equipment and storage medium
CN114253481A (en) Data storage method and device, computer equipment and storage medium
CN113835953A (en) Statistical method and device of job information, computer equipment and storage medium
Venieris et al. NAWQ-SR: A Hybrid-Precision NPU Engine for Efficient On-Device Super-Resolution
CN115329733B (en) Report form statistical method and device, computer equipment and storage medium
CN116204296A (en) Algorithm execution method, device, computer equipment and storage medium of monitoring system
CN118092997A (en) Source code adjustment method, source code adjustment device, computer equipment and storage medium
CN118034906A (en) Cloud server cluster processing method and device, computer equipment and storage medium
CN117873824A (en) Chip power consumption optimization method, device, computer equipment and storage medium
CN116700969A (en) Task processing method, device, computer equipment and storage medium
CN117909093A (en) Data distribution processing method and device for chip interface
CN116112442A (en) Request response method, request response device, computer device, storage medium, and program product
CN117574221A (en) Business logic analysis method, device, computer equipment and storage medium
CN117112206A (en) Transaction resource isolation method, device, computer equipment and storage medium
CN117314036A (en) Work order distribution method, apparatus, device, storage medium and program product
CN117745446A (en) Resource data processing method, device, computer equipment and storage medium
CN117908825A (en) Chip data sequential processing method, device, computer equipment and storage medium
CN116860435A (en) Nuclear function priority determining method, device, computer equipment and storage medium
CN116681203A (en) Enterprise management consultation method and system based on big data analysis
CN117851071A (en) Application resource allocation method and device, computer equipment and storage medium
CN118154300A (en) Mortgage parameter processing method, mortgage parameter processing device, computer equipment and storage medium
CN117973723A (en) List processing method, device, computer equipment and 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