Skip to content

Instantly share code, notes, and snippets.

@diegoos
Last active November 13, 2016 03:22
Show Gist options
  • Save diegoos/738c8f28403c912b724ca18ca36e437b to your computer and use it in GitHub Desktop.
Save diegoos/738c8f28403c912b724ca18ca36e437b to your computer and use it in GitHub Desktop.
Tuning for MySQL 5.7. Set vars in /etc/mysql/mysql.conf.d/mysqld.cnf
# (adjust value here, 50%-70% of total RAM)
innodb_buffer_pool_size = 1G
# 128M – 2G (does not need to be larger than buffer pool)
innodb_log_file_size = 128M
# 1 (Default) - 0/2 (more performance, less reliability)
innodb_flush_log_at_trx_commit = 2
# O_DIRECT (avoid double buffering)
innodb_flush_method = O_DIRECT
# Can remove the need for table-level AUTO-INC lock (and can increase performance when multi-row insert statements are used to insert values into tables with auto_increment primary key).
innodb_autoinc_lock_mode = 2
# Requires by "innodb_autoinc_lock_mode" - binlog_format=ROW or MIXED (and ROW is the default in MySQL 5.7).
binlog_format = ROW
# This is a more advanced tuning, and only make sense when you are performing a lot of writes all the time (it does not apply to reads, i.e. SELECTs). If you really need to tune it, the best method is knowing how many IOPS the system can do.
# Set the innodb_io_capacity to 50% of the innodb_io_capacity_max
innodb_io_capacity_max = 4000
innodb_io_capacity = 2000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment