Running MySQL 8.0.24, I have been recently seeing frequent instances where the RHEL7 OS will kill the mysqld process as the system memory gets all used up. The server has 65 GB of memory, and I think I have MySQL configured to use only approximately 36 GB.

Parameter Setting
key_buffer_size 8 MB
+ tmp_table_size 8192 MB
+ innodb_buffer_pool_size 27648 MB
+ innodb_additional_mem_pool_size 1 MB
+ innodb_log_buffer_size 16 MB
max_connections 150
sort_buffer_size 0.25 MB
+ read_buffer_size 0.125 MB
+ read_rnd_buffer_size 0.25 MB
+ join_buffer_size 0.25 MB
+ thread_stack 0.27343750 MB
+ binlog_cache_size 0.03125000 MB

Totals: 36041.95 MB

However, if I monitor processes in the OS, using top, I see that mysqld is using more and more memory over time, and by the time Linux kills it, mysqld is using over 90% of memory, almost 60 GB.

I have seen the frequency of this increase of late, and it usually occurs while I am running a PHP script that does about 3000 queries in quick succession (selects), one every 5 to 15 seconds. Sounds like a lot, but should not be a problem. PHP is NOT running on the same server.

Any ideas on why mysqld continues to consume memory, given its configured variables listed above?

  • Sorry for the hard-to-read table. It rendered correctly in the editor when I was writing the question.
    – TFR3
    Commented Aug 9, 2023 at 20:38


Your Answer

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

Browse other questions tagged or ask your own question.