You can view the slow logs of an instance in the console so that you can troubleshoot performance issues and optimize requests.
Background information
Slow logs record requests that take longer than a specified threshold to execute in ApsaraDB for Redis. Slow logs are classified into slow logs from data nodes and slow logs from proxy nodes.
- If the ApsaraDB for Redis instance uses the standard architecture, only slow logs from data nodes are collected.
- For more information, see Modify the values of parameters for an instance.
Slow log type | Description | Parameter |
---|---|---|
Slow logs from data nodes |
|
|
Slow logs from proxy nodes |
| rt_threshold_ms: the threshold of command execution duration for slow logs from proxy nodes. Default value: 500. Unit: milliseconds. We recommend that you set the threshold to a value close to the client timeout period, which is from 200 milliseconds to 500 milliseconds. |
Procedure
- Log on to the ApsaraDB for Redis console and go to the Instances page. In the top navigation bar, select the region in which the instance is deployed. Then, find the instance and click its ID.
- In the left-side navigation pane, choose .
- Specify filter conditions to filter results based on your business requirements.
No. Description ① The node type and node ID. Note For standard instances, only the slow logs from Data Node are displayed. If you use standard instances, skip this step.② ③ The time range to query. By default, slow logs collected during the last hour are displayed. ④ The keyword that is specified to filter slow logs. Example: bgsave. NoteBy default, the Host Address parameter for master-replica cluster and read/write splitting instances displays the IP address of proxy nodes. To obtain the IP address of a specific client, set ptod_enabled to
1
in System Parameters. For more information, see Modify the values of parameters for an instance.
Execution durations of special slow SQL statements
- latency:eventloop
ApsaraDB for Redis uses the event-driven mode during runtime. An event includes the process of reading, parsing, and running commands and returning results. The execution duration of a
latency:eventloop
statement indicates the overall amount of time required for an event loop. - latency:pipeline
ApsaraDB for Redis allows the client to work in pipeline mode. In this mode, the client sends commands in batches and returns results in batches after all commands are run. The execution duration of a
latency:pipeline
statement indicates the overall amount of time required to handle all requests from the client in pipeline mode.Note By default, proxy nodes of ApsaraDB for Redis cluster instances send requests to the backend Redis server in pipeline mode. - latency:fork
The execution duration of a
latency:fork
statement indicates the amount of time required to fork a child process. The larger the amount of data, the longer the time required.
Related API operations
Operation | Description |
---|---|
DescribeSlowLogRecords | Queries the slow logs of an ApsaraDB for Redis instance that are generated during a specified period of time. |