A
A
Alexander Shestakov2020-04-28 13:04:10
linux
Alexander Shestakov, 2020-04-28 13:04:10

Bitrix - mysql eats memory, how to fix it?

Good afternoon, I inherited a server with Bitrix. After transferring to another server, it turned out that mysql once a day eats up all 32GB of memory, swap and crashes. After a reboot, the situation repeats.

It's useful to look at the mysql settings - but here I'm a layman. In my opinion, there is confusion in the settings, and obviously something is not right.

What to fix so that the memory does not fly to heaven?

my.cnf

spoiler

#
# Basic mysql configuration. Use bvat for advanced settings.
# Parameters set by bvat are stored in /etc/mysql/conf.d/bvat.cnf.
# If you want to change any parameter, you'll have to redefine it in /etc/mysql/conf.d/z_bx_custom.cnf
#

[client]
port = 3306
socket = /var/lib/mysqld/mysqld.sock
default-character-set = utf8

[mysqld_safe]
nice = 0
socket = /var/lib/mysqld/mysqld.sock

[mysqld]

# Basic mysql server configuration
user = mysql
port = 3306
basedir = /usr
datadir = /var/lib/mysql
socket = /var/lib/mysqld/mysqld.sock
skip-external-locking
default-storage-engine = innodb
pid-file = /var/run/mysqld/mysqld.pid
transaction-isolation = READ-COMMITTED
max_allowed_packet = 16M
myisam-recover-options = BACKUP
explicit_defaults_for_timestamp = 1
expire_logs_days = 10
max_binlog_size = 100M
sql_mode = ""

# Cache parameters
query_cache_size = 32M
table_open_cache = 4096
thread_cache_size = 32
key_buffer_size = 16M
thread_stack = 128K
join_buffer_size = 2M
sort_buffer_size = 2M

# Parameters for temporary tables
tmpdir = /tmp
max_heap_table_size = 32M
tmp_table_size = 32M

# InnoDB parameters
innodb_file_per_table
innodb_buffer_pool_size = 32M
innodb_flush_log_at_trx_commit = 2
innodb_log_file_size = 64M
innodb_flush_method = O_DIRECT

# Database charset parameters
character-set-server = utf8
collation-server = utf8_unicode_ci
init-connect = "SET NAMES utf8 COLLATE utf8_unicode_ci"
#skip-character-set-client-handshake
skip-name-resolve

[mysqldump]
quick
quote-names
max_allowed_packet = 16M
default-character-set = utf8

[mysql]

[isamchk]
key_buffer = 16M

# Include additional settings
!includedir /etc/mysql/conf.d/


vbat

spoiler
# memory: 32768MB
[mysqld]
query_cache_type = 1
query_cache_size = 128M
query_cache_limit = 16M
innodb_buffer_pool_size = 14336M
max_connections = 125
table_open_cache = 14336
thread_cache_size = 128
max_heap_table_size = 128M
tmp_table_size = 128M
key_buffer_size = 196M
join_buffer_size = 24M
sort_buffer_size = 24M
bulk_insert_buffer_size = 2M
myisam_sort_buffer_size = 24M


bx_custom

spoiler
[mysqld]
# memory: 8192MB
query_cache_type = 1
query_cache_size = 64M
query_cache_limit = 64M
innodb_buffer_pool_size = 10G
max_connections = 256
table_open_cache = 12288
thread_cache_size = 128
max_heap_table_size = 128M
tmp_table_size = 128M
key_buffer_size = 16M
join_buffer_size = 14M
sort_buffer_size = 14M
bulk_insert_buffer_size = 2M
myisam_sort_buffer_size = 14M

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor, 2020-04-28
@mehmets256

Solutions are standard.
Run mysqltuner
turn on logs (on slow queries)
look for configuration under low memory server
(memory usage grows because you allowed it)

V
Victor Taran, 2020-04-29
@shambler81

the fact that the sequel eats memory is normal
, he eats it off especially for work, in fact he reserves it, there's nothing to worry about.
Look at the site, most likely you need to work with the site cache

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question