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

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

1.Saving and Restoring the Buffer Pool State

主要内容为【热启动】,就是把之前常用的内存数据,按照划定的比例快速重新加载到内存中。

To reduce the warmup period after restarting the server, InnoDB saves a percentage of the most recently used pages for each buffer pool at server shutdown and restores these pages at server startup. The percentage of recently used pages that is stored is defined by the innodb_buffer_pool_dump_pct configuration option.

After restarting a busy server, there is typically a warmup period with steadily increasing throughput, as disk pages that were in the buffer pool are brought back into memory (as the same data is queried, updated, and so on). The ability to restore the buffer pool at startup shortens the warmup period by reloading disk pages that were in the buffer pool before the restart rather than waiting for DML operations to access corresponding rows. Also, I/O requests can be performed in large batches, making the overall I/ O faster. Page loading happens in the background, and does not delay database startup【并不会延缓启动进程】.

In addition to saving the buffer pool state at shutdown and restoring it at startup, you can save and restore the buffer pool state at any time, while the server is running. For example, you can save the state of the buffer pool after reaching a stable【steɪbl 稳定的、稳固的】 throughput【ˈθruːpʊt 吞吐量、生产力】 under a steady workload. You could also restore the previous buffer pool state after running reports or maintenance jobs that bring data pages into the buffer pool that are only requited for those operations, or after running some other non-typical workload.

Even though a buffer pool can be many gigabytes in size, the buffer pool data that InnoDB saves to disk is tiny【ˈtaɪni 极小的;微小的;微量的】 by comparison. Only tablespace IDs and page IDs necessary to locate the appropriate【əˈproʊprieɪt 适当的;合适的;恰当的】 pages are saved to disk. This information is derived from the INNODB_BUFFER_PAGE_LRU INFORMATION_SCHEMA table. By default, tablespace ID and page ID data is saved in a file named ib_buffer_pool, which is saved to the InnoDB data directory. The file name and location can be modified using the innodb_buffer_pool_filename configuration parameter.----实际上,保存的数量并不大,可以理解为某种元数据。

Because data is cached in and aged out of the buffer pool as it is with regular database operations, there is no problem if the disk pages are recently updated, or if a DML operation involves data that has not yet been loaded. The loading mechanism skips requested pages that no longer exist.

The underlying mechanism involves a background thread that is dispatched to perform the dump and load operations.

Disk pages from compressed tables are loaded into the buffer pool in their compressed form. Pages are uncompressed as usual when page contents are accessed during DML operations. Because uncompressing pages is a CPU-intensive【ɪnˈtensɪv 密集的;集约的;彻底的;十分细致的;短时间内集中紧张进行的】 process, it is more efficient for concurrency to perform the operation in a connection thread rather than in the single thread that performs the buffer pool restore operation.

1.1 Configuring the Dump Percentage for Buffer Pool Pages

主要参数是innodb_buffer_pool_dump_pct,可以启动时指定;也支持运行时,动态修改。

Before dumping pages from the buffer pool, you can configure the percentage of most-recently-used buffer pool pages that you want to dump by setting the innodb_buffer_pool_dump_pct option. If you plan to dump buffer pool pages while the server is running, you can configure the option dynamically

If you plan to dump buffer pool pages at server shutdown, set innodb_buffer_pool_dump_pct in your configuration file.

默认值是25%

The innodb_buffer_pool_dump_pct default value is 25 (dump 25% of most-recently-used pages).

1.2 Saving the Buffer Pool State at Shutdown and Restoring it at Startup

To save the state of the buffer pool at server shutdown, issue the following statement prior to shutting down the server:

SET GLOBAL innodb_buffer_pool_dump_at_shutdown=ON;

innodb_buffer_pool_dump_at_shutdown is enabled by default. --此参数默认是开启的。

1.3 Saving and Restoring the Buffer Pool State Online

To save the state of the buffer pool while MySQL server is running, issue the following statement:

SET GLOBAL innodb_buffer_pool_dump_now=ON;

To restore the buffer pool state while MySQL is running, issue the following statement:

SET GLOBAL innodb_buffer_pool_load_now=ON;

1.4 可用通过状态值 和 系统表 查看 这个过程

To display progress when saving the buffer pool state to disk, issue the following statement:

SHOW STATUS LIKE 'Innodb_buffer_pool_dump_status';

To display progress when loading the buffer pool, issue the following statement:

SHOW STATUS LIKE 'Innodb_buffer_pool_load_status';

系统表

You can monitor buffer pool load progress using Performance Schema.

--performance_schema.setup_instruments

--performance_schema.events_stages_current

--performance_schema.events_stages_history

The events_stages_current table returns an empty set if the buffer pool load operation has completed. In this case, you can check the events_stages_history table to view data for the completed event.

2. Excluding Buffer Pool Pages from Core Files

 A core file records the status and memory image of a running process. Because the buffer pool resides in main memory, and the memory image of a running process is dumped to the core file, systems with large buffer pools can produce large core files when the mysqld process dies.

Large core files can be problematic for a number of reasons including the time it takes to write them, the amount of disk space they consume, and the challenges associated with transferring large files.---文件太多不好

To reduce core file size, you can disable the innodb_buffer_pool_in_core_file variable to omit buffer pool pages from core dumps. The innodb_buffer_pool_in_core_file variable was introduced in MySQL 8.0.14 and is enabled by default.--可以通过参数变量来限制

Disabling innodb_buffer_pool_in_core_file takes effect only if the core_file variable is enabled and the operating system supports the MADV_DONTDUMP non-POSIX extension to the madvise() system call, which is supported in Linux 3.4 and later. The MADV_DONTDUMP extension causes pages in a specified range to be excluded from core dumps.

The core_file variable is read only and disabled by default. It is enabled by specifying the --corefile option at startup. The innodb_buffer_pool_in_core_file variable is dynamic. It can be specified at startup or configured at runtime using a SET statement.

If the innodb_buffer_pool_in_core_file variable is disabled but MADV_DONTDUMP is not supported by the operating system, or an madvise() failure occurs, a warning is written to the MySQL server error log and the core_file variable is disabled to prevent writing core files that unintentionally include buffer pool pages. If the read-only core_file variable becomes disabled, the server must be restarted to enable it again.

The reduction in core file size achieved by disabling the innodb_buffer_pool_in_core_file variable depends on the size of the buffer pool, but it is also affected by the InnoDB page size. A smaller page size means more pages are required for the same amount of data, and more pages means more page metadata.

 

《17.8.3.6 Saving and Restoring the Buffer Pool State》

《17.8.3.7 Excluding Buffer Pool Pages from Core Files》

https://dev.mysql.com/doc/refman/8.0/en/innodb-preload-buffer-pool.html

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

到了这里,关于MySQL 8.0 Reference Manual(读书笔记72节--InnoDB Buffer Pool Configuration (3))的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索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日
    浏览(58)
  • 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日
    浏览(75)
  • 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日
    浏览(50)
  • 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日
    浏览(39)
  • 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日
    浏览(42)
  • 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日
    浏览(43)
  • 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日
    浏览(44)
  • 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日
    浏览(55)
  • 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日
    浏览(46)
  • 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日
    浏览(45)

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

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

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

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

二维码1

领取红包

二维码2

领红包