SlideShare ist ein Scribd-Unternehmen logo
1 von 80
Downloaden Sie, um offline zu lesen
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Performance Schema and
Sys Schema in MySQL 5.7
Mark Leith
Senior Software Development Manager
MySQL Enterprise Tools, Oracle
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
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 decisions. The development, release,
and timing of any features or functionality described for Oracle’s products
remains at the sole discretion of Oracle.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Introduction
Much Slides
1
2
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
You are … :
• Using 5.1?
• Using 5.5?
• Using 5.6?
• Using 5.7?
• A Performance Schema user?
• A Sys Schema user?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Introduction
Much Slides
1
2
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Performance Schema Improvements in MySQL 5.7
• 23 Worklogs completed
• 14 Adding new instrumentation
• 4 Performance / Scalability improvements
• 5 Configuration / Refactoring improvements
• 35 new tables added (5.7 has 87, 5.6 had 52, 5.5 had 17)
• 419 new instruments (5.7 has 972, 5.6 had 553, 5.5 had 222)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Performance Schema in MySQL 5.7.2
• WL#3249 - PERFORMANCE SCHEMA, Instrument memory usage
• https://dev.mysql.com/worklog/task/?id=3249
• WL#5766 - PERFORMANCE SCHEMA, Stored programs
instrumentation
• https://dev.mysql.com/worklog/task/?id=5766
• WL#3656 - PERFORMANCE SCHEMA table for SHOW SLAVE STATUS
• https://dev.mysql.com/worklog/task/?id=3656
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
"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
WL#3249 - PERFORMANCE_SCHEMA, Instrument
memory usage
http://www.mysqlperformanceblog.com/2012/03/21/troubleshooting-mysql-memory-usage/
8
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#3249 - Instrument Memory Usage
• Added 212 different memory instrumentation types (all disabled by default)
• Records current, high and low water marks of allocations
• Does not track latency of memory allocation
• 5 new summary tables
• memory_summary_by_account_by_event_name
• memory_summary_by_host_by_event_name
• memory_summary_by_thread_by_event_name
• memory_summary_by_user_by_event_name
• memory_summary_global_by_event_name
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
p_s.memory_summary_global_by_event_name
mysql> select * from performance_schema.memory_summary_global_by_event_name
-> order by current_number_of_bytes_used desc limit 1G
*************************** 1. row ***************************
EVENT_NAME: memory/innodb/buf_buf_pool
COUNT_ALLOC: 1
COUNT_FREE: 0
SUM_NUMBER_OF_BYTES_ALLOC: 137428992
SUM_NUMBER_OF_BYTES_FREE: 0
LOW_COUNT_USED: 0
CURRENT_COUNT_USED: 1
HIGH_COUNT_USED: 1
LOW_NUMBER_OF_BYTES_USED: 0
CURRENT_NUMBER_OF_BYTES_USED: 137428992
HIGH_NUMBER_OF_BYTES_USED: 137428992
InnoDB Buffer Pool
137.429 Megabytes
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
sys.memory_global_by_current_bytes view
mysql> select * from sys.memory_global_by_current_bytesG
*************************** 1. row ***************************
event_name: memory/innodb/buf_buf_pool
current_count: 1
current_alloc: 131.06 MiB
current_avg_alloc: 131.06 MiB
high_count: 1
high_alloc: 131.06 MiB
high_avg_alloc: 131.06 MiB
*************************** 2. row ***************************
event_name: memory/innodb/log0log
current_count: 9
current_alloc: 16.01 MiB
current_avg_alloc: 1.78 MiB
high_count: 9
high_alloc: 16.01 MiB
high_avg_alloc: 1.78 MiB
...
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
sys.user_summary view
mysql> select * from sys.user_summaryG
*************************** 1. row ***************************
user: mark
statements: 3072
statement_latency: 1.77 s
statement_avg_latency: 575.29 us
table_scans: 7
file_ios: 20043
file_io_latency: 346.79 ms
current_connections: 1
total_connections: 1
unique_hosts: 1
current_memory: 515.81 KiB
total_memory_allocated: 30.69 MiB
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
"Suppose I accessed your database and listed the entire set of
stored functions and procedures. How many of them are you
not even sure are in use anymore? How many of them you
think you can DROP, but are too afraid to, and keep them in
just in case?"
Shlomi Noach
WL#5766 - PERFORMANCE_SCHEMA, Stored programs
instrumentation
13
http://code.openark.org/blog/mysql/why-delegating-code-to-mysql-stored-routines-is-poor-engineering-practice
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#5766 - Stored programs instrumentation
• Tracks Stored Procedures, Stored Functions, Triggers and Events
• Added 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 instrumentation
• 1 new summary table
• events_statements_summary_by_program
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
p_s.memory_summary_global_by_event_name
SUM_ROWS_AFFECTED: 1
SUM_ROWS_SENT: 0
SUM_ROWS_EXAMINED: 1
SUM_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
mysql> select * from events_statements_summary_by_programG
*************************** 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
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#3656 - PERFORMANCE_SCHEMA table for SHOW SLAVE
STATUS
• 6 new tables
• replication_connection_configuration
• replication_connection_status
• replication_execute_configuration
• replication_execute_status
• replication_execute_status_by_coordinator
• replication_execute_status_by_worker
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
SHOW SLAVE STATUS Split
17
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Replication Connection Config
mysql> select * from replication_connection_configurationG
*************************** 1. row ***************************
CHANNEL_NAME:
HOST: 127.0.0.1
PORT: 13253
USER: rsandbox
NETWORK_INTERFACE:
AUTO_POSITION: 1
SSL_ALLOWED: NO
SSL_CA_FILE:
SSL_CA_PATH:
SSL_CERTIFICATE:
SSL_CIPHER:
SSL_KEY:
SSL_VERIFY_SERVER_CERTIFICATE: NO
SSL_CRL_FILE:
SSL_CRL_PATH:
CONNECTION_RETRY_INTERVAL: 60
CONNECTION_RETRY_COUNT: 86400
HEARTBEAT_INTERVAL: 30.000
*************************** 2. row ***************************
CHANNEL_NAME: 56-cluster
One row per replication channel
when using multi-master replication
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Replication Connection Status
mysql> select * from performance_schema.replication_connection_statusG
*************************** 1. row ***************************
CHANNEL_NAME:
GROUP_NAME:
SOURCE_UUID: 00013253-1111-1111-1111-111111111111
THREAD_ID: 23
SERVICE_STATE: ON
COUNT_RECEIVED_HEARTBEATS: 27
LAST_HEARTBEAT_TIMESTAMP: 2015-09-18 15:01:00
RECEIVED_TRANSACTION_SET: <GTID SET>
LAST_ERROR_NUMBER: 0
LAST_ERROR_MESSAGE:
LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00
*************************** 2. row ***************************
CHANNEL_NAME: 56-cluster
GROUP_NAME:
SOURCE_UUID: 16d226ee-f89b-11e4-9d4f-b36d08df49cf
THREAD_ID: 25
SERVICE_STATE: ON
COUNT_RECEIVED_HEARTBEATS: 27
...
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Replication Applier Status Config / State
mysql> select * from performance_schema.replication_applier_status;
+--------------+---------------+-----------------+----------------------------+
| CHANNEL_NAME | SERVICE_STATE | REMAINING_DELAY | COUNT_TRANSACTIONS_RETRIES |
+--------------+---------------+-----------------+----------------------------+
| | ON | NULL | 0 |
| 56-cluster | ON | NULL | 0 |
+--------------+---------------+-----------------+----------------------------+
mysql> select * from performance_schema.replication_applier_configuration;
+--------------+---------------+
| CHANNEL_NAME | DESIRED_DELAY |
+--------------+---------------+
| | 0 |
| 56-cluster | 0 |
+--------------+---------------+
One row per replication channel
when using multi-master replication
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Replication Applier Status Details
mysql> select * from performance_schema.replication_applier_status_by_worker;
+--------------+-----------+-----------+---------------+-----------------------+-------------------+--------------------+----------------------+
| CHANNEL_NAME | WORKER_ID | THREAD_ID | SERVICE_STATE | LAST_SEEN_TRANSACTION | LAST_ERROR_NUMBER | LAST_ERROR_MESSAGE | LAST_ERROR_TIMESTAMP |
+--------------+-----------+-----------+---------------+-----------------------+-------------------+--------------------+----------------------+
| | 1 | 27 | ON | <GTID SET> | 0 | | 0000-00-00 00:00:00 |
| | 2 | 29 | ON | <GTID SET> | 0 | | 0000-00-00 00:00:00 |
| | 3 | 31 | ON | <GTID SET> | 0 | | 0000-00-00 00:00:00 |
| | 4 | 33 | ON | <GTID SET> | 0 | | 0000-00-00 00:00:00 |
| 56-cluster | 1 | 28 | ON | <GTID SET> | 0 | | 0000-00-00 00:00:00 |
| 56-cluster | 2 | 30 | ON | <GTID SET> | 0 | | 0000-00-00 00:00:00 |
| 56-cluster | 3 | 32 | ON | <GTID SET> | 0 | | 0000-00-00 00:00:00 |
| 56-cluster | 4 | 34 | ON | <GTID SET> | 0 | | 0000-00-00 00:00:00 |
+--------------+-----------+-----------+---------------+-----------------------+-------------------+--------------------+----------------------+
mysql> select * from performance_schema.replication_applier_status_by_coordinator;
+--------------+-----------+---------------+-------------------+--------------------+----------------------+
| CHANNEL_NAME | THREAD_ID | SERVICE_STATE | LAST_ERROR_NUMBER | LAST_ERROR_MESSAGE | LAST_ERROR_TIMESTAMP |
+--------------+-----------+---------------+-------------------+--------------------+----------------------+
| | 24 | ON | 0 | | 0000-00-00 00:00:00 |
| 56-cluster | 26 | ON | 0 | | 0000-00-00 00:00:00 |
+--------------+-----------+---------------+-------------------+--------------------+----------------------+
One row per parallel worker, across
all replication channels
One row per channel use for all applier
state when not using parallel workers
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Performance Schema in MySQL 5.7.3
• WL#5879 - PERFORMANCE SCHEMA, MDL lock instrumentation
• https://dev.mysql.com/worklog/task/?id=5879
• WL#5864 - PERFORMANCE SCHEMA, instrument TRANSACTIONS
• https://dev.mysql.com/worklog/task/?id=5864
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
"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
WL#5879 - PERFORMANCE_SCHEMA, MDL lock
instrumentation
23
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#5879 - PERFORMANCE_SCHEMA, MDL lock
instrumentation
• Added the wait/lock/metadata/sql/mdl instrument
• 2 new current instance tables
• metadata_locks
• table_handles
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
p_s.metadata_locks 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 | |
+-----------------------+---------------------+------+-----+---------+-------+
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
p_s.metadata_locks sample output
mysql> 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 |
+--------+--------------------+----------------+---------------------+---------------+-------------+
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
sys.schema_table_lock_waits
mysql> select * from sys.schema_table_lock_waitsG
*************************** 1. row ***************************
object_schema: test
object_name: t
waiting_thread_id: 43
waiting_pid: 21
waiting_account: msandbox@localhost
waiting_lock_type: SHARED_UPGRADABLE
waiting_lock_duration: TRANSACTION
waiting_query: alter table test.t add foo int
waiting_query_secs: 988
waiting_query_rows_affected: 0
waiting_query_rows_examined: 0
blocking_thread_id: 42
blocking_pid: 20
blocking_account: msandbox@localhost
blocking_lock_type: SHARED_NO_READ_WRITE
blocking_lock_duration: TRANSACTION
sql_kill_blocking_query: KILL QUERY 20
sql_kill_blocking_connection: KILL 20
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
sys.innodb_lock_waits
mysql> SELECT * FROM sys.innodb_lock_waitsG
*************************** 1. row ***************************
wait_started: 2014-11-11 13:39:20
wait_age: 00:00:07
wait_age_secs: 7
locked_table: `db1`.`t1`
locked_index: PRIMARY
locked_type: RECORD
waiting_trx_id: 867158
waiting_trx_started: 2014-11-11 13:39:15
waiting_trx_age: 00:00:12
waiting_trx_rows_locked: 0
waiting_trx_rows_modified: 0
waiting_pid: 3
waiting_query: UPDATE t1 SET val = val + 1 WHERE id = 2
waiting_lock_id: 867158:2363:3:3
waiting_lock_mode: X
blocking_trx_id: 867157
blocking_pid: 4
...
blocking_query: UPDATE t1 SET val …
blocking_lock_id: 867157:2363:3:3
blocking_lock_mode: X
blocking_trx_started: 2014-11-11 13:39:11
blocking_trx_age: 00:00:16
blocking_trx_rows_locked: 1
blocking_trx_rows_modified: 1
sql_kill_blocking_query: KILL QUERY 4
sql_kill_blocking_connection: KILL 4
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#5864 - PERFORMANCE SCHEMA, instrument
TRANSACTIONS
• Added the transaction instrument
• 8 new raw and summary tables
• events_transactions_current
• events_transactions_history
• events_transactions_history_long
• events_transactions_summary_by_account_by_event_name
• events_transactions_summary_by_host_by_event_name
• events_transactions_summary_by_thread_by_event_name
• events_transactions_summary_by_user_by_event_name
• events_transactions_summary_global_by_event_name
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#5864 - PERFORMANCE SCHEMA, instrument
TRANSACTIONS
• Exposes details of transactions in raw or summary views
• Show details such as
• Transaction latency
• Isolation levels
• Auto commit
• Savepoint info
• GTID or transaction IDs
• Link transactions to the statements within the transactions
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
p_s.events_transactions_current
mysql> select * from events_transactions_currentG
*************************** 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: 0
NUMBER_OF_ROLLBACK_TO_SAVEPOINT: 0
NUMBER_OF_RELEASE_SAVEPOINT: 0
OBJECT_INSTANCE_BEGIN: NULL
NESTING_EVENT_ID: NULL
NESTING_EVENT_TYPE: NULL
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
sys.ps_thread_trx_info(<thread_id>)
SELECT sys.ps_thread_trx_info(48) as trx_infoG
*************************** 1. row ***************************
trx_info: [
{
"time": "790.70 us",
"state": "COMMITTED",
"mode": "READ WRITE",
"autocommitted": "NO",
"gtid": "AUTOMATIC",
"isolation": "REPEATABLE READ",
"statements_executed": [
{
"sql_text": "INSERT INTO info VALUES (1, 'foo')",
"time": "471.02 us",
"schema": "trx",
"rows_examined": 0,
"rows_affected": 1,
"rows_sent": 0,
"tmp_tables": 0,
"tmp_disk_tables": 0,
"sort_rows": 0,
"sort_merge_passes": 0
},
...
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
sys.ps_trace_thread procedure
• ps_trace_thread() monitors a specific thread for a period
• Captures as much information on the thread activity as possible
• Returns a “dot” formatted file, that can graph the event hierarchy
• http://en.wikipedia.org/wiki/DOT_(graph_description_language)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
sys.ps_trace_thread procedure example
mysql> call ps_trace_thread(27768, '/tmp/stack_27768.dot', 60, 0.1, true, true, true);
+------------------------------------------------+
| Info |
+------------------------------------------------+
| Data collection starting for THREAD_ID = 27768 |
+------------------------------------------------+
1 row in set (4.82 sec)
+---------------------------------------------+
| Info |
+---------------------------------------------+
| Stack trace written to /tmp/stack_27768.dot |
+---------------------------------------------+
1 row in set (60.90 sec)
+--------------------------------------------------------+
| Convert to PDF |
+--------------------------------------------------------+
| dot -Tpdf -o /tmp/stack_27768.pdf /tmp/stack_27768.dot |
+--------------------------------------------------------+
1 row in set (60.90 sec)
+--------------------------------------------------------+
| Convert to PNG |
+--------------------------------------------------------+
| dot -Tpng -o /tmp/stack_27768.png /tmp/stack_27768.dot |
+--------------------------------------------------------+
1 row in set (60.90 sec)+
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
ps_trace_thread procedure example
MySQL 5.7
Procedures
Transactions
Statements
Stages
Waits
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Performance Schema in MySQL 5.7.4
• WL#7152 - PERFORMANCE SCHEMA, EXTRACT DIGEST
• https://dev.mysql.com/worklog/task/?id=7152
• WL#5768 - PERFORMANCE SCHEMA, prepared statements
instrumentation
• https://dev.mysql.com/worklog/task/?id=5768
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#7152 - PERFORMANCE SCHEMA, EXTRACT DIGEST
• Moved the statement digest normalization code from the Performance
Schema storage engine (storage/perfschema/pfs_digest.*) to the SQL layer
(sql/sql_digest*)
• As a result of re factoring, the following APIs are available in the SQL layer:
• compute_digest_md5(), to compute a query digest
• compute_digest_text(), to compute a query digest text.
• Because the server may need to read a statement digest *after* parsing is
completed, the memory used to represent a digest is stored in THD in two
new attributes, THD::m_digest_state and THD::m_digest
• Groundwork for Query Rewrite Framework, MySQL Enterprise Firewall, etc.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#5768 - PERFORMANCE SCHEMA, prepared statements
instrumentation
• Instrumentation depends on already existing statement instruments
• statement/com/prepare, statement/com/execute
• statement/sql/prepare_sql, statement/sql/execute_sql
• 1 new current instance table
• prepared_statements_instances
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
p_s.prepared_statement_instances
mysql> select * from performance_schema.prepared_statements_instancesG
*************************** 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: 0
SUM_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
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Performance Schema in MySQL 5.7.5
• WL#6884 - PERFORMANCE SCHEMA, USER VARIABLES
• https://dev.mysql.com/worklog/task/?id=6884
• WL#7415 - PERFORMANCE SCHEMA, STAGE PROGRESS
• https://dev.mysql.com/worklog/task/?id=7415
• WL#7445 - PERFORMANCE SCHEMA: instrument SX-lock for rw_lock
• https://dev.mysql.com/worklog/task/?id=7445
• WL#7802 - PERFORMANCE SCHEMA, BATCH TABLE IO
• https://dev.mysql.com/worklog/task/?id=7802
• WL#7777 - Integrate PFS memory instrumentation with InnoDB
• https://dev.mysql.com/worklog/task/?id=7777
• WL#7817 - RPL Monitoring: Move status variables to replication P_S tables
• https://dev.mysql.com/worklog/task/?id=7817
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#6884 - PERFORMANCE SCHEMA, USER VARIABLES
mysql> set @debug := 1;
Query OK, 0 rows affected (0.10 sec)
mysql> set @totalRows := 300;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from performance_schema.user_variables_by_thread;
+-----------+---------------+----------------+
| THREAD_ID | VARIABLE_NAME | VARIABLE_VALUE |
+-----------+---------------+----------------+
| 33 | totalRows | 300 |
| 33 | debug | 1 |
| 34 | totalRows | 150 |
+-----------+---------------+----------------+
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#7415 - PERFORMANCE SCHEMA, STAGE PROGRESS
• Added the WORK_COMPLETED and WORK_ESTIMATED columns to
the events_stages_current table
• Work is in units, and depends on the stage what it may be, rows
copied, bytes processed, etc.
• Started with adding tracking to:
• stage/sql/copy to tmp table
• (more to come later in this presentation)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
sys.sessions progress estimation
mysql> select * from sys.sessionsG
*************************** 1. row ***************************
thd_id: 44524
conn_id: 44502
user: msandbox@localhost
db: test
command: Query
state: alter table (flush)
time: 18
current_statement: alter table t1 add column g int
statement_latency: 18.45 s
progress: 98.84
lock_latency: 265.43 ms
rows_examined: 0
rows_sent: 0
rows_affected: 0
tmp_tables: 0
tmp_disk_tables: 0
...
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#7445 - PERFORMANCE SCHEMA: instrument SX-lock for
rw_lock
• This task is a consequence of
• WL#6363 InnoDB: implement SX-lock for rw_lock
• Adds the new wait/synch/sxlock/% wait type
• 12 new instruments added (all disabled by default)
• wait/synch/sxlock/innodb/btr_search_latch, wait/synch/sxlock/innodb/
dict_operation_lock, wait/synch/sxlock/innodb/fil_space_latch, wait/synch/sxlock/
innodb/checkpoint_lock, wait/synch/sxlock/innodb/fts_cache_rw_lock, wait/synch/
sxlock/innodb/fts_cache_init_rw_lock, wait/synch/sxlock/innodb/trx_i_s_cache_lock,
wait/synch/sxlock/innodb/trx_purge_latch, wait/synch/sxlock/innodb/
index_tree_rw_lock, wait/synch/sxlock/innodb/index_online_log, wait/synch/sxlock/
innodb/dict_table_stats, wait/synch/sxlock/innodb/hash_table_locks
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#7445 - PERFORMANCE SCHEMA: instrument SX-lock for
rw_lock
• New Lock operations:
• SHARED LOCK
• SHARED EXCLUSIVE LOCK
• EXCLUSIVE LOCK
• TRY SHARED LOCK
• TRY SHARED EXCLUSIVE LOCK
• TRY EXCLUSIVE LOCK
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#7802 - PERFORMANCE SCHEMA, BATCH TABLE IO
• When scanning large numbers of rows, the Table/Index IO
instrumentation overhead within 5.6 could be high
• Now, we record instrumentation in batches when:
• We are accessing the inner-most table of a query block, and
• We are not requesting a single row from that table (eq_ref), and
• We are not evaluating a subquery containing table access for that
table.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#7802 - PERFORMANCE SCHEMA, BATCH TABLE IO
• For such tables, switch from instrumenting row operations to instrumenting scans by:
• Before starting the access, signal to the storage handler that scan instrumentation
will be used
• On first access to the handler, start the timer and reset number of rows to zero
• On each successful row fetch in the handler, increment the row count, but do not
report to performance schema
• On first unsuccessful row fetch (error, eof), report row count and execution time
to performance schema
• If scan is aborted by nested-loop executor (e.g because of LIMIT reached or first-
match complete), signal the handler that scan is complete - handler will then
report accumulated data to performance schema
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#7777 - Integrate PFS memory instrumentation with
InnoDB
• Follow up to WL#3249 - PERFORMANCE SCHEMA, Instrument
memory usage
• Instrumented all InnoDB memory usage within the new framework
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#7817 - RPL Monitoring: Move status variables to
replication P_S tables
• With Multi-Master Replication, having single global status variables is
incorrect for the following variables, so they were added to the replication
tables:
• Slave_running
• Slave_retried_transactions
• Slave_last_heartbeat
• Slave_received_heartbeats
• Slave_heartbeat_period
• You saw these integrated in my examples for the replication tables earlier
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Performance Schema in MySQL 5.7.6
• WL#7800 - PERFORMANCE SCHEMA, SETUP_ACTORS ENABLED COLUMN
• https://dev.mysql.com/worklog/task/?id=7800
• WL#7270 - PERFORMANCE SCHEMA, configurable statement text size
• https://dev.mysql.com/worklog/task/?id=7270
• WL#7698 - PERFORMANCE SCHEMA, REDUCE MEMORY USAGE FOR TABLE IO / TABLE LOCK
• https://dev.mysql.com/worklog/task/?id=7698
• WL#7794 - PERFORMANCE SCHEMA, SCALABLE MEMORY ALLOCATION
• https://dev.mysql.com/worklog/task/?id=7794
• WL#5889 - Add InnoDB events to Performance Schema's Event Stage table
• https://dev.mysql.com/worklog/task/?id=5889
• WL#6629 - PERFORMANCE_SCHEMA, STATUS VARIABLES
• https://dev.mysql.com/worklog/task/?id=6629
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#7800 - PERFORMANCE SCHEMA, SETUP_ACTORS
ENABLED COLUMN
• The performance_schema.setup_actors table previously only
worked for including users to instrument, but it was impossible to
instrument all but one or two users easily
• Added `ENABLED` enum(‘YES’,'NO') to setup_actors
• To disable user “mark@localhost”:
• INSERT INTO performance_schema.setup_actors VALUES
(‘localhost’, ’mark’, ‘%’, ‘NO’);
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#7270 - PERFORMANCE SCHEMA, configurable
statement text size
• Previously all SQL text and digest storage was limited to 1024
characters because of memory concerns
• However, this can cause incorrect digest aggregation for queries
that differ only after 1024 characters
• Added two new variables to control how much memory to use:
• max_digest_length (remember, this is now digesting at SQL layer)
• performance_schema_max_sql_text_length
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#7698 - PERFORMANCE SCHEMA, REDUCE MEMORY
USAGE FOR TABLE IO / TABLE LOCK
• For instances with large numbers of tables, table IO and lock instrumentation could
have excessive memory usage
• Some bad assumptions (such as always allocate space for 64 indexes per table, or lock
stats for unused tables) on up front allocations, now indexes are allocated on demand
• Added 2 new system variables:
• performance_schema_max_table_lock_stat (max tables to track for table locks)
• performance_schema_max_index_stat (max indexes to track)
• And 2 new status variables:
• performance_schema_table_lock_stat_lost
• performance_schema_index_stat_lost
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#7794 - PERFORMANCE SCHEMA, SCALABLE MEMORY
ALLOCATION
• Up until now, Performance Schema always allocated all of the
internal instrument buffers on server start up, to save runtime
memory allocation overhead
• Default config in 5.6 could allocate 400+MB memory straight away
• Memory is now allocated in chunks (size depends on instrument)
• ~120MB up front usage by default for all instrumentation
• 70 new memory instruments to track various usage
• memory/performance_schema/%
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#7794 - PERFORMANCE SCHEMA, SCALABLE MEMORY
ALLOCATION
• The following now provide auto-scaling (set to -1 for value):
• performance_schema_accounts_size
• performance_schema_hosts_size
• performance_schema_max_cond_instances
• performance_schema_max_file_instances
• performance_schema_max_index_stat
• performance_schema_max_metadata_locks
• performance_schema_max_mutex_instances
• performance_schema_max_prepared_statements_instances
• performance_schema_max_program_instances
• performance_schema_max_rwlock_instances
• performance_schema_max_socket_instances
• performance_schema_max_table_handles
• performance_schema_max_table_instances
• performance_schema_max_table_lock_stat
• performance_schema_max_thread_instances
• performance_schema_users_size
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#5889 - Add InnoDB events to Performance Schema's
Event Stage table
• Follow up to WL#7415 - PERFORMANCE SCHEMA, STAGE PROGRESS
• Added stage progress instruments within InnoDB:
• stage/innodb/buffer pool load
• stage/innodb/alter table (read PK and internal sort)
• stage/innodb/alter table (merge sort)
• stage/innodb/alter table (insert)
• stage/innodb/alter table (flush)
• stage/innodb/alter table (log apply index)
• stage/innodb/alter table (log apply table)
• stage/innodb/alter table (end)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#5889 - Add InnoDB events to Performance Schema's
Event Stage table
• InnoDB ALTER TABLE instruments work in tandem for the entire
ALTER TABLE for example:
work_complete | work_estimated
'.../alter table (read..)' 0 .. 100 | 700
'.../alter table (merge..)' 101 .. 300 | 700
'.../alter table (insert)' 301 .. 500 | 700
'.../alter table (flush)' 500 .. 650 | 700
'.../alter table (end)' 651 .. 700 | 700
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#6629 - PERFORMANCE_SCHEMA, STATUS VARIABLES
• Consolidate system and status variable reporting within
Performance Schema
• Deprecated INFORMATION_SCHEMA tables ([GLOBAL |
SESSION]_[VARIABLES | STATUS])
• Improved the way that output is given (no session only variables in
performance_schema.global_status for example)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#6629 - PERFORMANCE_SCHEMA, STATUS VARIABLES
• Added 9 new tables:
• System Variables
• global_variables
• session_variables
• variables_by_thread
• Status Variables:
• global_status
• session_status
• status_by_thread
• status_by_account
• status_by_user
• status_by_host
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
mysql> select * from performance_schema.status_by_thread where variable_name like 'bytes%';
+-----------+----------------+----------------+
| THREAD_ID | VARIABLE_NAME | VARIABLE_VALUE |
+-----------+----------------+----------------+
| 37 | Bytes_received | 3901 |
| 37 | Bytes_sent | 135557 |
+-----------+----------------+----------------+
2 rows in set (0.01 sec)
mysql> select * from performance_schema.status_by_user where variable_name like 'bytes%';
+----------+----------------+----------------+
| USER | VARIABLE_NAME | VARIABLE_VALUE |
+----------+----------------+----------------+
| NULL | Bytes_received | 191 |
| NULL | Bytes_sent | 160 |
| msandbox | Bytes_received | 4281 |
| msandbox | Bytes_sent | 136263 |
| root | Bytes_received | 360 |
| root | Bytes_sent | 334 |
| mark | Bytes_received | 3434 |
| mark | Bytes_sent | 101628 |
+----------+----------------+----------------+
WL#6629 - PERFORMANCE_SCHEMA, STATUS VARIABLES
Or by host, account
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
sys.metrics
mysql> select * from sys.metrics limit 199, 10;
+-----------------------------+----------------+--------------------------------------+---------+
| Variable_name | Variable_value | Type | Enabled |
+-----------------------------+----------------+--------------------------------------+---------+
| tc_log_page_waits | 0 | Global Status | YES |
| threads_cached | 7 | Global Status | YES |
| threads_connected | 3 | Global Status | YES |
| threads_created | 10 | Global Status | YES |
| threads_running | 3 | Global Status | YES |
| uptime | 275689 | Global Status | YES |
| uptime_since_flush_status | 275689 | Global Status | YES |
| adaptive_hash_pages_added | 0 | InnoDB Metrics - adaptive_hash_index | NO |
| adaptive_hash_pages_removed | 0 | InnoDB Metrics - adaptive_hash_index | NO |
| adaptive_hash_rows_added | 0 | InnoDB Metrics - adaptive_hash_index | NO |
+-----------------------------+----------------+--------------------------------------+---------+
performance_schema.global_status
information_schema.innodb_metrics
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Performance Schema in MySQL 5.7.7
• WL#8321 - Enable statements_history and transactions_history
consumers by default in 5.7
• https://dev.mysql.com/worklog/task/?id=8321
• WL#8159 - Include Sys Schema in MySQL 5.7
• https://dev.mysql.com/worklog/task/?id=8159
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#8321 - Enable statements_history and
transactions_history consumers by default in 5.7
• Original intent was to enable the events_statements_history
(default of last 10 statements per thread by default) and
events_transactions_history (default of last 10 transactions per
thread) consumers by default
• events_statements_history now enabled by default
• events_transactions_history was enabled, but the transaction
instrument was not enabled by default, so this was later reverted
to save confusion
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#8159 - Include Sys Schema in MySQL 5.7
• Now installed by default from MySQL 5.7.7, with sys 1.4.0!
• Installed with:
• mysql_upgrade (unless —skip-sys-schema is used)
• mysql_install_db (unless —skip-sys-schema is used)
• mysqld —initialize
• (i.e, nothing extra to do)
• MySQL 5.7.9 upgraded to sys 1.5.0
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Performance Schema in MySQL 5.7.8
• WL#7795 - PERFORMANCE SCHEMA, HISTORY PER THREAD
• https://dev.mysql.com/worklog/task/?id=7795
• WL#7729 - Instrumentation of connection type
• https://dev.mysql.com/worklog/task/?id=7729
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#7795 - PERFORMANCE SCHEMA, HISTORY PER THREAD
• When enabling events_waits_history / events_waits_history_long
consumers, the instrumentation overhead could get high on high
concurrency / throughput systems (particularly, but also all of the
other stages, statements and transaction history consumers add
too)
• Added a `HISTORY` enum(‘YES','NO') column to
performance_schema.threads
• Allows you to just trace a specific session history, rather than all,
to debug specific sessions only without affecting other sessions
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#7729 - Instrumentation of connection type
• Added a CONNECTION_TYPE column to the
performance_schema.threads table
• Exposes how threads are connected:
• TCP/IP
• Socket
• Named Pipe
• Shared Memory
• SSL/TLS
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
sys.session_ssl_stats
mysql> select * from session_ssl_status;
+-----------+-------------+--------------------+---------------------+
| thread_id | ssl_version | ssl_cipher | ssl_sessions_reused |
+-----------+-------------+--------------------+---------------------+
| 26 | TLSv1 | DHE-RSA-AES256-SHA | 0 |
| 27 | TLSv1 | DHE-RSA-AES256-SHA | 0 |
| 28 | NULL | NULL | NULL |
+-----------+-------------+--------------------+---------------------+
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Performance Schema in MySQL 5.7.9
• WL#8786 - INFORMATION_SCHEMA WITH
SHOW_COMPATIBILITY_56
• https://dev.mysql.com/worklog/task/?id=8786
• WL#8792 - Update to sys schema 1.5.0
• https://dev.mysql.com/worklog/task/?id=8792
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#8786 - INFORMATION_SCHEMA WITH
SHOW_COMPATIBILITY_56
• WL#6629 originally made the INFORMATION_SCHEMA tables for
system / status variables return an empty result set when using
show_compatibility_56 = OFF
• This broke many things
• We changed this in 5.7.9 to still return a result set, but flag a
deprecation warning
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
WL#8792 - Update to sys schema 1.5.0
• 5.7.9 now updated to the latest sys schema!
• Includes many of the updates already talked about
• And much more that I can not fit in here!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Question time!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Performance Schema and Sys Schema in MySQL 5.7

Weitere ähnliche Inhalte

Was ist angesagt?

Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Yury Velikanov
 
What's new in Oracle 19c & 18c Recovery Manager (RMAN)
What's new in Oracle 19c & 18c Recovery Manager (RMAN)What's new in Oracle 19c & 18c Recovery Manager (RMAN)
What's new in Oracle 19c & 18c Recovery Manager (RMAN)
Satishbabu Gunukula
 

Was ist angesagt? (20)

MySQL InnoDB Cluster HA Overview & Demo
MySQL InnoDB Cluster HA Overview & DemoMySQL InnoDB Cluster HA Overview & Demo
MySQL InnoDB Cluster HA Overview & Demo
 
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs
 
What is new in MariaDB 10.6?
What is new in MariaDB 10.6?What is new in MariaDB 10.6?
What is new in MariaDB 10.6?
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability
 
[오픈소스컨설팅] 아파치톰캣 운영가이드 v1.3
[오픈소스컨설팅] 아파치톰캣 운영가이드 v1.3[오픈소스컨설팅] 아파치톰캣 운영가이드 v1.3
[오픈소스컨설팅] 아파치톰캣 운영가이드 v1.3
 
ProxySQL for MySQL
ProxySQL for MySQLProxySQL for MySQL
ProxySQL for MySQL
 
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
 
MySQL Shell for DBAs
MySQL Shell for DBAsMySQL Shell for DBAs
MySQL Shell for DBAs
 
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQLMySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
 
MariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & OptimizationMariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & Optimization
 
Standard Edition High Availability (SEHA) - The Why, What & How
Standard Edition High Availability (SEHA) - The Why, What & HowStandard Edition High Availability (SEHA) - The Why, What & How
Standard Edition High Availability (SEHA) - The Why, What & How
 
Fast Start Failover DataGuard
Fast Start Failover DataGuardFast Start Failover DataGuard
Fast Start Failover DataGuard
 
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
 
PostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsPostgreSQL Administration for System Administrators
PostgreSQL Administration for System Administrators
 
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
 
Intro to MySQL Master Slave Replication
Intro to MySQL Master Slave ReplicationIntro to MySQL Master Slave Replication
Intro to MySQL Master Slave Replication
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
 
Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...
Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...
Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...
 
MySQL_SQL_Tunning_v0.1.3.docx
MySQL_SQL_Tunning_v0.1.3.docxMySQL_SQL_Tunning_v0.1.3.docx
MySQL_SQL_Tunning_v0.1.3.docx
 
What's new in Oracle 19c & 18c Recovery Manager (RMAN)
What's new in Oracle 19c & 18c Recovery Manager (RMAN)What's new in Oracle 19c & 18c Recovery Manager (RMAN)
What's new in Oracle 19c & 18c Recovery Manager (RMAN)
 

Andere mochten auch (6)

Performance schema and sys schema
Performance schema and sys schemaPerformance schema and sys schema
Performance schema and sys schema
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
The MySQL SYS Schema
The MySQL SYS SchemaThe MySQL SYS Schema
The MySQL SYS Schema
 
Developing Information Schema Plugins
Developing Information Schema PluginsDeveloping Information Schema Plugins
Developing Information Schema Plugins
 
Extending MySQL Enterprise Monitor
Extending MySQL Enterprise MonitorExtending MySQL Enterprise Monitor
Extending MySQL Enterprise Monitor
 
Instrumenting plugins for Performance Schema
Instrumenting plugins for Performance SchemaInstrumenting plugins for Performance Schema
Instrumenting plugins for Performance Schema
 

Ähnlich wie Performance Schema and Sys Schema in MySQL 5.7

Mysql tech day_paris_ps_and_sys
Mysql tech day_paris_ps_and_sysMysql tech day_paris_ps_and_sys
Mysql tech day_paris_ps_and_sys
Mark Leith
 
MySQL 5.7: Core Server Changes
MySQL 5.7: Core Server ChangesMySQL 5.7: Core Server Changes
MySQL 5.7: Core Server Changes
Morgan Tocker
 
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
Geir Høydalsvik
 
MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014
Dave Stokes
 
Mysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesMysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New Features
Tarique Saleem
 

Ähnlich wie Performance Schema and Sys Schema in MySQL 5.7 (20)

Mysql tech day_paris_ps_and_sys
Mysql tech day_paris_ps_and_sysMysql tech day_paris_ps_and_sys
Mysql tech day_paris_ps_and_sys
 
MySQL NoSQL APIs
MySQL NoSQL APIsMySQL NoSQL APIs
MySQL NoSQL APIs
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
 
MySQL 5.7: Performance Schema Improvements
MySQL 5.7: Performance Schema ImprovementsMySQL 5.7: Performance Schema Improvements
MySQL 5.7: Performance Schema Improvements
 
MySQL Troubleshooting with the Performance Schema
MySQL Troubleshooting with the Performance SchemaMySQL Troubleshooting with the Performance Schema
MySQL Troubleshooting with the Performance Schema
 
MySQL sys schema deep dive
MySQL sys schema deep diveMySQL sys schema deep dive
MySQL sys schema deep dive
 
MySQL-Performance Schema- What's new in MySQL-5.7 DMRs
MySQL-Performance Schema- What's new in MySQL-5.7 DMRsMySQL-Performance Schema- What's new in MySQL-5.7 DMRs
MySQL-Performance Schema- What's new in MySQL-5.7 DMRs
 
MySQL Performance Metrics that Matter
MySQL Performance Metrics that MatterMySQL Performance Metrics that Matter
MySQL Performance Metrics that Matter
 
MySQL Replication
MySQL ReplicationMySQL Replication
MySQL Replication
 
MySQL Group Replication - an Overview
MySQL Group Replication - an OverviewMySQL Group Replication - an Overview
MySQL Group Replication - an Overview
 
MySQL 5.7: Core Server Changes
MySQL 5.7: Core Server ChangesMySQL 5.7: Core Server Changes
MySQL 5.7: Core Server Changes
 
MySQL Webinar Series 4/4 - Manage & tune
MySQL Webinar Series 4/4 - Manage & tuneMySQL Webinar Series 4/4 - Manage & tune
MySQL Webinar Series 4/4 - Manage & tune
 
MySQL Performance Schema : fossasia
MySQL Performance Schema : fossasiaMySQL Performance Schema : fossasia
MySQL Performance Schema : fossasia
 
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
 
MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014
 
Mysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesMysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New Features
 
Mysql User Camp : 20-June-14 : Mysql New features and NoSQL Support
 Mysql User Camp : 20-June-14 : Mysql New features and NoSQL Support Mysql User Camp : 20-June-14 : Mysql New features and NoSQL Support
Mysql User Camp : 20-June-14 : Mysql New features and NoSQL Support
 
MySQL Tech Tour 2015 - Manage & Tune
MySQL Tech Tour 2015 - Manage & TuneMySQL Tech Tour 2015 - Manage & Tune
MySQL Tech Tour 2015 - Manage & Tune
 
Netherlands Tech Tour - 06 MySQL Enterprise Monitor
Netherlands Tech Tour - 06 MySQL Enterprise MonitorNetherlands Tech Tour - 06 MySQL Enterprise Monitor
Netherlands Tech Tour - 06 MySQL Enterprise Monitor
 
Double the Performance of Oracle SOA Suite 11g? Absolutely!
Double the Performance of Oracle SOA Suite 11g? Absolutely!Double the Performance of Oracle SOA Suite 11g? Absolutely!
Double the Performance of Oracle SOA Suite 11g? Absolutely!
 

Mehr von Mark Leith

Introduction to MySQL Enterprise Monitor
Introduction to MySQL Enterprise MonitorIntroduction to MySQL Enterprise Monitor
Introduction to MySQL Enterprise Monitor
Mark Leith
 
MySQL Administration and Monitoring
MySQL Administration and MonitoringMySQL Administration and Monitoring
MySQL Administration and Monitoring
Mark Leith
 
Performance schema and_ps_helper
Performance schema and_ps_helperPerformance schema and_ps_helper
Performance schema and_ps_helper
Mark Leith
 

Mehr von Mark Leith (7)

MySQL sys schema deep dive
MySQL sys schema deep diveMySQL sys schema deep dive
MySQL sys schema deep dive
 
Introduction to MySQL Enterprise Monitor
Introduction to MySQL Enterprise MonitorIntroduction to MySQL Enterprise Monitor
Introduction to MySQL Enterprise Monitor
 
MySQL Administration and Monitoring
MySQL Administration and MonitoringMySQL Administration and Monitoring
MySQL Administration and Monitoring
 
Performance schema and_ps_helper
Performance schema and_ps_helperPerformance schema and_ps_helper
Performance schema and_ps_helper
 
MySQL Monitoring Mechanisms
MySQL Monitoring MechanismsMySQL Monitoring Mechanisms
MySQL Monitoring Mechanisms
 
Getting to Know MySQL Enterprise Monitor
Getting to Know MySQL Enterprise MonitorGetting to Know MySQL Enterprise Monitor
Getting to Know MySQL Enterprise Monitor
 
MySQL Monitoring Mechanisms
MySQL Monitoring MechanismsMySQL Monitoring Mechanisms
MySQL Monitoring Mechanisms
 

Kürzlich hochgeladen

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Kürzlich hochgeladen (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Performance Schema and Sys Schema in MySQL 5.7

  • 1. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Performance Schema and Sys Schema in MySQL 5.7 Mark Leith Senior Software Development Manager MySQL Enterprise Tools, Oracle Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 2. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 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 decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
  • 3. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Program Agenda Introduction Much Slides 1 2
  • 4. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | You are … : • Using 5.1? • Using 5.5? • Using 5.6? • Using 5.7? • A Performance Schema user? • A Sys Schema user?
  • 5. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Program Agenda Introduction Much Slides 1 2
  • 6. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Performance Schema Improvements in MySQL 5.7 • 23 Worklogs completed • 14 Adding new instrumentation • 4 Performance / Scalability improvements • 5 Configuration / Refactoring improvements • 35 new tables added (5.7 has 87, 5.6 had 52, 5.5 had 17) • 419 new instruments (5.7 has 972, 5.6 had 553, 5.5 had 222)
  • 7. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Performance Schema in MySQL 5.7.2 • WL#3249 - PERFORMANCE SCHEMA, Instrument memory usage • https://dev.mysql.com/worklog/task/?id=3249 • WL#5766 - PERFORMANCE SCHEMA, Stored programs instrumentation • https://dev.mysql.com/worklog/task/?id=5766 • WL#3656 - PERFORMANCE SCHEMA table for SHOW SLAVE STATUS • https://dev.mysql.com/worklog/task/?id=3656
  • 8. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | "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 WL#3249 - PERFORMANCE_SCHEMA, Instrument memory usage http://www.mysqlperformanceblog.com/2012/03/21/troubleshooting-mysql-memory-usage/ 8
  • 9. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#3249 - Instrument Memory Usage • Added 212 different memory instrumentation types (all disabled by default) • Records current, high and low water marks of allocations • Does not track latency of memory allocation • 5 new summary tables • memory_summary_by_account_by_event_name • memory_summary_by_host_by_event_name • memory_summary_by_thread_by_event_name • memory_summary_by_user_by_event_name • memory_summary_global_by_event_name
  • 10. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | p_s.memory_summary_global_by_event_name mysql> select * from performance_schema.memory_summary_global_by_event_name -> order by current_number_of_bytes_used desc limit 1G *************************** 1. row *************************** EVENT_NAME: memory/innodb/buf_buf_pool COUNT_ALLOC: 1 COUNT_FREE: 0 SUM_NUMBER_OF_BYTES_ALLOC: 137428992 SUM_NUMBER_OF_BYTES_FREE: 0 LOW_COUNT_USED: 0 CURRENT_COUNT_USED: 1 HIGH_COUNT_USED: 1 LOW_NUMBER_OF_BYTES_USED: 0 CURRENT_NUMBER_OF_BYTES_USED: 137428992 HIGH_NUMBER_OF_BYTES_USED: 137428992 InnoDB Buffer Pool 137.429 Megabytes
  • 11. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | sys.memory_global_by_current_bytes view mysql> select * from sys.memory_global_by_current_bytesG *************************** 1. row *************************** event_name: memory/innodb/buf_buf_pool current_count: 1 current_alloc: 131.06 MiB current_avg_alloc: 131.06 MiB high_count: 1 high_alloc: 131.06 MiB high_avg_alloc: 131.06 MiB *************************** 2. row *************************** event_name: memory/innodb/log0log current_count: 9 current_alloc: 16.01 MiB current_avg_alloc: 1.78 MiB high_count: 9 high_alloc: 16.01 MiB high_avg_alloc: 1.78 MiB ...
  • 12. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | sys.user_summary view mysql> select * from sys.user_summaryG *************************** 1. row *************************** user: mark statements: 3072 statement_latency: 1.77 s statement_avg_latency: 575.29 us table_scans: 7 file_ios: 20043 file_io_latency: 346.79 ms current_connections: 1 total_connections: 1 unique_hosts: 1 current_memory: 515.81 KiB total_memory_allocated: 30.69 MiB
  • 13. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | "Suppose I accessed your database and listed the entire set of stored functions and procedures. How many of them are you not even sure are in use anymore? How many of them you think you can DROP, but are too afraid to, and keep them in just in case?" Shlomi Noach WL#5766 - PERFORMANCE_SCHEMA, Stored programs instrumentation 13 http://code.openark.org/blog/mysql/why-delegating-code-to-mysql-stored-routines-is-poor-engineering-practice
  • 14. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#5766 - Stored programs instrumentation • Tracks Stored Procedures, Stored Functions, Triggers and Events • Added 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 instrumentation • 1 new summary table • events_statements_summary_by_program
  • 15. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | p_s.memory_summary_global_by_event_name SUM_ROWS_AFFECTED: 1 SUM_ROWS_SENT: 0 SUM_ROWS_EXAMINED: 1 SUM_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 mysql> select * from events_statements_summary_by_programG *************************** 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
  • 16. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#3656 - PERFORMANCE_SCHEMA table for SHOW SLAVE STATUS • 6 new tables • replication_connection_configuration • replication_connection_status • replication_execute_configuration • replication_execute_status • replication_execute_status_by_coordinator • replication_execute_status_by_worker
  • 17. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | SHOW SLAVE STATUS Split 17
  • 18. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Replication Connection Config mysql> select * from replication_connection_configurationG *************************** 1. row *************************** CHANNEL_NAME: HOST: 127.0.0.1 PORT: 13253 USER: rsandbox NETWORK_INTERFACE: AUTO_POSITION: 1 SSL_ALLOWED: NO SSL_CA_FILE: SSL_CA_PATH: SSL_CERTIFICATE: SSL_CIPHER: SSL_KEY: SSL_VERIFY_SERVER_CERTIFICATE: NO SSL_CRL_FILE: SSL_CRL_PATH: CONNECTION_RETRY_INTERVAL: 60 CONNECTION_RETRY_COUNT: 86400 HEARTBEAT_INTERVAL: 30.000 *************************** 2. row *************************** CHANNEL_NAME: 56-cluster One row per replication channel when using multi-master replication
  • 19. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Replication Connection Status mysql> select * from performance_schema.replication_connection_statusG *************************** 1. row *************************** CHANNEL_NAME: GROUP_NAME: SOURCE_UUID: 00013253-1111-1111-1111-111111111111 THREAD_ID: 23 SERVICE_STATE: ON COUNT_RECEIVED_HEARTBEATS: 27 LAST_HEARTBEAT_TIMESTAMP: 2015-09-18 15:01:00 RECEIVED_TRANSACTION_SET: <GTID SET> LAST_ERROR_NUMBER: 0 LAST_ERROR_MESSAGE: LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00 *************************** 2. row *************************** CHANNEL_NAME: 56-cluster GROUP_NAME: SOURCE_UUID: 16d226ee-f89b-11e4-9d4f-b36d08df49cf THREAD_ID: 25 SERVICE_STATE: ON COUNT_RECEIVED_HEARTBEATS: 27 ...
  • 20. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Replication Applier Status Config / State mysql> select * from performance_schema.replication_applier_status; +--------------+---------------+-----------------+----------------------------+ | CHANNEL_NAME | SERVICE_STATE | REMAINING_DELAY | COUNT_TRANSACTIONS_RETRIES | +--------------+---------------+-----------------+----------------------------+ | | ON | NULL | 0 | | 56-cluster | ON | NULL | 0 | +--------------+---------------+-----------------+----------------------------+ mysql> select * from performance_schema.replication_applier_configuration; +--------------+---------------+ | CHANNEL_NAME | DESIRED_DELAY | +--------------+---------------+ | | 0 | | 56-cluster | 0 | +--------------+---------------+ One row per replication channel when using multi-master replication
  • 21. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Replication Applier Status Details mysql> select * from performance_schema.replication_applier_status_by_worker; +--------------+-----------+-----------+---------------+-----------------------+-------------------+--------------------+----------------------+ | CHANNEL_NAME | WORKER_ID | THREAD_ID | SERVICE_STATE | LAST_SEEN_TRANSACTION | LAST_ERROR_NUMBER | LAST_ERROR_MESSAGE | LAST_ERROR_TIMESTAMP | +--------------+-----------+-----------+---------------+-----------------------+-------------------+--------------------+----------------------+ | | 1 | 27 | ON | <GTID SET> | 0 | | 0000-00-00 00:00:00 | | | 2 | 29 | ON | <GTID SET> | 0 | | 0000-00-00 00:00:00 | | | 3 | 31 | ON | <GTID SET> | 0 | | 0000-00-00 00:00:00 | | | 4 | 33 | ON | <GTID SET> | 0 | | 0000-00-00 00:00:00 | | 56-cluster | 1 | 28 | ON | <GTID SET> | 0 | | 0000-00-00 00:00:00 | | 56-cluster | 2 | 30 | ON | <GTID SET> | 0 | | 0000-00-00 00:00:00 | | 56-cluster | 3 | 32 | ON | <GTID SET> | 0 | | 0000-00-00 00:00:00 | | 56-cluster | 4 | 34 | ON | <GTID SET> | 0 | | 0000-00-00 00:00:00 | +--------------+-----------+-----------+---------------+-----------------------+-------------------+--------------------+----------------------+ mysql> select * from performance_schema.replication_applier_status_by_coordinator; +--------------+-----------+---------------+-------------------+--------------------+----------------------+ | CHANNEL_NAME | THREAD_ID | SERVICE_STATE | LAST_ERROR_NUMBER | LAST_ERROR_MESSAGE | LAST_ERROR_TIMESTAMP | +--------------+-----------+---------------+-------------------+--------------------+----------------------+ | | 24 | ON | 0 | | 0000-00-00 00:00:00 | | 56-cluster | 26 | ON | 0 | | 0000-00-00 00:00:00 | +--------------+-----------+---------------+-------------------+--------------------+----------------------+ One row per parallel worker, across all replication channels One row per channel use for all applier state when not using parallel workers
  • 22. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Performance Schema in MySQL 5.7.3 • WL#5879 - PERFORMANCE SCHEMA, MDL lock instrumentation • https://dev.mysql.com/worklog/task/?id=5879 • WL#5864 - PERFORMANCE SCHEMA, instrument TRANSACTIONS • https://dev.mysql.com/worklog/task/?id=5864
  • 23. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | "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 WL#5879 - PERFORMANCE_SCHEMA, MDL lock instrumentation 23
  • 24. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#5879 - PERFORMANCE_SCHEMA, MDL lock instrumentation • Added the wait/lock/metadata/sql/mdl instrument • 2 new current instance tables • metadata_locks • table_handles
  • 25. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | p_s.metadata_locks 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 | | +-----------------------+---------------------+------+-----+---------+-------+
  • 26. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | p_s.metadata_locks sample output mysql> 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 | +--------+--------------------+----------------+---------------------+---------------+-------------+
  • 27. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | sys.schema_table_lock_waits mysql> select * from sys.schema_table_lock_waitsG *************************** 1. row *************************** object_schema: test object_name: t waiting_thread_id: 43 waiting_pid: 21 waiting_account: msandbox@localhost waiting_lock_type: SHARED_UPGRADABLE waiting_lock_duration: TRANSACTION waiting_query: alter table test.t add foo int waiting_query_secs: 988 waiting_query_rows_affected: 0 waiting_query_rows_examined: 0 blocking_thread_id: 42 blocking_pid: 20 blocking_account: msandbox@localhost blocking_lock_type: SHARED_NO_READ_WRITE blocking_lock_duration: TRANSACTION sql_kill_blocking_query: KILL QUERY 20 sql_kill_blocking_connection: KILL 20
  • 28. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | sys.innodb_lock_waits mysql> SELECT * FROM sys.innodb_lock_waitsG *************************** 1. row *************************** wait_started: 2014-11-11 13:39:20 wait_age: 00:00:07 wait_age_secs: 7 locked_table: `db1`.`t1` locked_index: PRIMARY locked_type: RECORD waiting_trx_id: 867158 waiting_trx_started: 2014-11-11 13:39:15 waiting_trx_age: 00:00:12 waiting_trx_rows_locked: 0 waiting_trx_rows_modified: 0 waiting_pid: 3 waiting_query: UPDATE t1 SET val = val + 1 WHERE id = 2 waiting_lock_id: 867158:2363:3:3 waiting_lock_mode: X blocking_trx_id: 867157 blocking_pid: 4 ... blocking_query: UPDATE t1 SET val … blocking_lock_id: 867157:2363:3:3 blocking_lock_mode: X blocking_trx_started: 2014-11-11 13:39:11 blocking_trx_age: 00:00:16 blocking_trx_rows_locked: 1 blocking_trx_rows_modified: 1 sql_kill_blocking_query: KILL QUERY 4 sql_kill_blocking_connection: KILL 4
  • 29. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#5864 - PERFORMANCE SCHEMA, instrument TRANSACTIONS • Added the transaction instrument • 8 new raw and summary tables • events_transactions_current • events_transactions_history • events_transactions_history_long • events_transactions_summary_by_account_by_event_name • events_transactions_summary_by_host_by_event_name • events_transactions_summary_by_thread_by_event_name • events_transactions_summary_by_user_by_event_name • events_transactions_summary_global_by_event_name
  • 30. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#5864 - PERFORMANCE SCHEMA, instrument TRANSACTIONS • Exposes details of transactions in raw or summary views • Show details such as • Transaction latency • Isolation levels • Auto commit • Savepoint info • GTID or transaction IDs • Link transactions to the statements within the transactions
  • 31. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | p_s.events_transactions_current mysql> select * from events_transactions_currentG *************************** 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: 0 NUMBER_OF_ROLLBACK_TO_SAVEPOINT: 0 NUMBER_OF_RELEASE_SAVEPOINT: 0 OBJECT_INSTANCE_BEGIN: NULL NESTING_EVENT_ID: NULL NESTING_EVENT_TYPE: NULL
  • 32. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | sys.ps_thread_trx_info(<thread_id>) SELECT sys.ps_thread_trx_info(48) as trx_infoG *************************** 1. row *************************** trx_info: [ { "time": "790.70 us", "state": "COMMITTED", "mode": "READ WRITE", "autocommitted": "NO", "gtid": "AUTOMATIC", "isolation": "REPEATABLE READ", "statements_executed": [ { "sql_text": "INSERT INTO info VALUES (1, 'foo')", "time": "471.02 us", "schema": "trx", "rows_examined": 0, "rows_affected": 1, "rows_sent": 0, "tmp_tables": 0, "tmp_disk_tables": 0, "sort_rows": 0, "sort_merge_passes": 0 }, ...
  • 33. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | sys.ps_trace_thread procedure • ps_trace_thread() monitors a specific thread for a period • Captures as much information on the thread activity as possible • Returns a “dot” formatted file, that can graph the event hierarchy • http://en.wikipedia.org/wiki/DOT_(graph_description_language)
  • 34. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | sys.ps_trace_thread procedure example mysql> call ps_trace_thread(27768, '/tmp/stack_27768.dot', 60, 0.1, true, true, true); +------------------------------------------------+ | Info | +------------------------------------------------+ | Data collection starting for THREAD_ID = 27768 | +------------------------------------------------+ 1 row in set (4.82 sec) +---------------------------------------------+ | Info | +---------------------------------------------+ | Stack trace written to /tmp/stack_27768.dot | +---------------------------------------------+ 1 row in set (60.90 sec) +--------------------------------------------------------+ | Convert to PDF | +--------------------------------------------------------+ | dot -Tpdf -o /tmp/stack_27768.pdf /tmp/stack_27768.dot | +--------------------------------------------------------+ 1 row in set (60.90 sec) +--------------------------------------------------------+ | Convert to PNG | +--------------------------------------------------------+ | dot -Tpng -o /tmp/stack_27768.png /tmp/stack_27768.dot | +--------------------------------------------------------+ 1 row in set (60.90 sec)+
  • 35. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | ps_trace_thread procedure example MySQL 5.7 Procedures Transactions Statements Stages Waits
  • 36. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 37. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 38. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 39. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 40. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 41. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 42. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Performance Schema in MySQL 5.7.4 • WL#7152 - PERFORMANCE SCHEMA, EXTRACT DIGEST • https://dev.mysql.com/worklog/task/?id=7152 • WL#5768 - PERFORMANCE SCHEMA, prepared statements instrumentation • https://dev.mysql.com/worklog/task/?id=5768
  • 43. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#7152 - PERFORMANCE SCHEMA, EXTRACT DIGEST • Moved the statement digest normalization code from the Performance Schema storage engine (storage/perfschema/pfs_digest.*) to the SQL layer (sql/sql_digest*) • As a result of re factoring, the following APIs are available in the SQL layer: • compute_digest_md5(), to compute a query digest • compute_digest_text(), to compute a query digest text. • Because the server may need to read a statement digest *after* parsing is completed, the memory used to represent a digest is stored in THD in two new attributes, THD::m_digest_state and THD::m_digest • Groundwork for Query Rewrite Framework, MySQL Enterprise Firewall, etc.
  • 44. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#5768 - PERFORMANCE SCHEMA, prepared statements instrumentation • Instrumentation depends on already existing statement instruments • statement/com/prepare, statement/com/execute • statement/sql/prepare_sql, statement/sql/execute_sql • 1 new current instance table • prepared_statements_instances
  • 45. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | p_s.prepared_statement_instances mysql> select * from performance_schema.prepared_statements_instancesG *************************** 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: 0 SUM_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
  • 46. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Performance Schema in MySQL 5.7.5 • WL#6884 - PERFORMANCE SCHEMA, USER VARIABLES • https://dev.mysql.com/worklog/task/?id=6884 • WL#7415 - PERFORMANCE SCHEMA, STAGE PROGRESS • https://dev.mysql.com/worklog/task/?id=7415 • WL#7445 - PERFORMANCE SCHEMA: instrument SX-lock for rw_lock • https://dev.mysql.com/worklog/task/?id=7445 • WL#7802 - PERFORMANCE SCHEMA, BATCH TABLE IO • https://dev.mysql.com/worklog/task/?id=7802 • WL#7777 - Integrate PFS memory instrumentation with InnoDB • https://dev.mysql.com/worklog/task/?id=7777 • WL#7817 - RPL Monitoring: Move status variables to replication P_S tables • https://dev.mysql.com/worklog/task/?id=7817
  • 47. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#6884 - PERFORMANCE SCHEMA, USER VARIABLES mysql> set @debug := 1; Query OK, 0 rows affected (0.10 sec) mysql> set @totalRows := 300; Query OK, 0 rows affected (0.00 sec) mysql> select * from performance_schema.user_variables_by_thread; +-----------+---------------+----------------+ | THREAD_ID | VARIABLE_NAME | VARIABLE_VALUE | +-----------+---------------+----------------+ | 33 | totalRows | 300 | | 33 | debug | 1 | | 34 | totalRows | 150 | +-----------+---------------+----------------+
  • 48. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#7415 - PERFORMANCE SCHEMA, STAGE PROGRESS • Added the WORK_COMPLETED and WORK_ESTIMATED columns to the events_stages_current table • Work is in units, and depends on the stage what it may be, rows copied, bytes processed, etc. • Started with adding tracking to: • stage/sql/copy to tmp table • (more to come later in this presentation)
  • 49. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | sys.sessions progress estimation mysql> select * from sys.sessionsG *************************** 1. row *************************** thd_id: 44524 conn_id: 44502 user: msandbox@localhost db: test command: Query state: alter table (flush) time: 18 current_statement: alter table t1 add column g int statement_latency: 18.45 s progress: 98.84 lock_latency: 265.43 ms rows_examined: 0 rows_sent: 0 rows_affected: 0 tmp_tables: 0 tmp_disk_tables: 0 ...
  • 50. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#7445 - PERFORMANCE SCHEMA: instrument SX-lock for rw_lock • This task is a consequence of • WL#6363 InnoDB: implement SX-lock for rw_lock • Adds the new wait/synch/sxlock/% wait type • 12 new instruments added (all disabled by default) • wait/synch/sxlock/innodb/btr_search_latch, wait/synch/sxlock/innodb/ dict_operation_lock, wait/synch/sxlock/innodb/fil_space_latch, wait/synch/sxlock/ innodb/checkpoint_lock, wait/synch/sxlock/innodb/fts_cache_rw_lock, wait/synch/ sxlock/innodb/fts_cache_init_rw_lock, wait/synch/sxlock/innodb/trx_i_s_cache_lock, wait/synch/sxlock/innodb/trx_purge_latch, wait/synch/sxlock/innodb/ index_tree_rw_lock, wait/synch/sxlock/innodb/index_online_log, wait/synch/sxlock/ innodb/dict_table_stats, wait/synch/sxlock/innodb/hash_table_locks
  • 51. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#7445 - PERFORMANCE SCHEMA: instrument SX-lock for rw_lock • New Lock operations: • SHARED LOCK • SHARED EXCLUSIVE LOCK • EXCLUSIVE LOCK • TRY SHARED LOCK • TRY SHARED EXCLUSIVE LOCK • TRY EXCLUSIVE LOCK
  • 52. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#7802 - PERFORMANCE SCHEMA, BATCH TABLE IO • When scanning large numbers of rows, the Table/Index IO instrumentation overhead within 5.6 could be high • Now, we record instrumentation in batches when: • We are accessing the inner-most table of a query block, and • We are not requesting a single row from that table (eq_ref), and • We are not evaluating a subquery containing table access for that table.
  • 53. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#7802 - PERFORMANCE SCHEMA, BATCH TABLE IO • For such tables, switch from instrumenting row operations to instrumenting scans by: • Before starting the access, signal to the storage handler that scan instrumentation will be used • On first access to the handler, start the timer and reset number of rows to zero • On each successful row fetch in the handler, increment the row count, but do not report to performance schema • On first unsuccessful row fetch (error, eof), report row count and execution time to performance schema • If scan is aborted by nested-loop executor (e.g because of LIMIT reached or first- match complete), signal the handler that scan is complete - handler will then report accumulated data to performance schema
  • 54. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#7777 - Integrate PFS memory instrumentation with InnoDB • Follow up to WL#3249 - PERFORMANCE SCHEMA, Instrument memory usage • Instrumented all InnoDB memory usage within the new framework
  • 55. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#7817 - RPL Monitoring: Move status variables to replication P_S tables • With Multi-Master Replication, having single global status variables is incorrect for the following variables, so they were added to the replication tables: • Slave_running • Slave_retried_transactions • Slave_last_heartbeat • Slave_received_heartbeats • Slave_heartbeat_period • You saw these integrated in my examples for the replication tables earlier
  • 56. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Performance Schema in MySQL 5.7.6 • WL#7800 - PERFORMANCE SCHEMA, SETUP_ACTORS ENABLED COLUMN • https://dev.mysql.com/worklog/task/?id=7800 • WL#7270 - PERFORMANCE SCHEMA, configurable statement text size • https://dev.mysql.com/worklog/task/?id=7270 • WL#7698 - PERFORMANCE SCHEMA, REDUCE MEMORY USAGE FOR TABLE IO / TABLE LOCK • https://dev.mysql.com/worklog/task/?id=7698 • WL#7794 - PERFORMANCE SCHEMA, SCALABLE MEMORY ALLOCATION • https://dev.mysql.com/worklog/task/?id=7794 • WL#5889 - Add InnoDB events to Performance Schema's Event Stage table • https://dev.mysql.com/worklog/task/?id=5889 • WL#6629 - PERFORMANCE_SCHEMA, STATUS VARIABLES • https://dev.mysql.com/worklog/task/?id=6629
  • 57. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#7800 - PERFORMANCE SCHEMA, SETUP_ACTORS ENABLED COLUMN • The performance_schema.setup_actors table previously only worked for including users to instrument, but it was impossible to instrument all but one or two users easily • Added `ENABLED` enum(‘YES’,'NO') to setup_actors • To disable user “mark@localhost”: • INSERT INTO performance_schema.setup_actors VALUES (‘localhost’, ’mark’, ‘%’, ‘NO’);
  • 58. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#7270 - PERFORMANCE SCHEMA, configurable statement text size • Previously all SQL text and digest storage was limited to 1024 characters because of memory concerns • However, this can cause incorrect digest aggregation for queries that differ only after 1024 characters • Added two new variables to control how much memory to use: • max_digest_length (remember, this is now digesting at SQL layer) • performance_schema_max_sql_text_length
  • 59. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#7698 - PERFORMANCE SCHEMA, REDUCE MEMORY USAGE FOR TABLE IO / TABLE LOCK • For instances with large numbers of tables, table IO and lock instrumentation could have excessive memory usage • Some bad assumptions (such as always allocate space for 64 indexes per table, or lock stats for unused tables) on up front allocations, now indexes are allocated on demand • Added 2 new system variables: • performance_schema_max_table_lock_stat (max tables to track for table locks) • performance_schema_max_index_stat (max indexes to track) • And 2 new status variables: • performance_schema_table_lock_stat_lost • performance_schema_index_stat_lost
  • 60. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#7794 - PERFORMANCE SCHEMA, SCALABLE MEMORY ALLOCATION • Up until now, Performance Schema always allocated all of the internal instrument buffers on server start up, to save runtime memory allocation overhead • Default config in 5.6 could allocate 400+MB memory straight away • Memory is now allocated in chunks (size depends on instrument) • ~120MB up front usage by default for all instrumentation • 70 new memory instruments to track various usage • memory/performance_schema/%
  • 61. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#7794 - PERFORMANCE SCHEMA, SCALABLE MEMORY ALLOCATION • The following now provide auto-scaling (set to -1 for value): • performance_schema_accounts_size • performance_schema_hosts_size • performance_schema_max_cond_instances • performance_schema_max_file_instances • performance_schema_max_index_stat • performance_schema_max_metadata_locks • performance_schema_max_mutex_instances • performance_schema_max_prepared_statements_instances • performance_schema_max_program_instances • performance_schema_max_rwlock_instances • performance_schema_max_socket_instances • performance_schema_max_table_handles • performance_schema_max_table_instances • performance_schema_max_table_lock_stat • performance_schema_max_thread_instances • performance_schema_users_size
  • 62. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#5889 - Add InnoDB events to Performance Schema's Event Stage table • Follow up to WL#7415 - PERFORMANCE SCHEMA, STAGE PROGRESS • Added stage progress instruments within InnoDB: • stage/innodb/buffer pool load • stage/innodb/alter table (read PK and internal sort) • stage/innodb/alter table (merge sort) • stage/innodb/alter table (insert) • stage/innodb/alter table (flush) • stage/innodb/alter table (log apply index) • stage/innodb/alter table (log apply table) • stage/innodb/alter table (end)
  • 63. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#5889 - Add InnoDB events to Performance Schema's Event Stage table • InnoDB ALTER TABLE instruments work in tandem for the entire ALTER TABLE for example: work_complete | work_estimated '.../alter table (read..)' 0 .. 100 | 700 '.../alter table (merge..)' 101 .. 300 | 700 '.../alter table (insert)' 301 .. 500 | 700 '.../alter table (flush)' 500 .. 650 | 700 '.../alter table (end)' 651 .. 700 | 700
  • 64. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#6629 - PERFORMANCE_SCHEMA, STATUS VARIABLES • Consolidate system and status variable reporting within Performance Schema • Deprecated INFORMATION_SCHEMA tables ([GLOBAL | SESSION]_[VARIABLES | STATUS]) • Improved the way that output is given (no session only variables in performance_schema.global_status for example)
  • 65. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#6629 - PERFORMANCE_SCHEMA, STATUS VARIABLES • Added 9 new tables: • System Variables • global_variables • session_variables • variables_by_thread • Status Variables: • global_status • session_status • status_by_thread • status_by_account • status_by_user • status_by_host
  • 66. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | mysql> select * from performance_schema.status_by_thread where variable_name like 'bytes%'; +-----------+----------------+----------------+ | THREAD_ID | VARIABLE_NAME | VARIABLE_VALUE | +-----------+----------------+----------------+ | 37 | Bytes_received | 3901 | | 37 | Bytes_sent | 135557 | +-----------+----------------+----------------+ 2 rows in set (0.01 sec) mysql> select * from performance_schema.status_by_user where variable_name like 'bytes%'; +----------+----------------+----------------+ | USER | VARIABLE_NAME | VARIABLE_VALUE | +----------+----------------+----------------+ | NULL | Bytes_received | 191 | | NULL | Bytes_sent | 160 | | msandbox | Bytes_received | 4281 | | msandbox | Bytes_sent | 136263 | | root | Bytes_received | 360 | | root | Bytes_sent | 334 | | mark | Bytes_received | 3434 | | mark | Bytes_sent | 101628 | +----------+----------------+----------------+ WL#6629 - PERFORMANCE_SCHEMA, STATUS VARIABLES Or by host, account
  • 67. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | sys.metrics mysql> select * from sys.metrics limit 199, 10; +-----------------------------+----------------+--------------------------------------+---------+ | Variable_name | Variable_value | Type | Enabled | +-----------------------------+----------------+--------------------------------------+---------+ | tc_log_page_waits | 0 | Global Status | YES | | threads_cached | 7 | Global Status | YES | | threads_connected | 3 | Global Status | YES | | threads_created | 10 | Global Status | YES | | threads_running | 3 | Global Status | YES | | uptime | 275689 | Global Status | YES | | uptime_since_flush_status | 275689 | Global Status | YES | | adaptive_hash_pages_added | 0 | InnoDB Metrics - adaptive_hash_index | NO | | adaptive_hash_pages_removed | 0 | InnoDB Metrics - adaptive_hash_index | NO | | adaptive_hash_rows_added | 0 | InnoDB Metrics - adaptive_hash_index | NO | +-----------------------------+----------------+--------------------------------------+---------+ performance_schema.global_status information_schema.innodb_metrics
  • 68. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Performance Schema in MySQL 5.7.7 • WL#8321 - Enable statements_history and transactions_history consumers by default in 5.7 • https://dev.mysql.com/worklog/task/?id=8321 • WL#8159 - Include Sys Schema in MySQL 5.7 • https://dev.mysql.com/worklog/task/?id=8159
  • 69. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#8321 - Enable statements_history and transactions_history consumers by default in 5.7 • Original intent was to enable the events_statements_history (default of last 10 statements per thread by default) and events_transactions_history (default of last 10 transactions per thread) consumers by default • events_statements_history now enabled by default • events_transactions_history was enabled, but the transaction instrument was not enabled by default, so this was later reverted to save confusion
  • 70. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#8159 - Include Sys Schema in MySQL 5.7 • Now installed by default from MySQL 5.7.7, with sys 1.4.0! • Installed with: • mysql_upgrade (unless —skip-sys-schema is used) • mysql_install_db (unless —skip-sys-schema is used) • mysqld —initialize • (i.e, nothing extra to do) • MySQL 5.7.9 upgraded to sys 1.5.0
  • 71. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Performance Schema in MySQL 5.7.8 • WL#7795 - PERFORMANCE SCHEMA, HISTORY PER THREAD • https://dev.mysql.com/worklog/task/?id=7795 • WL#7729 - Instrumentation of connection type • https://dev.mysql.com/worklog/task/?id=7729
  • 72. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#7795 - PERFORMANCE SCHEMA, HISTORY PER THREAD • When enabling events_waits_history / events_waits_history_long consumers, the instrumentation overhead could get high on high concurrency / throughput systems (particularly, but also all of the other stages, statements and transaction history consumers add too) • Added a `HISTORY` enum(‘YES','NO') column to performance_schema.threads • Allows you to just trace a specific session history, rather than all, to debug specific sessions only without affecting other sessions
  • 73. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#7729 - Instrumentation of connection type • Added a CONNECTION_TYPE column to the performance_schema.threads table • Exposes how threads are connected: • TCP/IP • Socket • Named Pipe • Shared Memory • SSL/TLS
  • 74. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | sys.session_ssl_stats mysql> select * from session_ssl_status; +-----------+-------------+--------------------+---------------------+ | thread_id | ssl_version | ssl_cipher | ssl_sessions_reused | +-----------+-------------+--------------------+---------------------+ | 26 | TLSv1 | DHE-RSA-AES256-SHA | 0 | | 27 | TLSv1 | DHE-RSA-AES256-SHA | 0 | | 28 | NULL | NULL | NULL | +-----------+-------------+--------------------+---------------------+
  • 75. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Performance Schema in MySQL 5.7.9 • WL#8786 - INFORMATION_SCHEMA WITH SHOW_COMPATIBILITY_56 • https://dev.mysql.com/worklog/task/?id=8786 • WL#8792 - Update to sys schema 1.5.0 • https://dev.mysql.com/worklog/task/?id=8792
  • 76. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#8786 - INFORMATION_SCHEMA WITH SHOW_COMPATIBILITY_56 • WL#6629 originally made the INFORMATION_SCHEMA tables for system / status variables return an empty result set when using show_compatibility_56 = OFF • This broke many things • We changed this in 5.7.9 to still return a result set, but flag a deprecation warning
  • 77. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WL#8792 - Update to sys schema 1.5.0 • 5.7.9 now updated to the latest sys schema! • Includes many of the updates already talked about • And much more that I can not fit in here!
  • 78. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Question time!
  • 79. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |