MariaDb performance issue

  • Using mysqltuner, we are facing performance issue with application using this db. We have physical memory of 128 GB. But this db is set to 16 GB. How can increase the memory and performance of this db. I just want to tune SQL to run better and understand how to do it myself.

    Here's my mysqltuner results;

     >>  MySQLTuner 1.7.2 - Major Hayden 
     >>  Bug reports, feature requests, and downloads at
     >>  Run with '--help' for additional options and output filtering

    [--] Skipped version check for MySQLTuner script
    [OK] Logged in using credentials from debian maintenance account.
    [OK] Currently running supported MySQL version 10.5.13-MariaDB-1:10.5.13+maria~bionic
    [OK] Operating on 64-bit architecture

    -------- Log file Recommendations ------------------------------------------------------------------
    [--] Log file: (0B)
    [!!] Log file doesn't exist
    [!!] Log file isn't readable.

    -------- Storage Engine Statistics -----------------------------------------------------------------
    [--] Data in MyISAM tables: 53G (Tables: 586)
    [--] Data in InnoDB tables: 8G (Tables: 61)
    [OK] Total fragmented tables: 0

    -------- Security Recommendations ------------------------------------------------------------------
    [OK] There are no anonymous accounts for any database users
    [!!] User 'mariadb.sys@localhost' has no password set.
    [!!] User 'admin@%' hasn't specific host restriction.
    [--] There are 612 basic passwords in the list.

    -------- CVE Security Recommendations --------------------------------------------------------------

    -------- Performance Metrics -----------------------------------------------------------------------
    [--] Up for: 17d 2h 55m 12s (5B q [3K qps], 1M conn, TX: 4370G, RX: 1173G)
    [--] Reads / Writes: 98% / 2%
    [--] Binary logging is disabled
    [--] Physical Memory : 124.4G
    [--] Max MySQL memory : 16.8G
    [--] Other process memory: 12.0G
    [--] Total buffers: 16.3G global + 3.7M per thread (151 max threads)
    [--] P_S Max memory usage: 0B
    [--] Galera GCache Max memory usage: 0B
    [OK] Maximum reached memory usage: 16.5G (13.23% of installed RAM)
    [OK] Maximum possible memory usage: 16.8G (13.54% of installed RAM)
    [OK] Overall possible memory usage with other process is compatible with memory available
    [OK] Slow queries: 0% (171/5B)
    [OK] Highest usage of available connections: 27% (42/151)
    [OK] Aborted connections: 0.09% (1174/1257762)
    [!!] name resolution is active : a reverse name resolution is made for each new connection and can reduce performance
    [!!] Query cache may be disabled by default due to mutex contention.
    [OK] Query cache efficiency: 31.6% (1B cached / 4B selects)
    [!!] Query cache prunes per day: 18570996
    [OK] Sorts requiring temporary tables: 0% (12 temp sorts / 60M sorts)
    [!!] Joins performed without indexes: 96248
    [!!] Temporary tables created on disk: 31% (3M on disk / 9M total)
    [OK] Thread cache hit rate: 99% (1K created / 1M connections)
    [OK] Table cache hit rate: 25% (1K open / 4K opened)
    [OK] Open file limit used: 5% (1K/32K)
    [OK] Table locks acquired immediately: 99% (765M immediate / 766M locks)

    -------- Performance schema ------------------------------------------------------------------------
    [--] Performance schema is disabled.
    [--] Memory used by P_S: 0B
    [--] Sys schema isn't installed.

    -------- ThreadPool Metrics ------------------------------------------------------------------------
    [--] ThreadPool stat is enabled.
    [--] Thread Pool Size: 32 thread(s).
    [--] Using default value is good enough for your version (10.5.13-MariaDB-1:10.5.13+maria~bionic)

    -------- MyISAM Metrics ----------------------------------------------------------------------------
    [OK] Key buffer used: 100.0% (134M used / 134M cache)
    [OK] Key buffer size / total MyISAM indexes: 128.0M/15.7G
    [OK] Read Key buffer hit rate: 96.8% (20B cached / 648M reads)
    [OK] Write Key buffer hit rate: 98.5% (368M cached / 363M writes)

    -------- InnoDB Metrics ----------------------------------------------------------------------------
    [--] InnoDB is enabled.
    [--] InnoDB Thread Concurrency: 0
    [OK] InnoDB File per table is activated
    [OK] InnoDB buffer pool / data size: 16.0G/8.5G
    [!!] Ratio InnoDB log file size / InnoDB Buffer pool size (6.25 %): 1.0G * 1/16.0G should be equal 25%
    [!!] InnoDB buffer pool instances: 1
    [--] Number of InnoDB Buffer Pool Chunk : 16 for 1 Buffer Pool Instance(s)
    [OK] Innodb_buffer_pool_size aligned with Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances
    [OK] InnoDB Read buffer efficiency: 100.00% (577364940319 hits/ 577365358867 total)
    [!!] InnoDB Write Log efficiency: 64.94% (744310 hits/ 1146064 total)
    [OK] InnoDB log waits: 0.00% (0 waits / 401754 writes)

    -------- AriaDB Metrics ----------------------------------------------------------------------------
    [--] AriaDB is enabled.
    [OK] Aria pagecache size / total Aria indexes: 128.0M/328.0K
    [OK] Aria pagecache hit rate: 99.7% (95M cached / 320K reads)

    -------- TokuDB Metrics ----------------------------------------------------------------------------
    [--] TokuDB is disabled.

    -------- XtraDB Metrics ----------------------------------------------------------------------------
    [--] XtraDB is disabled.

    -------- RocksDB Metrics ---------------------------------------------------------------------------
    [--] RocksDB is disabled.

    -------- Spider Metrics ----------------------------------------------------------------------------
    [--] Spider is disabled.

    -------- Connect Metrics ---------------------------------------------------------------------------
    [--] Connect is disabled.

    -------- Galera Metrics ----------------------------------------------------------------------------
    [--] Galera is disabled.

    -------- Replication Metrics -----------------------------------------------------------------------
    [--] Galera Synchronous replication: NO
    [--] No replication slave(s) for this server.
    [--] This is a standalone server.

    -------- Recommendations ---------------------------------------------------------------------------
    General recommendations:
    Set up a Password for user with the following SQL statement ( SET PASSWORD FOR 'user'@'SpecificDNSorIp' = PASSWORD('secure_password'); )
    Restrict Host for user@% to user@SpecificDNSorIp
    Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
    Adjust your join queries to always utilize indexes
    When making adjustments, make tmp_table_size/max_heap_table_size equal
    Reduce your SELECT DISTINCT queries which have no LIMIT clause
    Performance should be activated for better diagnostics
    Consider installing Sys schema from
    Variables to adjust:
    query_cache_size (=0)
    query_cache_type (=0)
    query_cache_size (> 20M)
    join_buffer_size (> 1.0M, or always use indexes with joins)
    tmp_table_size (> 16M)
    max_heap_table_size (> 16M)
    performance_schema = ON enable PFS
    innodb_log_file_size * innodb_log_files_in_group should be equal to 1/4 of buffer pool size (=4G) if possible.

    Any help is really appreaciated.

    • Once you have twice as much RAM as the dataset size, adding more RAM will not help performance. Most of the 128GB is unused now.
    • A slow query can, in many cases, be sped up by having a better index or a better formulation. We need to look at such a query.
    • MyISAM is, in most cases, slower than InnoDB. So switch Engines.
    • Opening 4K tables in 17 days is rather trivial; I would no worry about that metric.
    • HDD or SSD? I ask because 3K qps is rather high. We may need to look at ways to cut back on the number of queries and/or combine queries, possibly into transactions.
    • Next steps:

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2