Why is the memory on the server high, mostly in the db (mysqld) process, even though DB activity is not high?

You can see that the server memory is full,

It can be seen from CLI monitoring that there are many mysql processes that use up to 10GB of memory (virtually), but in terms of DB activity itself is not heavy,

1 Like

anyone can hellp me ?

1 Like

Hi @Fikri_Maulana short information about how MySQL uses memory

1 Like

@Fikri_Maulana
short information about how MySQL uses memory. Check your innodb_buffer_pool_size, The amount of memory u have assigned to MySQL will consume all of it,2nd thing which take place in memory consumption is Number thread/sessions running.
From where to start memory consumption issues:

  1. Check at Os level below command will give who is using most memory at OS level
    ps -eo size,pid,user,command --sort -size | grep [m]ysqld | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' |cut -d "" -f2 | cut -d "-" -f1
    e.g my output was 799.32 Mb /usr/sbin/mysqld
    Or You can user TOP command aswell for specific process
    [root@localhost ~]# top -b -o %MEM -n1 -p 7392 | grep PID -A 1
    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    7392 mysql 20 0 1338008 350680 15308 S 0.0 14.8 0:04.45 mysqld
    7392 is our MySQL PID

  2. below query will tell you which schema or temp tables are using your most of the memory
    *SELECT SUBSTRING_INDEX(event_name,‘/’,2) AS code_area, sys.format_bytes(SUM(current_alloc)) AS current_alloc *
    *FROM sys.x$memory_global_by_current_bytes *
    *GROUP BY SUBSTRING_INDEX(event_name,‘/’,2) *
    ORDER BY SUM(current_alloc) DESC;

1 Like