Page 1 of 1

MySQL Config Tuner Scripts

Posted: Mon Mar 20, 2017 2:05 pm
by skurudo


Code: Select all

wget --no-check-certificate

Code: Select all


Code: Select all

perl --user root --pass rootpassword
Performance Metrics and Recommendations your friends
Output exampleShow

Code: Select all

-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 44d 17h 59m 10s (2B q [573.704 qps], 9M conn, TX: 6971G, RX: 468G)
[--] Reads / Writes: 91% / 9%
[--] Binary logging is disabled
[--] Physical Memory     : 15.6G
[--] Max MySQL memory    : 9.0G
[--] Other process memory: 244.5M
[--] Total buffers: 608.0M global + 34.2M per thread (250 max threads)
[--] P_S Max memory usage: 0B
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 9.0G (57.74% of installed RAM)
[OK] Maximum possible memory usage: 9.0G (57.52% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 0% (17K/2B)
[!!] Highest connection usage: 100%  (251/250)
[!!] Aborted connections: 4.26%  (408724/9598439)
[!!] Query cache may be disabled by default due to mutex contention.
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 49M sorts)
[!!] Joins performed without indexes: 450259
[!!] Temporary tables created on disk: 28% (16M on disk / 58M total)
[OK] Thread cache hit rate: 99% (3K created / 9M connections)
[!!] Table cache hit rate: 10% (8K open / 74K opened)
[OK] Open file limit used: 2% (11K/500K)
[OK] Table locks acquired immediately: 99% (468M immediate / 468M locks)

-------- Performance schema ------------------------------------------------------------------------
[--] Performance schema is disabled.

-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is disabled.

-------- MyISAM Metrics ----------------------------------------------------------------------------
[OK] Key buffer used: 99.9% (33M used / 33M cache)
[OK] Key buffer size / total MyISAM indexes: 32.0M/717.9M
[OK] Read Key buffer hit rate: 100.0% (589B cached / 94M reads)
[OK] Write Key buffer hit rate: 99.6% (6B cached / 30M writes)

-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is disabled.

-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[OK] InnoDB buffer pool / data size: 512.0M/357.7M
[OK] InnoDB buffer pool instances: 1
[--] InnoDB Buffer Pool Chunk Size not used or defined in your version
[OK] InnoDB Read buffer efficiency: 100.00% (19723956887 hits/ 19724049028 total)
[!!] InnoDB Write Log efficiency: 59.76% (7444679 hits/ 12458378 total)
[OK] InnoDB log waits: 0.00% (0 waits / 5013699 writes)

-------- TokuDB Metrics ----------------------------------------------------------------------------
[--] TokuDB 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 Secure Password for user@host ( SET PASSWORD FOR 'user'@'SpecificDNSorIp' = PASSWORD('secure_password'); )
    Restrict Host for user@% to user@SpecificDNSorIp
    Enable the slow query log to troubleshoot bad queries
    Reduce or eliminate persistent connections to reduce connection usage
    Reduce or eliminate unclosed connections and network issues
    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
    Increase table_open_cache gradually to avoid file descriptor limits
    Read this before increasing table_open_cache over 64:
    Beware that open_files_limit (500000) variable
    should be greater than table_open_cache ( 8192)
Variables to adjust:
    max_connections (> 250)
    wait_timeout (< 25)
    interactive_timeout (< 50)
    query_cache_type (=0)
    join_buffer_size (> 16.0M, or always use indexes with joins)
    tmp_table_size (> 8M)
    max_heap_table_size (> 16M)
    table_open_cache (> 8192)
MySQL performance tuning prime


Code: Select all


Code: Select all

chmod +x
Output exampleShow

Code: Select all

Current MyISAM index space = 717 M acceptable normsem memoryay be safeo complete
Current key_buffer_size = 32 M
Key cache miss rate is 1 : 6207
Key buffer free ratio = 0 %
You could increase key_buffer_size
It is safe to raise this up to 1/4 of total system memory;
assuming this is a dedicated database server.

Query cache is enabled
Current query_cache_size = 16 M
Current query_cache_used = 12 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 79.86 %
Current query_cache_min_res_unit = 4 K
MySQL won't cache query results that are larger than query_cache_limit in size

Current sort_buffer_size = 16 M
Current read_rnd_buffer_size = 1 M
Sort buffer seems to be fine

Current join_buffer_size = 16.00 M
You have had 450256 queries where a join could not use an index properly
join_buffer_size >= 4 M
This is not advised
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.

Current open_files_limit = 500000 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine

Current table_open_cache = 8192 tables
Current table_definition_cache = 8192 tables
You have a total of 6164 tables
You have 8192 open tables.
Current table_cache hit rate is 10%
, while 100% of your table cache is in use
You should probably increase your table_cache

Current max_heap_table_size = 16 M
Current tmp_table_size = 8 M
Of 58531429 temp tables, 22% were created on disk
Created disk tmp tables ratio seems fine

Current read_buffer_size = 1 M
Current table scan ratio = 455 : 1
read_buffer_size seems to be fine

Current Lock Wait ratio = 1 : 8445
Your table locking seems to be fine

PS: Remember, it's not a panacea, but only the start. No need to blindly follow the recommendations, try and check.