This section provides a brief introduction to
InnoDB integration with Performance Schema. For
comprehensive Performance Schema documentation, see
Chapter 22, MySQL Performance Schema.
Starting with InnoDB 1.1 with MySQL 5.5, you can profile certain
internal InnoDB operations using the MySQL
Performance Schema
feature. This type of tuning is primarily for expert users
who evaluate optimization strategies to overcome performance
bottlenecks. DBAs can also use this feature for capacity planning,
to see whether their typical workload encounters any performance
bottlenecks with a particular combination of CPU, RAM, and disk
storage; and if so, to judge whether performance can be improved by
increasing the capacity of some part of the system.
To use this feature to examine InnoDB
performance:
You must be running MySQL 5.5 or higher with the Performance Schema feature available and enabled, as described in Section 22.2, “Performance Schema Build and Startup Configuration”. Since the Performance Schema feature introduces some performance overhead, you should use it on a test or development system rather than on a production system.
You must be running InnoDB 1.1 or higher.
You must be generally familiar with how to use the Performance Schema feature. For example, you should know how enable instruments and consumers, and how to query
performance_schematables to retrieve data. For an introductory overview, see Section 22.1, “Performance Schema Quick Start”.You should be familiar with Performance Schema instruments that are available for
InnoDB. To viewInnoDB-related instruments, you can query thesetup_instrumentstable for instrument names that contain 'innodb'.mysql>
SELECT * FROM setup_instruments WHERE NAME LIKE '%innodb%';+-------------------------------------------------------+---------+-------+ | NAME | ENABLED | TIMED | +-------------------------------------------------------+---------+-------+ | wait/synch/mutex/innodb/commit_cond_mutex | YES | YES | | wait/synch/mutex/innodb/innobase_share_mutex | YES | YES | | wait/synch/mutex/innodb/prepare_commit_mutex | YES | YES | | wait/synch/mutex/innodb/autoinc_mutex | YES | YES | | wait/synch/mutex/innodb/btr_search_enabled_mutex | YES | YES | | wait/synch/mutex/innodb/buf_pool_mutex | YES | YES | | wait/synch/mutex/innodb/buf_pool_zip_mutex | YES | YES | | wait/synch/mutex/innodb/cache_last_read_mutex | YES | YES | | wait/synch/mutex/innodb/dict_foreign_err_mutex | YES | YES | | wait/synch/mutex/innodb/dict_sys_mutex | YES | YES | | wait/synch/mutex/innodb/file_format_max_mutex | YES | YES | ... | wait/synch/rwlock/innodb/btr_search_latch | YES | YES | | wait/synch/rwlock/innodb/dict_operation_lock | YES | YES | | wait/synch/rwlock/innodb/fil_space_latch | YES | YES | | wait/synch/rwlock/innodb/checkpoint_lock | YES | YES | | wait/synch/rwlock/innodb/trx_i_s_cache_lock | YES | YES | | wait/synch/rwlock/innodb/trx_purge_latch | YES | YES | | wait/synch/rwlock/innodb/index_tree_rw_lock | YES | YES | | wait/synch/rwlock/innodb/dict_table_stats | YES | YES | | wait/synch/cond/innodb/commit_cond | YES | YES | | wait/io/file/innodb/innodb_data_file | YES | YES | | wait/io/file/innodb/innodb_log_file | YES | YES | | wait/io/file/innodb/innodb_temp_file | YES | YES | +-------------------------------------------------------+---------+-------+ 46 rows in set (0.00 sec)For additional information about the instrumented
InnoDBobjects, you can query Performance Schema instances tables, which provide additional information about instrumented objects. Instance tables relevant toInnoDBinclude:The
mutex_instancestableThe
rwlock_instancestableThe
cond_instancestableThe
file_instancestable
NoteMutexes and RW-locks related to the
InnoDBbuffer pool are not included in this coverage; the same applies to the output of theSHOW ENGINE INNODB MUTEXcommand.For example, to view information about instrumented
InnoDBfile objects seen by the Performance Schema when executing file I/O instrumentation, you might issue the following query:mysql>
SELECT * FROM file_instances WHERE EVENT_NAME LIKE '%innodb%'\G*************************** 1. row *************************** FILE_NAME: /path/to/mysql-5.5/data/ibdata1 EVENT_NAME: wait/io/file/innodb/innodb_data_file OPEN_COUNT: 1 *************************** 2. row *************************** FILE_NAME: /path/to/mysql-5.5/data/ib_logfile0 EVENT_NAME: wait/io/file/innodb/innodb_log_file OPEN_COUNT: 1 *************************** 3. row *************************** FILE_NAME: /path/to/mysql-5.5/data/ib_logfile1 EVENT_NAME: wait/io/file/innodb/innodb_log_file OPEN_COUNT: 1You should be familiar with
performance_schematables that storeInnoDBevent data. Tables relevant toInnoDB-related events include:The Wait Event tables, which store wait events.
The Summary tables, which provide aggregated information for terminated events over time. Summary tables include file I/O summary tables, which aggregate information about I/O operations.
If you are only interested in
InnoDB-related objects, use the clauseWHERE EVENT_NAME LIKE '%innodb%'orWHERE NAME LIKE '%innodb%'(as required) when querying these tables.