CN109885385B - Self-optimizing method, device and equipment for application server thread pool - Google Patents

Self-optimizing method, device and equipment for application server thread pool Download PDF

Info

Publication number
CN109885385B
CN109885385B CN201811574499.1A CN201811574499A CN109885385B CN 109885385 B CN109885385 B CN 109885385B CN 201811574499 A CN201811574499 A CN 201811574499A CN 109885385 B CN109885385 B CN 109885385B
Authority
CN
China
Prior art keywords
target value
tuning
maximum
thread
application server
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.)
Active
Application number
CN201811574499.1A
Other languages
Chinese (zh)
Other versions
CN109885385A (en
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.)
Shandong Civic Se Commercial Middleware Co ltd
Original Assignee
Shandong Civic Se Commercial Middleware 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 Shandong Civic Se Commercial Middleware Co ltd filed Critical Shandong Civic Se Commercial Middleware Co ltd
Priority to CN201811574499.1A priority Critical patent/CN109885385B/en
Publication of CN109885385A publication Critical patent/CN109885385A/en
Application granted granted Critical
Publication of CN109885385B publication Critical patent/CN109885385B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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

  • Measurement Of The Respiration, Hearing Ability, Form, And Blood Characteristics Of Living Organisms (AREA)
  • Hardware Redundancy (AREA)

Abstract

The invention discloses a self-optimizing method, a device, equipment and a computer readable storage medium for an application server thread pool, wherein the method comprises the following steps: acquiring tuning input parameters of an application server at the current moment in a timing way, wherein the tuning input parameters comprise service concurrency, service response time and resource utilization rate; calculating the tuning input parameters by using a climbing algorithm to obtain a tuning target value, and comparing the tuning target value with the maximum number of threads currently allowed by the application server; and if the tuning target value is equal to the maximum thread number, determining that the maximum thread number is not required to be adjusted, otherwise, setting the maximum thread number as the tuning target value. According to the thread pool self-adjusting method and device, the automatic self-adjusting process of the thread pool can be achieved, manual participation is not needed, and strong instantaneity can be achieved.

Description

Self-optimizing method, device and equipment for application server thread pool
Technical Field
The present invention relates to the technical field of application servers, and more particularly, to a method, an apparatus, a device, and a computer readable storage medium for self-optimizing an application server thread pool.
Background
In the process of switching home-made environments, the method has high requirements on the performance and user experience of the service system. In order to improve the performance and user experience of the service system, performance improvement of the application server is generally required, and in order to improve the performance of the application server, tuning of a thread pool of the application server is often required. At present, the thread pool of an application server is usually tuned by a worker, for example, a high concurrency service manually tunes the thread pool to a larger extent, and a low concurrency service manually tunes the thread pool to a smaller extent, but the mode not only requires the real-time intervention of the worker, but also can avoid poor real-time property of the thread pool tuning due to lower manual operation speed due to the fact that the worker manually realizes the thread pool tuning process.
In summary, the technical solution for implementing thread pool tuning of an application server in the prior art has the problems of requiring manual intervention and poor real-time performance.
Disclosure of Invention
The invention aims to provide a self-tuning method, device and equipment for an application server thread pool and a computer readable storage medium, which can solve the problems of manual intervention and poor real-time performance in the technical scheme for realizing the tuning of the application server thread pool in the prior art.
In order to achieve the above object, the present invention provides the following technical solutions:
a method for self-optimizing an application server thread pool, comprising:
acquiring tuning input parameters of an application server at the current moment in a timing way, wherein the tuning input parameters comprise service concurrency, service response time and resource utilization rate;
calculating the tuning input parameters by using a climbing algorithm to obtain a tuning target value, and comparing the tuning target value with the maximum number of threads currently allowed by the application server;
and if the tuning target value is equal to the maximum thread number, determining that the maximum thread number is not required to be adjusted, otherwise, setting the maximum thread number as the tuning target value.
Preferably, after determining that the tuning target value is not equal to the maximum number of threads, the method further includes:
if the tuning target value is greater than the maximum thread number, judging whether tasks waiting for execution exist in task queues corresponding to the thread pool, if so, creating a difference value between the tuning target value and the maximum thread number and a smaller value thread in the number of tasks waiting for execution, so as to realize execution of the tasks waiting for execution by using the created threads, and executing the step of setting the maximum thread number as the tuning target value, and if not, executing the step of setting the maximum thread number as the tuning target value.
Preferably, after determining that the tuning target value is not equal to the maximum number of threads, the method further includes:
if the tuning target value is smaller than the maximum thread number, judging whether the tuning target value is larger than the current thread number of the thread pool, if so, executing the step of setting the maximum thread number as the tuning target value, if not, setting the maximum thread number as the current thread number, creating a difference value of the current thread number and the tuning target value as idle threads, so as to realize task execution by using the idle threads and cancel threads in the corresponding thread pool, and subtracting 1 from the maximum thread number every cancellation of one thread until the maximum thread number is equal to the tuning target value, so as to set the maximum thread number as the tuning target value.
Preferably, after setting the maximum thread number to the tuning target value, the method further includes:
and judging whether the maximum thread number is equal to the tuning target value, if so, determining that the tuning is completed, otherwise, returning to the step of comparing the tuning target value with the maximum thread number currently allowed by the application server until the number of times of returning reaches a preset number of times.
Preferably, after the number of times of returning reaches the preset number of times, the method further includes:
judging whether the maximum thread number is equal to the tuning target value, if so, determining that the tuning is finished, otherwise, outputting error reporting information.
Preferably, outputting the error reporting information includes:
and sending the error reporting information to a pre-designated terminal, wherein the error reporting information comprises the maximum thread number and the tuning target value.
Preferably, the resource usage rate includes a CPU usage rate and a memory usage rate of the application server.
A self-optimizing apparatus for an application server thread pool, comprising:
an acquisition module for: acquiring tuning input parameters of an application server at the current moment in a timing way, wherein the tuning input parameters comprise service concurrency, service response time and resource utilization rate;
a calculation module for: calculating the tuning input parameters by using a climbing algorithm to obtain a tuning target value, and comparing the tuning target value with the maximum number of threads currently allowed by the application server;
a setting module, configured to: and if the tuning target value is equal to the maximum thread number, determining that the maximum thread number is not required to be adjusted, otherwise, setting the maximum thread number as the tuning target value.
A self-optimizing apparatus for an application server thread pool, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the method for self-tuning an application server thread pool as claimed in any one of the preceding claims when executing said computer program.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of a method of self-tuning an application server thread pool as claimed in any one of the preceding claims.
The invention discloses a self-optimizing method, a device, equipment and a computer readable storage medium for an application server thread pool, wherein the method comprises the following steps: acquiring tuning input parameters of an application server at the current moment in a timing way, wherein the tuning input parameters comprise service concurrency, service response time and resource utilization rate; calculating the tuning input parameters by using a climbing algorithm to obtain a tuning target value, and comparing the tuning target value with the maximum number of threads currently allowed by the application server; and if the tuning target value is equal to the maximum thread number, determining that the maximum thread number is not required to be adjusted, otherwise, setting the maximum thread number as the tuning target value. According to the technical scheme, the mountain climbing algorithm is used at regular time, based on the service concurrency, service response time and resource utilization rate of the application server, the maximum thread number which the thread pool should be allowed to currently, namely the tuning target value, is determined, and then the maximum thread number of the thread pool is automatically adjusted to the tuning target value based on the comparison result by comparing the tuning target value with the maximum thread number which the thread pool is allowed to currently, so that the automatic tuning process of the thread pool is realized, manual participation is not needed, and strong instantaneity can be achieved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for self-tuning an application server thread pool according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a self-optimizing device for an application server thread pool according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, a flowchart of a method for self-optimizing an application server thread pool according to an embodiment of the present invention may include:
s11: and acquiring tuning input parameters of the application server at the current moment in a timing way, wherein the tuning input parameters comprise service concurrency, service response time and resource utilization rate.
It should be noted that, the execution subject of the self-tuning method of the application server thread pool provided by the embodiment of the invention can be self-tuning. It should be noted that, the time interval between every two adjacent time of obtaining the tuning input parameters in the timing tuning input parameters can be set according to actual needs, so that the tuning input parameters of the application server at the current moment are automatically obtained when the corresponding time interval is reached each time, the tuning input parameters include the current service concurrency of the application server, service response time and resource utilization rate, and of course, other parameters capable of representing the current service condition and resource utilization condition of the application server can be included according to actual needs; the business concurrency, business response time and resource utilization rate have the same meaning as the corresponding concepts in the prior art, and are not described herein.
In addition, the application server can be a domestic server, so that the self-tuning optimization of the domestic server thread pool is realized by applying the method provided by the embodiment of the invention on the domestic server.
S12: and calculating the tuning input parameters by using a hill climbing algorithm to obtain a tuning target value, and comparing the tuning target value with the current allowed maximum thread number of the application server.
It should be noted that, the mountain climbing algorithm has the same meaning as the corresponding concept in the prior art, and is a local preferred method, which can utilize feedback information to help generate a solution decision, and belongs to one of artificial intelligence algorithms. In the method, a mountain climbing algorithm is utilized to calculate a tuning input algorithm, the obtained result is a tuning target value, and the tuning target value is the maximum number of threads which are matched with the current tuning input parameters and allowed by the application server thread Chi Yingyun. Therefore, after determining the tuning target value, the tuning target value needs to be compared with the maximum number of threads allowed by the application server currently, so that whether the maximum number of threads of the application server needs to be adjusted is determined based on the comparison result. In addition, the maximum thread number allowed by the application server is a variable, and different values can be given to the thread number at different moments so that the thread number can be matched with the service condition and the resource use condition of the application server at corresponding moments.
S13: if the tuning target value is equal to the maximum thread number, determining that the maximum thread number is not required to be adjusted, otherwise, setting the maximum thread number as the tuning target value.
If the tuning target value is equal to the maximum thread number, the maximum thread number allowed by the thread pool is the value matched with the current service condition and resource use condition of the application server, so that adjustment is not needed, otherwise, the maximum thread number needs to be set as the tuning target value, so that the maximum thread number allowed by the thread pool is matched with the service condition and resource use condition of the application server.
According to the technical scheme, the mountain climbing algorithm is used at regular time, based on the service concurrency, service response time and resource utilization rate of the application server, the maximum thread number which the thread pool should be allowed to currently, namely the tuning target value, is determined, and then the maximum thread number of the thread pool is automatically adjusted to the tuning target value based on the comparison result by comparing the tuning target value with the maximum thread number which the thread pool is allowed to currently, so that the automatic tuning process of the thread pool is realized, manual participation is not needed, and strong instantaneity can be achieved.
The self-tuning method for the application server thread pool provided by the embodiment of the invention can further comprise the following steps after determining that the tuning target value is not equal to the maximum thread number:
if the tuning target value is larger than the maximum thread number, judging whether tasks waiting to be executed exist in task queues corresponding to the thread pool, if so, creating a difference value between the tuning target value and the maximum thread number and a smaller value thread in the number of the tasks waiting to be executed, executing the tasks waiting to be executed by using the created threads, and executing the step of setting the maximum thread number as the tuning target value, and if not, executing the step of setting the maximum thread number as the tuning target value.
After determining the tuning target value, the process of correspondingly adjusting the comparison result based on the tuning target value and the maximum number of threads can be realized by adding a presize () method dedicated to modifying the maximum number of threads. Specifically, the maximum thread number may be denoted as maxThreadPoolSize, the tuning target value may be denoted as target value, the task queue may be denoted as workQueue, and the task may be denoted as Worker; when target > maxThreadPoolSize and there is no waiting workbench in the workQueue, the maxThreadPoolSize can be set directly to target without further changes. When target > maxThreadPoolSize and there is a waiting Worker in the workQueue, then the thread for executing the waiting Worker in the workQueue may be dynamically added and maxThreadPoolSize set to target. When the threads for executing the tasks waiting for execution are dynamically increased, the dynamically increased threads can meet the execution of the tasks waiting for execution at present, and the number of threads does not need to be increased to the maximum at one time, so that the difference value between the optimal target value and the maximum number of threads and the number of tasks waiting for execution can be compared, and if the difference value is equal to the number of tasks waiting for execution, the dynamically increased number of threads is equal to the difference value or the number of tasks waiting for execution; if the difference is greater than the number of tasks waiting for execution, the number of threads in the dynamic increment is equal to the number of tasks waiting for execution in order to avoid thread waste and simultaneously normally execute the tasks waiting for execution; if the difference is smaller than the number of tasks waiting for execution, in order to avoid that the total number of threads in the thread pool exceeds the optimal target value, the dynamically increased number of threads can only be equal to the difference, and part of tasks in the tasks waiting for execution are executed by using the increased threads, and the rest of tasks continue to be executed after waiting for idle threads. Thus, when the tuning target value is larger than the maximum number of threads, the task waiting to be executed can be executed to the maximum limit, and meanwhile, the successful setting of the maximum number of threads in the thread pool can be ensured.
The self-tuning method for the application server thread pool provided by the embodiment of the invention can further comprise the following steps after determining that the tuning target value is not equal to the maximum thread number:
if the tuning target value is smaller than the maximum thread number, judging whether the tuning target value is larger than the current thread number of the thread pool, if so, executing the step of setting the maximum thread number as the tuning target value, if not, setting the maximum thread number as the current thread number, creating a difference value of the current thread number and the tuning target value, creating idle threads to realize task execution by the idle threads and log off the threads in the corresponding thread pool, and subtracting 1 from the maximum thread number every log off of one thread until the maximum thread number is equal to the tuning target value, so as to set the maximum thread number as the tuning target value.
It should be noted that, the idle thread may be created in the task queue, so that the idle thread is utilized to implement execution of the task that needs to be executed currently, while the thread that should execute the task that is executed by the idle thread and exists in the thread pool may be logged out, so that the thread in the thread pool is logged out through the spatial thread, the number of threads in the thread pool is reduced, so that the number of thread pools can be adjusted to the tuning target value, and tuning of the thread pool is implemented. Specifically, the number of threads currently in the thread pool, that is, the current number of threads, may be expressed as currentPoolSize, when the target is < maxThreadPoolSize, the target and currentPoolSize need to be compared, if the target is > currentPoolSize, it is indicated that the threads in the thread pool do not need to be ended, and maxThreadPoolSize may be set as the target directly. If the target is smaller than the currentPoolSize, it means that after the thread pool is reduced, more executing threads cancel, then according to the number delta of threads cancel, insert delta Poison (idling threads) into the workQueue, that is, insert difference value between currentPoolSize and target into the work queue, thereby implementing task execution by using idling threads, and cancel the corresponding threads in the thread pool, implementing slow reduction of the thread pool, avoiding task execution abnormality caused by directly reducing the thread pool to the target.
And when it is determined that the thread pool needs to be reduced, maxThreadPoolSize can be set as currentPoolSize, and after each thread in one thread pool is logged off, if maxThreadPoolSize > target, maxthreadpoolsize— is ensured to gradually change to target.
In addition, when an idle thread is added to the task queue, if so, it is determined whether the total number of idle threads is equal to the difference between currentPoolSize and target, if so, it is indicated that the increased number of idle threads reaches the requirement, and no further increase is needed, otherwise, it is indicated that the increased number of idle threads does not reach the requirement, and further increase is needed, so that accurate setting of idle threads is achieved.
The method for self-adjusting the optimal value of the application server thread pool provided by the embodiment of the invention can further comprise the following steps after the maximum thread number is set as the optimal target value:
judging whether the maximum thread number is equal to the tuning target value, if so, determining that the tuning is completed, otherwise, returning to execute the step of comparing the tuning target value with the maximum thread number currently allowed by the application server until the number of times of returning reaches the preset number of times.
After the adjustment of the maximum number of threads in the thread pool is achieved, whether the current maximum number of threads is equal to the tuning target value can be judged to check whether the sub-tuning is successful or not, if so, the successful realization of the sub-tuning is indicated, namely the sub-tuning is completed, otherwise, the failure of the sub-tuning is indicated, and a step of comparing the tuning target value with the current maximum number of threads allowed by the application server is required to be returned to ensure the successful realization of the sub-tuning. In addition, if the number of times of the step of comparing the tuning target value with the maximum number of threads currently allowed by the application server reaches the preset number of times set according to actual needs, the corresponding step is not performed again even if the current maximum number of threads is not equal to the tuning target value, so that the self-tuning cannot be successfully realized due to other problems, and even if the self-tuning related step is performed again, the self-tuning cannot be successfully realized, thereby avoiding the waste of algorithm resources.
The self-optimizing method for the application server thread pool provided by the embodiment of the invention can further comprise the following steps after the return times reach the preset times:
judging whether the maximum thread number is equal to the tuning target value, if so, determining that the tuning is finished, otherwise, outputting error reporting information.
If the number of times of executing the corresponding step of self-tuning reaches the preset number of times and the maximum number of threads is not equal to the tuning target value, the fact that the self-tuning cannot be successfully achieved is indicated to be likely due to other problems, and error reporting information can be output at this time, so that a worker can acquire the self-tuning condition based on the error reporting information, corresponding operation is achieved, and the worker can acquire and process the self-tuning condition conveniently.
The self-optimizing method for the application server thread pool provided by the embodiment of the invention outputs error reporting information, and the method can comprise the following steps:
and sending error reporting information to a pre-designated terminal, wherein the error reporting information comprises the maximum thread number and a tuning target value.
The pre-designated terminal may be a terminal corresponding to a worker who needs to manage the self-tuning, so that error reporting information including the maximum number of threads and the tuning target value is sent to the designated terminal, so that the corresponding worker can timely acquire the maximum number of threads and the tuning target value based on the error reporting information and perform corresponding processing. Of course, the error reporting information can be set in other ways according to the actual needs, and the error reporting information is within the protection scope of the invention.
In addition, the resource utilization rate can include the CPU utilization rate and the memory utilization rate of the application server, and the two resource utilization rates can effectively reflect the resource utilization condition of the application server, and other settings can be performed according to actual needs, which are all within the protection scope of the invention.
In summary, the technical scheme disclosed by the application takes the business concurrency, the resource utilization rate, the business response time and the like as reference factors, combines the factors with the climbing algorithm to obtain the size adjustment direction and the strength (adjustment target value) of the thread pool under the corresponding scene, and further realizes the adjustment of the thread pool based on the adjustment direction and the strength (adjustment target value). Therefore, the performance requirement of high-frequency service is guaranteed, and the waste of hardware resources of low-frequency service is avoided.
The embodiment of the invention also provides a self-optimizing device for the application server thread pool, which can comprise the following steps as shown in fig. 2:
an acquisition module 11 for: acquiring tuning input parameters of an application server at the current moment in a timing way, wherein the tuning input parameters comprise service concurrency, service response time and resource utilization rate;
a calculation module 12 for: calculating a tuning input parameter by using a hill climbing algorithm to obtain a tuning target value, and comparing the tuning target value with the current allowed maximum thread number of an application server;
a setting module 13 for: if the tuning target value is equal to the maximum thread number, determining that the maximum thread number is not required to be adjusted, otherwise, setting the maximum thread number as the tuning target value.
Therefore, in the process of realizing self-tuning of the thread pool, the algorithm for adjusting the size of the thread pool in the thread pool and the thread pool are decoupled into two independent devices, so that the maintenance and other works of the devices are facilitated. Moreover, an API for detection and regulation needs to be set for the thread pool, so that the device of the embodiment can obtain corresponding information and adjust the size of the thread pool through the API.
The self-optimizing device for the application server thread pool provided by the embodiment of the invention can further comprise:
a first execution module for: after determining that the tuning target value is not equal to the maximum number of threads, if the tuning target value is greater than the maximum number of threads, judging whether a task waiting to be executed exists in a task queue corresponding to the thread pool, if so, creating a difference value between the tuning target value and the maximum number of threads and a smaller number of threads in the number of tasks waiting to be executed, so as to realize execution of the task waiting to be executed by using the created threads, and instructing the setting module to execute the step of setting the maximum number of threads as the tuning target value, and if not, instructing the setting module to execute the step of setting the maximum number of threads as the tuning target value.
The self-optimizing device for the application server thread pool provided by the embodiment of the invention can further comprise:
a second execution module for: after determining that the tuning target value is not equal to the maximum number of threads, if the tuning target value is smaller than the maximum number of threads, judging whether the tuning target value is larger than the current number of threads in the thread pool, if so, instructing the setting module to execute the step of setting the maximum number of threads as the tuning target value, if not, setting the maximum number of threads as the current number of threads, creating a difference value between the current number of threads and the tuning target value, and idling threads so as to realize task execution by the idling threads and cancel threads in the corresponding thread pool, and subtracting 1 from the maximum number of threads until the maximum number of threads is equal to the tuning target value every time one thread is cancelled, so that the maximum number of threads is set as the tuning target value.
The self-optimizing device for the application server thread pool provided by the embodiment of the invention can further comprise:
the first judging module is used for: after the maximum thread number is set as the tuning target value, judging whether the maximum thread number is equal to the tuning target value, if so, determining that the tuning is completed, otherwise, returning to execute the step of comparing the tuning target value with the maximum thread number currently allowed by the application server until the number of times of returning reaches the preset number of times.
The self-optimizing device for the application server thread pool provided by the embodiment of the invention can further comprise:
the second judging module is used for: after the number of times returned reaches the preset number of times, judging whether the maximum number of threads is equal to the tuning target value, if so, determining that the tuning is finished, and if not, outputting error reporting information.
The second judging module of the self-optimizing device for the application server thread pool provided by the embodiment of the invention can comprise:
error reporting unit for: and sending error reporting information to a pre-designated terminal, wherein the error reporting information comprises the maximum thread number and a tuning target value.
The embodiment of the invention also provides a self-optimizing device for the application server thread pool, which can comprise:
a memory for storing a computer program;
a processor for implementing the steps of the self-optimizing method of any one of the application server thread pools as described above when executing a computer program.
The embodiment of the invention also provides a computer readable storage medium, wherein the computer readable storage medium is stored with a computer program, and the computer program can realize the steps of the self-optimizing method of any application server thread pool when being executed by a processor.
It should be noted that, for the description of the related parts in the self-tuning device and apparatus for an application server thread pool and the computer readable storage medium provided in the embodiments of the present invention, please refer to the detailed description of the corresponding parts in the self-tuning method for an application server thread pool provided in the embodiments of the present invention, and the detailed description is omitted herein. In addition, the parts of the above technical solutions provided in the embodiments of the present invention, which are consistent with the implementation principles of the corresponding technical solutions in the prior art, are not described in detail, so that redundant descriptions are avoided.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (9)

1. A method for self-optimizing a thread pool of an application server, comprising:
acquiring tuning input parameters of an application server at the current moment in a timing way, wherein the tuning input parameters comprise service concurrency, service response time and resource utilization rate;
calculating the tuning input parameters by using a climbing algorithm to obtain a tuning target value, and comparing the tuning target value with the maximum number of threads currently allowed by the application server;
if the tuning target value is equal to the maximum thread number, determining that the maximum thread number does not need to be adjusted, otherwise, setting the maximum thread number as the tuning target value;
after determining that the tuning target value is not equal to the maximum number of threads, the method further includes:
if the tuning target value is greater than the maximum thread number, judging whether tasks waiting for execution exist in task queues corresponding to the thread pool, if so, creating a difference value between the tuning target value and the maximum thread number and a smaller value thread in the number of tasks waiting for execution, so as to realize execution of the tasks waiting for execution by using the created threads, and executing the step of setting the maximum thread number as the tuning target value, and if not, executing the step of setting the maximum thread number as the tuning target value.
2. The method of claim 1, wherein after determining that the tuning target value is not equal to the maximum number of threads, further comprising:
if the tuning target value is smaller than the maximum thread number, judging whether the tuning target value is larger than the current thread number of the thread pool, if so, executing the step of setting the maximum thread number as the tuning target value, if not, setting the maximum thread number as the current thread number, creating a difference value of the current thread number and the tuning target value as idle threads, so as to realize task execution by using the idle threads and cancel threads in the corresponding thread pool, and subtracting 1 from the maximum thread number every cancellation of one thread until the maximum thread number is equal to the tuning target value, so as to set the maximum thread number as the tuning target value.
3. The method of claim 2, further comprising, after setting the maximum number of threads to the tuning target value:
and judging whether the maximum thread number is equal to the tuning target value, if so, determining that the tuning is completed, otherwise, returning to the step of comparing the tuning target value with the maximum thread number currently allowed by the application server until the number of times of returning reaches a preset number of times.
4. A method according to claim 3, further comprising, after the number of returns reaches a preset number:
judging whether the maximum thread number is equal to the tuning target value, if so, determining that the tuning is finished, otherwise, outputting error reporting information.
5. The method of claim 4, wherein outputting the error message comprises:
and sending the error reporting information to a pre-designated terminal, wherein the error reporting information comprises the maximum thread number and the tuning target value.
6. The method of claim 5, wherein the resource usage comprises CPU usage and memory usage of the application server.
7. A self-optimizing apparatus for an application server thread pool, comprising:
an acquisition module for: acquiring tuning input parameters of an application server at the current moment in a timing way, wherein the tuning input parameters comprise service concurrency, service response time and resource utilization rate;
a calculation module for: calculating the tuning input parameters by using a climbing algorithm to obtain a tuning target value, and comparing the tuning target value with the maximum number of threads currently allowed by the application server;
a setting module, configured to: if the tuning target value is equal to the maximum thread number, determining that the maximum thread number does not need to be adjusted, otherwise, setting the maximum thread number as the tuning target value;
the self-optimizing device of the application server thread pool is further used for:
if the tuning target value is greater than the maximum thread number, judging whether tasks waiting for execution exist in task queues corresponding to the thread pool, if so, creating a difference value between the tuning target value and the maximum thread number and a smaller value thread in the number of tasks waiting for execution, so as to realize execution of the tasks waiting for execution by using the created threads, and executing the step of setting the maximum thread number as the tuning target value, and if not, executing the step of setting the maximum thread number as the tuning target value.
8. A self-optimizing apparatus for an application server thread pool, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the self-optimizing method of the application server thread pool according to any one of claims 1 to 6 when executing said computer program.
9. A computer readable storage medium, having stored thereon a computer program which when executed by a processor performs the steps of a method for self-tuning of an application server thread pool according to any of claims 1 to 6.
CN201811574499.1A 2018-12-21 2018-12-21 Self-optimizing method, device and equipment for application server thread pool Active CN109885385B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811574499.1A CN109885385B (en) 2018-12-21 2018-12-21 Self-optimizing method, device and equipment for application server thread pool

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811574499.1A CN109885385B (en) 2018-12-21 2018-12-21 Self-optimizing method, device and equipment for application server thread pool

Publications (2)

Publication Number Publication Date
CN109885385A CN109885385A (en) 2019-06-14
CN109885385B true CN109885385B (en) 2023-07-07

Family

ID=66925048

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811574499.1A Active CN109885385B (en) 2018-12-21 2018-12-21 Self-optimizing method, device and equipment for application server thread pool

Country Status (1)

Country Link
CN (1) CN109885385B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110245019B (en) * 2019-06-17 2021-07-06 广东金赋科技股份有限公司 Thread concurrency method and device for self-adaptive system resources
CN113535346B (en) * 2020-04-21 2024-03-19 中移动信息技术有限公司 Method, device, equipment and computer storage medium for adjusting thread number

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108446170A (en) * 2018-01-24 2018-08-24 北京奇艺世纪科技有限公司 A kind of DNS thread management methods, device and server based on machine learning

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104657219B (en) * 2015-02-27 2017-10-20 西安交通大学 A kind of application program threads number dynamic adjusting method being used under isomery many-core system
CN105630606A (en) * 2015-12-22 2016-06-01 山东中创软件工程股份有限公司 Method and device for adjusting capacity of thread pools
CN107220033A (en) * 2017-07-05 2017-09-29 百度在线网络技术(北京)有限公司 Method and apparatus for controlling thread pool thread quantity
CN108874537A (en) * 2018-04-11 2018-11-23 哈尔滨工程大学 The method that adaptive dynamic based on segmentation adjusts thread pool size
CN108984288A (en) * 2018-06-11 2018-12-11 山东中创软件商用中间件股份有限公司 Thread pool capacity adjustment method, device and equipment based on system response time

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108446170A (en) * 2018-01-24 2018-08-24 北京奇艺世纪科技有限公司 A kind of DNS thread management methods, device and server based on machine learning

Also Published As

Publication number Publication date
CN109885385A (en) 2019-06-14

Similar Documents

Publication Publication Date Title
CN105656810B (en) Method and device for updating application program
CN109885385B (en) Self-optimizing method, device and equipment for application server thread pool
WO2016165242A1 (en) Method of adjusting number of nodes in system and device utilizing same
CN107257363B (en) Method and system for responding request of request terminal
US20110246596A1 (en) Load-aware method of optimizing command execution in a cloud environment
WO2015165546A1 (en) Dynamically scaled web service deployments
CN114648131A (en) Federal learning method, device, system, equipment and medium
CN111262783B (en) Dynamic routing method and device
CN112214303A (en) Kubernetes cluster automatic scaling system
CN111447113B (en) System monitoring method and device
CN106302794B (en) The dynamic setting method and device of Connecting quantity
CN114860397B (en) Task scheduling method, device and equipment
CN109428901B (en) Message processing method and message processing device
CN115469966A (en) Elastic expansion method and device for container cloud service
CN111193760B (en) Information sending method, device and storage medium
CN112148496B (en) Energy efficiency management method and device for computing storage resources of super-fusion virtual machine and electronic equipment
CN109298944B (en) Server pressure adjusting method and device, computer device and storage medium
CN109739513B (en) Dynamic scheduling method and device for service requests under multi-edge cloud
US20170019300A1 (en) Method and system for auto distribution of workload among a plurality of servers which run web services
CN110457130A (en) A kind of distributed resource flexible scheduling model, method, electronic equipment and storage medium
CN110879758A (en) Data processing method for interface timeout management
CN114020352B (en) Cloud platform configuration method, device, equipment and storage medium
CN113190276A (en) Intelligent virus scanning processing method and device
CN114443283B (en) Method and device for stretching application instance
CN113377861B (en) Reconstruction method, device, equipment and storage medium of distributed storage system

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
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Jia Meng

Inventor after: Zhao Xin

Inventor after: Zhai Luchao

Inventor after: Zhao Xiaomeng

Inventor before: Jia Meng

Inventor before: Wen Shangzhuo

Inventor before: Zhao Xin

Inventor before: Zhai Luchao

Inventor before: Zhao Xiaomeng

GR01 Patent grant
GR01 Patent grant