MySQL Performance Tuning
MySQL Performance Tuning
Version 1
Folder structure in Ubuntu 20.04
/etc/mysql
innodb_buffer_pool_size = 8G
query_cache_size – Specifies the size of the cache of MySQL queries waiting
to run. The recommendation is to start with small values around 10MB and
then increase to no more than 100-200MB. With too many cached queries,
max_connection – Refers to the number of connections allowed into
you can experience a cascade of queries “Waiting for cache lock.” If your
the database. If you’re getting errors citing “Too many connections,”
queries keep backing up, a better procedure is to use EXPLAIN to evaluate
increasing this value may help.
each query and find ways to make them more efficient.
query_cache_size max_connection
my.cnf
innodb_buffer_pool_size innodb_io_capacity
innodb_buffer_pool_size – This setting allocates system memory as a data innodb_io_capacity – This variable sets the rate for input/output
cache for your database. If you have large chunks of data, increase this from your storage device. This is directly related to the type and
value. Take note of the RAM required to run other system resources. speed of your storage drive. A 5400-rpm HDD will have a much
lower capacity than a high-end SSD or Intel Optane. You can adjust
this value to better match your hardware.