Java frameworks can be used to automatically instrument applications based on the Java bytecode injection technology. This way, you can know the spans between which a slow request occurs. However, this is insufficient to identify issues at the code level. You can use Tracing Analysis and the slow-request analysis feature of SkyWalking to find the specific methods that cause slow requests.
Prerequisites
SkyWalking is connected to Tracing Analysis. For more information, see Use SkyWalking to report Java application data.
Create a slow-request collection task
Log on to the ARMS console. In the left-side navigation pane, choose .
On the Applications page, select a region in the top navigation bar and click the name of the application that you want to manage.
NoteIf the icon is displayed in the Language column, the application is connected to Application Monitoring. If a hyphen (-) is displayed, the application is connected to Managed Service for OpenTelemetry.
In the left-side navigation pane, click Slow Request Analysis. Then, click Create a task.
In the Create a task dialog box, set parameters and click OK. The following table describes the parameters.
Parameter
Description
Required
Example
Span name
The name of the span that you want to monitor.
Yes
/api
Monitoring duration
The duration of the monitoring.
No
5 min
Span time-consuming threshold
The threshold of the span duration. The span is analyzed only when its duration exceeds this threshold. Unit: milliseconds
No
30 ms
Monitoring interval
The interval at which monitoring data is collected.
No
20 ms
Maximum number of samples
The maximum number of data samples that are collected for the span. Valid values: 1 to 9.
No
5
The created task is displayed in the Task list section.
Find the methods that cause slow requests
After the specified monitoring duration that starts from the time when you create the task is elapsed, the spans whose durations exceed the threshold are displayed in the Sampled Traces section. Perform the following steps to find the methods that cause slow requests based on the detailed information of the thread stacks on the right of the page:
On the Slow Request Analysis page, click the task that you created in the Task list section.
The spans whose duration exceeds the threshold are displayed in the Sampled Traces section.
In the Sampled Traces section, click the span that you want to check. Then, view the content in the Thread Stack section on the right of the page.
Methods whose duration exceeds the specified threshold are displayed in red. You can optimize these methods.
What can I do if no thread stack is sampled after the monitoring duration ends?
If no thread stack is sampled after the monitoring duration ends, perform the following steps to troubleshoot the issue:
In the Task list section of the Slow Request Analysis page, click View task details to the right of the task that you created.
View the task details in the Task details dialog box.