Quantcast
Channel: MySQL Forums - Performance
Viewing all articles
Browse latest Browse all 1205

High memory usage on mysql 5.7.18 (4 replies)

$
0
0
top shows that mysqld is taking up unusually high memory.

VIRT 24.757g
RES 0.014t
SHR 7228

from:

top - 00:44:26 up 32 days, 3:36, 1 user, load average: 0.77, 0.49, 0.58
Tasks: 198 total, 1 running, 197 sleeping, 0 stopped, 0 zombie
%Cpu(s): 9.8 us, 1.9 sy, 0.0 ni, 87.6 id, 0.5 wa, 0.0 hi, 0.1 si, 0.1 st
KiB Mem : 31414872 total, 488760 free, 29922400 used, 1003712 buff/cache
KiB Swap: 4047996 total, 64 free, 4047932 used. 932180 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
22189 mysql 20 0 24.757g 0.014t 7228 S 25.2 48.7 432:18.74 /usr/sbin/mysqld --daemonize

According to the following calculations (reference http://mysqltuner.com by Major Hayden), the maximum memory that could have been used by mysql is 393 MB:

maxTmpTableSize = tmp_table_size (16777216) > max_heap_table_size (16777216) ? max_heap_table_size (16777216) : tmp_table_size (16777216)
= 16777216

serverBuffers = key_buffer_size (8388608) + maxTmpTableSize (16777216) + innodb_buffer_pool_size (134217728) + innodb_log_buffer_size (16777216) + query_cache_size (1048576)
= 177209344

perThreadBuffers = read_buffer_size (131072) + read_rnd_buffer_size (262144) + sort_buffer_size (262144) + thread_stack (262144) + join_buffer_size (262144)
= 1179648

maxTotalPerThreadBuffers = perThreadBuffers * max_used_connections (54) => 1179648 * 54
= 63700992

performance_schema.memory = 171216568

maxUsedMemory = serverBuffers + maxTotalPerThreadBuffers + performance_schema.memory
= 412126904 B

~393 MB

The maximum memory that "can" be used by mysql is 613 MB:

totalPerThreadBuffers = perThreadBuffers (1179648) * max_connections (250)
= 294912000

maxPeakMemory = serverBuffers + totalPerThreadBuffers + pfMemory
= 643337912 B

~ 613 MB

But top shows that it is using much higher than both of these numbers.

Is there a way to account for all the memory used by the mysqld process? Or could there be a memory leak?

System information:
Linux version 3.10.0-514.21.1.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP

Viewing all articles
Browse latest Browse all 1205

Latest Images

Trending Articles



Latest Images