For Database Instances with Relatively Low Configurations That Are Relevant to the User's Core Services
It is recommended that you scale up the instance specification. For details,see Specification Scaling.
For Database Instances That Are Not Relevant to the User's Core Services
Check the related monitoring indicators of the memory usage in the instance virtual machine. If the memory usage curve remains flat, no operation is required.
For Database Instances with Relatively High Configurations That Are Relevant to the User's Core Services
Check the memory usage trend of the instance through the monitoring indicators on the Console. If the memory usage of the instance remains high:
• Scale up the instance specification.
• Adjust the value of the database parameter innodb_buffer_pool_size:
– When the database instance memory is 2 GB, the reference value is 256 MB.
– When the database instance memory is 4 GB, the reference value is 1 GB.
– When the database instance memory is 8 GB, the reference value is 3 GB.
– If the database instance memory is larger than 8 GB, no operation is required.
Note
• Adjust the value of the parameter innodb_buffer_pool_size based on actual services and memory usage.
• MySQL has a dynamic memory balance mechanism. If the system memory usage is less than 90%, no operation is required.
• The MySQL memory is allocated to the Engine layer and Server layer.
– The memory allocated to the Engine layer includes the InnoDB buffer pool, log buffer, table cache, and table definition cache. Among them, the InnoDB buffer pool mainly caches common data such as table data pages, index pages, and data dictionaries. Most of the memory of the database is occupied by this kind of cache, which is generally resident memory. The InnoDB buffer pool is a memory area that can be changed by the parameter InnoDB_buffer_pool_size.
– At the Server layer, thread caches like thread cache, binlog cache, sort buffer, read buffer, join buffer, and read buffer occupy a large amount of memory. The cache is independently allocated for each database connection session. The total amount of independent caches is proportional to the number of connections. The higher the number of connections, the larger the total independent caches. However, such caches are not resident memory and are usually released when connections are closed.
The above memory allocation keeps the memory usage of a running MySQL instance at about 80%.