0

I've been having some trouble regarding my MariaDB 10.4 setup for a while now, looking for some help if possible.

mysqltuner.pl

[--] Skipped version check for MySQLTuner script
[OK] Logged in using credentials passed on the command line
[OK] Currently running supported MySQL version 10.4.13-MariaDB-1:10.4.13+maria~b                                                                                                                  ionic-log
[OK] Operating on 64-bit architecture

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

-------- Storage Engine Statistics ---------------------------------------------                                                                                                                  --------------------
[--] Status: +Aria +CSV +InnoDB +MEMORY +MRG_MyISAM +MyISAM +PERFORMANCE_SCHEMA                                                                                                                   +SEQUENCE
[--] Data in InnoDB tables: 82.9G (Tables: 838)
[--] Data in MyISAM tables: 226.4M (Tables: 49)
[--] Data in Aria tables: 2.0G (Tables: 1)
[OK] Total fragmented tables: 0

-------- Analysis Performance Metrics ------------------------------------------                                                                                                                  --------------------
[--] innodb_stats_on_metadata: OFF
[OK] No stat updates during querying INFORMATION_SCHEMA.

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

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

-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 4d 9h 38m 16s (23M q [61.340 qps], 2M conn, TX: 155G, RX: 37G)
[--] Reads / Writes: 40% / 60%
[--] Binary logging is enabled (GTID MODE: OFF)
[--] Physical Memory     : 62.7G
[--] Max MySQL memory    : 4085.0G
[--] Other process memory: 0B
[--] Total buffers: 54.3G global + 1.0G per thread (4000 max threads)
[--] P_S Max memory usage: 1G
[--] Galera GCache Max memory usage: 0B
[!!] Maximum reached memory usage: 4086.1G (6516.52% of installed RAM)
[!!] Maximum possible memory usage: 4085.0G (6514.91% of installed RAM)
[!!] Overall possible memory usage with other process exceeded memory
[!!] Slow queries: 16% (3M/23M)
[!!] Highest connection usage: 100%  (4001/4000)
[OK] Aborted connections: 0.60%  (12902/2165797)
[OK] Query cache is disabled by default due to mutex contention on multiprocessor machines.
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 155K sorts)
[!!] Joins performed without indexes: 150667
[OK] Temporary tables created on disk: 5% (18K on disk / 353K total)
[OK] Thread cache hit rate: 98% (40K created / 2M connections)
[!!] Table cache hit rate: 4% (549 open / 11K opened)
[!!] table_definition_cache(970) is lower than number of tables(1049)
[OK] Open file limit used: 0% (69/16K)
[OK] Table locks acquired immediately: 99% (3M immediate / 3M locks)
[OK] Binlog cache memory access: 99.61% (6883564 Memory / 6910302 Total)

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

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

-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 19.4% (26M used / 134M cache)
[OK] Key buffer size / total MyISAM indexes: 128.0M/37.5M
[OK] Read Key buffer hit rate: 99.9% (18M cached / 15K reads)
[OK] Write Key buffer hit rate: 99.4% (32K cached / 31K writes)

-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[!!] InnoDB buffer pool / data size: 52.0G/82.9G
[OK] Ratio InnoDB log file size / InnoDB Buffer pool size: 6.0G * 2/52.0G should be equal to 25%
[OK] InnoDB buffer pool instances: 52
[--] Number of InnoDB Buffer Pool Chunk : 416 for 52 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% (121838918627 hits/ 121840689951 total)
[OK] InnoDB Write log efficiency: 99.81% (284699018 hits/ 285239240 total)
[OK] InnoDB log waits: 0.00% (0 waits / 540222 writes)

-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is enabled.
[!!] Aria pagecache size / total Aria indexes: 128.0M/239.5M
[!!] Aria pagecache hit rate: 52.5% (290M cached / 138M reads)

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

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

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

-------- Replication Metrics -----------------------------------------------------------------------
[--] Galera Synchronous replication: NO
[--] No replication slave(s) for this server.
[--] Binlog format: MIXED
[--] XA support enabled: ON
[--] Semi synchronous replication Master: OFF
[--] Semi synchronous replication Slave: OFF
[--] This is a standalone server

-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
    Reduce your overall MySQL memory footprint for system stability
    Dedicate this server to your database for highest performance.
    Reduce or eliminate persistent connections to reduce connection usage
    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).
    Increase table_open_cache gradually to avoid file descriptor limits
    Read this before increasing table_open_cache over 64: https://bit.ly/2Fulv7r
    Read this before increasing for MariaDB https://mariadb.com/kb/en/library/optimizing-table_open_cache/
    This is MyISAM only table_cache scalability problem, InnoDB not affected.
    See more details here: https://bugs.mysql.com/bug.php?id=49177
    This bug already fixed in MySQL 5.7.9 and newer MySQL versions.
    Beware that open_files_limit (16364) variable
    should be greater than table_open_cache (4096)
    Consider installing Sys schema from https://github.com/mysql/mysql-sys for MySQL
    Consider installing Sys schema from https://github.com/FromDual/mariadb-sys for MariaDB
Variables to adjust:
  *** MySQL's maximum memory usage is dangerously high ***
  *** Add RAM before increasing MySQL buffer variables ***
    max_connections (> 4000)
    wait_timeout (< 86400)
    interactive_timeout (< 86400)
    join_buffer_size (> 256.0K, or always use indexes with JOINs)
    table_open_cache (> 4096)
    table_definition_cache(970) > 1049 or -1 (autosizing if supported)
    innodb_buffer_pool_size (>= 82.9G) if possible.
    aria_pagecache_buffer_size (> 239.5M)

my.cnf

# MariaDB database server configuration file.
#
# You can copy this file to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# 
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port        = 3306
socket      = /var/run/mysqld/mysqld.sock

#default-character-set = utf8mb4


# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket      = /var/run/mysqld/mysqld.sock
nice        = 0

[mysqld]
#
# * Basic Settings
#
user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port        = 3306
basedir     = /usr
datadir     = /var/lib/mysql
tmpdir      = /tmp
lc_messages_dir = /usr/share/mysql
lc_messages = en_US
skip-external-locking

character-set-client-handshake = FALSE
character-set-server = utf8mb4


#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address        = 0.0.0.0
#
# * Fine Tuning
#
max_connect_errors = 1000000
max_connections     = 8000
#connect_timeout        = 60
#wait_timeout       = 1200
max_allowed_packet  = 4G
thread_cache_size       = 1024
sort_buffer_size    = 4M
bulk_insert_buffer_size = 16M
tmp_table_size      = 32M
max_heap_table_size = 32M

skip-name-resolve   =   1
open_files_limit = 7000

connect_timeout = 30
net_read_timeout = 86400
net_write_timeout = 86400
interactive_timeout = 86400
wait_timeout = 86400
performance_schema = ON
table_definition_cache = 1049

#
# * MyISAM
#
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched. On error, make copy and try a repair.
myisam_recover_options = BACKUP
key_buffer_size     = 128M
#open-files-limit   = 2000
table_open_cache    = 4096
myisam_sort_buffer_size = 512M
concurrent_insert   = 2
read_buffer_size    = 2M
read_rnd_buffer_size    = 1M
#
# * Query Cache Configuration
#
# Cache only tiny result sets, so we can fit more in the query cache.
#query_cache_limit      = 3M
query_cache_size        = 0
# for more write intensive setups, set to DEMAND or OFF
#query_cache_type       = DEMAND
#
# * Logging and Replication
#

log_error                      = /var/log/mysql/mysql-error.log
log_queries_not_using_indexes  = 1
#slow_query_log                 = 1
#slow_query_log_file            = /var/log/mysql-slow.log


log_error=/var/log/mysql/error.log
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
#
# we do want to know about network errors and such
log_warnings        = 2
#
# Enable the slow query log to see queries with especially long duration
slow_query_log = 1
slow_query_log_file = /var/log/mysql/mariadb-slow.log
long_query_time = 10
#log_slow_rate_limit    = 1000
log_slow_verbosity  = query_plan

#log-queries-not-using-indexes
#log_slow_admin_statements
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id      = 1
#report_host        = master1
#auto_increment_increment = 2
#auto_increment_offset  = 1
log_bin         = /var/log/mysql/mariadb-bin
log_bin_index       = /var/log/mysql/mariadb-bin.index
# not fab for performance, but safer
#sync_binlog        = 1
expire_logs_days    = 10
max_binlog_size         = 100M
# slaves
#relay_log      = /var/log/mysql/relay-bin
#relay_log_index    = /var/log/mysql/relay-bin.index
#relay_log_info_file    = /var/log/mysql/relay-bin.info
#log_slave_updates
#read_only
#
# If applications support it, this stricter sql_mode prevents some
# mistakes like inserting invalid dates etc.
#sql_mode       = NO_ENGINE_SUBSTITUTION,TRADITIONAL
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
default_storage_engine  = InnoDB
# you can't just change log file size, requires special procedure
innodb_log_file_size    = 6G
innodb_buffer_pool_size = 52G
innodb_log_buffer_size  = 2G
innodb_file_per_table   = 1
innodb_open_files   = 512
innodb_io_capacity  = 512
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit = 0

innodb_read_io_threads          = 64
innodb_write_io_threads         = 64

innodb_buffer_pool_instances = 52

#innodb_force_recovery = 2
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem

#
# * Galera-related settings
#

[mysqldump]
quick
quote-names
max_allowed_packet  = 32M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completion

#default-character-set = utf8mb4


[isamchk]
key_buffer      = 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
!include /etc/mysql/mariadb.cnf
!includedir /etc/mysql/conf.d/

Running Ubuntu 18.04 bionic with 64GB RAM. CPU: Intel Xeon E3-1275 v6 @ 8x 4.2GHz

  • 2
    What problem are you actually having? There is no question in your question. – Gordan Bobic Jun 25 at 8:01
  • Hi, apologies. I'm having frequent connection refused on the Database. – Mike Jun 25 at 13:29