Updated on 2024-01-10 GMT+08:00

RDS for MariaDB Memory Usage Too High

For a DB instance storing mission-critical application data

Scale up the instance class.

For a DB instance not storing mission-critical application data

Check the memory usage of the local computer. If the memory usage curve is stable, no action is required.

For a DB instance storing mission-critical application data and configured with a large instance class

  1. During off-peak hours, change the value of performance_schema to OFF. You need to reboot the instance for the change to take effect.
  2. View the memory usage of your instance using DBA Assistant. For details, see Viewing Performance Metrics.
    If the space usage remains high, perform either of the following operations:
    • Scale up the instance class.
    • Change the innodb_buffer_pool_size value:
      • If the instance memory is 2 GB, change innodb_buffer_pool_size to 268,435,456 in byte (256 MB).
      • If the instance memory is 4 GB, change innodb_buffer_pool_size to 1,073,741,824 in byte (1 GB).
      • If the instance memory is 8 GB, change innodb_buffer_pool_size to 3,221,225,472 in byte (3 GB).
      • If the instance memory is greater than 8 GB, you do not need to adjust the innodb_buffer_pool_size value.
  • Change the value of innodb_buffer_pool_size as needed.
  • MariaDB has a dynamic memory balancing mechanism. If the memory usage is less than 90%, no action is required.
  • RDS for MariaDB memory is allocated to the engine layer and server layer.
    • The memory allocated to the engine layer includes the InnoDB buffer pool, log buffer, and full text index cache. The InnoDB buffer pool is resident memory and accounts for a large proportion.

      The InnoDB buffer pool is a memory area that holds cached InnoDB data for tables, indexes, and other auxiliary buffers. You can use the innodb_buffer_pool_size parameter to define the buffer pool size.

    • The memory allocated to the server layer is occupied by the thread cache, binlog cache, sort buffer, read buffer, and join buffer. These caches and buffers are usually released when connections are closed.

    Such memory allocation keeps memory usage of a running RDS for MariaDB instance at about 80%.