I have a game server, MySQL is at 100-200% CPU constantly, i've tried to optimize query-cache-size but didn't help. I have some "big" tables i guess with over a million record. I have another table with 150k record, and im suspecting that because its being written and read many times during a minute. I've ran MySQLTuner, here is the results:
[--] Skipped version check for MySQLTuner script
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password: [!!] Your MySQL version 5.5.62 is EOL software! Upgrade soon!
[OK] Operating on 64-bit architecture
-------- Log file Recommendations ------------------------------------------------------------------
[!!] Log file ./srv.err doesn't exist
-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +CSV +InnoDB +MEMORY +MRG_MYISAM +MyISAM +PERFORMANCE_SCHEMA
[--] Data in MyISAM tables: 1.5G (Tables: 130)
[!!] InnoDB is enabled but isn't being used
[OK] Total fragmented tables: 0
-------- Analysis Performance Metrics --------------------------------------------------------------
[--] innodb_stats_on_metadata: ON
[!!] Stat are updated during querying INFORMATION_SCHEMA.
-------- Security Recommendations ------------------------------------------------------------------
[OK] There are no anonymous accounts for any database users
[OK] All database users have passwords assigned
[!!] User 'root@%' does not specify hostname restrictions.
[!!] There is no basic password file list!
-------- CVE Security Recommendations --------------------------------------------------------------
[--] Skipped due to --cvefile option undefined
-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 90d 23h 30m 41s (639M q [81.385 qps], 955K conn, TX: 102G, RX: 90G)
[--] Reads / Writes: 3% / 97%
[--] Binary logging is disabled
[--] Physical Memory : 12.0G
[--] Max MySQL memory : 583.2M
[--] Other process memory: 0B
[--] Total buffers: 168.0M global + 2.8M per thread (151 max threads)
[--] P_S Max memory usage: 0B
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 349.5M (2.86% of installed RAM)
[OK] Maximum possible memory usage: 583.2M (4.77% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 0% (107/639M)
[OK] Highest usage of available connections: 43% (66/151)
[OK] Aborted connections: 0.55% (5273/955610)
[!!] 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 / 25M selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (456 temp sorts / 3M sorts)
[OK] No joins without indexes
[!!] Temporary tables created on disk: 35% (2K on disk / 6K total)
[!!] Thread cache is disabled
[OK] Table cache hit rate: 96% (236 open / 245 opened)
[OK] table_definition_cache(400) is upper than number of tables(211)
[OK] Open file limit used: 0% (359/352K)
[OK] Table locks acquired immediately: 99% (632M immediate / 633M locks)
-------- Performance schema ------------------------------------------------------------------------
[--] Performance schema is disabled.
[--] Memory used by P_S: 0B
[--] Sys schema isn't installed.
-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is disabled.
-------- MyISAM Metrics ----------------------------------------------------------------------------
[OK] Key buffer used: 100.0% (8M used / 8M cache)
[OK] Key buffer size / total MyISAM indexes: 8.0M/379.3M
[OK] Read Key buffer hit rate: 99.6% (3B cached / 15M reads)
[!!] Write Key buffer hit rate: 86.2% (77M cached / 66M writes)
-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is disabled.
[!!] InnoDB Storage engine is disabled. InnoDB is the default storage engine
-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is disabled.
-------- 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: STATEMENT
[--] XA support enabled: ON
[--] Semi synchronous replication Master: Not Activated
[--] Semi synchronous replication Slave: Not Activated
[--] This is a standalone server
-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
Add skip-innodb to MySQL configuration to disable InnoDB
Restrict Host for 'root'@% to root@SpecificDNSorIp
UPDATE mysql.user SET host ='SpecificDNSorIp' WHERE user='root' AND host ='%'; FLUSH PRIVILEGES;
Enable the slow query log to troubleshoot bad queries
Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries which have no LIMIT clause
Set thread_cache_size to 4 as a starting value
Variables to adjust:
SET innodb_stats_on_metadata = OFF
query_cache_size (=0)
query_cache_type (=0)
query_cache_limit (> 1M, or use smaller result sets)
tmp_table_size (> 16M)
max_heap_table_size (> 16M)
thread_cache_size (start at 4)
What do you think? What should i do? Dedicated server with Intel Xeon 5570 + 12G RAM + 2x750GB HDD in RAID1
Thanks in advance.