Performance optimization for my.cnf

Nirjonadda

Well-known member
Currently installed: MySQL 5.6 but I am thinking Upgrade to MariaDB 10.2. Please can you let me know that what are recommended for site speed? About Site performance .... ? How to fixing Recommendations and my.cnf Performance optimization ? We have 10 CPUs with 50 GB RAM Memory.

This my current my.cnf the following configuration with MySQL 5.6.37

Code:
[mysqld]
local-infile=0
bind-address=127.0.0.1
innodb_file_per_table=1
default-storage-engine=InnoDB
performance-schema=1
max_allowed_packet=256M
max_connections=5000
max_user_connections=1000
wait_timeout=2000
connect_timeout=5000
lock_wait_timeout=31536000
innodb_lock_wait_timeout=1000
interactive_timeout=2000

# Query Cache Configuration
query_cache_limit=256M
query_cache_size=1024M
tmp_table_size=4G
max_heap_table_size=128M
max_tmp_tables=300
join_buffer_size = 8M

key_buffer_size = 16G

innodb_file_per_table = ON
innodb-buffer-pool-instances = 16
innodb_buffer_pool_size = 12G
innodb-log-buffer-size  = 16M
innodb-log-file-size = 256M
innodb_additional_mem_pool_size = 16M

# Fine Tuning
key_buffer=32M
thread_stack=192K
thread_cache_size=50
thread_concurrency = 16
binlog_cache_size = 2M
read_rnd_buffer_size = 32M
sort_buffer_size = 16M
myisam_sort_buffer_size=64M
table_open_cache=28560
open_files_limit=50000

# Basic Settings
expire-logs-days = 7
log-error=/var/log/mysqld.log
#log-queries-not-using-indexes = 1
#long-query-time  = 20
#max-binlog-size  = 100M
#slow-query-log = 0
#slow-query-log-file = /var/log/mysqlslowqueries.log

I am doing using MySQLTuner-perl. How to fixing Recommendations and Performance optimization ?

Code:
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.6.37
[OK] Operating on 64-bit architecture

-------- Log file Recommendations ------------------------------------------------------------------
[--] Log file: /var/log/mysqld.log(0B)
[OK] Log file /var/log/mysqld.log exists
[OK] Log file /var/log/mysqld.log is readable.
[!!] Log file /var/log/mysqld.log is empty
[OK] Log file /var/log/mysqld.log is smaller than 32 Mb
[OK] /var/log/mysqld.log doesn't contain any warning.
[OK] /var/log/mysqld.log doesn't contain any error.
[--] 0 start(s) detected in /var/log/mysqld.log
[--] 0 shutdown(s) detected in /var/log/mysqld.log

-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MEMORY +MRG_MYISAM +MyISAM +PERFORMANCE_SCHEMA
[--] Data in MyISAM tables: 126M (Tables: 13)
[--] Data in InnoDB tables: 8G (Tables: 366)
[--] Data in MEMORY tables: 1M (Tables: 5)
[OK] Total fragmented tables: 0

-------- Security Recommendations ------------------------------------------------------------------
[OK] There are no anonymous accounts for any database users
[OK] All database users have passwords assigned
[--] There are 612 basic passwords in the list.

-------- CVE Security Recommendations --------------------------------------------------------------
[OK] NO SECURITY CVE FOUND FOR YOUR VERSION

-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 30m 4s (98K q [54.731 qps], 8K conn, TX: 1G, RX: 70M)
[--] Reads / Writes: 76% / 24%
[--] Binary logging is disabled
[--] Physical Memory     : 49.0G
[--] Max MySQL memory    : 289.7G
[--] Other process memory: 29.2G
[--] Total buffers: 13.2G global + 56.3M per thread (5000 max threads)
[--] P_S Max memory usage: 1G
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 17.0G (34.79% of installed RAM)
[!!] Maximum possible memory usage: 289.7G (591.59% of installed RAM)
[!!] Overall possible memory usage with other process exceeded memory
[OK] Slow queries: 0% (85/98K)
[OK] Highest usage of available connections: 0% (41/5000)
[OK] Aborted connections: 0.00%  (0/8115)
[!!] 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.
[!!] Query cache efficiency: 0.0% (0 cached / 51K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 9K sorts)
[!!] Joins performed without indexes: 3037
[!!] Temporary tables created on disk: 35% (2K on disk / 7K total)
[OK] Thread cache hit rate: 99% (41 created / 8K connections)
[OK] Table cache hit rate: 36% (552 open / 1K opened)
[OK] Open file limit used: 0% (22/50K)
[OK] Table locks acquired immediately: 99% (126K immediate / 126K locks)

-------- Performance schema ------------------------------------------------------------------------
[--] Memory used by P_S: 1.6G
[--] Sys schema isn't installed.

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

-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 18.3% (6M used / 33M cache)
[!!] Key buffer size / total MyISAM indexes: 32.0M/39.8M
[!!] Read Key buffer hit rate: 50.3% (6K cached / 3K reads)
[!!] Write Key buffer hit rate: 0.0% (1K cached / 0 writes)

-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[OK] InnoDB buffer pool / data size: 12.0G/8.7G
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (4.16666666666667 %): 256.0M * 2/12.0G should be equal 25%
[!!] InnoDB buffer pool instances: 16
[--] InnoDB Buffer Pool Chunk Size not used or defined in your version
[OK] InnoDB Read buffer efficiency: 99.93% (367075940 hits/ 367345970 total)
[OK] InnoDB Write log efficiency: 99.94% (20770404 hits/ 20782009 total)
[OK] InnoDB log waits: 0.00% (0 waits / 11605 writes)

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

-------- 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:
    MySQL started within last 24 hours - recommendations may be inaccurate
    Reduce your overall MySQL memory footprint for system stability
    Dedicate this server to your database for highest performance.
    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
    Consider installing Sys schema from https://github.com/mysql/mysql-sys
Variables to adjust:
  *** MySQL's maximum memory usage is dangerously high ***
  *** Add RAM before increasing MySQL buffer variables ***
    query_cache_size (=0)
    query_cache_type (=0)
    query_cache_limit (> 256M, or use smaller result sets)
    join_buffer_size (> 8.0M, or always use indexes with joins)
    tmp_table_size (> 4G)
    max_heap_table_size (> 128M)
    key_buffer_size (> 39.8M)
    innodb_log_file_size should be (=1G) if possible, so InnoDB total log files size equals to 25% of buffer pool size.
    innodb_buffer_pool_instances(=12)
 
Top Bottom