Introducing a New MySQL Component for Flexible Performance Instrumentation ??
MySQL’s performance_schema provides performance metrics grouped by fixed dimensions like account, host, and user. These are very good, but under some circumstances, folks running MySQL such as myself (and perhaps, you) encounter limitations when needing to get insights into performance by other attributes. For example:
In cases like these, MySQL’s performance schema falls short in terms of grouping metrics based on application-defined attributes.
The Solution: Customizable Query Grouping via Query Comments
To solve this, I created a MySQL component that allows you to group performance metrics by any custom label specified in query comments. Simply add a label like
/* WORKLOAD_NAME=<your_arbitrary_label_here> */
to your queries, and the component will capture key performance metrics grouped by the label. The metrics are cumulative and include:
领英推荐
By capturing these metrics, you can gain valuable insights into query performance tailored to your needs. This component is open-sourced under the GPLv2 license and available on GitHub.
Why You Should Try This
This solution is especially useful for teams managing large applications or those using proxies between their app and MySQL. It enables more granular and flexible query performance analysis, helping database operators and developers optimize their applications.
Check it out, explore the code, and feel free to contribute or raise issues via GitHub. Your feedback is welcome!
Disclaimer: This is my very first MySQL component and I hadn't done any C++ in a long time, but I am happy to improve it based on your input.
Principal Software Engineer at Percona
1 个月I think MySQL has "Query attribute" component to tag a query. https://dev.mysql.com/doc/refman/8.4/en/query-attributes.html Is it possible to extend the query attribute component and make it usable in PFS queries?
Engineering Leader | Optimizing Infrastructure @Booking.com | EMBA at HEC Paris | Server Efficiency | SRE | Finops
1 个月This is ?? I already know some use cases where we can try this.
Shape the future storage of Uber
1 个月Nice Eduardo. Glad to see this come alive. Cannot wait for the next one.
System / Infrastructure Engineer and MySQL Expert
1 个月Very nice Eduardo. Do you have a blog about this I can aggrrgate on Planet for the MySQL Community ? Will you be at FOSDEM (I will, arriving in Brussels Tuesday) ? Cheers, J-F