MySQL using up all RAM and SWAP in group replication settings

linuxMySQL

I am using MySQL 8.0.18 in a group replication (multi-master) infrastructure. There are currently 4 master servers connected to each other and everything seems to be working fine but over the course of around 2 weeks all mysqld process on all servers uses up all the swap. ram usage stays at 800Mb as I suspect innodb_log_buffer_size is doing its job.

Server Specs:

  • Debian 10
  • 1Gb RAM
  • 3GB SWAP
  • 20GB ssd

Mysql.cnf:

max_connections=20
innodb_log_buffer_size=800M
key_buffer_size=50M
super_read_only=off
gtid_mode = ON
enforce_gtid_consistency = ON
master_info_repository = TABLE
relay_log_info_repository = TABLE
binlog_checksum = NONE
log_slave_updates = ON
log_bin = binlog
binlog_format = ROW
transaction_write_set_extraction = XXHASH64
loose-group_replication_bootstrap_group = OFF
loose-group_replication_start_on_boot = OFF
loose-group_replication_ssl_mode = REQUIRED
loose-group_replication_recovery_use_ssl = 1
loose-group_replication_unreachable_majority_timeout=80
loose-group-replication-autorejoin-tries=2015
loose-group-replication-transaction-size-limit=0

Related OS config:

vm.swappiness=5

How do I make mysql stop using so much swap?

Best Answer

innodb_log_buffer_size=800M is probably using more than the available memory (after allowing for the OS, MySQL code, etc, etc).

Use the default value.