38
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1 MySQL 5.6 and Cluster Lee Stigile Technical Sales Consulting Manager -- Americas

Meetup my sql5.6_cluster

Embed Size (px)

DESCRIPTION

Presentation for the RMOUG MySQL Group

Citation preview

Page 1: Meetup my sql5.6_cluster

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1

MySQL 5.6 and Cluster

Lee Stigile – Technical Sales Consulting

Manager -- Americas

Page 2: Meetup my sql5.6_cluster

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 2

Agenda

Goal:

Benefits of Upgrading to MySQL 5.6

Understand MySQL Cluster

MySQL 5.6 – Top 5 New Features

Improved Features: Compression and Partitioning

MySQL Cluster

Page 3: Meetup my sql5.6_cluster

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

Oracle Invests Innovations for the MySQL Community Oracle Delivers. Past 12 Months:

GA: MySQL 5.6, MySQL Cluster 7.3, MySQL Workbench 6.0, MySQL

Utilities, MySQL Connectors...and more

DMRs: MySQL 5.7

Labs: Multi-source Replication, Fabric

Page 4: Meetup my sql5.6_cluster

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

Oracle Premier Lifetime Support

MySQL Enterprise Authentication

MySQL Enterprise Thread Pool

MySQL Enterprise Backup

MySQL Enterprise Monitor/Query Analyzer

MySQL Enterprise Edition Highest Levels of Security, Performance, and Availability

MySQL Enterprise Audit

MySQL Workbench

Page 5: Meetup my sql5.6_cluster

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

Features

Performance

Online Schema (DDL) Changes

Pre-load Buffer Pool

Full Text Search (InnoDB)

NoSQL and SQL Access

Optimizer Improvements

Replication

Performance Schema

Partitioning

Compression

Page 6: Meetup my sql5.6_cluster

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

#1 Performance

Page 7: Meetup my sql5.6_cluster

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

MySQL 5.6: Scalability

Users can fully utilize latest generations of hardware and OS

Scales as data volumes and users grow

Page 8: Meetup my sql5.6_cluster

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

2008 2009 2010 2012

4 CPU MySQL 5.0 4 CPU MySQL 5.1

16 CPU InnoDB Plugin

Sun Micro

December

32 CPU MySQL 5.5

Up to 48 CPU

MySQL 5.6

MySQL Scalability

Oracle Buys

Innobase/InnoDB

2005

January 2010

Oracle Buys Sun

InnoDB joins MySQL

2010

Page 9: Meetup my sql5.6_cluster

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

Performance Improvements InnoDB and MySQL

Refactored InnoDB Split kernel mutex

Separate thread for flushing operations

Multi-threaded purge

Reduced buffer pool contention

New adaptive hashing algorithm

MySQL Memory Allocation

Switch from malloc to better memory allocators for multi-threaded

concurrency

Lock_open contention (bottleneck when opening tables)

Page 10: Meetup my sql5.6_cluster

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

ScienceLogic

Network Monitoring Software

Averages 8,000 queries every second or about 1 billion queries a day

Can reach 175,000 tables and up to 20 million rows in a single table.

2 terabytes on average

“tremendous performance gains”

“moving log-flushing from a main process to a background process”

Moved from 5.1 to 5.5, 5.6

Page 11: Meetup my sql5.6_cluster

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

#2 Online Operations

Page 12: Meetup my sql5.6_cluster

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

Online DDL for InnoDB Tables

ADD INDEX

DROP INDEX

ADD COLUMN

DROP COLUMN

RENAME COLUMN

Page 13: Meetup my sql5.6_cluster

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

#3 Optimizer

Page 14: Meetup my sql5.6_cluster

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

DBT-3 Benchmarks Open-source Benchmark

DBT1,2,4,5 OLTP, Web Services,

Web Server

DBT-3 Decision Support Systems

Large Data Volume

Complex Queries

QUERY #16

SELECT p_brand, p_type, p_size, count(distinct ps_suppkey)

as supplier_cnt

FROM partsupp, part

WHERE p_partkey = ps_partkey AND p_brand <> 'Brand#23'

AND p_typce not like 'LARGE PLATED%' AND p_size in

(43, cc1, 25, 5, 35, 12, 42, 40)

AND ps_suppkey not in (

SELECT s_suppkey FROM supplier

WHERE s_comment like '%Customer%Complaints%')

GROUP BY p_brand, p_type, p_size

ORDER BY supplier_cnt desc, p_brand, p_type, p_size;

Page 15: Meetup my sql5.6_cluster

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 15

Materialized Subqueries Query #17

~40 days to execute

Now – 6.8 seconds

Executes Once

Hash Index

Query #16 0.65 -> 0.47

QUERY #17

SELECT c_name, c_custkey, o_orderkey, o_orderdate,

o_totalprice, sum(l_quantity)

FROM customer, orders, lineitem

WHERE o_orderkey in (

SELECT l_orderkey

FROM lineitem

GROUP BY l_orderkey

HAVING sum(l_quantity) > 313)

AND c_custkey = o_custkey

AND o_orderkey = l_orderkey

GROUP BY c_name, c_custkey, o_orderkey,

o_orderdate, o_totalprice

ORDER BY o_totalprice desc, o_orderdate

LIMIT 100;

Page 16: Meetup my sql5.6_cluster

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

Optimizer Summary Complex

Optimize Many Tables in Join 25+

Postpone Materialization of Views/Subqueries in FROM

Indexes for Derived Tables

Standard Optimize “IN” clause

Optimized SELECT col1, … FROM t1 .. ORDER BY name LIMIT 10

Better Optimizer Diagnostics

EXPLAIN for INSERT, UPDATE and DELETE

EXPLAIN output in JSON

Page 17: Meetup my sql5.6_cluster

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 17

#4 Performance Schema

Page 18: Meetup my sql5.6_cluster

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

• Resource-intensive queries

• Tables/indexes with most load

• Users consuming the most resources

• Network load

• Aggregated statistics by

• thread

• user

• host

• object

MySQL 5.6 – Performance Schema

Page 19: Meetup my sql5.6_cluster

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

Show which Queries executed the most # of times

Page 20: Meetup my sql5.6_cluster

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

Top Files by Total I/O (ps_helper)

Page 21: Meetup my sql5.6_cluster

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 21

Statements with Temporary Tables

Page 22: Meetup my sql5.6_cluster

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

MySQL Query Analyzer

Page 23: Meetup my sql5.6_cluster

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

#5 Replication

Page 24: Meetup my sql5.6_cluster

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

Before:

– Transaction Data: in tables

– Replication Info: in files

MySQL 5.6

– Transaction Data: in tables

– Replication Info: in tables

Data

Position Info

CRASH!

Time

Atomic

Data

Position Info Time

Atomic

MySQL 5.6: Crash-Safe Slaves

Page 25: Meetup my sql5.6_cluster

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

0 5 10

QPS 58.11 144.4 282.53

0

50

100

150

200

250

300

Qu

eri

es p

er

Seco

nd

Worker Threads

Multi-Threaded Slave Performance

Multi-Threaded Slaves

5x Performance Gain

Reduce Slave Latency

Per Schema

Threads per Schema

Multi-tenancy

Page 26: Meetup my sql5.6_cluster

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

Honorable Mentions

Page 27: Meetup my sql5.6_cluster

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

SELECT * FROM table WHERE custID=100

table index table index

0-99

100-199

200-299

partitioned Partitioning

Page 28: Meetup my sql5.6_cluster

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 28

current: Antelope

new: Barracuda

compression off-page storage of variable length data

[mysqld]

innodb_file_format=Barracuda

innodb_file_per_table=1

row_format=compressed

key_block_size=8 # or 4, 2, 1K

Compression

Page 29: Meetup my sql5.6_cluster

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

Features

Performance

Online Schema (DDL) Changes

Pre-load Buffer Pool

Full Text Search (InnoDB)

NoSQL and SQL Access

Optimizer Improvements

Replication

Performance Schema

Partitioning

Compression

Page 30: Meetup my sql5.6_cluster

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

MySQL Cluster

Page 31: Meetup my sql5.6_cluster

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

MySQL Cluster – Basic Architecture

Data Node 1

F1

F2

Data Node2

F2

F1

Data Nodes

• Active/Active

• 99.999% Availability

• No Single Point of Failure

• 1 billion/minute

Page 32: Meetup my sql5.6_cluster

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

MySQL Cluster -- Extended

Data Nodes

Node Group 1

F1

F3

F3

F1

No

de

1

No

de

2

Node Group 2

F2

F4

F4

F2

No

de

3

No

de

4

Cluster

Mgmt Cluster

Mgmt

Page 33: Meetup my sql5.6_cluster

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

Data Node Distribution

• Four Data Nodes

• Two Replicas

• Two Node Groups

F2-Secondary

F1-Secondary

F2-Primary

Node Group 1

F3-Primary

F4-Secondary

F3-Secondary

F4-Primary

Node Group 2

F1-Primary

Page 34: Meetup my sql5.6_cluster

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

Transparent

• Application

• Transparency

• Sharding

Page 35: Meetup my sql5.6_cluster

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

Access

memcached HTTP

Data Node 1

F1

F2

Data Node2

F2

F1

Data Nodes

Application

JDBC / ODBC / PHP / PERL /

Python / Ruby …

1. Direct API

2. Key-Value

3. NoSQL

4. SQL

5. Schema-less

Page 36: Meetup my sql5.6_cluster

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

Flight Control

1. Flight Operations

Management System

2. No Single Point of

Failure

Page 37: Meetup my sql5.6_cluster

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

ecommerce

1. Payment Processing

2. Fulfillment

3. 18,000 Retailers

4. High Availability

5. Scaling

Page 38: Meetup my sql5.6_cluster

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

QUESTIONS?

What’s New in MySQL 5.6