bench
bench copied to clipboard
Default MariaDB Mysql config is unnecessarily dangerous
https://github.com/frappe/bench/blob/cbf30b4e6a77132bb242606e1d3b3367fab4f3ee/bench/playbooks/roles/mariadb/files/mariadb_config.cnf#L14
The max-allowed-packet setting is 256MB in the playbook default config which is unnecessary, and is reported by https://github.com/major/MySQLTuner-perl as dangerous due to potentially exceeding memory limits, especially with maximum connections set to 500, also unnecessarily large. You should only need roughly as many connections as there are gunicorn worker processes.
Each connection could potentially allocate at least 256MB, multiplied by 500 equates to more memory than available for all frappe & ERPNext instances.
To make matters worse the setting is duplicated, meaning you have to remove one or fix both.
Look out for:
max-connections = 500
max_allowed_packet = 256M
I would suggest:
max-connections = 20
max-allowed-packet = 4M
join-buffer-size = 2M [due to a lot of non-indexed joins]