Trying some light tuning on MariaDB with mysqltuner
Hello, I'm incompetent.
While looking for something to tinker with in MariaDB to kill time, I found a MySQL tuning software called mysqltuner, so I installed it.
Installation
On Devuan, install it as follows.
sudo apt install mysqltuner
Execution
It starts interactively like this.
$ mysqltuner
>> MySQLTuner 1.9.9
* Jean-Marie Renouard <jmrenouard@gmail.com>
* Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.pl/
>> Run with '--help' for additional options and output filtering
[--] Skipped version check for MySQLTuner script
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password:
Finally, it showed something like this.
General recommendations:
You are using n unsupported version for production environments
Upgrade as soon as possible to a supported version !
Reduce or eliminate unclosed connections and network issues
Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
We will suggest raising the 'join_buffer_size' until JOINs not using indexes are found.
See https://dev.mysql.com/doc/internals/en/join-buffer-size.html
(specially the conclusions at the bottom of the page).
Performance schema should be activated for better diagnostics
Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: https://bit.ly/2TcGgtU
Variables to adjust:
skip-name-resolve=1
join_buffer_size (> 256.0K, or always use indexes with JOINs)
table_definition_cache(400) > 585 or -1 (autosizing if supported)
performance_schema=ON
innodb_buffer_pool_size (>= 1.3G) if possible.
innodb_log_file_size should be (=32M) if possible, so InnoDB total log files size equals 25% of buffer pool size.
It seems better to skip DNS name resolution.
※However, it might be a trap; if you're using user@localhost within MariaDB, it might be better to avoid it: When writing skip-name-resolve prevents connection to DB – netcreates. blog
So, I used grep -r mysqld to find the conf file for the target section, and it was at /etc/mysql/mariadb.conf.d/50-server.cnf , so I added it.
Also, it seems better to adjust the join_buffer_size, so I changed it.
It also seems better to set the table definition cache, so I changed that too.
It seems better to specify the innodb log size to prevent it from growing too large.
I also specified the innodb pool size, but kept it quite small.
[mysqld]
skip-name-resolve=1
join_buffer_size = 512K
table_definition_cache = 600
innodb_log_file_size = 32M
innodb_buffer_pool_size = 2G
If it's already commented out in the syntax, uncomment it, apply the above settings, and restart MariaDB.
sudo service mariadb restart
And the result of running mysqltuner again.
General recommendations:
You are using n unsupported version for production environments
Upgrade as soon as possible to a supported version !
MySQL was started within the last 24 hours - recommendations may be inaccurate
We will suggest raising the 'join_buffer_size' until JOINs not using indexes are found.
See https://dev.mysql.com/doc/internals/en/join-buffer-size.html
(specially the conclusions at the bottom of the page).
Performance schema should be activated for better diagnostics
Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: https://bit.ly/2TcGgtU
Variables to adjust:
join_buffer_size (> 512.0K, or always use indexes with JOINs)
performance_schema=ON
innodb_log_file_size should be (=512M) if possible, so InnoDB total log files size equals 25% of buffer pool size.
I don't want to enable performance_schema, and there aren't any other critical issues, so I'll stop here for now.
That's all for now. See you next time.