Hi,
I need advice from experts here with mysql/mariadb optimization that I just did.
This is my.cnf
##############
And this is from mysqltuner
What is your suggestion for the best performance that I should add to my.cnf?
I need advice from experts here with mysql/mariadb optimization that I just did.
This is my.cnf
HTML:
[mysqld]
performance_schema = on
datadir = /var/lib/mysql
socket = /var/lib/mysql/mysql.sock
symbolic-links = 0
log-error = /var/log/mysqld.log
max_allowed_packet = 268435456
open_files_limit = 1000576
skip-external-locking
# Innodb Setting
default_storage_engine = InnoDB
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = O_DIRECT
innodb_stats_on_metadata = 0
innodb_buffer_pool_size = 40G
innodb_log_file_size = 5G
innodb_buffer_pool_instances = 45
max_connections = 250
wait_timeout = 60
query_cache_size = 0
query_cache_type = 0
query_cache_limit = 1M
tmp_table_size = 128M
max_heap_table_size = 128M
table_open_cache = 60000
table_definition_cache = 1000006
####Disable Strick Mode ####
sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER
## Slow Query ###
slow_query_log= 1
slow_query_log_file = /var/log/mysql-slow.log
long_query_time= 10
[mysqldump]
quick
max_allowed_packet = 1024M
And this is from mysqltuner
Code:
-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 42s (15K q [373.667 qps], 421 conn, TX: 136M, RX: 2M)
[--] Reads / Writes: 94% / 6%
[--] Binary logging is disabled
[--] Physical Memory : 125.7G
[--] Max MySQL memory : 108.7G
[--] Other process memory: 0B
[--] Total buffers: 45.4G global + 258.9M per thread (250 max threads)
[--] P_S Max memory usage: 121M
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 50.8G (40.42% of installed RAM)
[!!] Maximum possible memory usage: 108.7G (86.48% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 0% (0/15K)
[OK] Highest usage of available connections: 8% (21/250)
[OK] Aborted connections: 0.24% (1/421)
[!!] name resolution is active : a reverse name resolution is made for each new connection and can reduce performance
[OK] Query cache is disabled by default due to mutex contention on multiprocessor machines.
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 3K sorts)
[!!] Joins performed without indexes: 4
[!!] Temporary tables created on disk: 72% (1K on disk / 1K total)
[OK] Thread cache hit rate: 95% (21 created / 421 connections)
[OK] Table cache hit rate: 99% (635 open / 641 opened)
[OK] table_definition_cache(1000006) is upper than number of tables(112329)
[OK] Open file limit used: 0% (625/1M)
[OK] Table locks acquired immediately: 100% (9K immediate / 9K locks)
-------- Performance schema ------------------------------------------------------------------------
[--] Memory used by P_S: 122.0M
[--] Sys schema is installed.
-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is enabled.
[--] Thread Pool Size: 32 thread(s).
[--] Using default value is good enough for your version (10.3.23-MariaDB-log-cll-lve)
-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 23.3% (31M used / 134M cache)
[OK] Key buffer size / total MyISAM indexes: 128.0M/1.8G
[OK] Read Key buffer hit rate: 98.5% (432K cached / 6K reads)
[OK] Write Key buffer hit rate: 98.9% (1K cached / 1K writes)
-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[OK] InnoDB buffer pool / data size: 45.0G/40.9G
[OK] Ratio InnoDB log file size / InnoDB Buffer pool size: 5.0G * 2/45.0G should be equal to 25%
[OK] InnoDB buffer pool instances: 45
[--] Number of InnoDB Buffer Pool Chunk : 360 for 45 Buffer Pool Instance(s)
[OK] Innodb_buffer_pool_size aligned with Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances
[!!] InnoDB Read buffer efficiency: 85.39% (726770 hits/ 851131 total)
[!!] InnoDB Write Log efficiency: 84.27% (1929 hits/ 2289 total)
[OK] InnoDB log waits: 0.00% (0 waits / 360 writes)
PHP:
Reduce your overall MySQL memory footprint for system stability
Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
We will suggest raising the 'join_buffer_size' until JOINs not using indexes are found.
See https://dev.mysql.com/doc/internals/en/join-buffer-size.html
(specially the conclusions at the bottom of the page).
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries which have no LIMIT clause
Variables to adjust:
join_buffer_size (> 256.0K, or always use indexes with JOINs)
tmp_table_size (> 128M)
max_heap_table_size (> 128M)
What is your suggestion for the best performance that I should add to my.cnf?