Not the answer you need?
Register and ask your own question!

MySQL using 90% memory

jvguyjvguy EntrantInactive User Role Beginner
We are using Percona 5.6 in our production environment. The database is more read intensive but no read replica's has been setup yet but that is one of the thing in our TODO list.

Last week I was checking memory usage and I observed that MySQL was using more than 85% of memory but I did not seen any performance depletion due to high memory usage. Is it normal for MySQL to claim maximum Memory but not actually using those memory?

What is the best way to see how MySQL is allocating its memory? Please sherd some light to me.

Comments

  • cetanhotacetanhota Contributor Inactive User Role Beginner
    You can use this procedure to see how much total memory MySQL will use.
    DELIMITER $$
    CREATE DEFINER=`root`@`%` PROCEDURE `MaxMemoryUsed`()
    begin
    /*
    Written By:
    Date: 10/15/2012
    This procedure will provide the total amount of memory that mysql
    will used based on memory config settings.
    */
    SET @kilo_bytes = 1024;
    SET @mega_bytes = @kilo_bytes * 1024;
    SET @giga_bytes = @mega_bytes * 1024;

    select (@@key_buffer_size + @@query_cache_size + @@[email protected]@innodb_buffer_pool_size + @@innodb_additional_mem_pool_size + @@innodb_log_buffer_size + @@thread_stack +
    @@max_connections * (@@read_buffer_size + @@read_rnd_buffer_size + @@sort_buffer_size + @@join_buffer_size +
    @@binlog_cache_size + @@thread_stack)) / @mega_bytes as 'Max_Memory_in_Megs';
    end$$
    DELIMITER ;
  • niljoshiniljoshi MySQL Sage Inactive User Role Beginner
    Hi,

    I would suggest you to read my blog post about how to troubleshoot the memory usage in MySQL. You'll get many ways to figure out where memory is allocating.
    http://www.mysqlperformanceblog.com/2014/01/24/mysql-server-memory-usage-2/
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.