Bug #108695 mysql memory utilization is high
Submitted: 5 Oct 2022 19:49 Modified: 6 Oct 2022 16:14
Reporter: lokesh singhal Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0.25 OS:Ubuntu (18)
Assigned to: CPU Architecture:ARM
Tags: mysql memory issue

[5 Oct 2022 19:49] lokesh singhal
Description:
I have below server configuration
vcpu = 6 cores 
RAM  = 64GB 
disk = 200GB 

my.cnf configuration:

max_connections=1000 
innodb_buffer_pool_size=40G
innodb_log_file_size=2G
interative_time_out=300
wait_time_out=300

Rest all parameter is default.

Now it shows MySQL memory utilization is 84% of physical RAM.
CPU utilization is normal.

What is the issue here?

How to repeat:
On restart goes to normal after 1 month is shows again same.
[6 Oct 2022 12:35] MySQL Verification Team
Hi Mr. singhal,

Thank you for your bug report.

However, it is not a bug.

We have received hundreds of reports like this and always discovered that a problem is not in any program, including MySQL.

Problem is in malloc library that is used on Linux, as well as on many other operating system.

Simply, when a process allocates lot's of memory, the memory that is freed by MySQL server remains attached to the server, by the OS malloc library.  That is a why for reducing the frequency with which  that OS system call has to be made. 

There is a way to free even that memory, but that requires to write a complex C program (only for your system), that would reduce the RAM attached to the MySQL server. However, that program would slow down future malloc's considerably !!!!

Not a bug.
[6 Oct 2022 16:14] lokesh singhal
Can you suggest me next step here to release memory Do I need to restart MySQL service or any other way?
[7 Oct 2022 12:51] MySQL Verification Team
Hi,

I warn you again that this will slow down MySQL server.

You have to see how much virtual memory you have free. Add as much as you want to free. Write a C program that will calloc() that amount of memory and then let it free() that amount ....