I'm trying to tweak my MySQL config on my Magento 1.9 install, without Full Page Cache installed on the server it run's really slow and I'm pretty sure its something to do with the MySQL Config.
Could you take a look at my my.cnf
file and share some recommendations - I've run mysqltuner.pl
and I'll share this information too:
File: my.cnf
[client]
port=3306
socket=/var/run/mysqld/mysqld.sock
[mysqld_safe]
socket=/var/run/mysqld/mysqld.sock
[mysqld]
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
log_error=/var/log/mysql/error.log
symbolic-links=0
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 256M
table_open_cache = 1024
sort_buffer_size = 8M
read_buffer_size = 8M
read_rnd_buffer_size = 16M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 16M
innodb_buffer_pool_size = 7G
#innodb_use_native_aio = 0
innodb_file_per_table
max_connections=200
max_user_connections=100
wait_timeout=1800
connect_timeout=120
interactive_timeout=50
long_query_time=5
!includedir /etc/mysql/conf.d/
The mysqltuner report:
-------- Log file Recommendations ------------------------------------------------------------------
[--] Log file: /var/log/mysql/error.log(24K)
[OK] Log file /var/log/mysql/error.log exists
[OK] Log file /var/log/mysql/error.log is readable.
[OK] Log file /var/log/mysql/error.log is not empty
[OK] Log file /var/log/mysql/error.log is smaller than 32 Mb
[!!] /var/log/mysql/error.log contains 21 warning(s).
[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: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MEMORY +MRG_MYISAM +MyISAM +PERFORMANCE_SCHEMA
[--] Data in MyISAM tables: 10M (Tables: 14)
[--] Data in InnoDB tables: 7G (Tables: 733)
[--] Data in MEMORY tables: 3M (Tables: 34)
[!!] Total fragmented tables: 3
-------- Security Recommendations ------------------------------------------------------------------
[OK] There are no anonymous accounts for any database users
[OK] All database users have passwords assigned
[!!] User 'db_db@%' hasn't specific host restriction.
[!!] User 'db_db@%' hasn't specific host restriction.
[--] There are 612 basic passwords in the list.
-------- CVE Security Recommendations --------------------------------------------------------------
[OK] NO SECURITY CVE FOUND FOR YOUR VERSION
-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 4d 0h 33m 27s (275M q [793.345 qps], 528K conn, TX: 247G, RX: 112G)
[--] Reads / Writes: 99% / 1%
[--] Binary logging is disabled
[--] Physical Memory : 11.7G
[--] Max MySQL memory : 13.6G
[--] Other process memory: 326.1M
[--] Total buffers: 7.3G global + 32.5M per thread (200 max threads)
[--] P_S Max memory usage: 72B
[--] Galera GCache Max memory usage: 0B
[!!] Maximum reached memory usage: 10.5G (89.78% of installed RAM)
[!!] Maximum possible memory usage: 13.6G (116.29% of installed RAM)
[!!] Overall possible memory usage with other process exceeded memory
[OK] Slow queries: 0% (0/275M)
[OK] Highest usage of available connections: 51% (102/200)
[OK] Aborted connections: 2.80% (14817/528902)
[!!] 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 / 271M selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (476 temp sorts / 48M sorts)
[!!] Joins performed without indexes: 3032285
[!!] Temporary tables created on disk: 54% (20M on disk / 36M total)
[OK] Thread cache hit rate: 98% (7K created / 528K connections)
[!!] Table cache hit rate: 0% (400 open / 53M opened)
[OK] Open file limit used: 0% (0/1K)
[OK] Table locks acquired immediately: 99% (3M immediate / 3M locks)
-------- Performance schema ------------------------------------------------------------------------
[--] Memory used by P_S: 72B
[--] Sys schema is installed.
-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is disabled.
-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 18.2% (48M used / 268M cache)
[OK] Key buffer size / total MyISAM indexes: 256.0M/5.7M
[OK] Read Key buffer hit rate: 96.1% (17M cached / 667K reads)
[!!] Write Key buffer hit rate: 59.5% (722K cached / 430K writes)
-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[!!] InnoDB buffer pool / data size: 7.0G/7.4G
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (1.33928571428571 %): 48.0M * 2/7.0G should be equal 25%
[!!] InnoDB buffer pool instances: 8
[--] Number of InnoDB Buffer Pool Chunk : 56 for 8 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% (166321305029 hits/ 166321346229 total)
[!!] InnoDB Write Log efficiency: 86.55% (4331380 hits/ 5004636 total)
[OK] InnoDB log waits: 0.00% (0 waits / 673256 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:
Control warning line(s) into /var/log/mysql/error.log file
Run OPTIMIZE TABLE to defragment tables for better performance
OPTIMIZE TABLE `db_db.log_visitor`; -- can free 66 MB
OPTIMIZE TABLE `db_db.log_visitor_info`; -- can free 101 MB
OPTIMIZE TABLE `db_db.report_event`; -- can free 55 MB
Total freed space after theses OPTIMIZE TABLE : 222 Mb
Restrict Host for user@% to user@SpecificDNSorIp
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
Increase table_open_cache gradually to avoid file descriptor limits
Read this before increasing table_open_cache over 64: http://bit.ly/1mi7c4C
Beware that open_files_limit (1024) variable
should be greater than table_open_cache (407)
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 (> 1M, or use smaller result sets)
join_buffer_size (> 256.0K, or always use indexes with joins)
tmp_table_size (> 16M)
max_heap_table_size (> 16M)
table_open_cache (> 407)
innodb_buffer_pool_size (>= 7G) if possible.
innodb_log_file_size * innodb_log_files_in_group should be equal to 1/4 of buffer pool size (=3G) if possible.
innodb_buffer_pool_instances(=7)
Server Spec
12 CPU's 12GB Ram