All Products
Search
Document Center

:Apsaradb RDS for MySQL instance memory usage alerts

Last Updated:Mar 04, 2021

Problem description

On the alarm page of the RDS console, a memory usage alarm is displayed on the instance.

Cause

  • Improper settings of monitoring metrics.
  • The instance memory usage is abnormal.

Solution

Check the memory usage of an instance

Log on to the instance and run the following SQL statement to check the memory usage of the current instance.

show variables where variable_name in ('innodb_buffer_pool_size',                         'innodb_log_buffer_size',                         'innodb_additional_mem_pool_size',                         'key_buffer_size',                         'query_cache_size');

A similar output is displayed. This example uses an RDS instance with a memory size of 240MB. For a description of the parameters.

+---------------------------------+-----------------+
| Variable_name                   | Value           |
+---------------------------------+-----------------+
| innodb_additional_mem_pool_size | 2097152         |
| innodb_buffer_pool_size         | 67108864        |
| innodb_log_buffer_size          | 1048576         |
| key_buffer_size                 | 16777216        |
| query_cache_size                | 0               |
+---------------------------------+-----------------+
A total of 5 rows of records were returned, which took 342.74 ms.

Inappropriate metric settings

Check innodb_buffer_pool_size parameter to check the value of the parameter. Most alerts on memory usage are caused by the growth of the buffer pool of the instance, which is normal. Therefore, this type of alarm is a false positive caused by unreasonable setting of monitoring indicators.

By default, the buffer pool of apsaradb RDS for MySQL uses 80% of the instance memory size. This increases the memory size of the buffer pool during the instance usage. When the memory usage exceeds 80% and you confirm that it is the memory usage of the buffer pool, we recommend that you set the monitoring metric to 90%. For more information about how to set metrics, see configure alarm rules.

Memory usage exception

If an alert is triggered when the memory usage exceeds 90%, consider the following two aspects:

  • Check whether there are too many sessions. If there are too many idle sessions, evaluate whether the setting of the number of idle sessions is reasonable. For more information about how to check the Session value, see MySQL official documentation.
  • Check whether a single Session occupies too much private memory. Mainly troubleshoot operations, such as creating a temporary table, and performing sort or join operations. These operations occupy a large amount of private memory.

Application scope

  • ApsaraDB RDS for MySQL