0
我最近得到了一臺新的專用MySQL機器。現在它運行良好,但有時它會通過狀態查詢變慢很多:複製到tmp表。它似乎隨機發生。需要InnoDB優化技巧 - mysql
該機器擁有12GB DDR3 ram,並運行RAID10設置(4x 15k RPM SAS驅動器)。
本機託管5個數據庫,每個數據庫的大小都在1到8gb之間。讀/寫:66%/ 34%
下面是我的my.cnf文件。如果有人有性能優化技巧,我很樂意聽到他們。
[mysqld]
skip-name-resolve
datadir=/var/lib/mysql
#socket=/tmp/mysql.sock
log-error=/var/log/mysqld.log
old_passwords=0
max_connections = 1500
table_cache = 1024
max_allowed_packet = 16M
sort_buffer_size = 2M
thread_cache = 8
thread_concurrency = 32
query_cache_size = 0M
query_cache_type = 0
default-storage-engine = innodb
transaction_isolation = REPEATABLE-READ
tmp_table_size = 256M
long_query_time = 3
log_slow_queries = 1
innodb_additional_mem_pool_size=48M
innodb_flush_log_at_trx_commit=2
innodb_log_buffer_size=32M
innodb_buffer_pool_size=6G
innodb_autoinc_lock_mode=2
innodb_io_capacity=500
innodb_read_io_threads=16
innodb_write_io_threads=8
innodb_buffer_pool_size = 5000M
innodb_lock_wait_timeout = 300
innodb_max_dirty_pages_pct = 90
innodb_thread_concurrency =32
檢查緩慢的查詢日誌以便識別速度慢的查詢。你的配置中有兩次innodb_buffer_pool_size。如果MySQL是這臺機器上運行的唯一守護進程,請將緩衝池設置爲10 G(通常它設置爲可用RAM的80%) –
感謝您指出了重複項。我有緩慢的查詢日誌啓用,但我根本無法找到慢日誌的存儲位置。 –
請檢查:http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ –