mysql 5.7: performance schema improvements

68
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 1

Upload: mark-leith

Post on 26-Jan-2015

131 views

Category:

Technology


2 download

DESCRIPTION

Improvements made within MySQL 5.7 for Performance Schema.

TRANSCRIPT

Page 1: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 121

Page 2: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 122

MySQL 5.7: Performance Schema ImprovementsMark LeithSenior Software Development Manager

MySQL @ Oracle

Page 3: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.3

Program Agenda

What is Performance Schema anyway?Performance Schema in MySQL 5.5 & MySQL 5.6Improvements made to date in MySQL 5.7Things still to comeQuestions (or ask along the way)

Page 4: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.4

Know Your Audience

Using 5.1 (yes, still)?Using 5.5 (but I’ll upgrade soon, honest)?Using 5.6?Using … 5.7?Used Performance Schema?#monitoringlove#monitoringhate

Page 5: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.5

What is Performance Schema anyway?

Page 6: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.6

What is Performance Schema anyway?

Introduced in MySQL 5.5A storage engine, built for recording instrumentation

– PERFORMANCE_SCHEMA

– Manages fixed buffers in memory with lock free hashes

– Real engine, unlike INFORMATION_SCHEMA

A database schema to expose the instrumentation– performance_schema

A set of interfaces in the MySQL Server wrapping calls to trace– i.e. pthread_mutex_lock() -> mysql_mutex_lock()

Page 7: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.7

What is Performance Schema anyway?

Records latency of events that happen within the serverAll latency exposed to picosecond precision

– Though tracked at different precisions internally

Also tracks other information as appropriate– Bytes, source position, object metadata, etc.

Page 8: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.8

Performance Schema in MySQL 5.5 & MySQL 5.6

Page 9: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.9

Performance Schema in MySQL 5.5

Laid out the framework for instrumentationFocused early on low level instruments

– Prove it could handle load, build from ground up

Not turned on by default, had some overhead issues

Page 10: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.10

Performance Schema in MySQL 5.5

17 Tables222 Instruments

Instrument Event Class

File IO wait/io/file/%

Mutexeswait/synch/

mutex/%Read/Write

Lockswait/synch/

rwlock/%

Conditionswait/synch/

cond/%

Page 11: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.11

Performance Schema in MySQL 5.5

Page 12: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.12

Performance Schema in MySQL 5.6

Fixed lots of performance issuesFocused on bringing the instrumentation to the DBA / Developer

Statements / Statement DigestsExecution StagesObject tracking (table / index IO, table locks)Network IO

Turned on by default, with a subset of instrumentation disabled

Page 13: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.13

Performance Schema in MySQL 5.6

52 Tables (+35)545 Instruments (+323)

Instrument Type Event Class

Statements statement/%Stages stage/%

Table IOwait/io/

table/%Table

Lockswait/lock/

table/%

Network IOwait/io/

socket/%Idle Timing idle

Page 14: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.14

Performance Schema in MySQL 5.6

Page 15: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1215

“I really think Performance Schema overhead is reasonable for most workloads. … On my old server I got some 20.2K QPS with Performance Schema Disabled and 19.4 QPS with Performance Schema enabled which is overhead of less than 5%.For most workloads paying 5% to have insight about what is happening with the system is a very fair trade.”

Peter Zaitsev, CEO, Percona

http://www.mysqlperformanceblog.com/2014/02/11/performance_schema-vs-slow-query-log/

Page 16: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.16

Improvements made to date in MySQL 5.7

Page 17: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12

Insert Picture Here

17

Memory UsageMetadata LockingReplication Configuration & StatusPrepared StatementsTransactionsStored Programs

Page 18: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.18

Improvements made to date in MySQL 5.7

75 Tables (+23)784 Instruments (+239)

Instrument Type Event Class

Transactions transaction

Memory memory/%

Metadata Locks wait/lock/metadata/%

Page 19: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.19

Improvements made to date in MySQL 5.7

Page 20: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.20

WL#3249PERFORMANCE SCHEMA, Instrument memory usage

Page 21: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1221

“Understanding where MySQL can allocate memory can help us to find the cause in most cases. It is not as straightforward as it should be and I’m very hopeful future releases of MySQL, MariaDB or Drizzle bring improvements in this space allowing us to see directly for what purpose memory is allocated and so detect all kinds of memory usage problems easier.”

Peter Zaitsev, CEO, Percona

http://www.mysqlperformanceblog.com/2012/03/21/troubleshooting-mysql-memory-usage/

Page 22: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.22

Instrument memory usage

Added 212 different memory instrumentation types so farRecords current, high and low water marks of allocationsDoes not track latency of memory allocation5 new tables

memory_summary_by_account_by_event_namememory_summary_by_host_by_event_namememory_summary_by_thread_by_event_namememory_summary_by_user_by_event_namememory_summary_global_by_event_name

Page 23: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.23

Instrument memory usage - global summarymysql> SELECT * FROM sys.memory_global_by_current_allocated\G*************************** 1. row *************************** event_name: memory/performance_schema/internal_buffers current_count: 60 current_alloc: 497.00 MiBcurrent_avg_alloc: 8.28 MiB high_count: 60 high_alloc: 497.00 MiB high_avg_alloc: 8.28 MiB*************************** 2. row *************************** event_name: memory/mysys/KEY_CACHE current_count: 3 current_alloc: 8.00 MiBcurrent_avg_alloc: 2.67 MiB high_count: 3 high_alloc: 8.00 MiB high_avg_alloc: 2.67 MiB

Page 24: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.24

Instrument memory usage - thread summariesmysql> select * from memory_by_thread_by_current_allocated\G

*************************** 1. row *************************** user: sql/main current_count: 2407 current_alloc: 10.89 MiBcurrent_avg_alloc: 4.63 KiBcurrent_max_alloc: 8.00 MiB total_allocated: 30.55 MiB thread_id: 1*************************** 2. row *************************** user: mem@localhost current_count: 1914 current_alloc: 1.50 MiBcurrent_avg_alloc: 824 bytescurrent_max_alloc: 816.67 KiB total_allocated: 9.25 GiB thread_id: 4336

Page 25: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.25

Instrument memory usage - thread detailsmysql> SELECT event_name, -> sys.format_bytes(current_number_of_bytes_used) AS current_used -> FROM performance_schema.memory_summary_by_thread_by_event_name -> WHERE thread_id = 24 -> ORDER BY current_number_of_bytes_used DESC;+-----------------------------------------------------+--------------+| event_name | current_used |+-----------------------------------------------------+--------------+| memory/sql/Filesort_buffer::sort_keys | 255.94 KiB || memory/sql/sp_head::main_mem_root | 103.64 KiB || memory/mysys/IO_CACHE | 64.05 KiB || memory/mysys/lf_dynarray | 46.17 KiB || memory/mysys/array_buffer | 24.20 KiB || memory/sql/thd::main_mem_root | 23.95 KiB || memory/sql/String::value | 16.13 KiB || memory/sql/TABLE | 9.44 KiB || memory/sql/TABLE_SHARE::mem_root | 8.70 KiB || memory/myisam/MI_INFO | 7.07 KiB || memory/sql/THD::transactions::mem_root | 4.02 KiB || memory/myisam/MYISAM_SHARE | 3.29 KiB |…

Page 26: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.26

Instrument memory usage - other details

Disabled by default

Still requires InnoDB instrumentation

UPDATE setup_instruments

SET enabled = ‘YES’

WHERE name LIKE ‘memory/%’;

Page 27: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.27

WL#5879PERFORMANCE SCHEMA, MDL lock instrumentation

Page 28: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1228

“Unfortunately, it’s unlikely that I’ll be able to create a reproducible test case, because there’s no way to actually see what is happening. I hope that a future version of MySQL will include a more comprehensive set of tables for inspecting locks, requests, and waits at all layers of the server.”

Baron Schwartz, CEO, VividCortex

http://www.xaprb.com/blog/2012/08/28/debugging-metadata-locking-in-mysql-5-5/

Page 29: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.29

MDL Lock Instrumentation

Added the wait/lock/metadata/sql/mdl instrument2 new tables

metadata_lockstable_handles

Page 30: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.30

Metadata Locks Table Structure

+-----------------------+---------------------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-----------------------+---------------------+------+-----+---------+-------+| OBJECT_TYPE | varchar(64) | NO | | NULL | || OBJECT_SCHEMA | varchar(64) | YES | | NULL | || OBJECT_NAME | varchar(64) | YES | | NULL | || OBJECT_INSTANCE_BEGIN | bigint(20) unsigned | NO | | NULL | || LOCK_TYPE | varchar(32) | NO | | NULL | || LOCK_DURATION | varchar(32) | NO | | NULL | || LOCK_STATUS | varchar(32) | NO | | NULL | || SOURCE | varchar(64) | YES | | NULL | || OWNER_THREAD_ID | bigint(20) unsigned | YES | | NULL | || OWNER_EVENT_ID | bigint(20) unsigned | YES | | NULL | |+-----------------------+---------------------+------+-----+---------+-------+

Page 31: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.31

MDL Lock InstrumentationOBJECT_TYPE

GLOBAL, SCHEMA, TABLE, FUNCTION, PROCEDURE, TRIGGER, EVENT, COMMIT

LOCK_TYPEINTENTION_EXCLUSIVE, SHARED, SHARED_HIGH_PRIO,

SHARED_READ, SHARED_WRITE, SHARED_UPGRADABLE, SHARED_NO_WRITE, SHARED_NO_READ_WRITE, EXCLUSIVE

LOCK_DURATIONSTATEMENT, TRANSACTION, EXPLICIT

LOCK_STATUSPENDING, GRANTED, VICTIM, TIMEOUT, KILLED

Page 32: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.32

Metadata Locks Table Structuremysql> select object_type as scope, object_schema, object_name, lock_type, lock_duration, lock_status -> from metadata_locks -> order by object_type = 'global' desc, object_type = 'schema' desc, -> object_type = 'table' desc, object_type = 'commit' desc;+--------+--------------------+----------------+---------------------+---------------+-------------+| scope | object_schema | object_name | lock_type | lock_duration | lock_status |+--------+--------------------+----------------+---------------------+---------------+-------------+| GLOBAL | NULL | NULL | SHARED | EXPLICIT | GRANTED || GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING || GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING || GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING || GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING || GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING || GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING || GLOBAL | NULL | NULL | INTENTION_EXCLUSIVE | STATEMENT | PENDING ||| TABLE | mem__events | action_logs | SHARED_READ | TRANSACTION | GRANTED || TABLE | mem__events | events | SHARED_READ | TRANSACTION | GRANTED || TABLE | performance_schema | metadata_locks | SHARED_READ | TRANSACTION | GRANTED || COMMIT | NULL | NULL | SHARED | EXPLICIT | GRANTED |+--------+--------------------+----------------+---------------------+---------------+-------------+

Page 33: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.33

WL#3656PERFORMANCE SCHEMA table forSHOW SLAVE STATUS

Page 34: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.34

Replication Instrumentation

6 new tablesreplication_connection_configurationreplication_connection_statusreplication_execute_configurationreplication_execute_statusreplication_execute_status_by_coordinatorreplication_execute_status_by_worker

Page 35: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.35

Replication Instrumentation

Page 36: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.36

Replication Connection Configurationmysql> select * from performance_schema.replication_connection_configuration\G *************************** 1. row *************************** HOST: 127.0.0.1 PORT: 3306 USER: rpl NETWORK_INTERFACE: AUTO_POSITION: 1 SSL_ALLOWED: YES SSL_CA_FILE: SSL_CA_PATH: SSL_CERTIFICATE: SSL_CIPHER: SSL_KEY:SSL_VERIFY_SERVER_CERTIFICATE: YES SSL_CRL_FILE: SSL_CRL_PATH: CONNECTION_RETRY_INTERVAL: 40 CONNECTION_RETRY_COUNT: 10

Page 37: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.37

Replication Connection Status

mysql> select * from replication_connection_status\G*************************** 1. row *************************** SOURCE_UUID: THREAD_ID: NULL SERVICE_STATE: CONNECTINGRECEIVED_TRANSACTION_SET: LAST_ERROR_NUMBER: 1045 LAST_ERROR_MESSAGE: error connecting to master 'repl@localhost:5613' - retry-time: 60 retries: 1 LAST_ERROR_TIMESTAMP: 2014-04-02 05:41:20

Page 38: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.38

Replication Execute Status

mysql> select * from replication_execute_status;+---------------+-----------------+| SERVICE_STATE | REMAINING_DELAY |+---------------+-----------------+| ON | NULL |+---------------+-----------------+

Very high level overview of status

Page 39: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.39

Replication Coordinator Status

mysql> select * from replication_execute_status_by_coordinator\G*************************** 1. row *************************** THREAD_ID: 1281 SERVICE_STATE: ON LAST_ERROR_NUMBER: 0 LAST_ERROR_MESSAGE:LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00

Status of Coordinator thread in multi-threaded replication

Page 40: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.40

Replication Worker Status

mysql> select * from replication_execute_status_by_worker;+-----------+-----------+---------------+-----------------------------------------+-------------------+--------------------+----------------------+| WORKER_ID | THREAD_ID | SERVICE_STATE | LAST_SEEN_TRANSACTION | LAST_ERROR_NUMBER | LAST_ERROR_MESSAGE | LAST_ERROR_TIMESTAMP |+-----------+-----------+---------------+-----------------------------------------+-------------------+--------------------+----------------------+| 1 | 1282 | ON | | 0 | | 0000-00-00 00:00:00 || 2 | 1283 | ON | | 0 | | 0000-00-00 00:00:00 || 3 | 1284 | ON | | 0 | | 0000-00-00 00:00:00 || 4 | 1285 | ON | | 0 | | 0000-00-00 00:00:00 || 5 | 1286 | ON | | 0 | | 0000-00-00 00:00:00 || 6 | 1287 | ON | | 0 | | 0000-00-00 00:00:00 || 7 | 1288 | ON | | 0 | | 0000-00-00 00:00:00 || 8 | 1289 | ON | 181f2b36-a0b4-11e3-9ac7-1025863574a7:16 | 0 | | 0000-00-00 00:00:00 |+-----------+-----------+---------------+-----------------------------------------+-------------------+--------------------+----------------------+

Status of worker threads within multi-threaded replication

Page 41: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.41

WL#5768PERFORMANCE SCHEMA, prepared statements instrumentation

Page 42: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.42

Prepared Statement Instrumentation

Instrumentation depends on already existing statement instrumentsstatement/com/prepare, statement/com/executestatement/sql/prepare_sql, statement/sql/execute_sql

1 new tableprepared_statements_instances

Page 43: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.43

Prepared Statement Instancesmysql> select * from performance_schema.prepared_statements_instances\G*************************** 1. row *************************** OBJECT_INSTANCE_BEGIN: 140198306602144 STATEMENT_ID: 1 STATEMENT_NAME: stmt1 SQL_TEXT: select * from test.t1 OWNER_THREAD_ID: 54003 OWNER_EVENT_ID: 935 OWNER_OBJECT_TYPE: NULL OWNER_OBJECT_SCHEMA: NULL OWNER_OBJECT_NAME: NULL TIMER_PREPARE: 15386274000 COUNT_REPREPARE: 0 COUNT_EXECUTE: 1 SUM_TIMER_EXECUTE: 217699000 MIN_TIMER_EXECUTE: 217699000 AVG_TIMER_EXECUTE: 217699000 MAX_TIMER_EXECUTE: 217699000

SUM_LOCK_TIME: 0 SUM_ERRORS: 0 SUM_WARNINGS: 0 SUM_ROWS_AFFECTED: 0 SUM_ROWS_SENT: 0 SUM_ROWS_EXAMINED: 0SUM_CREATED_TMP_DISK_TABLES: 0 SUM_CREATED_TMP_TABLES: 0 SUM_SELECT_FULL_JOIN: 0 SUM_SELECT_FULL_RANGE_JOIN: 0 SUM_SELECT_RANGE: 0 SUM_SELECT_RANGE_CHECK: 0 SUM_SELECT_SCAN: 0 SUM_SORT_MERGE_PASSES: 0 SUM_SORT_RANGE: 0 SUM_SORT_ROWS: 0 SUM_SORT_SCAN: 0 SUM_NO_INDEX_USED: 0 SUM_NO_GOOD_INDEX_USED: 0

Page 44: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.44

WL#5864PERFORMANCE SCHEMA, instrument TRANSACTIONS

Page 45: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.45

Replication Instrumentation

Added the transaction instrument8 new tables

events_transactions_currentevents_transactions_historyevents_transactions_history_longevents_transactions_summary_by_account_by_event_nameevents_transactions_summary_by_host_by_event_nameevents_transactions_summary_by_thread_by_event_nameevents_transactions_summary_by_user_by_event_nameevents_transactions_summary_global_by_event_name

Page 46: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.46

Transaction Instrumentation

Exposes details of transactions in raw or summary viewsShow details such as

Transaction latencyIsolation levelsAuto commitSavepoint infoGTID or transaction IDs

Link transactions to the statements within the transactions

Page 47: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.47

Current Transaction Details

mysql> select * from events_transactions_current\G*************************** 1. row *************************** THREAD_ID: 1 EVENT_ID: 23733 END_EVENT_ID: 23742 EVENT_NAME: transaction STATE: COMMITTED TRX_ID: 281479898269256 GTID: NULL XID: NULL XA_STATE: NULL SOURCE: handler.cc:1246 TIMER_START: 31140612726000 TIMER_END: 31140647445000 TIMER_WAIT: 34719000

ACCESS_MODE: READ WRITE ISOLATION_LEVEL: REPEATABLE READ AUTOCOMMIT: YES NUMBER_OF_SAVEPOINTS: 0NUMBER_OF_ROLLBACK_TO_SAVEPOINT: 0 NUMBER_OF_RELEASE_SAVEPOINT: 0 OBJECT_INSTANCE_BEGIN: NULL NESTING_EVENT_ID: NULL NESTING_EVENT_TYPE: NULL

Page 48: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.48

Transaction Summary - per usermysql> select * from events_transactions_summary_by_user_by_event_name\G*************************** 1. row *************************** USER: mem EVENT_NAME: transaction COUNT_STAR: 400044 SUM_TIMER_WAIT: 21208048458267000 MIN_TIMER_WAIT: 160744000 AVG_TIMER_WAIT: 53014289000 MAX_TIMER_WAIT: 24028520397000 COUNT_READ_WRITE: 400044SUM_TIMER_READ_WRITE: 21208048458267000MIN_TIMER_READ_WRITE: 160744000AVG_TIMER_READ_WRITE: 53014289000MAX_TIMER_READ_WRITE: 24028520397000 COUNT_READ_ONLY: 0 SUM_TIMER_READ_ONLY: 0 MIN_TIMER_READ_ONLY: 0 AVG_TIMER_READ_ONLY: 0 MAX_TIMER_READ_ONLY: 0

Page 49: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.49

WL#5766PERFORMANCE SCHEMA, stored programs instrumentation

Page 50: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.50

Stored Program Instrumentation

Tracks Stored Procedures, Stored Functions, Triggers and EventsAdded 16 new statement/sp/% instruments

Expose the different work flows that stored programs use, such as cursor operations, workflow controls etc.

Integrated in to the normal statement instrumentation1 new tables

events_statements_summary_by_program

Page 51: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.51

Stored Program Summarymysql> select * from events_statements_summary_by_program\G*************************** 1. row *************************** OBJECT_TYPE: PROCEDURE OBJECT_SCHEMA: ps_demo OBJECT_NAME: ps_demo_proc COUNT_STAR: 1 SUM_TIMER_WAIT: 6970931000 MIN_TIMER_WAIT: 6970931000 AVG_TIMER_WAIT: 6970931000 MAX_TIMER_WAIT: 6970931000 COUNT_STATEMENTS: 5 SUM_STATEMENTS_WAIT: 6802181000 MIN_STATEMENTS_WAIT: 16372000 AVG_STATEMENTS_WAIT: 1360436000 MAX_STATEMENTS_WAIT: 6484366000 SUM_LOCK_TIME: 176401000000 SUM_ERRORS: 0 SUM_WARNINGS: 0 SUM_ROWS_AFFECTED: 1 SUM_ROWS_SENT: 0

SUM_ROWS_EXAMINED: 1SUM_CREATED_TMP_DISK_TABLES: 0 SUM_CREATED_TMP_TABLES: 0 SUM_SELECT_FULL_JOIN: 0 SUM_SELECT_FULL_RANGE_JOIN: 0 SUM_SELECT_RANGE: 0 SUM_SELECT_RANGE_CHECK: 0 SUM_SELECT_SCAN: 0 SUM_SORT_MERGE_PASSES: 0 SUM_SORT_RANGE: 0 SUM_SORT_ROWS: 0 SUM_SORT_SCAN: 0 SUM_NO_INDEX_USED: 0 SUM_NO_GOOD_INDEX_USED: 0

Page 52: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.52

Stored Program Instrumentation

Like Transaction instrumentation, stored programs link to the statements within them, or even link to transactions within them, which in turn link to their statements

Page 53: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.53

Full Hierarchy of New Instrumentation

Page 54: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1254

Page 55: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1255

Page 56: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1256

Page 57: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1257

Page 58: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1258

Page 59: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1259

Page 60: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.60

Things still to come

Page 61: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.61

Status / Variable Instrumentation

Deprecate I_S.[GLOBAL|SESSION]_[STATUS|VARIABLES]Replace with tables that show true state / aggregates

Per thread, user, host, accountSee session statistics or configuration individually

Improve SHOW commands to only show appropriate variablesSHOW SESSION STATUS to only show session specific itemsBackwards compatibility switch available

Less internal mutex contention for polling status

Page 62: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.62

Further Replication Statistics

Redesigned lag monitoringConsistently check lag across a replication chain

Further statistics on load of the replication threadsQueue lengthsEvent countingBusy times

Page 63: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.63

Stage Progress Tracking

View the progress of longer stages of executionExtends stage tables with “estimate” and “completed” columnsBounded (“estimated”) or unbounded (only “completed” filled in)Units depend on stage

stage/sql/copy to tmp table - 130 (rows) completed

Page 64: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.64

Performance Schema Indexes

Add indexes for the PERFORMANCE_SCHEMA engineIndex key search fields across the schemaWill alleviate processing overhead for queries

Page 65: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.65

Continued focus …

On performance!On filling missing instrumentation points!On consolidating instrumentation within Performance schema!

Page 66: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.66

The preceding 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 decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

Page 67: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1267

Page 68: MySQL 5.7: Performance Schema Improvements

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1268