MySQL performance tunning

重要參數1 = key_buffer_size 這個值只針對 MYISAM engine 有作用 , 這個值用來設定 index 使用多少 memory , mysql 把 index 儘可能的放在 memory 中, 這 key_buffer_size 決定 index 的使用效率 , 效率高的話就是多數的 索引 index 都是存在 memory 中, 那就 select 會快, 一般這個值是 16M , 這兩個狀態值可以用來判斷: Key_reads , Key_read_requests

看以下的例子:
DBM53 的 
show global status like ‘Key_read%’
Key_read_requests 36,479,348,961 
Key_reads 1,009,874,537 

Key_reads / Key_read_requests = 0.02 這樣偏高, 不太好 , 這個值正常是 0.01 , 0.001 最佳

好朋友 phpmyadmin 裡面有很好的解釋:


Key_read_requests 36 G The number of requests to read a key block from the cache.
Key_reads 1,010 M The number of physical reads of a key block from disk. If Key_reads is big, then your key_buffer_size value is probably too small. The cache miss rate can be calculated as Key_reads/Key_read_requests.

這台的 show global variables like ‘key_%’ 是 128MB
key_buffer_size 134,217,728

set global key_buffer_size=1024M

重要參數2 = table_cache

show global status like ‘Open%’

Open_tables 2,048 

若等於

show global variables like ‘%table%cache%’

table_cache 2,048 

並且 Opened_tables 一直增加 , 那要增加 table_cache 的值 , server 1G RAM 推薦 table_cache 128 ~ 256

沒錯, phpmyadmin 指示

Open_tables 2,048 The number of tables that are open.
Opened_tables 6,529 The number of tables that have been opened. If opened tables is big, your table cache value is probably too small.

那麼就來修改 table_cache 吧!

set global table_cache=3000;

 

 

 

not finish!

參考網址:

Comments are closed.

Related URL:
  1. Protected: [LAB] Best practices guidelines for running MySQL databases on NetApp® storage , 測試結果
  2. amazon aws ami LAMP / NGINX / PHP / memcache steps
  3. 建 mysql partition table 遇到的問題
  4. Protected: [memo] mysql CPU / MEMORY / DISK / SERVER
  5. [memo] MySQL PROCEDURE ANALYSE / schema 分析
  6. Protected: dbs222 mysql innodb Troubleshutting
  7. mysql performance tunning – pdf
  8. 使用 mysql partition table sample
  9. Protected: mysql myisam performance tunning 過程 – sample data
  10. Protected: mysql innodb 的部份參數 , my.cnf