Tuning up MariaDB for a system with 128GB of RAM will significantly improve its performance. Here’s a basic configuration to start with:
1. Edit the MariaDB configuration file. This file is typically located at /etc/mysql/my.cnf or /etc/my.cnf. You may need to use sudo to edit this file: `sudo nano /etc/mysql/my.cnf`
2. Add or modify the following settings under the [mysqld] section:
“`
[mysqld]
innodb_buffer_pool_size = 96G
innodb_log_file_size = 1G
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit = 2
innodb_read_io_threads = 64
innodb_write_io_threads = 64
innodb_io_capacity = 5000
innodb_io_capacity_max = 10000
innodb_file_per_table = 1
innodb_stats_on_metadata = 0
key_buffer_size = 2G
max_connections = 500
query_cache_type = 0
query_cache_size = 0
join_buffer_size = 256K
sort_buffer_size = 256K
read_rnd_buffer_size = 256K
read_buffer_size = 256K
table_open_cache = 2000
table_definition_cache = 2000
“`
3. Save the file and exit.
4. Restart the MariaDB service to apply the changes: `sudo systemctl restart mariadb`
Please note that these settings are a starting point and you may need to adjust them based on your specific use case. For example, if your database is read-heavy, you may want to allocate more memory to the innodb_buffer_pool_size. Always monitor your system after making these changes to ensure they’re having the desired effect.
Also, don’t allocate all your RAM to MariaDB. Leave some for your operating system and other services running on the server. In this case, we’ve allocated 96GB, leaving 32GB for the system.