GET 24/7 LIVE HELP NOW

Announcement

Announcement Module
Collapse
No announcement yet.

MySQL using 90% memory

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MySQL using 90% memory

    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.

  • #2
    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 + @@tmp_table_size+@@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 ;

    Comment


    • #3
      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/...emory-usage-2/

      Comment

      Working...
      X