ApsaraDB for Redis instances run on the data layer, which is closer to the application layer. Therefore, data is frequently written to or read from ApsaraDB for Redis instances. This consumes a large amount of bandwidth resources. The maximum bandwidth available to an ApsaraDB for Redis instance varies based on the instance type. If the maximum bandwidth is exceeded, applications may fail to access data that resides on the database.

Step 1: Analyze traffic usage

Check the traffic usage of an ApsaraDB for Redis instance within a specified period of time. For more information, see Query monitoring data.

In this example, the traffic usage in both the inbound and outbound directions stays at 100%, as shown in the following figure.

  • In most cases, if the average traffic usage stays around 80%, we recommend that you troubleshoot the issue. This helps prevent bandwidth resources from being exhausted.
  • You must check the Intranet In Ratio and Intranet Out Ratio metrics, which separately indicate the inbound traffic usage and outbound traffic usage.
Figure 1. Example of traffic usage
Example of traffic usage

Step 2: Optimize traffic usage

  1. Adjust the bandwidth of the ApsaraDB for Redis instance to reduce the impact on your business. This also provides you with more time to troubleshoot the issue. For more information, see Adjust the bandwidth of an ApsaraDB for Redis instance.
  2. The amount of user traffic may not match the expected bandwidth consumption. For example, the trend of traffic usage growth and the trend of queries per second (QPS) growth are inconsistent. In this case, use the cache analysis feature to identify big keys on the ApsaraDB for Redis instance. For more information, see Use the cache analysis feature to display details about big keys.
    Optimize big keys. Keys are typically classified as big keys when their size exceeds 10 KB. For example, you can split big keys, reduce access to big keys, or delete big keys that you no longer need.
    Figure 2. Example of big key analysis
    Example of big key analysis
  3. For performance-enhanced cluster instances of ApsaraDB for Redis Enhanced Edition, enable proxy query cache to address excessive or skewed requests that are caused by hotkeys. For more information, see Query hotkeys in real time and Use proxy query cache to address issues caused by hotkeys.
  4. Optional:For cluster instances, connect to them in direct connection mode to deal with heavy loads. For more information, see Enable the direct connection mode.
    Note In direct connection mode, the bandwidth limit of the ApsaraDB for Redis instance is equal to the bandwidth limit of each data shard multiplied by the number of data shards. For example, if a cluster instance contains 128 data shards and the bandwidth limit of each data shard is 96 MB/s, the bandwidth limit of the cluster instance is 12,288 MB/s after you enable the direct connection mode.
  5. If the traffic usage is still high after you perform the preceding optimizations, upgrade your instance to a specification that has more memory. An upgrade improves instance performance and allows the instance to handle more traffic. For more information, see Change the configurations of an instance.
    Note Before you upgrade your ApsaraDB for Redis instance, you can purchase a pay-as-you-go instance to test whether the specifications to which you want to upgrade meet the requirements of your workloads. You can release the pay-as-you-go instance after you complete the test. For more information, see Release instances.