This /etc/sysctl.conf settings are generally suitable for a MariaDB Galera Cluster. Use this wisely. Execute command sysctl -p after editing /etc/sysctl.conf.
# Increase the maximum number of memory map areas a process may have
# This can help prevent out-of-memory errors in large applications
vm.max_map_count=262144
# Increase the maximum number of file handles and inode cache for large file transfers
# This can improve performance when dealing with a large number of files
fs.file-max = 3261780
# Increase the maximum buffer size for TCP
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
# Increase Linux autotuning TCP buffer limits
net.ipv4.tcp_rmem = 4096 12582912 16777216
net.ipv4.tcp_wmem = 4096 12582912 16777216
# Disable caching of ssthresh from previous TCP connection
net.ipv4.tcp_no_metrics_save = 1
# Reduce the kernel's tendency to swap
vm.swappiness = 1
# Set the default queueing discipline for network devices
net.core.default_qdisc = fq_codel
# Enable TCP BBR congestion control
net.ipv4.tcp_congestion_control=bbr
# Enable TCP MTU probing
net.ipv4.tcp_mtu_probing=1
# Increase the maximum input queue length of a network device
net.core.netdev_max_backlog = 32768
# Increase the maximum accept queue limit
net.core.somaxconn = 65535
# Reduce the number of SYN and SYN+ACK retries before packet expires
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_synack_retries = 1
# Reduce the timeout to close client connections in TIME_WAIT state
net.ipv4.tcp_fin_timeout = 30
# Disable SYN cookie flood protection
net.ipv4.tcp_syncookies = 0
# Increase the local port range used by TCP and UDP
net.ipv4.ip_local_port_range = 1024 65535
# Additional Galera Cluster optimizations
# Increase the number of allowed open files per process for MariaDB
####fs.file-max = 3261780
# Increase the number of file handles specifically for MariaDB
# Adjust according to the needs of your Galera Cluster
fs.aio-max-nr = 1048576
# https://www.suse.com/support/kb/doc/?id=000017857
# Flushing a large cache can take extensive time and force many things to wait.
# In contrast, flushing a small cache (even multiple times) is far less disruptive.
# Good performance (for both slow storage and quick storage, and for both low RAM systems vs high RAM systems)
# does not usually require more than a few hundred megabytes of memory in dirty cache.
vm.dirty_bytes = 629145600
vm.dirty_background_bytes = 314572800
Here are some settings from the
sysctl.conf
file that would be particularly beneficial for a MariaDB database:Increase the maximum number of memory map areas a process may have:
vm.max_map_count=262144
Increase the maximum number of file handles and inode cache:
fs.file-max = 3261780
Reduce the kernel's tendency to swap:
vm.swappiness = 1
Increase the maximum input queue length of a network device:
net.core.netdev_max_backlog = 32768
Increase the maximum accept queue limit:
net.core.somaxconn = 65535
Increase the local port range used by TCP and UDP:
net.ipv4.ip_local_port_range = 1024 65535
Please remember to handle system configurations securely when using such tools and ensure you have the necessary permissions to modify configuration files. Always backup your configuration files before making any changes. Also, keep in mind that these settings may need to be adjusted based on the specific requirements and constraints of your system. It's always a good idea to monitor system performance and adjust settings as needed.