<Insert Picture Here>MySQL Performance Schema(OSI, 14th Oct, 2012)Mayank PrasadSr. Software Engineer, MySQL-Oracle
Safe Harbor Statement     The following is intended to outline our general product direction. It is     intended for infor...
Agenda                What is Performance Schema                Origin and Development                Design          ...
Why Performance Schema ??                End user: why is my session stuck ?                MySQL developer: why is this...
What is Performance Schema      Performance Schema is a mechanism to give user a consolidated view      in a tabular forma...
Origin and Development      Development was started by Marc Alff and Peter Gulutzan in 2008.      First introduced in MySQ...
Design         A new storage Engine : Performance Schema.         A new database : Performance Schema (with hard-coded DDL...
Design : Instrumentation8Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Design : Instrumentation contd.       Instrumentation for :                    I/O operations (File I/O, Table I/O, NET I...
Design : Event Waits Instrumentation       Monitored wait events.       Tables & Summary tables.       Instruments naming ...
Design : Event Wait Instrumentation contd.11Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Design : Event Stage Instrumentation       Instrumented stage events.       Tables and Summary Tables.       Instruments n...
Design : Event Stage Instrumentation contd.13Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Design : Event Statements Instrumentation       Instrumented statement events.       Tables and Summary Tables.       Inst...
Design : Event Statements Instrumentation                                       contd.15Copyright © 2012, Oracle and/or it...
Nested Events                                                          Statement                                          ...
Nested Events contd.17Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Design : Timings       Available timers.       Timers setup in Performance       Schema.       Configurable option for any...
Configuration        Compile time:              -DWITH_PERFSCHEMA_STORAGE_ENGINE=1        Server start-up: (enabled in 5.6...
Server Variables         Variables values at the run         time.20Copyright © 2012, Oracle and/or its affiliates. All ri...
Status Variables       Status information of       Performance Schema at run       time.       Used to inspect lost       ...
Tables in Performance Schema        Total 52 tables (only 17 in 5.5)        Main category:        l              setup_tab...
Tables in Performance Schema contd.       setup_consumers23Copyright © 2012, Oracle and/or its affiliates. All rights rese...
Tables in Performance Schema contd.       setup_instruments24Copyright © 2012, Oracle and/or its affiliates. All rights re...
Tables in Performance Schema contd.       events_statements_summary_global_by_event_name25Copyright © 2012, Oracle and/or ...
Example to use PS to diagnose an issue        In a multi threaded scenario, thread_1 is stuck.        l              Find ...
Benefits of Performance Schema       l              Great insight of a running MySQL server.       l              Good gra...
Drawbacks of Performance Schema       Only drawback is impact on performance.       Depends on PS configuration. All enabl...
Whats new in MySQL-5.6       Instrumenting Table I/O.       Instrumenting Table Lock.       Instrumenting NET I/O.       I...
Reference       MySQL documentation:       http://dev.mysql.com/doc/refman/5.6/en/performance-schema.html       PS overhea...
<Insert Picture Here>Thanks for attending!
MySQL at Glance      OSI, October 12-14, Bangalore        Sessions are happening at        10/12 Workshop                 ...
Upcoming SlideShare
Loading in...5
×

OSI_MySQL_Performance Schema

648

Published on

This Presentation I used in OSI-Days conference @ Bangalore on 14th Oct, 2012.

Published in: Lifestyle
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
648
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Transcript of "OSI_MySQL_Performance Schema"

  1. 1. <Insert Picture Here>MySQL Performance Schema(OSI, 14th Oct, 2012)Mayank PrasadSr. Software Engineer, MySQL-Oracle
  2. 2. Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decision. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.2Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  3. 3. Agenda  What is Performance Schema  Origin and Development  Design  Configuration  Server Variables and Status Variables  Tables in Performance Schema  An Example  Benefits of Performance Schema  Drawbacks of Performance Schema  Whats new in MySQL-5.6  Q/A.  Reference3Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  4. 4. Why Performance Schema ??  End user: why is my session stuck ?  MySQL developer: why is this code contended ?  App developer: why is my application slow ?  DBA: why is this table hot ?  Storage: why is this disk spinning ?  Network: why is this link traffic high ?  System: why is the global throughput low ?4Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  5. 5. What is Performance Schema Performance Schema is a mechanism to give user a consolidated view in a tabular format of what is happening behind the scene when MySQL Server is running. Information stored in tables. Can be accessed using SQL interface. Not persistent tables i.e. not stored on disk. Once server is stopped, all information in PS tables is gone.5Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  6. 6. Origin and Development Development was started by Marc Alff and Peter Gulutzan in 2008. First introduced in MySQL-5.5 with minimal functionality. Since then development is on full pace. Next plan GA is MySQL-5.6 with number of new features introduced.6Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  7. 7. Design A new storage Engine : Performance Schema. A new database : Performance Schema (with hard-coded DDL). Instruments and instrumentation points in code. Consumers. Tracking events (Wait, Stage, Statements, Idle). Timings. Dynamic configuration for instruments/consumers.7Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  8. 8. Design : Instrumentation8Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  9. 9. Design : Instrumentation contd. Instrumentation for :  I/O operations (File I/O, Table I/O, NET I/O)  Locking (mutex, rwlocks, table locks)  Waits  Statements  Stages  and so on ...9Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  10. 10. Design : Event Waits Instrumentation Monitored wait events. Tables & Summary tables. Instruments naming convention: wait/io/file|socket|table wait/lock wait/synch/cond|mutex|rwlock10Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  11. 11. Design : Event Wait Instrumentation contd.11Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  12. 12. Design : Event Stage Instrumentation Instrumented stage events. Tables and Summary Tables. Instruments naming convention: stage/<code_area>/<stage_name12Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  13. 13. Design : Event Stage Instrumentation contd.13Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  14. 14. Design : Event Statements Instrumentation Instrumented statement events. Tables and Summary Tables. Instruments naming convention: statement/com|sql14Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  15. 15. Design : Event Statements Instrumentation contd.15Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  16. 16. Nested Events Statement Stage Wait sync, lock, i/o16Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  17. 17. Nested Events contd.17Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  18. 18. Design : Timings Available timers. Timers setup in Performance Schema. Configurable option for any instrument to be timed.18Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  19. 19. Configuration Compile time: -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 Server start-up: (enabled in 5.6 by default) From configuration file: [mysqld] performance_schema=ON/1 performance_schema_consumers_<consumer_name>=on/true/1 performance_schema_events_waits_history_size=<some_number> performance_schema_instruments=<instrument_name=on/true/1 From command line: l --<all_above_options> Runtime: Update performance_schema.setup_consumers set ENABLED=YES where NAME=events_waits_history;19Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  20. 20. Server Variables Variables values at the run time.20Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  21. 21. Status Variables Status information of Performance Schema at run time. Used to inspect lost information.21Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  22. 22. Tables in Performance Schema Total 52 tables (only 17 in 5.5) Main category: l setup_tables l Instance_tables l wait_events_tables l stage_events_tables l statement_event_tables l connection_tables l connection_attribute_tables l summary_tables l miscellaneous_tables22Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  23. 23. Tables in Performance Schema contd. setup_consumers23Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  24. 24. Tables in Performance Schema contd. setup_instruments24Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  25. 25. Tables in Performance Schema contd. events_statements_summary_global_by_event_name25Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  26. 26. Example to use PS to diagnose an issue In a multi threaded scenario, thread_1 is stuck. l Find out what thread 1 is waiting for: l SELECT * FROM events_waits_current WHERE THREAD_ID = thread_1; Say thread1 is waiting for mutex_A (Column OBJECT_INSTANCE_BEGIN). l Find out who has taken mutex_A. l SELECT * FROM mutex_instances WHERE OBJECT_INSTANCE_BEGIN = mutex_A; thread_2 is holding mutex_A. (Column LOCKED_BY_THREAD_ID) l Find out what thread_2 is waiting for: l SELECT * FROM events_waits_current WHERE THREAD_ID = thread_2;26Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  27. 27. Benefits of Performance Schema l Great insight of a running MySQL server. l Good granularity of information (nested events). l Available irrespective of platforms. l User friendly with well known SQL interface. l Multiple summary tables to give consolidated view to user. l Can be configured to meet users need at run time.27Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  28. 28. Drawbacks of Performance Schema Only drawback is impact on performance. Depends on PS configuration. All enable, noticeable hit. Improved significantly in 5.6 and enabled by default. Less then 5% with default instrumentation enabled. Getting better and better …28Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  29. 29. Whats new in MySQL-5.6 Instrumenting Table I/O. Instrumenting Table Lock. Instrumenting NET I/O. Instrumenting Stages. Instrumenting Statements. Multiple summary tables. Host cache. ... and many more.29Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  30. 30. Reference MySQL documentation: http://dev.mysql.com/doc/refman/5.6/en/performance-schema.html PS overhead analysis: http://dimitrik.free.fr/blog/archives/2012/06/mysql-performance-pfs-overhead-in-56.html Blogs : http://marcalff.blogspot.com/ http://www.markleith.co.uk/30Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  31. 31. <Insert Picture Here>Thanks for attending!
  32. 32. MySQL at Glance OSI, October 12-14, Bangalore Sessions are happening at 10/12 Workshop “MySQL Performance Tuning” 10/13 Workshop “MySQL Cluster” 10/14 - 09:45-10:30 Keynote “The State Of The Dolphin” - 10:30-11:15 Session “MySQL Is Exciting Again” - 12:45-13:30 Session “Mysql 5.6 Optimizer Improvements” - 14:15-15:00 Panel Discussion “FOSS Fueled Innovation” - 15:45-16:30 Session “MySQL Cluster With A Mix & Match Of In-Memory Database & No SQL” - 16:30-17:15 Session “MySQL Performance Schema” Come and meet with MySQL Engineers and Experts and join us with “Live Workshop” at our booth!!32Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

×