Processing method and system for thread stack performance analysis task

By adaptively adjusting the weight value and snapshot sampling rate in thread stack performance analysis tasks, the problems of irrelevant data capture and automated analysis in thread stack snapshot analysis are solved, and the accurate capture of resource optimization and performance problems are achieved.

CN119440979APending Publication Date: 2025-02-14SHANGHAI GANGLIAN E COMMERCE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411478571.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-22
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The prior art captures a large amount of irrelevant data when performing thread stack snapshot analysis, resulting in wasted computing resources and storage space, unable to achieve fully automated performance analysis, and difficult to accurately locate and analyze performance problems.

Method used

By adaptively adjusting the initial weight value and snapshot sampling rate in thread stack performance analysis tasks based on historical performance analysis data, optimizing resource usage, reducing irrelevant data capture, implementing automated analysis, and dynamically adjusting the sampling rate to capture instantaneous performance problems.

Benefits of technology

It effectively reduces the capture of unrelated thread stack information, optimizes resource usage, realizes fully automated performance analysis, improves the timeliness and accuracy of problem discovery, and avoids information distortion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440979A_ABST
    Figure CN119440979A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the field of Java application performance analysis, and discloses a thread stack performance analysis task processing method and system. The method comprises the steps that according to historical performance analysis data, the occurrence frequency of thread stack entry endpoints is determined; adaptively adjusting an initial weight value in a current thread stack performance analysis task according to the frequency to obtain a target weight value; wherein the initial weight value is used for representing a uniform weight value set in an initialization stage of the thread stack performance analysis task; according to the target weight value, adaptively adjusting an initial snapshot sampling rate to obtain a target snapshot sampling rate, and processing a thread stack performance analysis task according to the target snapshot sampling rate; wherein the initial snapshot sampling rate is used for representing a unified sampling rate set in an initialization stage of the thread stack performance analysis task. The technical problems that in the prior art, the burden of data processing is increased, and computing resources and storage space are wasted can be at least solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of Java application performance analysis, and in particular to a method and system for processing thread stack performance analysis tasks. Background Art

[0002] In the field of Java application performance analysis, the industry widely uses distributed link tracing technologies, such as Pinpoint, SkyWalking, etc., to comprehensively monitor the flow of business requests in the service link. Specifically, the use of distributed link tracing technology can track the transmission of business requests between various service nodes, collect key information such as execution time and errors of each service call node, and enable developers to quickly locate the service node where the problem occurs. Therefore, this solution can play a relatively large role in locating communication problems across multiple processes or services. However, when the problem is located to a specific single task or performance problem within a process, distributed link tracing technology cannot provide more in-depth analysis assistance.

[0003] In the related technologies, in order to make up for the above shortcomings, the industry usually combines the use of periodic thread stack snapshot analysis. For example, in addition to providing distributed tracing functions, SkyWalking also has performance analysis tools that allow developers to manually trigger or set periodic performance analysis tasks. These tasks collect call stack snapshots of all threads in the process at a specified time interval, and then analyze these snapshot data to identify the code segments that cause performance problems, such as which method calls cause thread blocking, or which code segments have inefficiencies.

[0004] However, the inventors found that there are at least the following technical problems in the related art:

[0005] (1) When performing thread stack snapshot analysis, a large number of thread stack snapshots that are actually irrelevant to performance issues will be captured. These thread stack snapshots that are irrelevant to performance issues serve as additional data, increasing the burden of data processing and wasting computing resources and storage space.

[0006] (2) When performing performance analysis, developers usually need to determine possible problems based on prior knowledge or guesswork, and then perform precise matching to set thread entry points for monitoring. This approach may result in the omission of some unforeseen or unknown potential problem code segments;

[0007] (3) Performance analysis tasks must be manually triggered and supervised. The timing and effect of the analysis largely depend on the developer’s initiative and experience, and cannot be fully automated.

[0008] (4) It is challenging to control the execution time and duration of periodic tasks. This is because online problems are often random and unpredictable, which increases the difficulty of accurately locating and analyzing performance problems.

[0009] (5) Taking thread stack snapshots at a fixed frequency may miss key information, resulting in distorted snapshot information. This is because in a high-concurrency environment, performance issues may occur instantly and disappear quickly. This snapshot method may not be able to capture these instantaneous performance issues, resulting in a failure to truly reflect the actual state of the thread in operation. Summary of the invention

[0010] One purpose of the present application is to provide a method and system for processing a thread stack performance analysis task, at least to solve the above technical problems mentioned in the background technology.

[0011] To achieve the above objectives, some embodiments of the present application provide the following aspects:

[0012] In the first aspect, some embodiments of the present application also provide a method for processing a thread stack performance analysis task, the method comprising: determining the frequency of occurrence of a thread stack entry endpoint based on historical performance analysis data; adaptively adjusting an initial weight value in a current thread stack performance analysis task based on the frequency to obtain a target weight value; wherein the initial weight value is used to characterize a unified weight value set in the initialization phase of the thread stack performance analysis task; adaptively adjusting an initial snapshot sampling rate based on the target weight value to obtain a target snapshot sampling rate, so as to process the thread stack performance analysis task based on the target snapshot sampling rate; wherein the initial snapshot sampling rate is used to characterize a unified sampling rate set in the initialization phase of the thread stack performance analysis task.

[0013] In a second aspect, some embodiments of the present application also provide a processing system for a thread stack performance analysis task, characterized in that the system is used to execute the method described above; the system at least includes: a determination module, used to determine the frequency of occurrence of a thread stack entry endpoint based on historical performance analysis data; a first adjustment module, used to adaptively adjust the initial weight value in the current thread stack performance analysis task according to the frequency, to obtain a target weight value; wherein the initial weight value is used to characterize a unified weight value set in the initialization phase of the thread stack performance analysis task; a second adjustment module, used to adaptively adjust the initial snapshot sampling rate, to obtain a target snapshot sampling rate, so as to process the thread stack performance analysis task according to the target snapshot sampling rate; wherein the initial snapshot sampling rate is used to characterize the unified sampling rate set in the initialization phase of the thread stack performance analysis task.

[0014] Compared with the related art, the solution provided by the embodiment of the present application has at least the following beneficial effects:

[0015] (1) Since the initial weight value can be adaptively adjusted, for example, the analysis weight of the low-probability fault method can be reduced to obtain the target weight value, and the initial snapshot sampling rate can be adaptively adjusted according to the target weight value. This can reduce the capture of irrelevant thread stack information. In other words, by intelligently adjusting the initial weight value and thus adjusting the analysis focus, the use of resources can be optimized to avoid collecting too many thread stack snapshots that may not be important during the analysis process. This can solve the technical problem that the solution provided by the related technology will increase the burden of data processing and waste computing resources and storage space.

[0016] (2) Since the initial weight value is configured, that is, in the initialization phase of the thread stack performance analysis task, the initial weight values ​​of all thread stack entry endpoints are the same, ensuring that the method provided in the embodiment of the present application does not require manual specification of the thread entry point. In other words, the performance analysis system treats all methods equally at the beginning, without the need for developers to manually select or specify which methods are the focus of the analysis. This design simplifies the analysis process so that the analysis can be performed automatically without the need for additional manual configuration. This can solve the technical problem that in the solutions provided by the relevant technologies, some unforeseen or unknown potential problem code segments are omitted.

[0017] (3) Since the initial weight value can be adaptively adjusted, the most ideal parameter configuration can be achieved without human intervention. This can solve the technical problem that the solutions provided by related technologies must be manually triggered and supervised, and the timing and effect of the analysis largely depend on the initiative and experience of the developer, and cannot be fully automated.

[0018] (4) Since human intervention is eliminated, the background analysis process can be provided around the clock. Online problems can be discovered promptly and accurately at any time, ensuring that problems can be quickly captured when they occur. This can improve the timeliness and accuracy of problem discovery. Therefore, it can better solve the technical problem of accurately locating and analyzing performance problems in the solutions provided by related technologies.

[0019] (5) Since the performance analysis system can dynamically and adaptively adjust the initial snapshot sampling rate according to the frequency of fault occurrence, so as to optimize the use of resources without losing key information, this adaptive adjustment is conducive to ensuring the accuracy and efficiency of the analysis, and thus can solve the technical problem that the snapshot method in the solution provided by the related art may not be able to capture these instantaneous performance problems, resulting in the inability to truly reflect the state of the thread in actual operation. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0021] Figure 1 An exemplary flow chart of a method for processing a thread stack performance analysis task provided according to some embodiments of the present application;

[0022] Figure 2 An exemplary flow chart of an application example of a method for processing a thread stack performance analysis task provided according to some embodiments of the present application;

[0023] Figure 3 An exemplary architecture diagram of a system for processing thread stack performance analysis tasks provided according to some embodiments of the present application. DETAILED DESCRIPTION

[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0025] The following terms are used in this article.

[0026] 1. Thread: In multithreaded programming, a thread is an independent stream of program execution. Each thread can perform its own tasks or execution path.

[0027] 2. Call stack: It is a data structure used to store objects of active functions and their return addresses. Whenever a function is called, the state of the function (including parameters, local variables, etc.) is pushed into the call stack.

[0028] 3. Thread stack: It is a private memory area for each thread, used to store local variables, parameters and return addresses when calling functions.

[0029] 4.endpoint: thread stack entry endpoint.

[0030] 5.profile: thread stack performance analysis task. Refers to analyzing the thread execution path (call stack) and identifying performance problems during program execution by measuring the execution time of different parts. The thread stack performance analysis task can help developers understand how threads execute and how they consume performance analysis system resources during execution.

[0031] 6. duration_threshold: target timeout threshold. This is a preset time threshold used to determine whether an operation or method call exceeds the normal execution time. If the execution time exceeds this threshold, it may indicate a performance problem. At the beginning of the performance analysis task, the target timeout threshold needs to be initialized and a reasonable starting timeout threshold needs to be set.

[0032] 7.duration_threshold_Lowest: minimum water level threshold.

[0033] 8. duration_threshold_adjust_step: Parameter for adaptively adjusting the step size of the target timeout water level threshold.

[0034] 9. duration_threshold_lowest_age: The time to maintain the lowest water level threshold. It refers to the length of time the performance analysis system maintains the lowest water level threshold when automatically adjusting the target timeout water level threshold.

[0035] 10.profile_weight: initial weight value.

[0036] 11.highest_profile_weight: the highest weight value.

[0037] 12.lowest_profile_weght: the lowest weight value.

[0038] 13.profile_weight_adjust_step: parameter for adaptively adjusting the step size of the initial weight value.

[0039] 14.sample_rate: initial snapshot sampling rate.

[0040] 15.lowest_sample_rate: The lowest sampling rate of the snapshot.

[0041] 16.Thread snapshot: refers to the record of thread status captured at a certain moment, including call stack information, thread status, lock information, etc.

[0042] First embodiment

[0043] The first embodiment of the present application relates to a method for processing a thread stack performance analysis task. Figure 1 As shown, the method can be applied to a performance analysis system, and the method may include the following steps:

[0044] Step S101, determining the frequency of occurrence of thread stack entry endpoints according to historical performance analysis data;

[0045] Step S102, adaptively adjusting the initial weight value in the current thread stack performance analysis task according to the frequency to obtain a target weight value; wherein the initial weight value is used to represent a unified weight value set in the initialization phase of the thread stack performance analysis task;

[0046] Step S103, adaptively adjusting the initial snapshot sampling rate according to the target weight value to obtain the target snapshot sampling rate, so as to process the thread stack performance analysis task according to the target snapshot sampling rate; wherein the initial snapshot sampling rate is used to characterize the unified sampling rate set in the initialization stage of the thread stack performance analysis task.

[0047] The following is a detailed description of each of the above steps.

[0048] Regarding step S101, specifically, in some examples, the thread stack entry endpoint endpoint can also be understood as a code entry point, a starting point of thread execution, that is, the method or function that is first executed when a thread is created. Starting from this point, all subsequent calls of the thread can be tracked. The performance analysis system can obtain the frequency of occurrence of the thread stack entry endpoint endpoint based on the historical performance analysis data in the historical thread stack performance analysis task profile. Among them, the frequency of occurrence of the thread stack entry endpoint is used to characterize the number of times a specific function or code position is recorded as the starting point of thread execution in the performance analysis or thread snapshot. It can be understood that this can be analogous to the frequency of a specific function or code position (such as the front of a train) being photographed when taking a photo of a high-speed train. If the frequency is very high, it generally means that the corresponding specific function or code position is the starting point of many thread executions, or is a hot spot area for thread scheduling by the performance analysis system.

[0049] It should be noted that the implementation of the technical solution in the embodiment of the present application is based on a basic assumption that if a method has caused performance problems before, it is more likely to have performance problems again when it is executed in the future. Therefore, the performance analysis system should focus on these methods that have had performance problems in the past. Since these methods are more risky, more monitoring and analysis resources need to be allocated to conduct in-depth analysis on them.

[0050] For step S102, specifically, in some examples, if the frequency is greater than a preset frequency threshold, the initial weight value in the current thread stack performance analysis task can be obtained, and the initial weight value can be adaptively adjusted. The core of the embodiment of the present application is mainly to dynamically adjust the proportion (initial weight value) of different methods in the thread stack performance analysis task according to the real-time data and historical performance analysis data of the thread stack performance analysis task.

[0051] Among them, in the initialization phase of the thread stack performance analysis task, all thread stack entry endpoints can be assigned a unified and identical initial weight value. This ensures that at the beginning of the performance analysis, each method is considered to have equal importance, and there is no method that is particularly prioritized for analysis. In other words, the weight setting strategy of this step is to treat all methods equally, without presetting the priority of any method, so that the performance analysis system can dynamically adjust the initial weight value according to actual conditions during actual operation. In other words, in the embodiment of the present application, the strategy of treating all methods equally in the early stage of performance analysis helps to comprehensively identify potential performance problems.

[0052] Optionally, in some embodiments, the initial weight value may be specifically a highest weight value highest_profile_weight. The highest weight value is used to characterize the upper limit of the priority that can be given to a single task in the thread stack performance analysis task, that is, the highest value that the initial weight value may reach. By setting the initial weight value to the highest weight value highest_profile_weight, it is helpful to ensure that key tasks can receive sufficient attention.

[0053] Regarding step S103, specifically, in some examples, in the initialization phase of the thread stack performance analysis task, all thread stack entry endpoints endpoint may be assigned a unified and identical initial snapshot sampling rate sample_rate.

[0054] Optionally, in some embodiments, the initial snapshot sampling rate is used to characterize the number of times performance data is collected per unit time; the initial snapshot sampling rate may be specifically a snapshot minimum sampling rate sample_lowest_rate. The minimum snapshot sampling rate is used to characterize the lower limit of the sampling rate for collecting performance data, that is, the minimum sampling rate allowed by the performance analysis system. By setting the initial snapshot sampling rate to the snapshot minimum sampling rate sample_lowest_rate, the performance analysis system can be maintained at the minimum sampling rate sample_lowest_rate even when there are fewer performance issues, to ensure that important performance data can be captured.

[0055] For example, as the frequency of the thread stack entry endpoint endpoint appears in the historical performance analysis data, the initial weight value in the current thread stack performance analysis task can be adaptively adjusted to obtain the target weight value. If the target weight value increases, the initial snapshot sampling rate will increase accordingly to obtain the target snapshot sampling rate, so as to process the thread stack performance analysis task according to the target snapshot sampling rate. It can be seen that in this step, by adaptively adjusting the initial snapshot sampling rate according to the target weight value, the purpose of adaptively adjusting the initial snapshot sampling rate according to the actual operation of the current thread stack performance analysis task can be achieved.

[0056] Further, in some embodiments, once the performance of the thread stack entry endpoint is detected to be back to normal, the target snapshot sampling rate can be adjusted back to the initial snapshot sampling rate, so as to achieve a balance between the accuracy of performance analysis and the impact on the performance of the performance analysis system. It is understandable that if the target snapshot sampling rate is too low, the true state of the current performance may not be captured; if the target snapshot sampling rate is too high, the performance of the performance analysis system itself may be affected.

[0057] It is not difficult to find that compared with the related art, the solution provided in the embodiment of the present application provides a method for processing a thread stack performance analysis task, by determining the frequency of occurrence of a thread stack entry endpoint based on historical performance analysis data; then adaptively adjusting the initial weight value in the current thread stack performance analysis task according to the frequency to obtain a target weight value; wherein the initial weight value is used to characterize a unified weight value set in the initialization phase of the thread stack performance analysis task; according to the target weight value, adaptively adjusting the initial snapshot sampling rate to obtain the target snapshot sampling rate, so as to process the thread stack performance analysis task according to the target snapshot sampling rate; wherein the initial snapshot sampling rate is used to characterize the unified sampling rate set in the initialization phase of the thread stack performance analysis task.

[0058] (1) Since the initial weight value can be adaptively adjusted, for example, the analysis weight of the low-probability fault method can be reduced to obtain the target weight value, and the initial snapshot sampling rate can be adaptively adjusted according to the target weight value. This can reduce the capture of irrelevant thread stack information. In other words, by intelligently adjusting the initial weight value and thus adjusting the analysis focus, the use of resources can be optimized to avoid collecting too many thread stack snapshots that may not be important during the analysis process. This can solve the technical problem that the solution provided by the related technology will increase the burden of data processing and waste computing resources and storage space.

[0059] (2) Since the initial weight value is configured, that is, in the initialization phase of the thread stack performance analysis task, the initial weight values ​​of all thread stack entry endpoints are the same, ensuring that the method provided in the embodiment of the present application does not require manual specification of the thread entry point. In other words, the performance analysis system treats all methods equally at the beginning, without the need for developers to manually select or specify which methods are the focus of the analysis. This design simplifies the analysis process so that the analysis can be performed automatically without the need for additional manual configuration. This can solve the technical problem that in the solutions provided by the relevant technologies, some unforeseen or unknown potential problem code segments are omitted.

[0060] (3) Since the initial weight value can be adaptively adjusted, the most ideal parameter configuration can be achieved without human intervention. This can solve the technical problem that the solutions provided by related technologies must be manually triggered and supervised, and the timing and effect of the analysis largely depend on the initiative and experience of the developer, and cannot be fully automated.

[0061] (4) Since human intervention is eliminated, the background analysis process can be provided around the clock. Online problems can be discovered promptly and accurately at any time, ensuring that problems can be quickly captured when they occur. This can improve the timeliness and accuracy of problem discovery. Therefore, it can better solve the technical problem of accurately locating and analyzing performance problems in the solutions provided by related technologies.

[0062] (5) Since the performance analysis system can dynamically and adaptively adjust the initial snapshot sampling rate according to the frequency of fault occurrence, so as to optimize the use of resources without losing key information, this adaptive adjustment is conducive to ensuring the accuracy and efficiency of the analysis, and thus can solve the technical problem that the snapshot method in the solution provided by the related art may not be able to capture these instantaneous performance problems, resulting in the inability to truly reflect the state of the thread in actual operation.

[0063] In addition, it should be noted that the solution provided by the embodiment of the present application has been verified by extensive practical applications, and compared with the traditional technical solution, the automation performance of the solution provided by the embodiment of the present application has been improved by about 100%. In a large-scale snapshot analysis test environment, the solution provided by the embodiment of the present application reduces the average loss of storage resources by about 40% compared with the traditional technical solution.

[0064] Second embodiment

[0065] The second embodiment of the present application relates to a method for processing a thread stack performance analysis task. The second embodiment is an improvement based on the first embodiment, and the specific improvement is: in the second embodiment of the present application, a specific implementation method is provided for adaptively adjusting the initial weight value in the current thread stack performance analysis task according to the frequency to obtain the target weight value.

[0066] Specifically, in some embodiments, the initial weight value in the current thread stack performance analysis task is adaptively adjusted according to the frequency to obtain a target weight value, that is, step S102 may include the following steps:

[0067] Step S1021, obtaining a preset rule; wherein the preset rule is determined according to the execution time of the thread stack entry endpoint and the target timeout water level threshold;

[0068] Step S1022: adaptively adjust the initial weight value in the current thread stack performance analysis task according to the frequency and the preset rule to obtain a target weight value.

[0069] Exemplarily, the target timeout water level threshold can be set according to actual needs, and the present application embodiment does not specifically limit this. In some examples, the target timeout water level threshold duration_threshold can be a fixed value, such as but not limited to 5 seconds.

[0070] Optionally, in some embodiments, the adaptively adjusting the initial weight value in the current thread stack performance analysis task according to the frequency and the preset rule to obtain the target weight value, that is, step S1022 may further include the following steps:

[0071] Step S10221: Based on the frequency, determine whether the execution time of the thread stack entry endpoint in the current thread stack performance analysis task is greater than a target timeout water level threshold;

[0072] Step S10222: Based on the judgment result, a subtraction operation or an addition operation is performed on the initial weight value to obtain a target weight value.

[0073] Optionally, in some embodiments, the subtraction operation or the addition operation is performed on the initial weight value according to the judgment result, that is, step S10222 may further include the following steps:

[0074] Step S102221: if the execution time of the thread stack entry endpoint is less than or equal to the target timeout water level threshold, a subtraction operation is performed on the initial weight value; wherein the initial weight value does not decrease when it is reduced to a preset minimum weight value;

[0075] Step S102222: If the execution time of the thread stack entry endpoint is greater than the target timeout water level threshold, an addition operation is performed on the initial weight value; wherein the initial weight value is no longer increased when it is increased to a preset maximum weight value.

[0076] Exemplarily, for any thread stack entry endpoint endpoint, it can be determined whether the execution time of the thread stack entry endpoint endpoint is greater than the target timeout water level threshold duration_threshold.

[0077] Among them, if the execution time of the thread stack entry endpoint endpoint is less than or equal to the target timeout water level threshold duration_threshold, it can be indicated that the thread stack entry endpoint endpoint currently has no significant performance problems. In this case, the performance analysis system can perform a subtraction operation on the initial weight value of the thread stack entry endpoint endpoint. For example, the first target weight value a1 can be obtained by reducing a fixed step size step1 based on the initial weight value. Afterwards, the step of "determining whether the execution time of the thread stack entry endpoint endpoint is greater than the target timeout water level threshold duration_threshold" is continued. In this way, the second target weight value a2, the third target weight value a3... may be obtained in the process.

[0078] It should be noted that, in the process of performing a subtraction operation on the initial weight value of the thread stack entry endpoint endpoint, if the initial weight value is reduced to the lowest weight value lowest_profile_weight, it will no longer decrease. At this time, the lowest weight value lowest_profile_weight is the target weight value. By setting the lowest weight value lowest_profile_weight, it can be ensured that even the thread stack entry endpoint endpoint that currently performs well will be analyzed regularly to facilitate the discovery of potential performance problems. Among them, the lowest weight value lowest_profile_weight is used to characterize the lowest limit of the initial weight value. Even when resources are sufficient, the target weight value of the task will not be lower than the lowest weight value lowest_profile_weight. In this way, certain tasks can be prevented from being excessively ignored.

[0079] Among them, if the execution time of the thread stack entry endpoint endpoint is greater than the target timeout water level threshold duration_threshold, it can indicate that the thread stack entry endpoint endpoint currently has a performance problem. In this case, the performance analysis system can perform an addition operation on the initial weight value of the thread stack entry endpoint endpoint. For example, a fixed step size step2 can be added based on the initial weight value to obtain the first target weight value b1. Afterwards, the step of "determining whether the execution time of the thread stack entry endpoint endpoint is greater than the target timeout water level threshold duration_threshold" is continued. In this way, the second target weight value b2, the third target weight value b3... may be obtained in this process.

[0080] It should be noted that, in the process of performing the addition operation on the initial weight value of the thread stack entry endpoint endpoint, if the initial weight value is increased to the highest weight value highest_profile_weight, it will no longer increase. At this time, the highest weight value highest_profile_weight is the target weight value. By setting the highest weight value highest_profile_weight, the unlimited growth of the initial weight value can be limited to ensure that the performance analysis itself does not cause excessive performance loss to the performance analysis system, and ensure that the performance loss is within a controllable range.

[0081] Exemplarily, the initial weight value is reduced by a fixed step size, or the initial weight value is increased by a fixed step size, which can be specifically achieved by setting a parameter profile_weight_adjust_step for adaptively adjusting the step size of the initial weight value. The parameter can be used to define the value that changes each time the initial weight value is adjusted.

[0082] It is not difficult to find that in an embodiment of the present application, by obtaining a preset rule; wherein the preset rule is determined based on the execution time of the thread stack entry endpoint and the target timeout water level threshold, and adaptively adjusting the initial weight value in the current thread stack performance analysis task according to the frequency and the preset rule to obtain the target weight value, a specific implementation method is provided for adaptively adjusting the initial weight value in the current thread stack performance analysis task according to the frequency to obtain the target weight value.

[0083] Third embodiment

[0084] The third embodiment of the present application relates to a method for processing a thread stack performance analysis task. The third embodiment is an improvement based on the second embodiment, and the specific improvement is: in the second embodiment of the present application, the target timeout water level threshold duration_threshold can be a fixed value; however, when a certain thread stack entry endpoint endpoint triggers continuous performance analysis, if the target timeout water level threshold duration_threshold is a fixed value and remains unchanged, then only the thread stack snapshot after the target timeout water level threshold duration_threshold interval can be collected (for example, the thread stack snapshot after 5 seconds), which may cause information distortion and lead to inaccurate analysis results. Because the key performance problem may have occurred within the target timeout water level threshold duration_threshold (for example, within 5 seconds). The third embodiment of the present application provides a method for determining a target timeout water level threshold to solve the above technical problems.

[0085] Specifically, in some embodiments, the method for determining the target timeout water level threshold may include the following steps:

[0086] Step S201, obtaining the initial value of the timeout water level threshold;

[0087] Step S202: adaptively adjust the initial value according to preset parameters to obtain the target timeout water level threshold.

[0088] Exemplarily, the preset parameter may be a parameter duration_threshold_adjust_step for adaptively adjusting the step length of the target timeout water level threshold. That is, the adjustment amplitude of the target timeout water level threshold duration_threshold may be controlled by the parameter duration_threshold_adjust_step for adaptively adjusting the step length of the target timeout water level threshold. The parameter duration_threshold_adjust_step for adaptively adjusting the step length of the target timeout water level threshold is used to define the specific amount of time to be increased or decreased each time the target timeout water level threshold is adjusted.

[0089] Optionally, in some embodiments, after the initial value is adaptively adjusted according to preset parameters to obtain the target timeout water level threshold, the method may further include step S203: when it is detected that the performance of the thread stack entry endpoint has returned to normal, adjusting the target timeout water level threshold back to the initial value; otherwise, reducing the target timeout water level threshold until the target timeout water level threshold is equal to the minimum water level threshold.

[0090] Exemplarily, if the execution time of the thread stack entry endpoint endpoint is less than or equal to the target timeout water level threshold duration_threshold, it means that the thread stack entry endpoint endpoint has recovered from the previous performance problem. In this case, no further performance analysis is required, and the target timeout water level threshold duration_threshold obtained by dynamic adjustment is restored to the initial value. In this way, unnecessary performance loss caused by frequent performance analysis can be prevented.

[0091] Exemplarily, if the execution time of the thread stack entry endpoint endpoint is greater than the target timeout water level threshold duration_threshold, it indicates that the thread stack entry endpoint endpoint may still have performance issues. In this case, a more in-depth performance analysis is required. Specifically, the performance analysis system can gradually reduce the target timeout water level threshold duration_threshold according to the parameter duration_threshold_adjust_step of the step size of the adaptively adjusted target timeout water level threshold until the target timeout water level threshold is equal to the lowest water level threshold duration_threshold_lowest.

[0092] The minimum water level threshold duration_threshold_lowest is the lowest value allowed to be set for the target timeout water level threshold duration_threshold. According to the real-time performance data and analysis results, the performance analysis system can automatically adjust the value of the target timeout water level threshold to more accurately capture performance issues. Moreover, even if adaptive adjustment is performed, it will not be lower than the minimum water level threshold duration_threshold_lowest. In this way, the performance analysis task can be avoided from being triggered too frequently to collect performance data.

[0093] It should be noted that the third embodiment of the present application may also be an improvement based on the first embodiment.

[0094] It is not difficult to find that in the embodiment of the present application, by obtaining the initial value of the timeout water level threshold and adaptively adjusting the initial value according to the preset parameters, the target timeout water level threshold is obtained, and a method for determining the target timeout water level threshold is provided. Through this method, the initial value of the timeout water level threshold can be dynamically adjusted, which is conducive to improving the accuracy of the analysis results.

[0095] Fourth embodiment

[0096] The fourth embodiment of the present application relates to a method for processing a thread stack performance analysis task. The fourth embodiment is an improvement on the second embodiment, and the specific improvement is: in the fourth embodiment of the present application, another specific implementation method for adaptively adjusting the initial weight value is provided.

[0097] Specifically, in some embodiments, the method may further include the following steps:

[0098] Step S301, determining whether the target timeout water level threshold is within a preset range; wherein the preset range is used to indicate that the target timeout water level threshold is less than a preset threshold;

[0099] Step S302, if the target timeout water level threshold is within a preset range, determining the duration of the target timeout water level threshold being within the preset range;

[0100] The initial weight value in the current thread stack performance analysis task is adaptively adjusted according to the frequency to obtain the target weight value:

[0101] Step S303, combining the target timeout water level threshold and the duration, adaptively adjusting the initial weight value in the current thread stack performance analysis task according to the frequency, to obtain a target weight value.

[0102] Exemplarily, the smaller the target timeout water level threshold duration_threshold is, the higher the performance requirement of the thread stack entry endpoint endpoint, and the lower the tolerance of the performance analysis system to timeouts. This is because the execution time of the thread stack entry endpoint endpoint can easily exceed the target timeout water level threshold duration_threshold. Therefore, if the target timeout water level threshold duration_threshold is maintained at a low value for a long time, it will cause the performance analysis task to be triggered frequently, thereby causing performance loss to the performance analysis system. In order to avoid this situation, in an embodiment of the present application, it can be determined first whether the target timeout water level threshold is within a preset range. Since the preset range is used to characterize that the target timeout water level threshold is less than the preset threshold, it can be determined whether the target timeout water level threshold duration_threshold is a lower value.

[0103] Furthermore, if the target timeout water level threshold is within the preset range, it means that the target timeout water level threshold duration_threshold is a lower value, and the duration of the target timeout water level threshold within the preset range can be further determined. If the duration of the target timeout water level threshold within the preset range is greater than the preset duration, it can be explained that the target timeout water level threshold duration_threshold is maintained at a lower value for a long time.

[0104] Exemplarily, the lower value may be the lowest water level threshold, and the duration_threshold_lowest_age parameter may be used to characterize the duration that the target timeout water level threshold is within a preset range, that is, the time that the target timeout water level threshold is maintained within the lowest water level threshold.

[0105] Furthermore, if the target timeout water level threshold duration_threshold remains at a low value for a long time, the performance analysis system can adaptively adjust the initial weight value in the current thread stack performance analysis task according to the frequency to obtain the target weight value. In the process, the initial weight value profile_weight can be dynamically lowered, thereby achieving the purpose of reducing the frequency and depth of performance analysis.

[0106] It should be noted that the fourth embodiment of the present application may also be an improvement based on the first embodiment and / or the third embodiment.

[0107] It is not difficult to find that in the embodiment of the present application, by determining whether the target timeout water level threshold is within a preset range; wherein the preset range is used to characterize that the target timeout water level threshold is less than the preset threshold; if the target timeout water level threshold is within the preset range, then determining the duration of the target timeout water level threshold within the preset range; the adaptive adjustment of the initial weight value in the current thread stack performance analysis task according to the frequency to obtain the target weight value is specifically: combining the target timeout water level threshold and the duration, adaptively adjusting the initial weight value in the current thread stack performance analysis task according to the frequency to obtain the target weight value. Another specific implementation method for adaptively adjusting the initial weight value is provided. In this way, the purpose of reducing the frequency and depth of performance analysis can be achieved.

[0108] Fifth embodiment

[0109] The fifth embodiment of the present application relates to a method for processing a thread stack performance analysis task. The fifth embodiment is an improvement based on the first embodiment, and the specific improvement is: in the fifth embodiment of the present application, in order to ensure that a large number of thread stack performance analysis tasks do not occur simultaneously within a period of time, an improved solution is provided.

[0110] Specifically, in some embodiments, the method may further include the following steps:

[0111] Step S401, when the current thread stack performance analysis task is detected, a token is obtained; wherein a fixed number of tokens are pre-configured in the initialization phase;

[0112] Step S402: If the acquisition fails, the current thread stack performance analysis task is discarded.

[0113] Exemplarily, a token bucket algorithm and a concurrency control mechanism may be introduced at the entrance of the performance analysis system.

[0114] Exemplarily, in the initialization phase, a fixed number of tokens may be placed according to the configuration, and when the current thread stack performance analysis task is detected, an attempt may be made to obtain the token first, and if the acquisition fails, the current thread stack performance analysis task is discarded. In this way, a large number of thread stack performance analysis tasks will not occur simultaneously within a period of time.

[0115] It should be noted that the fifth embodiment of the present application may also be an improvement based on any one or more embodiments from the second embodiment to the fourth embodiment.

[0116] It is not difficult to find that in the embodiment of the present application, when the current thread stack performance analysis task is detected, a token is obtained; wherein a fixed number of tokens are pre-configured in the initialization phase; if the acquisition fails, the current thread stack performance analysis task is discarded. In this way, the performance loss of the application program caused by the thread stack performance analysis task can be minimized, and the impact of the thread stack performance analysis task on the application program performance can be further reduced, ensuring that a large number of thread stack performance analysis tasks will not occur simultaneously within a period of time, thereby effectively avoiding potential damage to the application program performance caused by the thread stack performance analysis task itself.

[0117] Sixth embodiment

[0118] The sixth embodiment of the present application provides a specific application example of a method for processing a thread stack performance analysis task.

[0119] Specifically, see Figure 2As shown, an exemplary analysis process of a method for processing a thread stack performance analysis task is described. In this exemplary analysis process, it starts from the "start" stage, and first performs "configuration initialization" to set the initial parameters of the performance analysis, such as the initial weight value, the initial snapshot sampling rate, etc. Next, the performance analysis system can perform "collection concurrent number judgment" to determine whether to discard the current thread stack performance analysis task. If it is determined to be discarded, the process ends (corresponding to the "no" branch), if it is determined not to be discarded, the process continues to be processed and enters the step of "initial weight value calculation", if it is detected that a snapshot analysis task already exists, the corresponding analysis task is generated and stored; after that, the execution time of the thread stack entry endpoint is further compared with the target timeout water level threshold, and the initial weight value is adaptively adjusted according to the comparison result to obtain the target weight value. It can be seen that through this exemplary analysis process, it can be ensured that the thread stack performance analysis task can effectively capture performance bottlenecks without causing excessive performance loss. The entire process is a closed-loop performance analysis system, which aims to improve the efficiency and accuracy of performance analysis through automation and adaptive mechanisms.

[0120] Further, see Figure 3 As shown, the workflow of a processing system for thread stack performance analysis tasks (hereinafter referred to as performance analysis system) is described, and its core content can be summarized as follows:

[0121] The automatic thread stack analysis master is responsible for the process control of the entire thread stack analysis task.

[0122] The automatic thread stack analysis coordinator is responsible for coordinating the collection of thread stack snapshots.

[0123] Thread stack snapshot analysis is used to analyze thread execution to identify performance issues.

[0124] The thread stack snapshot collector is used to actually perform the thread stack snapshot collection work.

[0125] Business thread: a thread used to execute business logic.

[0126] In the task start process, you can start the coordinator, for example, you can start the coordinator by initializing the thread stack analysis coordinator. You can also start the collector by initializing the thread stack snapshot collector: Initialize the thread stack snapshot collector.

[0127] Further, enter the task application and judgment process: the business thread requests thread stack snapshot analysis and attempts to apply for a thread snapshot analysis task. The performance analysis system determines whether to execute the snapshot task (calculate whether it meets the sampling rate) based on the current initial snapshot sampling rate.

[0128] Further, enter the task execution process: if the sampling conditions are met, create a collector task and submit the collector task. At this point, the collector can start executing the snapshot of the thread stack.

[0129] In the task termination process, when the thread business method is executed, the performance analysis system can notify the termination of the crawling task and end the crawling of this business method.

[0130] Furthermore, the performance analysis system can determine and adjust performance issues. That is, the performance analysis system can determine that the aforementioned method has potential performance issues, and if so, increase the initial snapshot sampling rate according to the target weight value so as to collect data more frequently for analysis.

[0131] It can be seen that the entire process is an automated monitoring and analysis performance analysis system, which aims to optimize performance analysis by dynamically adjusting the sampling rate and snapshot frequency while reducing the impact on application performance.

[0132] The step division of the above methods is only for the purpose of clear description. When implemented, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent; adding insignificant modifications to the algorithm or process or introducing insignificant designs without changing the core design of the algorithm and process are all within the scope of protection of this patent.

[0133] Seventh embodiment

[0134] A third embodiment of the present application relates to a system for processing thread stack performance analysis tasks.

[0135] The system is used to execute the method described in any one or more of the first to sixth embodiments; the system at least includes:

[0136] A determination module, used to determine the frequency of occurrence of thread stack entry endpoints based on historical performance analysis data;

[0137] A first adjustment module is used to adaptively adjust the initial weight value in the current thread stack performance analysis task according to the frequency to obtain a target weight value; wherein the initial weight value is used to represent a unified weight value set in the initialization phase of the thread stack performance analysis task;

[0138] The second adjustment module is used to adaptively adjust the initial snapshot sampling rate to obtain a target snapshot sampling rate, so as to process the thread stack performance analysis task according to the target snapshot sampling rate; wherein the initial snapshot sampling rate is used to represent the unified sampling rate set in the initialization phase of the thread stack performance analysis task.

[0139] It is not difficult to find that this embodiment is a performance analysis system embodiment corresponding to the first embodiment, and this embodiment can be implemented in conjunction with the first embodiment. The relevant technical details mentioned in the first embodiment are still valid in this embodiment, and in order to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied in the first embodiment.

[0140] It is worth mentioning that all modules involved in this embodiment are logic modules. In practical applications, a logic unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, in order to highlight the innovative part of this application, this embodiment does not introduce units that are not closely related to solving the technical problems proposed by this application, but this does not mean that there are no other units in this embodiment.

[0141] The flow chart or block diagram in the accompanying drawings shows the possible architecture, function and operation of the equipment, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of boxes in the block diagram and / or flow chart can be implemented with a dedicated performance analysis system for hardware that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0142] The scope of the present application is defined by the appended claims rather than the above description, and it is intended that all changes that fall within the meaning and scope of the equivalent elements of the claims are included in the present application. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the device claim may also be implemented by one unit or device through software or hardware. The words "first", "second", etc. are only used to distinguish the description, and do not indicate any particular order, nor can they be understood as indicating or implying relative importance.

[0143] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily mention changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims, and the above embodiments should be regarded as exemplary and non-restrictive.

Claims

1. A method for processing a thread stack performance analysis task, characterized in that: The method comprises: Determine the frequency of thread stack entry endpoints based on historical performance analysis data; Adaptively adjusting the initial weight value in the current thread stack performance analysis task according to the frequency to obtain a target weight value; wherein the initial weight value is used to represent a unified weight value set in the initialization phase of the thread stack performance analysis task; According to the target weight value, the initial snapshot sampling rate is adaptively adjusted to obtain the target snapshot sampling rate, so as to process the thread stack performance analysis task according to the target snapshot sampling rate; wherein the initial snapshot sampling rate is used to characterize the unified sampling rate set in the initialization phase of the thread stack performance analysis task.

2. The method according to claim 1, characterized in that: The initial weight value is specifically a maximum weight value; the maximum weight value is used to represent the upper limit value of the priority that can be given to a single task in the thread stack performance analysis task; The initial snapshot sampling rate is specifically a minimum snapshot sampling rate; the minimum snapshot sampling rate is used to represent the lower limit value of the sampling rate for collecting performance data.

3. The method according to claim 1, characterized in that Adaptively adjusting the initial weight value in the current thread stack performance analysis task according to the frequency to obtain the target weight value includes: Obtaining a preset rule; wherein the preset rule is determined according to the execution time of the thread stack entry endpoint and the target timeout water level threshold; The initial weight value in the current thread stack performance analysis task is adaptively adjusted according to the frequency and the preset rule to obtain a target weight value.

4. The method according to claim 3, characterized in that Adaptively adjusting the initial weight value in the current thread stack performance analysis task according to the frequency and the preset rule to obtain the target weight value includes: Based on the frequency, determining whether the execution time of the thread stack entry endpoint in the current thread stack performance analysis task is greater than a target timeout water level threshold; According to the judgment result, a subtraction operation or an addition operation is performed on the initial weight value to obtain a target weight value.

5. The method according to claim 4, characterized in that According to the judgment result, performing a subtraction operation or an addition operation on the initial weight value includes: If the execution time of the thread stack entry endpoint is less than or equal to the target timeout water level threshold, a subtraction operation is performed on the initial weight value; wherein the initial weight value does not decrease when it is reduced to a preset minimum weight value; If the execution time of the thread stack entry endpoint is greater than the target timeout water level threshold, an addition operation is performed on the initial weight value; wherein the initial weight value does not increase any more when it is increased to a preset maximum weight value.

6. The method according to any one of claims 3 to 5, characterized in that The method for determining the target timeout water level threshold comprises: Get the initial value of the timeout water level threshold; The initial value is adaptively adjusted according to preset parameters to obtain the target timeout water level threshold.

7. The method according to claim 6, characterized in that After the initial value is adaptively adjusted according to the preset parameters to obtain the target timeout water level threshold, the method further includes: When it is detected that the performance of the thread stack entry endpoint returns to normal, adjusting the target timeout water level threshold back to the initial value; Otherwise, reduce the target timeout water level threshold until the target timeout water level threshold is equal to the minimum water level threshold; wherein the minimum water level threshold is used to represent the lowest value allowed to be set for the target timeout water level threshold.

8. The method according to any one of claims 3 to 5, characterized in that The method further comprises: Determine whether the target timeout water level threshold is within a preset range; wherein the preset range is used to indicate that the target timeout water level threshold is less than a preset threshold; If the target timeout water level threshold is within the preset range, determining the duration of the target timeout water level threshold being within the preset range; The initial weight value in the current thread stack performance analysis task is adaptively adjusted according to the frequency to obtain the target weight value: In combination with the target timeout water level threshold and the duration, the initial weight value in the current thread stack performance analysis task is adaptively adjusted according to the frequency to obtain a target weight value.

9. The method according to claim 1, characterized in that: The method further comprises: When the current thread stack performance analysis task is detected, a token is acquired; wherein a fixed number of tokens are pre-configured in the initialization phase; If the acquisition fails, the current thread stack performance analysis task is discarded.

10. A processing system for thread stack performance analysis tasks, characterized in that: The system is used to perform the method according to any one of claims 1 to 9; the system at least comprises: A determination module, used to determine the frequency of occurrence of thread stack entry endpoints based on historical performance analysis data; A first adjustment module is used to adaptively adjust the initial weight value in the current thread stack performance analysis task according to the frequency to obtain a target weight value; wherein the initial weight value is used to represent a unified weight value set in the initialization phase of the thread stack performance analysis task; The second adjustment module is used to adaptively adjust the initial snapshot sampling rate to obtain a target snapshot sampling rate, so as to process the thread stack performance analysis task according to the target snapshot sampling rate; wherein the initial snapshot sampling rate is used to represent the unified sampling rate set in the initialization phase of the thread stack performance analysis task.