MySQL 8.0中InnoDB Buffer Pool Size进度更透明
来源:51cto
时间:2023-05-04 06:37:45 192浏览 收藏
今日不肯埋头,明日何以抬头!每日一句努力自己的话哈哈~哈喽,今天我将给大家带来一篇《MySQL 8.0中InnoDB Buffer Pool Size进度更透明》,主要内容是讲解MySQL、变量、状态等等,感兴趣的朋友可以收藏或者有更好的建议在评论提出,我都会认真看的!大家一起进步,一起学习!
从MySQL 5.7开始,支持在线动态调整 innodb buffer pool,并为此新增了一个状态变量 Innodb_buffer_pool_resize_status,可以通过观察它了解调整buffer pool过程中的一些状态,例如 Resizing also other hash tables. 或 Completed resizing buffer pool at 230131 15:57:03.。
从8.0.31开始,针对innodb buffer pool在线动态resize特性,新增了下面两个状态变量,可以更方便透明观察resize的进度:
状态变量 | 解释 |
Innodb_buffer_pool_resize_status_code | buffer pool resize状态码,共有以下几种不同值: - 0: No Resize operation in progress - 1: Starting Resize - 2: Disabling AHI (Adaptive Hash Index) - 3: Withdrawing Blocks,清除/降低buffer pool pages(主要针对buffer pool缩小的情况) - 4: Acquiring Global Lock - 5: Resizing Pool - 6: Resizing Hash - 7: Resizing Failed |
Innodb_buffer_pool_resize_status_progress | 报告当前resize的进度,用百分比进度条方式展示,数值范围从0-100 |
我们可以通过 Innodb_buffer_pool_resize_status_code 报告的状态码,了解当前的状态,以及是否出现报错等情况。
状态变量 Innodb_buffer_pool_resize_status_progress 可以实时查看当前resize的百分比进度,当有多个buffer pool instance时,每完成一个instance resize,该值就会更新一次。每当 Innodb_buffer_pool_resize_status_code 状态码变化一次,则 progress 的进度百分比会被重置为0,重新开始。当整个buffer pool都resize完成后,最终显示100。
接下来,我们找个正在跑sysbench压测中的实例,对其在线调整buffer pool看看这几个状态变量分别是怎样的。压测期间,在另一个窗口跑下面的命令观察:
$ while [ 1 ] ; do mysqladmin ext | grep -i Innodb_buffer_pool_resi | sed 's/ //g'; sleep 0.5; echo ; echo; done
...
|Innodb_buffer_pool_resize_status|bufferpool7:withdrawingblocks.(112590/122869)|
|Innodb_buffer_pool_resize_status_code|3|
|Innodb_buffer_pool_resize_status_progress|0|
...
|Innodb_buffer_pool_resize_status|bufferpool7:resizingwithchunks16to1.|
|Innodb_buffer_pool_resize_status_code|5|
|Innodb_buffer_pool_resize_status_progress|87|
...
|Innodb_buffer_pool_resize_status|Completedresizingbufferpoolat2302029:58:50.|
|Innodb_buffer_pool_resize_status_code|0|
|Innodb_buffer_pool_resize_status_progress|100|
此外,还可以从日志文件中查看详细过程:
09:56:20.275388+08:00 30 .. Resizing buffer pool from 17179869184 to 8589934592 (unit=134217728). (new size: 8589934592 bytes)
09:56:20.275397+08:00 0 .. Status code 1: Resizing buffer pool from 17179869184 to 8589934592 (unit=134217728).
09:56:20.275417+08:00 0 .. Status code 1: 12% complete
09:56:20.275422+08:00 0 .. Status code 1: 25% complete
...
09:56:20.275439+08:00 0 .. Status code 1: 100% complete
09:56:20.275443+08:00 0 .. Status code 1: Completed
09:56:20.275446+08:00 0 .. Status code 2: Disabling adaptive hash index.
09:56:20.286907+08:00 0 .. disabled adaptive hash index.
09:56:20.286939+08:00 0 .. Status code 2: 12% complete
09:56:20.286943+08:00 0 .. Status code 2: 25% complete
...
09:56:20.286963+08:00 0 .. Status code 2: 100% complete
09:56:20.286966+08:00 0 .. Status code 2: Completed
09:56:20.286970+08:00 0 .. Status code 3: Withdrawing blocks to be shrunken.
09:56:20.286974+08:00 0 .. buffer pool 0 : start to withdraw the last 65530 blocks.
09:56:20.288848+08:00 0 .. Status code 3: buffer pool 0 : withdrawing blocks. (52526/65530)
09:56:20.288865+08:00 0 .. buffer pool 0 : withdrew 52512 blocks from free list. Tried to relocate 14 pages (52526/65530).
...
09:56:20.288934+08:00 0 .. Status code 3: buffer pool 0 : withdrawing blocks. (52526/65530)
09:56:20.288937+08:00 0 .. buffer pool 0 : withdrew 0 blocks from free list. Tried to relocate 0 pages (52526/65530).
09:56:20.288941+08:00 0 .. buffer pool 0 : will retry to withdraw later.
09:56:20.288951+08:00 0 .. buffer pool 1 : start to withdraw the last 65530 blocks.
09:56:20.290815+08:00 0 .. Status code 3: buffer pool 1 : withdrawing blocks. (53263/65530)
09:56:20.290824+08:00 0 .. buffer pool 1 : withdrew 53249 blocks from free list. Tried to relocate 14 pages (53263/65530). -- 尝试释放buffer pages失败,将继续重试
...
09:56:27.305382+08:00 0 .. buffer pool 7 : withdrew 0 blocks from free list. Tried to relocate 0 pages (54852/65530).
09:56:27.305385+08:00 0 .. buffer pool 7 : will retry to withdraw later.
09:56:27.305388+08:00 0 .. Will retry to withdraw 8 seconds later.
09:56:29.047052+08:00 0 .. Page cleaner took 12405ms to flush 83911 and evict 0 pages
09:56:35.305806+08:00 0 .. buffer pool 0 : start to withdraw the last 65530 blocks.
09:56:35.333782+08:00 0 .. Status code 3: buffer pool 0 : withdrawing blocks. (65530/65530)
09:56:35.333813+08:00 0 .. buffer pool 0 : withdrew 0 blocks from free list. Tried to relocate 13004 pages (65530/65530).
09:56:35.334245+08:00 0 .. buffer pool 0 : withdrawn target 65530 blocks.
09:56:35.334253+08:00 0 .. Status code 3: 12% complete
...
09:56:35.515813+08:00 0 .. Status code 3: 100% complete
09:56:35.515817+08:00 0 .. Status code 3: Completed
09:56:35.515821+08:00 0 .. Status code 4: Latching whole of buffer pool.
09:56:35.515824+08:00 0 .. Status code 4: 14% complete
09:56:35.515827+08:00 0 .. Status code 4: 28% complete
09:56:35.515838+08:00 0 .. Status code 4: 42% complete
09:56:35.515842+08:00 0 .. Status code 4: 57% complete
09:56:35.515845+08:00 0 .. Status code 4: 71% complete
09:56:35.515848+08:00 0 .. Status code 4: 85% complete
09:56:35.515851+08:00 0 .. Status code 4: 100% complete
09:56:35.515862+08:00 0 .. Status code 4: Completed
09:56:35.515865+08:00 0 .. Status code 5: Starting pool resize
09:56:35.515868+08:00 0 .. Status code 5: buffer pool 0 : resizing with chunks 16 to 8.
09:56:35.533458+08:00 0 .. buffer pool 0 : 8 chunks (65530 blocks) were freed.
09:56:35.533477+08:00 0 .. Status code 5: 12% complete
...
09:56:35.639495+08:00 0 .. Status code 5: buffer pool 7 : resizing with chunks 16 to 8.
09:56:35.655714+08:00 0 .. buffer pool 7 : 8 chunks (65530 blocks) were freed.
09:56:35.655732+08:00 0 .. Status code 5: 100% complete
09:56:35.655746+08:00 0 .. Completed to resize buffer pool from 17179869184 to 8589934592.
09:56:35.655750+08:00 0 .. Re-enabled adaptive hash index.
09:56:35.655755+08:00 0 .. Status code 5: Completed
09:56:35.655758+08:00 0 .. Status code 0: Completed resizing buffer pool at 230202 9:56:35.
09:56:35.655761+08:00 0 .. Status code 0: 100% complete
以上就是《MySQL 8.0中InnoDB Buffer Pool Size进度更透明》的详细内容,更多关于mysql的资料请关注golang学习网公众号!
-
499 收藏
-
244 收藏
-
235 收藏
-
157 收藏
-
101 收藏
-
475 收藏
-
266 收藏
-
273 收藏
-
283 收藏
-
210 收藏
-
371 收藏
-
- 前端进阶之JavaScript设计模式
- 设计模式是开发人员在软件开发过程中面临一般问题时的解决方案,代表了最佳的实践。本课程的主打内容包括JS常见设计模式以及具体应用场景,打造一站式知识长龙服务,适合有JS基础的同学学习。
- 立即学习 542次学习
-
- GO语言核心编程课程
- 本课程采用真实案例,全面具体可落地,从理论到实践,一步一步将GO核心编程技术、编程思想、底层实现融会贯通,使学习者贴近时代脉搏,做IT互联网时代的弄潮儿。
- 立即学习 507次学习
-
- 简单聊聊mysql8与网络通信
- 如有问题加微信:Le-studyg;在课程中,我们将首先介绍MySQL8的新特性,包括性能优化、安全增强、新数据类型等,帮助学生快速熟悉MySQL8的最新功能。接着,我们将深入解析MySQL的网络通信机制,包括协议、连接管理、数据传输等,让
- 立即学习 497次学习
-
- JavaScript正则表达式基础与实战
- 在任何一门编程语言中,正则表达式,都是一项重要的知识,它提供了高效的字符串匹配与捕获机制,可以极大的简化程序设计。
- 立即学习 487次学习
-
- 从零制作响应式网站—Grid布局
- 本系列教程将展示从零制作一个假想的网络科技公司官网,分为导航,轮播,关于我们,成功案例,服务流程,团队介绍,数据部分,公司动态,底部信息等内容区块。网站整体采用CSSGrid布局,支持响应式,有流畅过渡和展现动画。
- 立即学习 484次学习