-
Notifications
You must be signed in to change notification settings - Fork 226
[DOC] PMM Mysql AHI Efficiency advisor check #5686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+52
−1
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6f4dc96
[DOC] Add InnoDB AHI efficiency advisor check topic
catalinaadam 0e4d1c8
added link
catalinaadam ec92a41
Update documentation/docs/advisors/checks/mysql-ahi-efficiency-perfor…
catalinaadam 897d143
Merge branch 'main' into DOC-PMM-mysql-ahi-efficiency-check
catalinaadam f71bde3
fix: replace unsupported "major" severity with "error" in AHI check
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
documentation/docs/advisors/checks/mysql-ahi-efficiency-performance-basic-check.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # InnoDB Adaptive Hash Index (AHI) efficiency check | ||
|
|
||
| ## Description | ||
|
|
||
| MySQL's InnoDB engine can automatically build a hash index in memory on frequently accessed data, this is called the Adaptive Hash Index (AHI). When it works well, the AHI lets MySQL answer queries with a fast hash lookup instead of traversing the full B-tree index, which means lower CPU usage and faster queries. | ||
|
|
||
| This check looks at two things: | ||
|
|
||
| - **how often the AHI is actually helping** (hit ratio): if most lookups still fall back to the B-tree, the AHI isn't doing much. | ||
| - **whether the AHI is causing contention** (latch wait load): under heavy concurrent workloads, multiple threads competing for the AHI's internal lock can slow things down more than the AHI speeds them up. | ||
|
|
||
| You'll see different alert levels depending on what's found: | ||
|
|
||
| - **Notice**: AHI is working normally, or it's disabled. | ||
| - **Warning**: contention is building up and starting to affect performance. | ||
| - **Major**: contention is high enough that the AHI is likely hurting more than helping. Increase AHI partitions or disable AHI altogether. | ||
|
|
||
| ## Resolution | ||
|
|
||
| ### If you're seeing Warning or Major alerts | ||
|
|
||
| Increase the number of AHI partitions. This splits the internal lock across more structures, reducing contention: | ||
|
|
||
| ```sql | ||
| SET GLOBAL innodb_adaptive_hash_index_parts = 16; | ||
| ``` | ||
|
|
||
| To make it permanent, add it to your MySQL configuration file and restart: | ||
|
|
||
| ```ini | ||
| [mysqld] | ||
| innodb_adaptive_hash_index_parts = 16 | ||
| ``` | ||
|
|
||
| If contention is still high after increasing partitions, disabling the AHI entirely is worth testing: | ||
|
|
||
| ```sql | ||
| SET GLOBAL innodb_adaptive_hash_index = OFF; | ||
| ``` | ||
|
|
||
| Benchmark your workload with it off to see if performance improves. | ||
|
|
||
| ### If the AHI is disabled | ||
|
|
||
| Consider turning it on and watching the **InnoDB Adaptive Hash Index** panel on the [MySQL InnoDB Details](../../reference/dashboards/dashboard-mysql-innodb-details.md) dashboard. The AHI is most useful for read-heavy workloads that repeatedly access the same index data. | ||
|
|
||
| ## Need more support from Percona? | ||
|
|
||
| Percona experts bring years of experience in tackling tough database performance issues and design challenges. | ||
|
|
||
| <div data-tf-live="01JKGYABNVYHQ8A91QNW69A9TP"></div><script src="//embed.typeform.com/next/embed.js"></script> | ||
|
catalinaadam marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Can you check if the "Major" alert level is used in our code base?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Major" is not a supported severity level. The supported levels (defined in
managed/pi/common/severity.go) are:emergency,alert,critical,error,warning,notice,info,debug. Passing"major"toParseSeverity()would silently returnUnknown(0).Fixed in the latest commit by replacing
"major"with"error"in both the check YAML (mysql_ahi_efficiency_performance_basic_check.yml) and the documentation.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Tusamarco Could you please review this fix? Do we want the severity to be set to "error" or "critical" in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in my opinin:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ademidoff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, we can change the severity to "warning" on line 123, but then there will be no difference between two branches: this one and the one above.
I think we need to refactor the code here, since not all branches are present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ademidoff @Tusamarco - Mariana Bonsignore needs this topic live by the end of the month. do you think we could refactor the code and merge by then?