ApsaraDB for Redis instances are running at a data layer that is closer to applications. 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 database data as expected.

Step 1: Analyze traffic usage

Check the traffic usage of the ApsaraDB for Redis instance within a specified time period. 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.

Note
  • In most cases, if the average traffic usage stays around 80%, you must pay close attention. The bandwidth resources may be exhausted.
  • You must check the IntranetInRatio and IntranetOutRatio metrics, which 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. The amount of user traffic may not match the expected bandwidth consumption. For example, the trend of traffic usage growth and the trend of QPS growth are inconsistent. In this case, you can find big keys on the ApsaraDB for Redis instance by using the cache analytics feature. For more information, see Use the cache analytics feature to find big keys.
    Optimize big keys, which are typically larger than 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 analytics
    Example of big key analytics
  2. For performance-enhanced cluster instances of ApsaraDB for Redis Enhanced Edition (Tair), you can enable proxy query cache to address excessive or skewed requests caused by hotkeys. For more information, see View real-time hot key logs and Use proxy query cache to address issues caused by hotkeys.
  3. Optional:For cluster instances, you can 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 equals the bandwidth limit of an individual data shard multiplied by the number of data shards. For example, a cluster instance contains 128 data shards and the bandwidth limit of an individual data shard is 96 Mbit/s. The bandwidth limit of the cluster instance is 12,288 Mbit/s after you enable the direct connection mode.
  4. If the traffic usage is still high after the preceding optimization steps, upgrade your instance for a larger memory to withstand more traffic and improve performance. For more information, see Change the specification of an ApsaraDB for Redis instance.
    Note Before you upgrade your 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 the test is complete. For more information about how to release an instance, see Release instances.