innodb_buffer_pool_size默认 128M
在线修改
SET GLOBAL innodb_buffer_pool_size=68719476736;
复制
查看修改进度
SHOW STATUS WHERE Variable_name='InnoDB_buffer_pool_resize_status';
复制
缓冲池大小调整进度会记录在错误日志error.log中
2023-12-07T08:51:42.868337Z 0 [Note] InnoDB: Resizing buffer pool from 134217728 to 68719476736 (unit=134217728). 2023-12-07T08:51:42.868458Z 0 [Note] InnoDB: Disabling adaptive hash index. 2023-12-07T08:51:42.869158Z 0 [Note] InnoDB: disabled adaptive hash index. 2023-12-07T08:51:42.869171Z 0 [Note] InnoDB: Withdrawing blocks to be shrunken. 2023-12-07T08:51:42.869179Z 0 [Note] InnoDB: Latching whole of buffer pool. 2023-12-07T08:51:42.869192Z 0 [Note] InnoDB: buffer pool 0 : resizing with chunks 1 to 512. 2023-12-07T08:51:48.538571Z 0 [Note] InnoDB: buffer pool 0 : 511 chunks (4186112 blocks) were added. 2023-12-07T08:51:48.538655Z 0 [Note] InnoDB: Resizing hash tables. 2023-12-07T08:51:48.635982Z 0 [Note] InnoDB: buffer pool 0 : hash tables were resized. 2023-12-07T08:51:48.636163Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 5049ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.) 2023-12-07T08:51:48.636170Z 0 [Note] InnoDB: Resizing also other hash tables. 2023-12-07T08:51:49.941980Z 0 [Note] InnoDB: Resized hash tables at lock_sys, adaptive hash index, dictionary. 2023-12-07T08:51:49.942044Z 0 [Note] InnoDB: Completed to resize buffer pool from 134217728 to 68719476736. 2023-12-07T08:51:49.942057Z 0 [Note] InnoDB: Re-enabled adaptive hash index. 2023-12-07T08:51:49.942076Z 0 [Note] InnoDB: Completed resizing buffer pool at 231207 16:51:49.
复制
在线缓冲池调整内容机制
调整操作由后台线程执行。当增加缓冲池大小时,调整操作:
- 逐块添加页面(块大小由 innodb_buffer_pool_chunk_size 定义)
- 将哈希表、列表和指针转换为使用内存中的新地址
- 将新页面添加到空闲列表
在这些操作进行时,其他线程无法访问缓冲池。
当减小缓冲池大小时,调整操作:
- 对缓冲池进行碎片整理并撤回(释放)页面
- 逐块删除页面(块大小由 innodb_buffer_pool_chunk_size 定义)
- 将哈希表、列表和指针转换为使用内存中的新地址
在这些操作中,只有对缓冲池进行碎片整理和撤回页面允许其他线程并发访问缓冲池。
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.
配置文件修改:
[mysqld] innodb_buffer_pool_size=134217728
复制
命令行:
复制
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
【MySQL 30周年庆】MySQL 8.0 OCP考试限时免费!教你免费领考券
墨天轮小教习
1460次阅读
2025-04-25 18:53:11
MySQL 30 周年庆!MySQL 8.4 认证免费考!这次是认真的。。。
严少安
610次阅读
2025-04-25 15:30:58
墨天轮个人数说知识点合集
JiekeXu
459次阅读
2025-04-01 15:56:03
MySQL数据库当前和历史事务分析
听见风的声音
441次阅读
2025-04-01 08:47:17
【活动】分享你的压箱底干货文档,三篇解锁进阶奖励!
墨天轮编辑部
385次阅读
2025-04-17 17:02:24
MySQL 9.3 正式 GA,我却大失所望,新特性亮点与隐忧并存?
JiekeXu
366次阅读
2025-04-15 23:49:58
3月“墨力原创作者计划”获奖名单公布
墨天轮编辑部
338次阅读
2025-04-15 14:48:05
openHalo问世,全球首款基于PostgreSQL兼容MySQL协议的国产开源数据库
严少安
315次阅读
2025-04-07 12:14:29
记录MySQL数据库的一些奇怪的迁移需求!
陈举超
211次阅读
2025-04-15 15:27:53
[MYSQL] 服务器出现大量的TIME_WAIT, 每天凌晨就清零了
大大刺猬
188次阅读
2025-04-01 16:20:44
TA的专栏
热门文章
PostgreSQL 12.8 详解命令pg_rewind
2021-10-29 7112浏览
[译] Postgresql 清理更新频繁的表
2022-04-12 6381浏览
patroni 报错问题处理:CRITICAL: system ID mismatch, node pgsql_node1 belongs to a different cluster: 7052280560147471869 != 7052284163
2022-01-12 5224浏览
patroni 服务启报错:patroni.exceptions.PatroniFatalException
2022-01-10 4973浏览
数据库短连接风暴触发oracle bug 32164034
2021-11-18 4707浏览