mysql性能调整与mysqltuner.pl的结果

时间:2014-08-13 12:41:49

标签: mysql mysqltuner

我正在使用带1.5GB RAM的VPS和3GB的突发RAM。 VPS正在托管多个Joomla网站。我想性能调整mysql。出于此目的,我在我的服务器中运行mysqltuner,结果如下。请指导为我的VPS创建最好的my.cnf文件。

    >>  MySQLTuner 1.3.0 - Major Hayden <major@mhtx.net>
>>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
>>  Run with '--help' for additional options and output filtering
[OK] Currently running supported MySQL version 5.6.17
[!!] Switch to 64-bit OS - MySQL cannot currently use all of your RAM

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM 
[--] Data in MyISAM tables: 661M (Tables: 6305)
[--] Data in InnoDB tables: 53M (Tables: 964)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 52)
[--] Data in MEMORY tables: 0B (Tables: 104)
[!!] Total fragmented tables: 524

-------- Security Recommendations  -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 4d 14h 30m 25s (10M q [25.447 qps], 280K conn, TX: 46B, RX: 1B)
[--] Reads / Writes: 92% / 8%
[--] Total buffers: 169.0M global + 1.1M per thread (151 max threads)
[OK] Maximum possible memory usage: 329.4M (10% of installed RAM)
[OK] Slow queries: 0% (137/10M)
[OK] Highest usage of available connections: 40% (61/151)
[OK] Key buffer size / total MyISAM indexes: 8.0M/167.7M
[OK] Key buffer hit rate: 100.0% (843M cached / 275K reads)
[!!] Query cache is disabled
[OK] Sorts requiring temporary tables: 4% (86K temp sorts / 1M sorts)
[!!] Joins performed without indexes: 275614
[OK] Temporary tables created on disk: 21% (430K on disk / 2M total)
[OK] Thread cache hit rate: 99% (1K created / 280K connections)
[!!] Table cache hit rate: 0% (2K open / 244K opened)
[OK] Open file limit used: 68% (3K/5K)
[OK] Table locks acquired immediately: 99% (11M immediate / 11M locks)
[OK] InnoDB buffer pool / data size: 128.0M/53.1M
[OK] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    Adjust your join queries to always utilize indexes
    Increase table_open_cache gradually to avoid file descriptor limits
    Read this before increasing table_open_cache over 64: http://bit.ly/1mi7c4C
Variables to adjust:
    query_cache_type (=1)
    join_buffer_size (> 256.0K, or always use indexes with joins)
    table_open_cache (> 2000)

2 个答案:

答案 0 :(得分:0)

你应该在github上使用最新版本。

您的mysql似乎已正确配置。

64位操作系统更好:)

在2G限制中增加数据缓存。

答案 1 :(得分:0)

您可以将my.cnf的以下设置用于16 CPU和64 GB内存。这些设置可以提高数据库性能。

[mysqld]  
innodb_file_per_table  
innodb_flush_method=O_DIRECT  
innodb_log_file_size=2G  
socket = /var/lib/mysql/mysql.sock  
symbolic-links=0  
open_files_limit=12000  
max_connections=10000  
max_user_connections=10000  
innodb_buffer_pool_size=20G  
innodb_thread_concurrency = 34  
innodb_flush_log_at_trx_commit = 2  
innodb_buffer_pool_instances=20  
thread_concurrency = 48  
thread_cache_size = 32  
table_cache = 1024  
query_cache_size = 512M  
query_cache_type=1  
query_cache_limit = 2M  
join_buffer_size = 8M  
tmp_table_size = 256M  
key_buffer = 32M  
innodb_autoextend_increment=512  
max_allowed_packet = 16M  
max_heap_table_size = 256M  
read_buffer_size = 2M  
read_rnd_buffer_size = 16M  
bulk_insert_buffer_size = 64M  
myisam_sort_buffer_size = 128M  
myisam_max_sort_file_size = 10G  
myisam_repair_threads = 1  
skip-name-resolve  
log_slow_queries = /var/log/mariadb/log-slow-queries.log  

[mysqld_safe]  
log-error=/var/log/mariadb/mariadb.log  
pid-file=/var/run/mariadb/mariadb.pid  


!includedir /etc/my.cnf.d