analyze_buffer_pool
它能做什么
这项技能检查 MySQL 或 MariaDB 服务器对 InnoDB 内存缓存的利用效率。适合想知道服务器是否需要更多内存或不同配置的数据库管理员。
适用场景
- ✓当你的 MySQL 或 MariaDB 服务器运行缓慢,并怀疑是内存或磁盘读取造成的时候。
- ✓当你想知道 InnoDB 缓冲池的大小对你的服务器是否合适时。
- ✓当你发现写入停顿的迹象,并希望了解其原因时。
技能链接
https://github.com/major/MySQLTuner-perl/blob/master/.agent/skills/analyze-buffer-pool/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请检查我的 MySQL 缓冲池是否足够大,并告诉我应设置多大。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会在不做任何更改的情况下读取服务器的统计信息,计算缓存命中率和脏页比例,并根据可用内存给出建议的大小。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
AI Skill: InnoDB Buffer Pool Sizing & Efficiency Analysis
🧠 Purpose & Operational Objectives
The analyze_buffer_pool skill enables autonomous DBA agents to diagnose memory pressure, caching efficiency, and dirty page write stalls in the InnoDB storage engine.
📋 Preconditions & Context
- Server running MySQL 5.5+ or MariaDB 10.0+ with InnoDB enabled.
- Database connectivity established or cached audit state available.
- Read-only execution: does not execute any modifying statements directly.
🛠️ Input Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
target_ram_percentage |
number | No | 75 |
Target percentage of available host RAM dedicated to InnoDB (50-85%). |
include_dirty_pages |
boolean | No | true |
Include dirty page write stall analysis. |
📊 Evaluation Criteria & Thresholds
- Hit Ratio: $\frac{\text{read_requests} - \text{reads}}{\text{read_requests}} \times 100$
- $\ge 99%$: OPTIMAL
- $95% - 99%$: ACCEPTABLE
- $< 95%$: UNDERSIZED (Generates disk I/O bottleneck)
- Dirty Page Ratio: $\frac{\text{pages_dirty}}{\text{pages_total}} \times 100$
- $> 75%$: DIRTY_STALL (Risk of checkpoint flushing stalls)
- Instance Partitioning:
- For buffer pools $> 1\text{GB}$, recommend
innodb_buffer_pool_instances$\ge 8$.
- For buffer pools $> 1\text{GB}$, recommend
🛡️ Guardrails & Safety
- All recommendations specify exact SQL (
SET GLOBAL ...) and rollback SQL. - Changes requiring restart (e.g.
innodb_buffer_pool_instanceson older MySQL) are explicitly flagged withrequires_restart: true.
常见问题
这会更改我的数据库设置吗?
不会。它只读取统计信息并提出建议。
多少的命中率算好?
这项技能将 99% 或更高视为最佳,低于 95% 视为容量不足。
它支持哪些版本?
MySQL 5.5 或更高版本,以及 MariaDB 10.0 或更高版本,并需启用 InnoDB。
详情
作者的原始描述
Deeply analyzes InnoDB Buffer Pool efficiency, hit ratio, memory allocation, and instance concurrency to recommend optimal sizing.
repo: major/MySQLTuner-perl
热度
- GitHub 星标
- 9.5k
- 排名
- #12276
- 许可证
- GPL-3.0
- 更新时间
- 2026/10/28
评论
- …