mysql autoextend_innodb_autoextend_increment':问题解决方法
mysql:innodb引擎部分參數(shù)性能調(diào)整
InnoDB做為MySQL目前最廣泛的事務(wù)存儲(chǔ)引擎,很多地方的設(shè)計(jì)和Oracle都是共通的。
下面是windows上一個(gè)MySQL默認(rèn)的參數(shù)查詢結(jié)果:
mysql> show variables like 'Innodb%';
+---------------------------------+------------------------+
| Variable_name? ?? ?? ?? ?? ?? ? | Value? ?? ?? ?? ?? ?? ?|
+---------------------------------+------------------------+
| innodb_additional_mem_pool_size | 2097152? ?? ?? ?? ?? ? |
| innodb_autoextend_increment? ???| 8? ?? ?? ?? ?? ?? ?? ? |
| innodb_buffer_pool_awe_mem_mb? ?| 0? ?? ?? ?? ?? ?? ?? ? |
| innodb_buffer_pool_size? ?? ?? ?| 8388608? ?? ?? ?? ?? ? |
| innodb_checksums? ?? ?? ?? ?? ? | ON? ?? ?? ?? ?? ?? ?? ?|
| innodb_commit_concurrency? ?? ? | 0? ?? ?? ?? ?? ?? ?? ? |
| innodb_concurrency_tickets? ?? ?| 500? ?? ?? ?? ?? ?? ???|
| innodb_data_file_path? ?? ?? ???| ibdata1:10M:autoextend |
| innodb_data_home_dir? ?? ?? ?? ?|? ?? ?? ?? ?? ?? ?? ?? ?|
| innodb_doublewrite? ?? ?? ?? ???| ON? ?? ?? ?? ?? ?? ?? ?|
| innodb_fast_shutdown? ?? ?? ?? ?| 1? ?? ?? ?? ?? ?? ?? ? |
| innodb_file_io_threads? ?? ?? ? | 4? ?? ?? ?? ?? ?? ?? ? |
| innodb_file_per_table? ?? ?? ???| OFF? ?? ?? ?? ?? ?? ???|
| innodb_flush_log_at_trx_commit??| 1? ?? ?? ?? ?? ?? ?? ? |
| innodb_flush_method? ?? ?? ?? ? |? ?? ?? ?? ?? ?? ?? ?? ?|
| innodb_force_recovery? ?? ?? ???| 0? ?? ?? ?? ?? ?? ?? ? |
| innodb_lock_wait_timeout? ?? ???| 50? ?? ?? ?? ?? ?? ?? ?|
| innodb_locks_unsafe_for_binlog??| OFF? ?? ?? ?? ?? ?? ???|
| innodb_log_arch_dir? ?? ?? ?? ? |? ?? ?? ?? ?? ?? ?? ?? ?|
| innodb_log_archive? ?? ?? ?? ???| OFF? ?? ?? ?? ?? ?? ???|
| innodb_log_buffer_size? ?? ?? ? | 1048576? ?? ?? ?? ?? ? |
| innodb_log_file_size? ?? ?? ?? ?| 10485760? ?? ?? ?? ?? ?|
| innodb_log_files_in_group? ?? ? | 2? ?? ?? ?? ?? ?? ?? ? |
| innodb_log_group_home_dir? ?? ? | .\? ?? ?? ?? ?? ?? ?? ?|
| innodb_max_dirty_pages_pct? ?? ?| 90? ?? ?? ?? ?? ?? ?? ?|
| innodb_max_purge_lag? ?? ?? ?? ?| 0? ?? ?? ?? ?? ?? ?? ? |
| innodb_mirrored_log_groups? ?? ?| 1? ?? ?? ?? ?? ?? ?? ? |
| innodb_open_files? ?? ?? ?? ?? ?| 300? ?? ?? ?? ?? ?? ???|
| innodb_rollback_on_timeout? ?? ?| OFF? ?? ?? ?? ?? ?? ???|
| innodb_support_xa? ?? ?? ?? ?? ?| ON? ?? ?? ?? ?? ?? ?? ?|
| innodb_sync_spin_loops? ?? ?? ? | 20? ?? ?? ?? ?? ?? ?? ?|
| innodb_table_locks? ?? ?? ?? ???| ON? ?? ?? ?? ?? ?? ?? ?|
| innodb_thread_concurrency? ?? ? | 8? ?? ?? ?? ?? ?? ?? ? |
| innodb_thread_sleep_delay? ?? ? | 10000? ?? ?? ?? ?? ?? ?|
+---------------------------------+------------------------+
innodb_additional_mem_pool_size
用于緩存InnoDB數(shù)據(jù)字典及其他內(nèi)部結(jié)構(gòu)的內(nèi)存池大小,類似于Oracle的library cache。這不是一個(gè)強(qiáng)制參數(shù),可以被突破。
innodb_buffer_pool_size
內(nèi)存緩沖池大小,用于緩存表和索引數(shù)據(jù)等。類似于Oracle的buffer cache,如果可能,盡可能的設(shè)置大一點(diǎn)。
innodb_log_buffer_size
日志緩沖區(qū)大小,類似于Oracle的log buffer
innodb_log_file_size
日志文件大小。默認(rèn)會(huì)創(chuàng)建2個(gè)5M大小的名為ib_logfile0和ib_logfile1的文件。日志文件的數(shù)目由參數(shù)innodb_log_files_in_group指定。存放位置由innodb_log_group_home_dir指定。
innodb_data_file_path
指定InnoDB表空間數(shù)據(jù)文件名,大小以及其他屬性。所有文件的加起來(lái)不能少于10M。多個(gè)數(shù)據(jù)文件之間以逗號(hào)分割,屬性之間以冒號(hào)分割。默認(rèn)創(chuàng)建一個(gè)大小10MB名為ibdata1的可自動(dòng)擴(kuò)展的數(shù)據(jù)文件,一般在生產(chǎn)環(huán)境中都需要根據(jù)實(shí)際情況指定,由于往表空間中添加數(shù)據(jù)文件需要停機(jī),盡量在規(guī)劃的時(shí)候做好準(zhǔn)備,如果可以的話最好開啟最后一個(gè)數(shù)據(jù)文件的自動(dòng)增長(zhǎng)屬性。數(shù)據(jù)文件的個(gè)數(shù)在規(guī)劃的時(shí)候還需要考慮另外一個(gè)innodb_open_files參數(shù)。
innodb_file_per_table
取值為ON或者OFF。是否為每個(gè)table使用單獨(dú)的數(shù)據(jù)文件保存。如果系統(tǒng)中表的個(gè)數(shù)不多,并且沒(méi)有超大表,使用該參數(shù)可以使得各個(gè)表之間的維護(hù)相對(duì)獨(dú)立,有一定的好處。
innodb_autoextend_increment
當(dāng)自動(dòng)擴(kuò)展表空間被填滿之時(shí),每次擴(kuò)展空間的大小,默認(rèn)值是8(單位MB)。該參數(shù)可以動(dòng)態(tài)修改:
mysql> set global innodb_autoextend_increment=10;
Query OK, 0 rows affected (0.01 sec)
innodb_status_file
定期將show inndb status的結(jié)果輸出保存到文件中,建議開啟以便分析性能。
2007 12:53] mike mike
Description:
The variable "innodb_autoextend_increment" does not seem to report the proper value. The
top value it will display is 1000; I assume that is bytes.
From the manual:
"The increment is 8MB at a time by default. It can be modified by changing the
innodb_autoextend_increment system variable."
I have it set in my my.cnf for 128M (assuming it will grow on demand by 128 meg chunks) -
however, I noticed that my database wasn't growing that large, it was always idling around
4,096KB free.
How to repeat:
Here is my configuration:
+---------------------------------+-------------------------+
| Variable_name? ?? ?? ?? ?? ?? ? | Value? ?? ?? ?? ?? ?? ? |
+---------------------------------+-------------------------+
| have_innodb? ?? ?? ?? ?? ?? ?? ?| YES? ?? ?? ?? ?? ?? ?? ?|
| innodb_additional_mem_pool_size | 33554432? ?? ?? ?? ?? ? |
| innodb_autoextend_increment? ???| 1000? ?? ?? ?? ?? ?? ???|
| innodb_buffer_pool_awe_mem_mb? ?| 0? ?? ?? ?? ?? ?? ?? ???|
| innodb_buffer_pool_size? ?? ?? ?| 536870912? ?? ?? ?? ?? ?|
| innodb_checksums? ?? ?? ?? ?? ? | ON? ?? ?? ?? ?? ?? ?? ? |
| innodb_commit_concurrency? ?? ? | 0? ?? ?? ?? ?? ?? ?? ???|
| innodb_concurrency_tickets? ?? ?| 500? ?? ?? ?? ?? ?? ?? ?|
| innodb_data_file_path? ?? ?? ???| ibdata:1024M:autoextend |
| innodb_data_home_dir? ?? ?? ?? ?| /var/lib/mysql/? ?? ?? ?|
| innodb_doublewrite? ?? ?? ?? ???| ON? ?? ?? ?? ?? ?? ?? ? |
| innodb_fast_shutdown? ?? ?? ?? ?| 1? ?? ?? ?? ?? ?? ?? ???|
| innodb_file_io_threads? ?? ?? ? | 4? ?? ?? ?? ?? ?? ?? ???|
| innodb_file_per_table? ?? ?? ???| ON? ?? ?? ?? ?? ?? ?? ? |
| innodb_flush_log_at_trx_commit??| 0? ?? ?? ?? ?? ?? ?? ???|
| innodb_flush_method? ?? ?? ?? ? |? ?? ?? ?? ?? ?? ?? ?? ? |
| innodb_force_recovery? ?? ?? ???| 0? ?? ?? ?? ?? ?? ?? ???|
| innodb_lock_wait_timeout? ?? ???| 50? ?? ?? ?? ?? ?? ?? ? |
| innodb_locks_unsafe_for_binlog??| OFF? ?? ?? ?? ?? ?? ?? ?|
| innodb_log_arch_dir? ?? ?? ?? ? |? ?? ?? ?? ?? ?? ?? ?? ? |
| innodb_log_archive? ?? ?? ?? ???| OFF? ?? ?? ?? ?? ?? ?? ?|
| innodb_log_buffer_size? ?? ?? ? | 8388608? ?? ?? ?? ?? ???|
| innodb_log_file_size? ?? ?? ?? ?| 5242880? ?? ?? ?? ?? ???|
| innodb_log_files_in_group? ?? ? | 2? ?? ?? ?? ?? ?? ?? ???|
| innodb_log_group_home_dir? ?? ? | ./? ?? ?? ?? ?? ?? ?? ? |
| innodb_max_dirty_pages_pct? ?? ?| 90? ?? ?? ?? ?? ?? ?? ? |
| innodb_max_purge_lag? ?? ?? ?? ?| 0? ?? ?? ?? ?? ?? ?? ???|
| innodb_mirrored_log_groups? ?? ?| 1? ?? ?? ?? ?? ?? ?? ???|
| innodb_open_files? ?? ?? ?? ?? ?| 300? ?? ?? ?? ?? ?? ?? ?|
| innodb_support_xa? ?? ?? ?? ?? ?| ON? ?? ?? ?? ?? ?? ?? ? |
| innodb_sync_spin_loops? ?? ?? ? | 20? ?? ?? ?? ?? ?? ?? ? |
| innodb_table_locks? ?? ?? ?? ???| ON? ?? ?? ?? ?? ?? ?? ? |
| innodb_thread_concurrency? ?? ? | 2? ?? ?? ?? ?? ?? ?? ???|
| innodb_thread_sleep_delay? ?? ? | 10000? ?? ?? ?? ?? ?? ? |
+---------------------------------+-------------------------+
Easy to repeat:
mysql> show variables like 'innodb_autoextend_increment';
+-----------------------------+-------+
| Variable_name? ?? ?? ?? ?? ?| Value |
+-----------------------------+-------+
| innodb_autoextend_increment | 1000??|
+-----------------------------+-------+
1 row in set (0.00 sec)
mysql> SET GLOBAL innodb_autoextend_increment = 15;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like 'innodb_autoextend_increment';
+-----------------------------+-------+
| Variable_name? ?? ?? ?? ?? ?| Value |
+-----------------------------+-------+
| innodb_autoextend_increment | 15? ? |
+-----------------------------+-------+
1 row in set (0.00 sec)
mysql> SET GLOBAL innodb_autoextend_increment = 999999;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like 'innodb_autoextend_increment';
+-----------------------------+-------+
| Variable_name? ?? ?? ?? ?? ?| Value |
+-----------------------------+-------+
| innodb_autoextend_increment | 1000??|
+-----------------------------+-------+
1 row in set (0.00 sec)
mysql>
obviously if this has no effect in the CLI it has no effect from my.cnf.
Suggested fix:
People suggest using innodb_autoextend_increment=50M in multiple places around the net.
I've done that, but obviously can't confirm that it is working (at least from the
variable itself)
From what I can tell it does not work properly either (phpMyAdmin for example reports out
how many KB free the InnoDB engine/file has) - I definately think there is an issue with
the variable not reporting the right status; or perhaps the variable isn't working
itself. Unless there is some sort of conflicting mechanism when innodb_file_per_table is
used, then there should be something in the docs about it.
[8 Jan 2007 14:30] Heikki Tuuri
The manual says:
"
innodb_autoextend_increment
The increment size (in MB) for extending the size of an auto-extending tablespace when it
becomes full. The default value is 8.
"
Thus, 1000 corresponds to 1000 MB. The default is 8 MB.
[21 Jan 2007 6:32] mike mike
okay, so is 1000MB an invalid number? does it not accept "M" as a quantifier? as in 50M is
not 50, but will ignore that value?
if so, a LOT of people's examples around the net are incorrect. it should for sanity's
sake match the syntax for any other variable.
作者: liyihongcug
發(fā)布時(shí)間: 2010-05-14
總結(jié)
以上是生活随笔為你收集整理的mysql autoextend_innodb_autoextend_increment':问题解决方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
                            
                        - 上一篇: 读写分离mysql数据库mariadb_
 - 下一篇: mysql导出bacpac_数据库的迁移