Hi -
I've recently installed my first MySQL 8.0.21 on a CentOS8 (latest updates), and noticed it seems to be using most of the memory on the machine, almost directly after a reboot. I've never seen this before with an untuned MySQL. So MySQL has no custom tuning, everything is default. Almost immediately after a reboot, I have about ~80MB free. If I disable MySQL from starting up, I'll have about 2.1GB of memory free.
If I'm quickly after a reboot, login (ssh), start top, I'll see the ~2GB of memory free, but this drops to the ~80MB in about 5 seconds. I see some changes to the mysql process in top in regards of memory usage, but nothing that reflects the amount of memory that's free on my system.
So this is a Vmware VM, running 4.18.0-240.1.1.el8_3.x86_64, 3GB of RAM, 2 cores (E5-2690 v3), running on VMware ESXi, 6.7.0, 16713306. I've done some hardening sysctls, installed apache, php etc, nothing fancy.
RPM: mysql-server-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64
Repo: AppStream
Output of top (sort on RES memory with 'M') example, logged in as quick as I could, some memory is already gone:
top - 19:30:47 up 0 min, 1 user, load average: 0.40, 0.08, 0.03
Tasks: 236 total, 3 running, 233 sleeping, 0 stopped, 0 zombie
%Cpu(s): 54.5 us, 30.3 sy, 0.0 ni, 3.0 id, 9.1 wa, 0.0 hi, 3.0 si, 0.0 st
MiB Mem : 2798.0 total, 1524.5 free, 1013.2 used, 260.4 buff/cache
MiB Swap: 1908.0 total, 1908.0 free, 0.0 used. 1620.6 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1397 mysql 20 0 428840 260188 26924 S 16.7 9.1 0:02.16 mysqld
1198 root 20 0 719396 50020 38244 S 0.0 1.7 0:00.21 php-fpm
1211 root 20 0 426316 31292 16400 S 0.0 1.1 0:00.26 tuned
1442 apache 20 0 733608 24128 12324 S 0.0 0.8 0:00.00 php-fpm
1443 apache 20 0 733608 24128 12324 S 0.0 0.8 0:00.00 php-fpm
1444 apache 20 0 733608 24128 12324 S 0.0 0.8 0:00.00 php-fpm
1446 apache 20 0 733608 24128 12324 S 0.0 0.8 0:00.00 php-fpm
1441 apache 20 0 733608 24124 12320 S 0.0 0.8 0:00.00 php-fpm
1017 polkitd 20 0 1628176 22248 17364 S 0.0 0.8 0:00.13 polkitd
1547 apache 20 0 1976548 22076 7664 S 0.0 0.8 0:00.22 httpd
1546 apache 20 0 1845400 20008 7664 S 0.0 0.7 0:00.07 httpd
Three seconds later:
Tasks: 234 total, 1 running, 233 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.2 us, 0.2 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 2798.0 total, 88.1 free, 2466.9 used, 243.1 buff/cache
MiB Swap: 1908.0 total, 1904.0 free, 4.0 used. 169.6 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1397 mysql 20 0 1773432 368564 34316 S 0.3 12.9 0:04.13 mysqld
1198 root 20 0 719396 49364 37588 S 0.0 1.7 0:00.22 php-fpm
1211 root 20 0 426316 30456 15564 S 0.0 1.1 0:00.27 tuned
1442 apache 20 0 733608 23956 12152 S 0.0 0.8 0:00.00 php-fpm
1443 apache 20 0 733608 23956 12152 S 0.0 0.8 0:00.00 php-fpm
1444 apache 20 0 733608 23956 12152 S 0.0 0.8 0:00.00 php-fpm
1446 apache 20 0 733608 23956 12152 S 0.0 0.8 0:00.00 php-fpm
1441 apache 20 0 733608 23952 12148 S 0.0 0.8 0:00.00 php-fpm
1547 apache 20 0 1976548 21912 7556 S 0.0 0.8 0:00.23 httpd
This is my /etc/my.cnf:
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
.. and /etc/my.cnf.d is empty.
No databases, freshly initialized.
Strange thing as well is that I don't seem from top where my memory is going. The numbers (RES) add up to about 5-600MB of memory.
This can't be normal behaviour, is it?