This section provides a brief introduction to
InnoDB integration with Performance Schema. For
comprehensive Performance Schema documentation, see
Chapter 22, MySQL Performance Schema.
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 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_schema tables 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 view
InnoDB-related instruments, you can query the
setup_instruments table 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 | NO | NO |
| wait/synch/mutex/innodb/innobase_share_mutex | NO | NO |
| wait/synch/mutex/innodb/autoinc_mutex | NO | NO |
| wait/synch/mutex/innodb/buf_pool_mutex | NO | NO |
| wait/synch/mutex/innodb/buf_pool_zip_mutex | NO | NO |
| wait/synch/mutex/innodb/cache_last_read_mutex | NO | NO |
| wait/synch/mutex/innodb/dict_foreign_err_mutex | NO | NO |
| wait/synch/mutex/innodb/dict_sys_mutex | NO | NO |
| wait/synch/mutex/innodb/file_format_max_mutex | NO | NO |
| wait/synch/mutex/innodb/fil_system_mutex | NO | NO |
| wait/synch/mutex/innodb/flush_list_mutex | NO | NO |
| wait/synch/mutex/innodb/fts_bg_threads_mutex | NO | NO |
| wait/synch/mutex/innodb/fts_delete_mutex | NO | NO |
| wait/synch/mutex/innodb/fts_optimize_mutex | NO | NO |
...
| wait/synch/rwlock/innodb/btr_search_latch | NO | NO |
| wait/synch/rwlock/innodb/dict_operation_lock | NO | NO |
| wait/synch/rwlock/innodb/fil_space_latch | NO | NO |
| wait/synch/rwlock/innodb/checkpoint_lock | NO | NO |
| wait/synch/rwlock/innodb/fts_cache_rw_lock | NO | NO |
| wait/synch/rwlock/innodb/fts_cache_init_rw_lock | NO | NO |
| wait/synch/rwlock/innodb/trx_i_s_cache_lock | NO | NO |
| wait/synch/rwlock/innodb/trx_purge_latch | NO | NO |
| wait/synch/rwlock/innodb/index_tree_rw_lock | NO | NO |
| wait/synch/rwlock/innodb/index_online_log | NO | NO |
| wait/synch/rwlock/innodb/dict_table_stats | NO | NO |
| wait/synch/rwlock/innodb/hash_table_locks | NO | NO |
| wait/synch/cond/innodb/commit_cond | NO | NO |
| 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 |
+-------------------------------------------------------+---------+-------+
62 rows in set (0.00 sec)
For additional information about the instrumented
InnoDB objects, you can query Performance
Schema
instances
tables, which provide additional information about
instrumented objects. Instance tables relevant to
InnoDB include:
The mutex_instances table
The rwlock_instances table
The cond_instances table
The file_instances table
Mutexes and RW-locks related to the InnoDB
buffer pool are not included in this coverage; the same
applies to the output of the SHOW ENGINE INNODB
MUTEX command.
For example, to view information about instrumented
InnoDB file 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.6/data/ibdata1
EVENT_NAME: wait/io/file/innodb/innodb_data_file
OPEN_COUNT: 2
*************************** 2. row ***************************
FILE_NAME: /path/to/mysql-5.6/data/ib_logfile0
EVENT_NAME: wait/io/file/innodb/innodb_log_file
OPEN_COUNT: 2
*************************** 3. row ***************************
FILE_NAME: /path/to/mysql-5.6/data/ib_logfile1
EVENT_NAME: wait/io/file/innodb/innodb_log_file
OPEN_COUNT: 2
...
You should be familiar with
performance_schema tables that store
InnoDB event data. Tables relevant to
InnoDB-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 clause WHERE EVENT_NAME LIKE
'%innodb%' or WHERE NAME LIKE
'%innodb%' (as required) when querying these tables.