auch auf die Gefahr hin, dass ich jetzt zum xten Mal die gleiche Frage stelle, aber irgendwie verstehe ich die (englischen) Erklärungen nicht/falsch.
OK, Hintergrund:
Ich habe einen KVM-Server mit CentOS 6.8 und der aktellen cPanel-Version 11.58. Die letzten Umstellungen waren das Update auf PHP 5.6 und MySQL auff MariaDB 10.0.27 - von der 10.1er Version wurde mir abgeraten - wäre noch nicht stabil.
Ich versuche seit Tagen/Wochen meine Kombination PHP 5.6 und MySQL zu optimieren, da der Server, sobald mehr als 5 - 10 User gleichzeitig auf einen Bildershop zugreifen, 4x 100% CPU-Last anzeigt.
Hardware:
4Core-KVM-CPU, 8 GB RAM, 300 GB HD.
Ein Tipp, den ich bekommen habe, war, dass ich die MY.CNF löschen/umbenennen soll, MySQL restart und nach 1 - 2 Tagen mysqltuner.pl laufen lasse. Die Variablenwerte habe ich dann in eine neue MY.CNF eingetragen.
OK, das hat in der Performance etwas gebracht. Aber was ich nicht verstehe, sind die Recommendations (außer MySQL started within the last 24 hours :-)
OK, hier die Ausgaben vom mysqltuner
Code: Select all
>> MySQLTuner 1.6.18 - Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
[[0;34m--[0m] Skipped version check for MySQLTuner script
[[0;31m!![0m] Currently running unsupported MySQL version 10.0.27-MariaDB
[[0;32mOK[0m] Operating on 64-bit architecture
-------- Storage Engine Statistics -----------------------------------------------------------------
[[0;34m--[0m] Status: [0;32m+ARCHIVE [0m[0;32m+Aria [0m[0;32m+BLACKHOLE [0m[0;32m+CSV [0m[0;32m+FEDERATED [0m[0;32m+InnoDB [0m[0;32m+MEMORY [0m[0;32m+MRG_MyISAM [0m[0;32m+MyISAM [0m[0;32m+PERFORMANCE_SCHEMA [0m
[[0;34m--[0m] Data in Aria tables: 1M (Tables: 2)
[[0;34m--[0m] Data in MyISAM tables: 764M (Tables: 249)
[[0;34m--[0m] Data in InnoDB tables: 949M (Tables: 1525)
[[0;34m--[0m] Data in MEMORY tables: 0B (Tables: 2)
[[0;32mOK[0m] Total fragmented tables: 0
-------- Security Recommendations ------------------------------------------------------------------
[[0;32mOK[0m] There are no anonymous accounts for any database users
[[0;32mOK[0m] All database users have passwords assigned
[[0;31m!![0m] User 'munin@localhost' has user name as password.
[[0;31m!![0m] There is no basic password file list!
-------- CVE Security Recommendations --------------------------------------------------------------
[[0;32mOK[0m] NO SECURITY CVE FOUND FOR YOUR VERSION
-------- Performance Metrics -----------------------------------------------------------------------
[[0;34m--[0m] Up for: 51m 19s (54K q [17.598 qps], 2K conn, TX: 415M, RX: 9M)
[[0;34m--[0m] Reads / Writes: 97% / 3%
[[0;34m--[0m] Binary logging is disabled
[[0;34m--[0m] Physical Memory : 7.7G
[[0;34m--[0m] Max MySQL memory : 2.0G
[[0;34m--[0m] Other process memory: 1.3G
[[0;34m--[0m] Total buffers: 1.4G global + 2.9M per thread (200 max threads)
[[0;34m--[0m] P_S Max memory usage: 0B
[[0;34m--[0m] Galera GCache Max memory usage: 0B
[[0;32mOK[0m] Maximum reached memory usage: 1.4G (18.34% of installed RAM)
[[0;32mOK[0m] Maximum possible memory usage: 2.0G (25.50% of installed RAM)
[[0;32mOK[0m] Overall possible memory usage with other process is compatible with memory available
[[0;32mOK[0m] Slow queries: 0% (0/54K)
[[0;32mOK[0m] Highest usage of available connections: 3% (6/200)
[[0;32mOK[0m] Aborted connections: 0.05% (1/2052)
[[0;32mOK[0m] Query cache is disabled by default due to mutex contention on multiprocessor machines.
[[0;32mOK[0m] Sorts requiring temporary tables: 0% (2 temp sorts / 4K sorts)
[[0;31m!![0m] Joins performed without indexes: 127
[[0;31m!![0m] Temporary tables created on disk: 32% (1K on disk / 5K total)
[[0;32mOK[0m] Thread cache hit rate: 99% (11 created / 2K connections)
[[0;31m!![0m] Table cache hit rate: 5% (1K open / 18K opened)
[[0;32mOK[0m] Open file limit used: 8% (363/4K)
[[0;32mOK[0m] Table locks acquired immediately: 100% (49K immediate / 49K locks)
-------- Performance schema ------------------------------------------------------------------------
[[0;34m--[0m] Performance schema is disabled.
-------- ThreadPool Metrics ------------------------------------------------------------------------
[[0;34m--[0m] ThreadPool stat is enabled.
[[0;34m--[0m] Thread Pool Size: 4 thread(s).
[[0;34m--[0m] Using default value is good enough for your version (10.0.27-MariaDB)
-------- MyISAM Metrics ----------------------------------------------------------------------------
[[0;31m!![0m] Key buffer used: 18.3% (51M used / 281M cache)
[[0;32mOK[0m] Key buffer size / total MyISAM indexes: 268.0M/267.0M
[[0;31m!![0m] Read Key buffer hit rate: 90.4% (5K cached / 551 reads)
[[0;31m!![0m] Write Key buffer hit rate: 1.5% (654 cached / 644 writes)
-------- AriaDB Metrics ----------------------------------------------------------------------------
[[0;34m--[0m] AriaDB is enabled.
[[0;32mOK[0m] Aria pagecache size / total Aria indexes: 128.0M/160.0K
[[0;32mOK[0m] Aria pagecache hit rate: 100.0% (833K cached / 414 reads)
-------- InnoDB Metrics ----------------------------------------------------------------------------
[[0;34m--[0m] InnoDB is enabled.
[[0;32mOK[0m] InnoDB buffer pool / data size: 950.0M/949.0M
[[0;32mOK[0m] InnoDB buffer pool instances: 1
[[0;34m--[0m] InnoDB Buffer Pool Chunk Size not used or defined in your version
[[0;32mOK[0m] InnoDB Read buffer efficiency: 99.99% (59649979 hits/ 59658036 total)
[[0;31m!![0m] InnoDB Write Log efficiency: 62.62% (2493 hits/ 3981 total)
[[0;32mOK[0m] InnoDB log waits: 0.00% (0 waits / 1488 writes)
-------- TokuDB Metrics ----------------------------------------------------------------------------
[[0;34m--[0m] TokuDB is disabled.
-------- Galera Metrics ----------------------------------------------------------------------------
[[0;34m--[0m] Galera is disabled.
-------- Replication Metrics -----------------------------------------------------------------------
[[0;34m--[0m] Galera Synchronous replication: NO
[[0;34m--[0m] No replication slave(s) for this server.
[[0;34m--[0m] This is a standalone server.
-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
Set up a Secure Password for user@host ( SET PASSWORD FOR 'user'@'SpecificDNSorIp' = PASSWORD('secure_password'); )
MySQL started within last 24 hours - recommendations may be inaccurate
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 (4096) variable
should be greater than table_open_cache ( 1000)
Variables to adjust:
join_buffer_size (> 256.0K, or always use indexes with joins)
tmp_table_size (> 64M)
max_heap_table_size (> 64M)
table_open_cache (> 1000)
Code: Select all
[mysqld]
bind-address = 127.0.0.1 # 15.09.2016
skip-name-resolve = 1 # 15.09.2016
max_connections = 200 # 200 16.09.2016
wait_timeout = 60 # 60 16.09.2016
interactive_timeout = 60 # 60 16.09.2016
innodb_file_per_table=1 # 16.09.2016
innodb_buffer_pool_size = 950M # 950M 15.09.2016
innodb_buffer_pool_instances = 1 # 1 15.09.2016
thread_cache_size = 4 # 15.09.2016
table_open_cache = 1000 # 400 15.09.2016 - 1000 16.09.2016
join_buffer_size = 256K # 128k 15.09.2016 - 256k 16.09.2016
query_cache_type = 0 # 0 15.09.2016
tmp_table_size = 64M # 16M 15.09.2016 - 64M 16.09.2016
max_heap_table_size = 64M # 16M 15.09.2016 - 64M 16.09.2016
key_buffer_size = 268M # 268M 15.09.2016
Viele Grüße
Thorsten