Quantcast
Channel: Planet MySQL
Viewing all articles
Browse latest Browse all 18766

Feature Preview: Anemometer and MySQL 5.6

$
0
0

MySQL 5.6 has some pretty cool features in its performance_schema.  Some of the additions allow the server to collect and aggregate detailed information about query execution from queries as they flow through the server.

This gives you the ability to get nearly the same level of detail found in the slow query log, but in real time. You don't have to sample your slow query logs, and process them with external scripts anymore to get great query performance data.  Now there are things I still like about the slow query logs, but I'll discuss those another time.

Mark Leith blogged about this new feature, and shows how you can use some basic queries to display a report on the mysql command line.

Since then, I've been working on adding support for this in Anemometer.  The result is available as a preview feature in a new branch.

Using this is as easy as enabling support for performance schema in your mysql instance, then simply adding a new datasource in conf/config.inc.php file that points to the mysql server.  Anemometer will read and report directly from the performance_schema.events_statements_by_digest table.

However, that table only contains the current snapshot of data for your server.  There's no history of aggregated statistics, so much of the interface is disabled in this mode.  But, with only a little work, you can use peformance_schema data to create your own history that looks much like the pt-query-digest tables report and report_history, where report contains the unique set of queries found, and the report_history table contains a set of aggregated query statistics in intervals of time slices.

I've provided a couple .sql files to do this:
mysql56-install.sql will create a database called slow_query_log with two tables: events_statements, and events_statements_history

mysql56-save_history.sql is use to "rotate" the data in the performance_schema.events_statements_by_digest table.  It will take the current data there, save it to these new history tables, then truncate the digest table to reset the data collection.

That way you can enjoy pretty much all the same functionality that comes from parsing the slow query log with pt-query-digest and saving that data to a table.

With a little more work, you could aggregate the data from many hosts like this and put it all in one central location.
Note that the are new examples and new configuration parameters in the sample.config.inc.php If you're already using Anemometer, you'll have to merge the new stuff into your copy. Let me know if you have any questions about how to do that.

PlanetMySQL Voting: Vote UP / Vote DOWN

Viewing all articles
Browse latest Browse all 18766

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>