2

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

2 Answers 2

1

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.

7
  • my innodb_buffer_pool_size is currently set to 25G , i'll update the question with my current cnf file
    – Tarek
    Commented Aug 25, 2016 at 6:56
  • I just modified it to 24G also made the max connection 2500 instead of 3000 .
    – Tarek
    Commented Aug 25, 2016 at 7:40
  • The config seems ok to me. I would try to decrease the pool size gradually and see if the VIRT is lower then 32G. You set the max connections value very high, I guess something between 500 and 1000 should be enough.
    – s.meissner
    Commented Aug 25, 2016 at 7:43
  • my max_used_connections was around 1700 , i decreased the max_con to 2500
    – Tarek
    Commented Aug 25, 2016 at 7:48
  • Did the lower buffer pool size makes any different? Still swapping?
    – s.meissner
    Commented Aug 25, 2016 at 10:28
1

Having the buffer pool at 25G on a 32G machine is reasonable. That has 25GB reserved for the main caching area. (If you are going to run other applications that will consume RAM, then lower the 25G to make room for them.)

The output implies that you are not swapping; good. It implies that there are many mysql processes alive, but probably doing nothing. This is normal. However, thread_cache_size is 64; this is unnecessarily large; 10 is usually adequate.

query_cache_size - lower to 50M; having a larger value can slow things down.

max_connections -- lower to a few hundred. Only rare installations need more than 1000. If you need 3000, you have other problems, and they need to be addressed. You say it peaked at 1700? What are your clients like? Are they failing to disconnect? Are they allowing too many connections? Apache, for example, has MaxClients, which should be, say, only 20, not some huge value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.