Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Geek Sync | Top Metrics to Monitor in Your MySQL Databases


Published on

As tables increase in size and more users come online, it becomes increasingly necessary to fine-tune your MySQL database server from time to time. The secret to knowing what adjustments need to be made is to perform regular monitoring. Most databases offer dozens, if not hundreds, of performance metrics that you can assess. Tracking the most useful metrics and reviewing them in the most informative way(s) strikes a balance between over-monitoring and firefighting unforeseen crises.

Join IDERA and Shree Nair as he walks through some tricks of the trade to be as performant as possible and make your life easier as a MySQL user. This is an interactive Geek Sync you will not want to miss!

About Shree: Shree Nair is Director of Technology Partnerships at IDERA. Shree has an exceptional track record in innovation, partner management, solution development, and global team leadership. He is the former Product Manager of Webyog's MySQL tools. Under his direction, Webyog performed a complete overhaul of the product and business systems to target a wide range of industries worldwide and expanded customer base beyond 30,000 customers. Shree believes monitoring MySQL should be easy and he continually seeks opportunities to make MySQL user's life easy. Shree earned a Master's at Coventry University, England.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Geek Sync | Top Metrics to Monitor in Your MySQL Databases

  1. 1. Top Metrics to Monitor in Your MySQL Databases
  2. 2. We will focus on these ● Examine the benefits of performance monitoring ● Outline the main performance metric categories ● List the monitoring tools provided by MySQL: ○ Server variables ○ Performance schema ○ Sys schema ● Learn how to monitor: ○ Transaction throughput ○ Query execution performance ○ Database Connections ○ Buffer Pool Metrics
  3. 3. Benefits of Following a Monitoring Plan ● Performance Improvements ● Sustain Growth ● Tighten Security
  4. 4. Database Metric Types ● What are metrics? ● Two important categories of metrics are: ○ Those that are most useful in identifying problems, and ○ Those whose primary value is in investigating problems.
  5. 5. How Often Should Monitoring Be Performed? • How mission-critical your database and the application(s) it supports are • You can reduce your need to constantly monitor your performance dashboard to a weekly inspection • Database performance metrics should be monitored by specialized tools that provide real-time and/or periodic alerts • The DBAs, IT operations staff, and users have shared responsibility in performance monitoring
  6. 6. Performance Metrics Categories
  7. 7. Work Metrics • Throughput • Success • Error • Performance
  8. 8. Resource Metrics • Utilization • Saturation • Errors • Availability
  9. 9. Monitoring Performance 1. Work metrics: ○ Database/transaction/query throughput ○ Query execution performance 1. Resource metrics: ○ Connections ○ Buffer pool usage
  10. 10. Throughput ● “Write” transactions vs. “read” transactions ● Sustained rates vs. peak rates ● A 10-byte row vs. a 1000-byte row Due to these differences, it is best to measure: ● Database throughput (the database as a whole) ● Transaction throughput (any operation) ● Query throughput (query execution)
  11. 11. Throughput Metrics in MySQL The Questions and Queries Status Variables Monitor the breakdown of read and write commands
  12. 12. Throughput Metrics in MySQL The Threads_running Status Variable The Slow_queries Server Variable
  13. 13. Throughput Metrics in MySQL Many key metrics are contained in the performance schema’s events_statements_summary_by_digest table. This query finds the top 10 statements by longest average run time:
  14. 14. Throughput Metrics in MySQL Performance schemas display event timer information in picoseconds (trillionths of a second) to present timing data in a standard unit. In the following example, TIMER_WAIT values are divided by 1,000,000,000,000 to convert time data into seconds:
  15. 15. Throughput Metrics in MySQL The sys Schema: ● It contains easily interpretable table for inspecting your performance data ● The sys schema provides an organized set of metrics in a more human-readable format, making the corresponding queries much simpler ● For instance, to find the slowest statements (those in the 95th percentile by runtime), run the following query:
  16. 16. Connections ● Connection manager threads handle client connection requests on the network interfaces that the server listens to ● On all platforms, one manager thread handles TCP/IP connection requests ● Connection manager threads associate each client connection with a thread dedicated to it that handles authentication and request processing for that connection ● It’s important to monitor your client connections because once the database server runs out of available connections, new client connections are refused!
  17. 17. Connections ● The MySQL connection limit defaults to 151, but it can be changed using the SET statement, so it’s best to not assume anything. The connection limit is stored in the @@max_connections variable: ● To permanently set the connection limit so that it persists once the server is restarted, add a line like this to your my.cnf configuration file:
  18. 18. Connections A few good metrics for monitoring your connections:
  19. 19. Connections Aborted Client and Connections- Unsuccessful connection attempts can occur for the following reasons: ● A client attempts to access a database but has no privileges for it ● A client uses an incorrect password ● A connection packet does not contain the right information ● It takes more than connect_timeout seconds to obtain a connect packet
  20. 20. Connections Connection Errors: MySQL does an outstanding job of breaking down metrics on connection errors into different status variables:
  21. 21. Buffer Pool Usage ● The buffer pool defaults to a relatively small 128MB ● The larger the buffer pool, the more InnoDB acts like an in-memory database, reading data from disk once and then accessing the data from memory during subsequent reads ● InnoDB’s memory overhead can increase the memory footprint by about 10 percent beyond the allotted buffer pool size ● Once the physical memory is exhausted, your system will resort to paging and performance will suffer significantly. Hence, if database performance starts to degrade while disk I/O is rising, it might be time to expand the buffer pool
  22. 22. Conclusion ● Monitor your databases and applications effectively ● There are two important categories of metrics: identifying and investigating problems ● How often you monitor different aspects of your database depends on how mission-critical it and the application(s) that it supports are ● Two important performance metrics: work metrics and resource metrics
  23. 23. Conclusion ● There are two general MySQL status variables for measuring query execution: questions and queries ● MySQL provides a few options for monitoring query latency, including its built-in metrics and the performance schema ● Many key metrics are contained in the performance schema’s events_statements_summary_by_digest table
  24. 24. Conclusion ● It’s important to monitor your client connections ● Every time a client is unable to connect, the server increments the Aborted_connects status variable ● Fine-grained connection metrics such as Connection_errors_max_connections and Connection_errors_internal can be instrumental in pinpointing the source of connection problems ● MySQL’s default storage engine, InnoDB, uses a special storage area called the buffer pool to cache data for tables and indexes