Description
Overview of the Issue
I reviewed the config files in ./config/mycnf
, and I think some of the configuration changes it makes are not optimal.. possibly dangerous in some cases.
Reproduction Steps
Let me use default-fast.cnf
as an example, since it has the most problems:
-
sql_mode = STRICT_TRANS_TABLES
-> This is on by default in MySQL 5.7+, but the problem is setting it here disables other modes in MySQL 5.7 such asNO_AUTO_CREATE_USER
: which introduces a security risk. Unless the version is 5.6, the default sql_mode should be used. -
back_log = 50
-> MySQL has an autosizing formula by default. I think we should not set this, since the formula will autotune as other variables like max_connections change. -
binlog_format = STATEMENT
-> We only support format = ROW, and this is later overwritten by another config file. Row is also the default in 5.7+ I don't recommend either setting variables to later be overwritten in the file (confusing) or setting variables to default (adds maintenance effort). So we should only need to set this in 5.6 or MariaDB. -
character_set_server
andcollation_server
-> This is the 3 byte utf8, which is deprecated. It is recommended to use the 4 byte, which is the default in MySQL 8.0. Because of backwards compatibility, maybe it makes sense to allow 3 byte in 5.6 and 5.7, but it should not be used in 8.0. -
innodb_autoextend_increment = 1
this was a problem in earlier versions of MySQL where extending the file was blocking, it is now async. I think we should now use default to reduce fragmentation. -
innodb_data_file_path = ibdata1:10M:autoextend
MySQL 8.0 requires 12M minimum. This should just be left default. -
innodb_file_per_table
This is the default 5.6+ anyway (remove from config) -
innodb_flush_method = O_DIRECT
This uses direct (unbuffered IO). The reason MySQL leaves the default to buffered is it can not rely oninnodb_buffer_pool_size
to configured correctly, so being able to use filesystem cache is really useful to improve performance for untuned systems. -
innodb_log_file_size = 4M
this is too small. I recommend just leaving at default. It will increase first start times, but the problem is InnoDB behaves differently with small log files. The maximum transaction size is 10% of log capacity, so it could cause false positive failures very easily. -
innodb_max_dirty_pages_pct = 75
I recommend leaving this default. There are better protections now to protect against a full buffer pool (innodb_max_dirty_pages_pct_lwm
). -
innodb_thread_concurrency = 2
this is not recommended to set for most workloads. It was useful in the past where InnoDB could not scale well on multiple cores, but it has overhead to do the accounting - and prevents vitess from using all the cores on my 16 thread machine. -
key_buffer_size = 2M
I am fine with this, but it is not much of a memory saving from leaving it default (8M) and simplifying config files. -
max_allowed_packet = 16M
this is the allocated up to size, not a pre-alloc size, so I recommend just leaving default. The minimum size is another setting callednet_buffer_length
. -
max_connections = 200
: this is not that much different from the default (200). Unless there is a specific reason, why don't we just leave default for simplifying the files? -
net_write_timeout=60
: this is the default. -
read_buffer_size = 1M
this is the default. -
read_rnd_buffer_size=1M
this is larger than the default (256K) and only really helps with MyISAM and MRR optimization. I don't know enough about Vitess yet to know if MRR is typical, but I would have assumed not. -
slave_net_timeout=60
this changed to 60 in MySQL 5.7. It is very important for 5.6, so we should put in a 5.6. specific config file. -
sort_buffer_size = 2M
It is workload dependent, but I think it's better to leave this default. -
table_open_cache=2048
This defaults to 2000 in MySQL 5.6+ anyway, and 4000 in MySQL 8.0, so i suggest we leave it default. -
thread_cache_size=200
this autoscales by default in 5.6+ so i suggest we leave it default. -
tmp_table_size=32M
this defaults to 16M. This change has no impact, since max_heap_table_size was left at 16M (both need to be changed). -
transaction_isolation = REPEATABLE-READ
this is the default, so I suggest removing it from the config file.
Activity