exploring mysql cluster 7.4

29
Exploring the new release MySQL Cluster 7.4 In-Memory Real-Time Performance, Web Scalability & 99.999% Availability Ivan Ma [email protected] 2015-04-11 February 2015

Upload: ivan-ma

Post on 06-Aug-2015

221 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Exploring mysql cluster 7.4

Exploring the new release MySQL Cluster 7.4 In-Memory Real-Time Performance, Web Scalability & 99.999% Availability

Ivan Ma [email protected] 2015-04-11

February 2015

Page 2: Exploring mysql cluster 7.4

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.

February 2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 2

Page 3: Exploring mysql cluster 7.4

MySQL Replication

MySQL Fabric

DRBD

Windows/Solaris/Clusterware Clustering or Oracle VM

MySQL Cluster

MySQL HA Solutions

19th February 2015

Getting Higher & Higher Availability

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

Page 4: Exploring mysql cluster 7.4

MySQL Cluster NDB Engine History

NDB Engine 2003

…………. 6.2GA

Sep2007 6.3GA

Jan2008 7.0GA

April2009 7.1GA

April2010

7.2GA

Based on MySQL

5.5 Feb2012

7.3GA – Based on MySQL

5.6 June2013

7.4 GA Feb 015

February 2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 4

Page 5: Exploring mysql cluster 7.4

MySQL Cluster Architecture

MySQL Cluster Data Nodes

Clients

Application / MySQL Node Layer

Data Layer

Copyright 2015, oracle and/or its affiliates. All rights reserved 5

Page 6: Exploring mysql cluster 7.4

MySQL Cluster Architecture

MySQL Cluster Data Nodes

Clients

Data Layer

Copyright 2015, oracle and/or its affiliates. All rights reserved 6

Application / MySQL Node Layer

Page 7: Exploring mysql cluster 7.4

MySQL Cluster Scaling

MySQL Cluster Data Nodes

Clients

Application Layer

Data Layer

Copyright 2015, oracle and/or its affiliates. All rights reserved 7

Page 8: Exploring mysql cluster 7.4

On-line Operations

• Scale the cluster (add & remove nodes on-line)

• Repartition tables

• Upgrade / patch servers & OS

• Upgrade / patch MySQL Cluster

• Back-Up

• Evolve the schema on-line, in real-time

Copyright 2015, oracle and/or its affiliates. All rights reserved 8

Page 9: Exploring mysql cluster 7.4

MySQL Cluster Auto-Installer

• Fast configuration

• Auto-discovery

• Workload optimized

• Repeatable best practices

Specify Workload

Auto-Discover

Define Topology Deploy

Copyright 2015, oracle and/or its affiliates. All rights reserved 9

Page 10: Exploring mysql cluster 7.4

NoSQL Access to MySQL Cluster data

Apps Apps Apps Apps Apps Apps Apps Apps Apps Apps Apps Apps

JPA

Cluster JPA

PHP Perl Python Ruby JDBC Cluster J JS Apache Memcached

MySQL JNI Node.JS mod_ndb ndb_eng

NDB API (C++)

MySQL Cluster Data Nodes

Page 11: Exploring mysql cluster 7.4

MySQL Cluster 7.4 GA

Copyright 2015, oracle and/or its affiliates. All rights reserved 11

Page 12: Exploring mysql cluster 7.4

MySQL Cluster 7.4 GA

• 200 Million NoSQL Reads/Sec

• 2.5M SQL Ops/Sec

• 50% Faster Reads

• 40% Faster Mixed

Performance

• Active-Active Geographic Redundancy

• Conflict Detection/Resolution

Active-Active

• 5X Faster Maintenance Ops

• Detailed Reporting

Management

Copyright 2015, oracle and/or its affiliates. All rights reserved 12

Page 13: Exploring mysql cluster 7.4

Performance Enhancements

MySQL Cluster 7.4

50% Read-Only Increase

Copyright 2015, oracle and/or its affiliates. All rights reserved 13

0

1000

2000

3000

4000

5000

6000

7000

8000

9000

64 128 192 256 320 384 448 512

Tran

saconspersecond

Threads

SysbenchR/W

7.4

7.3

7.2

0

1000

2000

3000

4000

5000

6000

7000

8000

9000

10000

64 128 192 256 320 384 448 512

Tran

saconpersecond

Threads

SysbenchRO

7.4

7.3

7.2

40% Read/Write Increase

Page 14: Exploring mysql cluster 7.4

• Memory optimized tables

– Durable

– Mix with disk-based tables

• Massively concurrent OLTP

• Distributed Joins for analytics

• Parallel table scans for non-indexed searches

• MySQL Cluster 7.4 FlexAsych – 200M NoSQL Reads/Second

14

MySQL Cluster 7.4 NoSQL Performance 200 Million NoSQL Reads/Second

Copyright 2015, oracle and/or its affiliates. All rights reserved

-

50,000,000

100,000,000

150,000,000

200,000,000

250,000,000

2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32

Readspersecond

DataNodes

FlexAsyncReads

Page 15: Exploring mysql cluster 7.4

• Memory optimized tables

– Durable

– Mix with disk-based tables

• Massively concurrent OLTP

• Distributed Joins for analytics

• Parallel table scans for non-indexed searches

• MySQL Cluster 7.4 DBT2 BM – 2.5M SQL Statements/Second

16/04/2015 15

MySQL Cluster 7.4 SQL Performance 2.5M SQL Statements/Second

Copyright 2015, oracle and/or its affiliates. All rights reserved

-

500,000

1,000,000

1,500,000

2,000,000

2,500,000

3,000,000

2 4 6 8 10 12 14 16

SQLStatements/sec

DataNodes

DBT2SQLStatementsperSecond

Page 16: Exploring mysql cluster 7.4

• Asynchronous replication between MySQL Clusters

• Active-Active

– Update anywhere

– Conflict detection • Application notified through exception tables

• Can opt to have conflicts resolved automatically

– Auto-conflict-resolution • Conflicting transaction and dependent ones

are rolled-back

• No changes to application schema

Active-Active Geo-Replication

February 2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 16

Page 17: Exploring mysql cluster 7.4

What is a conflict?

John.balance==$100

John.balance==$100

Spend $40 Add $100

$60

$200

February 2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 17

John.balance-=$40 John.balance==$60

John.balance==$200

John.balance+= $100 John.balance==$200

John.balance==$60

Page 18: Exploring mysql cluster 7.4

• NDB$EPOCH2 and NDB$EPOCH2_TRANS introduced

• Detects conflicting inserts/updates

• Entire transactions (and dependent ones) rolled back

• All conflicts are handled before switching primary

• Conflicting deletes

• Rolling back of transactions that read conflicted data

February 2015 18

Handling of Conflicts – Extensions in MySQL Cluster 7.4

Copyright 2015, oracle and/or its affiliates. All rights reserved

Page 19: Exploring mysql cluster 7.4

• Primary stores logical timestamp (GCI) against updated row

– Window for conflict opens

• GCI replicated with updated row to Secondary

• The same row and GCI is replicated back (reflected) from Secondary to Primary after it has been applied

– Closing window for conflict

• Primary checks every event originating from the Secondary to ensure it isn’t for a ‘conflictable’ row

Detecting Conflicts - Reflected GCI

John.balance==$100

John.balance-=$40 John.balance==$60

John.balance==$200

John.balance==$100

John.balance+= $100 John.balance==$200

John.balance==$60

Spend $40

Add $100

$60

$200

Primary Secondary

February 2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 19

Page 20: Exploring mysql cluster 7.4

How to Use Conflict Detection/Resolution

Decide which tables need protecting

For each table, specify what to do on conflicts

Just record in exception table

Application or DBA acts on

content

Rollback the conflicting row

Rollback the conflicting transaction

February 2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 20

Page 21: Exploring mysql cluster 7.4

Demo

February 2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 21

simple1 (10)

simple2 (10)

simple3 (10)

simple1 (10)

simple2 (10)

simple3 (10)

simple1 (10) (13)

STOPPED

simple1 (10) (20) simple2 (10) (20)

simple3 (10) (20) OK (no stop)

simple1 (10) (20) simple2 (10) (20)

simple3 (10) (20) ????

Exception

simple1 (13), simple2(10), simple3(20)

simple1 $EX(10->20), simple2$EX(10->20) Started

simple1 (13), simple2(10), simple3(20)

simple1 (10) (20) simple2 (10) (20)

Rollback

Page 22: Exploring mysql cluster 7.4

MySQL Cluster 7.4 Restart Improvements

• Duration of long-running maintenance activities dominated by Data Node restart times

• MySQL Cluster 7.4 = 5.5X faster restarts

• Benefits both nodal and rolling restarts

– Upgrades, add-node,…

• Benefits both SQL and NoSQL APIs

• Benefits both ”manual” a MySQL Cluster Manager operations

• Achieve 5x as much during a single maintenance window

Make Data Node Restarts Fast!

February 2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 22

Page 23: Exploring mysql cluster 7.4

MySQL Cluster 7.4 Restart Improvements

• Verbose logging

– Task start/completion

– Data volumes

– Parallelism & Wait times

• NDBINFO for recent node restarts

• More documentation of stages

• Goal: Make analysis of a slow restart possible

– Determine cause; Detect patterns; Understand the impact of indexes, local checkpoints etc.

Observability improvements

February 2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 23

Page 24: Exploring mysql cluster 7.4

MySQL Cluster 7.4 – Enhanced memory reporting

• ndbinfo.memory_per_fragment memory usage information for each fragment replica, for each table and index

• Allocated memory and how much of that is actually in use.

• Exposes

– Fragmentation of fixed and var-sized fragment pages

– Accurate Data and Index Memory use

– Comparison of Primary and Backup fragment usage

– Partitioning effectiveness

February 2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 24

Page 25: Exploring mysql cluster 7.4

Enhanced Memory Reporting

mysql> CREATE DATABASE clusterdb;USE clusterdb; mysql> CREATE TABLE simples (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=NDB; mysql> select node_id AS node, fragment_num AS frag, fixed_elem_alloc_bytes alloc_bytes, fixed_elem_free_bytes AS free_bytes, fixed_elem_free_rows AS spare_rows from memory_per_fragment where fq_name like '%simples%'; +------+------+-------------+------------+------------+ | node | frag | alloc_bytes | free_bytes | spare_rows | +------+------+-------------+------------+------------+ | 1 | 0 | 131072 | 5504 | 172 | | 1 | 2 | 131072 | 1280 | 40 | | 2 | 0 | 131072 | 5504 | 172 | | 2 | 2 | 131072 | 1280 | 40 | | 3 | 1 | 131072 | 3104 | 97 | | 3 | 3 | 131072 | 4256 | 133 | | 4 | 1 | 131072 | 3104 | 97 | | 4 | 3 | 131072 | 4256 | 133 | +------+------+-------------+------------+------------+

See how much memory a table is using

February 2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 25

Page 26: Exploring mysql cluster 7.4

Enhanced Memory Reporting

+------+------+-------------+------------+------------+ | node | frag | alloc_bytes | free_bytes | spare_rows | +------+------+-------------+------------+------------+ | 1 | 0 | 131072 | 5504 | 172 | | 1 | 2 | 131072 | 1280 | 40 | | 2 | 0 | 131072 | 5504 | 172 | | 2 | 2 | 131072 | 1280 | 40 | | 3 | 1 | 131072 | 3104 | 97 | | 3 | 3 | 131072 | 4256 | 133 | | 4 | 1 | 131072 | 3104 | 97 | | 4 | 3 | 131072 | 4256 | 133 | +------+------+-------------+------------+------------+ mysql> DELETE FROM clusterdb.simples LIMIT 1; +------+------+-------------+------------+------------+ | node | frag | alloc_bytes | free_bytes | spare_rows | +------+------+-------------+------------+------------+ | 1 | 0 | 131072 | 5504 | 172 | | 1 | 2 | 131072 | 1312 | 41 | | 2 | 0 | 131072 | 5504 | 172 | | 2 | 2 | 131072 | 1312 | 41 | | 3 | 1 | 131072 | 3104 | 97 | | 3 | 3 | 131072 | 4288 | 134 | | 4 | 1 | 131072 | 3104 | 97 | | 4 | 3 | 131072 | 4288 | 134 | +------+------+-------------+------------+------------+

See how memory is made available after deleting rows

February 2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 26

Page 27: Exploring mysql cluster 7.4

Enhanced Memory Reporting

mysql> CREATE TABLE simples (id INT NOT NULL AUTO_INCREMENT, species VARCHAR(20) DEFAULT "Human", PRIMARY KEY(id, species)) engine=ndb PARTITION BY KEY(species); // Add some data mysql> select node_id AS node, fragment_num AS frag, fixed_elem_alloc_bytes alloc_bytes, fixed_elem_free_bytes AS free_bytes, fixed_elem_free_rows AS spare_rows from ndbinfo.memory_per_fragment where fq_name like '%simples%'; +------+------+-------------+------------+------------+ | node | frag | alloc_bytes | free_bytes | spare_rows | +------+------+-------------+------------+------------+ | 1 | 0 | 0 | 0 | 0 | | 1 | 2 | 196608 | 11732 | 419 | | 2 | 0 | 0 | 0 | 0 | | 2 | 2 | 196608 | 11732 | 419 | | 3 | 1 | 0 | 0 | 0 | | 3 | 3 | 0 | 0 | 0 | | 4 | 1 | 0 | 0 | 0 | | 4 | 3 | 0 | 0 | 0 | +------+------+-------------+------------+------------+

Check how well partitioned/sharded a table is

February 2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 27

Page 28: Exploring mysql cluster 7.4

MySQL Cluster 7.4 – Enhanced activity reporting

• ndbinfo.operations_per_fragment activity counters for each fragment replica, for each table and index

• PK & scan access – requests, bytes, rows…

• Exposes

– How traffic maps to tables and indices

– Query execution, use of indexes etc.

– LDM and node imbalances

– Hotspots and scan overloads

February 2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 28

Page 29: Exploring mysql cluster 7.4

Exploring the new release MySQL Cluster 7.4

Thank You

February 2015