아래는 MySQL 설정 시 가장 많이 사용되는 parameter들의 설명이다.
사용용도 별로 나뉘어져 있으며 괄호안의 수치는 권고수치이다.
my.cnf에 추가하거나 수정하여 설정할 수 있다.
1. Connection/Threads/Tables/Files - max_connections : 동시에 사용할 수 있는 최대 connection 수 (50-150)
- thread_cache_size : 새로운 connection을 위해 사용되는 pool의
thread 수 (16)
- table_cache : Open table file handler를 위해 사용하는 file descriptor의
pool (256)
- innodb_thread_concurrency : InnDB storage engine과 함께 동시에 실행할
수 있는 connection의 최대 양 (4-8)
- open_files_limit : Database에 의해 open될 수 있는 file의 최대 수 (2048)
2. Memory
- key_buffer_size : MyISAM Index Memory Buffer (up to 4GB)
- innodb_buffer_pool_size : InnoDB Data + Index Memory Buffer
(70~80% of RAM)
- query_cache_size, query_cache_limit : 이미 수행된 query의 result set에
대한 cache size (32M, 1M)
- tmp_table_size, max_heap_table_size : Memory temporary, Heap table
의 최대 size. max_heap_table_size는 tmp_table_size보다 크거나 같아야함.
(32M-64M)
3. Per Session Buffers
- sort_buffer_size : ORDER BY나 GROUP BY와 같은 sorting operation을 위해
사용되는 buffer의 size (2-8M)
- join_buffer_size : Index를 제외한 JOIN 수행 시 사용되는 buffer의 size
(2-8M)
- read_buffer_size : Full table scan 수행 시 사용되는 buffer의 size (2-8M)
- read_rnd_buffer_size : ORDER BY 수행 후의 row를 읽어올 때 사용되는
buffer의 size (2-8M)
4. Miscellaneous
- slow-query-log,slow_query_log_file, long_query_time : long_query_
time 보다 수행시간이 긴 경우 log에 기록
- innodb_log_file_size : InnoDB redo log file size 설정. 수치가 커지면
recovery 시간도 길어짐.
((half the size of innodb_buffer_pool_size)/innodb_log_files_in_group)
- wait_timeout, interactive_timeout : Client에서의 connection 유지 시간.