In the ApsaraDB for Redis console, you can view slow query logs and use them to analyze how to improve performance and optimize requests.

Prerequisites

Activate Log Service

Background information

ApsaraDB for Redis uses slow query logs to record requests that run for a long time. If a command takes longer to run than the time specified by the slowlog-log-slower-than parameter (in microseconds), the command will be recorded in a slow query log. In ApsaraDB for Redis, the default value of the slowlog-log-slower-than parameter is 10,000 μs (10 ms).
Note The slow query log threshold in the proxy nodes of a cluster instance is fixed at 500 ms.

The slowlog-max-len parameter specifies the maximum number of slow query logs that can be stored by an ApsaraDB for Redis instance. By default, an ApsaraDB for Redis instance stores up to 128 slow query logs.

Note For more information about how to set this parameter, see Overview. We recommend that you do not modify the default value of the slowlog-log-slower-than parameter unless otherwise required.

View slow logs on the console

Limits

  • The engine version of the ApsaraDB for Redis instance is Redis 4.0 or later.
  • The minor version of the ApsaraDB for Redis instance is the latest.
  • Note If your instance version does not meet the conditions for querying slow logs and you need to upgrade the version to use the slow log feature, upgrade the major or minor version as needed. For more information, see Upgrade the minor version and Upgrade the major version.

Procedure

  1. Log on to the ApsaraDB for Redis console.
  2. In the upper-left corner of the top navigation bar, select the region where the target instance is located.
  3. On the Instance List page, click the target instance ID or Manage in the Action column for the target instance.
  4. On the Instance Information page, choose Logs > Slow Logs from the left-side navigation pane.
  5. On the Slow Logs page, click the calendar icon next to Query Time, select a time option or set Start Time and End Time, and then click OK.View slow logs in Logs of the console
    Note If you use an ApsaraDB for Redis instance of the cluster edition, you can click Data nodes next to Query Time and select the target node.

View slow logs in DMS

Procedure

  1. Use DMS to log on to the instance.
  2. Choose Performance > Slow Logs from the top navigation bar.
  3. On the Current Logs tab, view slow logs in the list.