MySQL 8.0 Reference Manual(读书笔记70节--InnoDB Buffer Pool Configuration)

这篇具有很好参考价值的文章主要介绍了MySQL 8.0 Reference Manual(读书笔记70节--InnoDB Buffer Pool Configuration)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

1.InnoDB Buffer Pool Size 配置

When increasing or decreasing innodb_buffer_pool_size, the operation is performed in chunks. Chunk size is defined by the innodb_buffer_pool_chunk_size configuration option, which has a default of 128M.-----innodb_buffer_pool_size的扩容和缩容,都是以innodb_buffer_pool_chunk_size为单位进行的,其默认为128M 。

Buffer pool size must always be equal to or a multiple of innodb_buffer_pool_chunk_size * innodb_buffer_pool_instances. If you configure innodb_buffer_pool_size to a value that is not equal to or a multiple of innodb_buffer_pool_chunk_size * innodb_buffer_pool_instances, buffer pool size is automatically adjusted to a value that is equal to or a multiple of innodb_buffer_pool_chunk_size * innodb_buffer_pool_instances.----- innodb_buffer_pool_size必须是 innodb_buffer_pool_chunk_size * innodb_buffer_pool_instances乘积的整数倍

举个例子:

假如 innodb_buffer_pool_instances 为16;innodb_buffer_pool_chunk_size默认的为128M。

innodb_buffer_pool_instances * innodb_buffer_pool_chunk_size =2G;

 innodb_buffer_pool_size 应该设置为2G的倍数

如果你设置成了8G,通过 SELECT @@innodb_buffer_pool_size/1024/1024/1024; 命令查看,确实为8G;

如果你设置成了9G,通过SELECT @@innodb_buffer_pool_size/1024/1024/1024;命令查看,实际上变成了10G。【向上扩展】

2.InnoDB Buffer Pool Chunk Size 配置

innodb_buffer_pool_chunk_size can be increased or decreased in 1MB (1048576 byte) units but can only be modified at startup, in a command line string or in a MySQL configuration file.

---调整的最小单位为1M,并且需重启。

The following conditions apply when altering innodb_buffer_pool_chunk_size:

• If the new innodb_buffer_pool_chunk_size value * innodb_buffer_pool_instances is larger than the current buffer pool size when the buffer pool is initialized,

innodb_buffer_pool_chunk_size is truncated to innodb_buffer_pool_size / innodb_buffer_pool_instances.

• Buffer pool size must always be equal to or a multiple of innodb_buffer_pool_chunk_size * innodb_buffer_pool_instances.

If you alter innodb_buffer_pool_chunk_size, innodb_buffer_pool_size is automatically adjusted to a value that is equal to or a multiple of innodb_buffer_pool_chunk_size * innodb_buffer_pool_instances.

The adjustment occurs when the buffer pool is initialized.

注意事项

(1)Care should be taken when changing innodb_buffer_pool_chunk_size, as changing this value can increase the size of the buffer pool, as shown in the examples above.

Before you change innodb_buffer_pool_chunk_size, calculate the effect on innodb_buffer_pool_size to ensure that the resulting buffer pool size is acceptable. --谨慎调整

(2)To avoid potential performance issues, the number of chunks (innodb_buffer_pool_size / innodb_buffer_pool_chunk_size) should not exceed 1000. ---换句话说,当innodb_buffer_pool_size>128G时,

可以考虑修改innodb_buffer_pool_chunk_size的默认值了。

3. InnoDB Buffer Pool Size 在线调整

是支持在线调整的。

Active transactions and operations performed through InnoDB APIs should be completed before resizing the buffer pool【当前的事务需要执行完毕】. When initiating a resizing operation, the operation does not start until all active transactions are completed.【新的事务请求,会被阻塞住,等待调整的命令执行完】 Once the resizing operation is in progress, new transactions and operations that require access to the buffer pool must wait until the resizing operation finishes.【调整时,buffer 也不允许新的事务或请求,去访问】 The exception to the rule is that concurrent【同时发生的】 access to the buffer pool is permitted while the buffer pool is defragmented 【去碎片化】and pages are withdrawn when buffer pool size is decreased. A drawback【ˈdrɔːbæk  缺点】 of allowing concurrent access is that it could result in a temporary shortage of available pages while pages are being withdrawn【撤回、撤离、不再提供】.

-----三种事务: 发出调整命令前的事务;发出命令后事务;同时发出的事务。

需要注意的是:Nested transactions could fail if initiated after the buffer pool resizing operation begins.

 4.可视化Online Buffer Pool Resizing Progress

The Innodb_buffer_pool_resize_status variable reports a string value indicating buffer pool resizing progress;执行的命令为:

SHOW STATUS WHERE Variable_name='InnoDB_buffer_pool_resize_status';

 From MyQL 8.0.31, you can also monitor an online buffer pool resizing operation using the Innodb_buffer_pool_resize_status_code and Innodb_buffer_pool_resize_status_progress status variables, which report numeric values, preferable for programmatic monitoring.--新版本的MySQL,有更多的监控指标

The Innodb_buffer_pool_resize_status_code status variable reports a status code indicating the stage of an online buffer pool resizing operation. Status codes include:

• 0: No Resize operation in progress

• 1: Starting Resize

• 2: Disabling AHI (Adaptive Hash Index)

• 3: Withdrawing Blocks

• 4: Acquiring Global Lock

• 5: Resizing Pool

• 6: Resizing Hash

• 7: Resizing Failed

The Innodb_buffer_pool_resize_status_progress status variable reports a percentage value indicating the progress of each stage. The percentage value is updated after each buffer pool instance is processed. As the status (reported by Innodb_buffer_pool_resize_status_code) changes from one status to another, the percentage value is reset to 0.

The following query returns a string value indicating the buffer pool resizing progress, a code indicating the current stage of the operation, and the current progress of that stage, expressed as a percentage value:

SELECT variable_name, variable_value 
 FROM performance_schema.global_status 
 WHERE LOWER(variable_name) LIKE "innodb_buffer_pool_resize%";

 

Buffer pool resizing progress is also visible in the server error log. ---调整过程也可以在error log 查看。

From MySQL 8.0.31, starting the server with --log-error-verbosity=3 logs additional information to the error log during an online buffer pool resizing operation.Additional information includes the status codes reported by Innodb_buffer_pool_resize_status_code and the percentage progress value reported by Innodb_buffer_pool_resize_status_progress.

5.Online Buffer Pool Resizing Internals

The resizing operation is performed by a background thread.

增加内存分配

When increasing the size of the buffer pool, the resizing operation:

• Adds pages in chunks (chunk size is defined by innodb_buffer_pool_chunk_size)

• Converts hash tables, lists, and pointers to use new addresses in memory

• Adds new pages to the free list

While these operations are in progress, other threads are blocked from accessing the buffer pool.

减少内存分配

When decreasing the size of the buffer pool, the resizing operation:

• Defragments the buffer pool and withdraws (frees) pages

• Removes pages in chunks (chunk size is defined by innodb_buffer_pool_chunk_size)

• Converts hash tables, lists, and pointers to use new addresses in memory

Of these operations, only defragmenting the buffer pool and withdrawing pages allow other threads to access to the buffer pool concurrently.

 

---《17.8.3.1 Configuring InnoDB Buffer Pool Size》

https://dev.mysql.com/doc/refman/8.0/en/innodb-buffer-pool-resize.html文章来源地址https://www.toymoban.com/news/detail-842891.html

到了这里,关于MySQL 8.0 Reference Manual(读书笔记70节--InnoDB Buffer Pool Configuration)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • MySQL 8.0 Reference Manual(读书笔记69节--InnoDB Startup Configuration)

    有些InnoDB的配置,是在实例初始化时,就决定了,所以,建议写在configuration file 文件中。 Because MySQL uses data file, log file, and page size settings to initialize InnoDB, it is recommended that you define these settings in an option file that MySQL reads at startup, prior to initializing InnoDB. Normally, InnoDB is initialize

    2024年03月24日
    浏览(41)
  • MySQL 8.0 Reference Manual(读书笔记76节--Optimizer Statistics for InnoDB (2))

    开始讲解 非固化的统计数据 This section describes how to configure non-persistent optimizer statistics. Optimizer statistics are not persisted to disk when innodb_stats_persistent=OFF or when individual tables are created or altered with STATS_PERSISTENT=0. Instead, statistics are stored in memory, and are lost when the server is shut down. Statis

    2024年03月27日
    浏览(32)
  • MySQL 8.0 Reference Manual(读书笔记82节-- InnoDB and Online DDL (2))

    The following table provides an overview of online DDL support for column operations. An asterisk indicates additional information, an exception, or a dependency. Operation Instant In Place Rebuilds Table Permits Concurrent DML Only Modifies Metadata Adding a column Yes* Yes No* Yes* Yes Dropping a column Yes* Yes Yes Yes Yes Renaming a column Yes* Yes No Ye

    2024年04月08日
    浏览(63)
  • MySQL 8.0 Reference Manual(读书笔记81节-- InnoDB and Online DDL (1))

    The online DDL feature provides support for instant and in-place table alterations and concurrent DML. Benefits of this feature include: • Improved responsiveness【rɪ\\\'spɒnsɪvnəs 响应性;灵敏度;敏感性;响应度;易起反应;】 and availability【əˌveɪlə\\\'bɪləti 可利用性;可利用;可用性;有用(效)性;使用价值;(有效

    2024年04月08日
    浏览(30)
  • MySQL 8.0 Reference Manual(读书笔记75节--Optimizer Statistics for InnoDB (1))

    This section describes how to configure persistent and non-persistent optimizer statistics for InnoDB tables. Persistent optimizer statistics are persisted across server restarts【意思是重启操作,对这些数据没有影响】, allowing for greater plan stability and more consistent query performance. Persistent optimizer statistics also provide con

    2024年03月27日
    浏览(31)
  • MySQL 8.0 Reference Manual(读书笔记84节-- InnoDB and Online DDL (4))

    Disk space requirements for online DDL operations are outlined【ˈaʊtlaɪnd 概述;略述;显示…的轮廓;勾勒…的外形;】 below. The requirements do not apply to operations that are performed instantly. • Temporary log files: A temporary log file records concurrent DML when an online DDL operation creates an index or alters a table. The tempora

    2024年04月08日
    浏览(36)
  • MySQL 8.0 Reference Manual(读书笔记83节-- InnoDB and Online DDL (3))

    The following table provides an overview of online DDL support for foreign key operations. An asterisk【ˈæstərɪsk 星号(置于词语旁以引起注意或另有注释);】 indicates additional information, an exception, or a dependency. Operation Instant In Place Rebuilds Table Permits Concurrent DML Only Modifies Metadata Adding a foreign key constrain

    2024年04月08日
    浏览(30)
  • MySQL 8.0 Reference Manual(读书笔记78节-- InnoDB Table and Page Compression (1))

    This section provides information about the InnoDB table compression and InnoDB page compression features. The page compression feature is also referred to as transparent page compression. Using the compression features of InnoDB, you can create tables where the data is stored in compressed form. Compression can help to improve both raw performance and scala

    2024年03月28日
    浏览(36)
  • MySQL 8.0 Reference Manual(读书笔记79节-- InnoDB Table and Page Compression (2))

    Overall application performance, CPU and I/O utilization and the size of disk files are good indicators of how effective compression is for your application. This section builds on the performance tuning advice and shows how to find problems that might not turn up during initial testing. To dig deeper into performance considerations for compressed tables, y

    2024年03月28日
    浏览(44)
  • MySQL 8.0 Reference Manual(读书笔记86节-- InnoDB INFORMATION_SCHEMA Tables(2))

    The following tables provide metadata for FULLTEXT indexes: 概述 • INNODB_FT_CONFIG: Provides metadata about the FULLTEXT index and associated processing for an InnoDB table. • INNODB_FT_BEING_DELETED: Provides a snapshot of the INNODB_FT_DELETED table; it is used only during an OPTIMIZE TABLE maintenance operation. When OPTIMIZE TABLE is run, the INNO

    2024年04月10日
    浏览(34)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包