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 of an ApsaraDB for Redis instance varies based on the instance type. When the maximum bandwidth is exceeded, the application data may not be accessed as expected.
Step 1: Analyze data usage
Check the data usage of the ApsaraDB for Redis instance within a specified time period. For more information, see Query monitoring data.
In this example, the data usage in both the inbound and outbound directions remains at 100%, as shown in the following figure.
- In most cases, if the average data usage stays around 80%, you must pay close attention. The bandwidth resources may be exhausted.
- You must check IntranetInRatio (inbound data usage) and IntranetOutRatio (outbound data usage).
Step 2: Optimize data usage
- The amount of user traffic may not match the expected bandwidth consumption. For example,
the trend of data usage growth and the trend of QPS growth are not consistent. 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 (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.
- Optional:For cluster instances, you can connect to them in direct connect mode to deal with
heavy loads. For more information, see Enable the direct connect mode.Note In direct connect mode, the bandwidth limit of the ApsaraDB for Redis instance equals the bandwidth limit of an individual shard multiplied by the number of shards. For example, a cluster instance of Enhanced Edition contains 128 shards and the bandwidth limit of an individual shard is 96 Mbit/s. The bandwidth limit of the cluster instance is 12,288 Mbit/s after you enable direct connect mode.
- You have performed the preceding steps to optimize the data usage, but the data usage
is still high. In this case, you can upgrade your instance for a larger memory to
withstand more traffic and improve performance. For more information, see Change specifications.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 it after the test is complete. For more information about how to release an instance, see Release a pay-as-you-go instance.