MySQL Server consuming too much memory

memorymy.cnfMySQLmysql-5.5

Currently I have the following happening :

enter image description here

And :

enter image description here

When i run the query i get about 68 entries with most Time set at 0

show full processlist;

enter image description here

  • What I'm doing wrong ?
  • How do i free some memory ?
  • Is it normal to have swap frozen like that ? I tried to modify the swappiness without success.

    echo 10 > /proc/sys/vm/swappiness

my.cnf file

[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket          = /var/run/mysqld/mysqld.sock
nice            = 0

log-warnings    = 2
log-error       = /var/log/mysqld.log



[mysqld]
#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /data/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

#
# * Fine Tuning
#
key_buffer_size         = 16M
max_allowed_packet      = 128M
thread_stack            = 192K
thread_cache_size       = 64
table_open_cache        = 3000
#open_file_limit         = 10000
join_buffer_size        = 128k
# This replaces the startup script and checks MyISAM tables if needed

# the first time they are touched
myisam-recover         = BACKUP
max_connections        = 3000
wait_timeout           = 150
interactive_timeout    = 30


innodb_buffer_pool_size        = 25G
#  The preferred value size for the log_file_size is 25% of the innodb_buffer_pool_size.
innodb_log_file_size           = 1G
#innodb_log_buffer_size         = 512M


innodb_buffer_pool_instances   = 10
tmp_table_size                 = 256M
max_heap_table_size            = 256M
innodb_flush_log_at_trx_commit = 2
query_cache_limit              = 64M
query_cache_size               = 256M


server-id               = 1
log_bin                 = /var/log/mysql/mysql-bin.log
expire_logs_days        = 1
max_binlog_size         = 100M

[mysqldump]
quick
quote-names

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer              = 16M

Best Answer

It seems that you misconfig the mysqld and that the service is reserving more memory than the server actually has (VIRT is 37G, but the server has 32G). Please have a look at the doc. I don't know your my.cnf but you should start by setting the innodb_buffer_pool_size to 24G and restart the service.