replication: what's new in mysql 8 - percona · 2018-11-18 · ha aset 1 •innodb cluster...

55
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Replication: What's new in MySQL 8 Luís Soares Software Development Director MySQL Replication Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018 1 Tiago Jorge Senior Software Engineer MySQL Replication

Upload: others

Post on 20-May-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

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

Replication: What's new in MySQL 8

Luís SoaresSoftware Development DirectorMySQL Replication

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018 1

Tiago JorgeSenior Software EngineerMySQL Replication

Page 2: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, 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.

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018 2

Page 3: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Program Agenda

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018 3

Page 4: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Introduction

Use Cases

Enhancements in MySQL 8 (and 5.7)

Roadmap

Conclusion

Program Agenda

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

1

2

3

4

4

5

Page 5: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Introduction

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

1

5

Page 6: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

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

Boom

Web ExplodesWdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

Page 7: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Today...

– Technology mesh.

– All things distributed.

– Large amounts of data to handle, transform, store.

– Offline periods are horribly expensive, simply unaffordable.

– Go green requires dynamic and adaptative behavior.

– Much more data to store – e.g. social media, “Look at all of my pictures!”; Monitoring – Keeping logs for N years! ; IoT – and much more.

– Moving, transforming and processing data quicker than anyone else means having an edge over competitors.

– It is a zoo. Distributed coordination and monitoring is key.

7Percona Live Europe 2018Wdnesday, 7th Nov 2018, Frankfurt am Main, GER

Page 8: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Database Replication

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

ServerB

ServerA

App

INSERT ...

INSERT ... INSERT ...

Replication“The process of generating and reproducing multiple copies of data at one or more sites.”,Database Systems: A Practical Approach to Design, Implementation, and Management, Thomas M. Connolly, Carolyn E. Begg, Third Edition, 2002.

8

Page 9: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

MySQL Database Replication: Overview

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

INSERT ...Server

B

binary log

INSERT ...

relay log

INSERT ...Server

A

binary log

App

ReceiverMeta-data

Update

ApplierMeta-data

Update

INSERT ...

Comm. Framework

9

Page 10: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

MySQL Database Replication: Overview

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

INSERT ...Server

B

binary log

INSERT ...

relay log

INSERT ...Server

A

binary log

App

ReceiverMeta-data

Update

ApplierMeta-data

Update

INSERT ...

Persistent

log buffer Threadedapplier

Send, Receive,ACK, NACK,

Heartbeating,...

Comm. Framework

Capturestatements

or datachanges.

Persistentlog buffer

10

Page 11: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

MySQL Database Replication: Some Notes

• Logical replication log recording master changes (binary log).

• Row or statement based format (may be intermixed).

• Each transaction is split into groups of events.

• Control events: Rotate, Format Description, Gtid, and more.

Binary Log

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

Layout of the Binary Log.

BEGIN ...E1 E2 COMMIT BEGIN ...E1 E2 COMMITGTID GTID

11

Page 12: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Coordination Between Servers

MySQL Database Replication: Some Notes

12Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

A B Since 3.23

A B

semi-synchronous (plugin)

A CB

group replication (plugin)

transactions

transactions

Since 5.5

Since 5.7.17

asynchronous (native)

transactions, membership, coordination

acks

And in MySQL 8 as of 8.0.1

Page 13: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Use cases

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

2

13

Page 14: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Clustering Made Practical

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

RAISE

eplicate

utomate

ntegrate

cale

nhance

14

Page 15: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Replicate

• For highly available infrastructures where:

– the number of servers has to grow or shrink dynamically;

– with as little pain as possible.

Group Replication

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

A B C D E

15

Page 16: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Automate

• Single-primary mode

– Automatic PRIMARY/SECONDARY role assignment

– Automatic new PRIMARY election on PRIMARY failures

– Automatic setup of read/write modes on PRIMARY and SECONDARIES

– Automatic global consistent view of which server is the PRIMARY

Group Replication

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

S S S* S P S

Next PrimaryOld Primary

16

Page 17: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

IntegrateBinary Log

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

• Logical replication log

– Extract, transform and load.

– MySQL fits nicely with other technologies.

INSERT ...Server

A

Replication log

App

INSERT ...

Hadoop

Kafka

Solr

Lucene

...

Transform

17

Page 18: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Scale

• Replicate between clusters

– For disaster recovery

• Read Replicas

– For read-scale out. Deploy asynchronous read replicas connected to the cluster

Asynchronous Replication

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

A B C

J K L

D

I

M

Z

.

.

.

.

.

.

18

Page 19: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

InnoDB Cluster

Enhance

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

S1 S2 S3 S4 S…

M

M M

MySQL Connector

Application

MySQL Router

MySQL Connector

Application

MySQL Router

MySQL Shell

HA

Rep

licaS

et1

• InnoDB Cluster Integrated Solution

– Group Replication for high availability.

– Asynchronous Replication for Read Scale-out.

– One-stop shell to deploy and manage the cluster.

– Seamlessly and automatically route the workload to the proper database server in the cluster.

– Hide failures from the application.

19

Page 20: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Binary Log Enhancements

Enhancements in MySQL 8 (and 5.7)

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

3.1

3

20

Operations3.2

Performance3.3

Monitoring3.4

Other3.5

Page 21: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

New Metadata in the Binary LogEasy to extract, transform and load into other systems.

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

Gtid_log_eventTransaction length, …Commit timestamps

Table_map eventTypes, primary key, …Sign, charset, …

Write_rowsCommit

ServerA

Binary log

App

INSERT ...

21

• New Metadata

– Easy to decode what is in the binary log.

– Further facilitates connecting MySQL to other systems using the binary log stream.

– Capturing data changes through the binary log is simplified.

– Also more stats showing where the data is/was at a certain point in time.

Page 22: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Enhancements in MySQL 8 (and 5.7)

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

Binary Log Enhancements 3.1

3

22

Operations3.2

Performance3.3

Monitoring3.4

Other3.5

Page 23: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Replicate, Filter, Aggregate, Query

Multi-Source Replication Filters

23Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

A

B

C

users

bio

groups

users

posts

comments

users bio groups posts comments

only users

Page 24: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Automatic protection against involuntarily tainting of offline replicas

Preventing Updates On Replicas that Leave the Cluster

24Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

B C

A

B CA

A joins a single primary cluster andit allows update operations priorto joining.

A becomes a secondary and isautomatically set to read only.

B C

A

A leaves the group and remainsread only until the DBA reverts.

Backported to 5.7.20

Page 25: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Choose next primary by assigning election weights to the candidates.

Primary Election Weights

25Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

B CAw=100 w=90w=50

B

CA

w=100

w=90w=50

CAw=90w=50

B is the primary.

B is not in the group anymore.C has higher weight than A.

C is elected the new primary.

Backported to 5.7.20

Page 26: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Automatically Shutdown When Replica Leaves the Group Involuntarily

Automatically Abort Replicas that Leave the Group

26Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

B C

A

A shuts itself down, thus becomingeffectively unavailble for both readsand write operations.

B CA

A is a secondary and wasautomatically set to read only.

B C

A

A leaves the group involuntarily(failed to apply changes, networkpartitioned, etc).

New in 8.0.12

@@group_replication_exit_state_action={ READ_ONLY | ABORT_SERVER }

Backported to 5.7.24

Page 27: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

User tells current primary to give up its role and assign it to another server.

Trigger Primary Election Online

27Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

B CA B CA

B is the primary.

Now I want A to be the primary, not B.

New in 8.0.13

A CB

A is the primary. B stepped down.

Page 28: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

User can specify on which mode the group operates.

Change Group Mode Online

28Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

B CA B CA

Single-primary mode,B is the primary.

Now I want the group operating inmulti-primary mode.

New in 8.0.13

A CB

Return to single-primary mode.

Page 29: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

User controls the amount of time to wait until others decide to evict a member from the group.

Relaxed Member Eviction

29Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

B CA B CA

I think A is not around anymore.Lets kick it out of the group!

New in 8.0.13

C

See… I told you. A is back!Good thing we waited.

Hold on. Lets wait for sometime!Maybe it is just too busy to talk to us

right now...

OK. Lets give it somemore time!

UNREACHABLE

A B

Page 30: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Enhancements in MySQL 8 (and 5.7)

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

Binary Log Enhancements 3.1

3

30

Operations3.2

Performance3.3

Monitoring3.4

Other3.6

Page 31: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Highly Efficient Replication Applier

• WRITESET dependency tracking allows applying a single threaded workload in parallel.

– Delivers the best throughput of the three dependency trackers, at any concurrency level.

• WRITESET_SESSION in addition to writesets tracks sessions dependencies as well. Two transactions executed on the same session are always scheduled in execution order on replica servers.

• Fast Group Replication recovery – time to catch up.

Write set parallelization

31Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

Backported to 5.7.22

Page 32: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Write set parallelization

Highly Efficient Replication Applier

32Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

0

5000

10000

15000

20000

25000

30000

35000

40000

45000

50000

1 2 4 8 16 32 64 128 256

Up

dat

es/

seco

nd

Ap

plie

s o

n t

he

Re

plic

a

Number of Clients on the Master

Applier Throughput: Sysbench Update Index

COMMIT_ORDER WRITESET WRITESET_SESSION

Backported to 5.7.22

Page 33: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Replica quickly online by using WRITESET

Fast Group Replication Recovery

33Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

0

1

2

3

4

5

6

7

8

9

10

Sysbench RW at 33% capacity(workload: 9K TPS on 64 threads)

Sysbench RW at 66% capacity(workload: 18K TPS on 64 threads)

Tim

e to

cac

th-u

p p

er t

ime

of

wo

rlo

ad m

issi

ng

(rat

io)

Group Replication Recovery Time: Sysbench Update Index (durable settings)

MySQL 5.7.20 MySQL 8.0.3

0

1

2

3

4

5

6

7

8

9

10

Sysbench RW at 33% capacity(workload: 4K TPS on 64 threads)

Sysbench RW at 66% capacity(workload: 8K TPS on 64 threads)

Tim

e to

cac

th-u

p p

er t

ime

of

wo

rlo

ad m

issi

ng

(rat

io)

Group Replication Recovery Time: Sysbench RW (durable settings)

MySQL 5.7.20 MySQL 8.0.3

Backported to 5.7.22

Page 34: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

High Cluster Throughput

– At lower thread count, the throughput of the system doubles in MySQL 8.0 compared to MySQL 5.7 on durable settings.

– At lower thread count, the throughput of the system more than doubles in MySQL 8.0 compared to MySQL 5.7 on non-durable settings.

More transactions per second while sustaining zero lag on any replica

34Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

Page 35: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

More transactions per second while sustaining zero lag on any replica

High Cluster Throughput

35Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

8 16 32 64

Number of Clients on the Master

Asynchronous Replication Sustained Throughput(Sysbench Update Index, non-durable settings)

MySQL 5.7 MySQL 8.0.3

0

5000

10000

15000

20000

25000

30000

35000

40000

45000

8 16 32 64

Up

dat

es

pe

r se

con

d

Number of Clients on the Master

Asynchronous Replication Sustained Throughput(Sysbench Update Index, durable settings)

MySQL 5.7 MySQL 8.0.3

Page 36: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Replicate only changed fields of documents (Partial JSON Updates)

Efficient Replication of JSON Documents

36Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

0

10000

20000

30000

40000

50000

60000

Entire JSON Partial JSON

Byt

es p

er

tran

sact

ion

Binary Log Space Per Transaction

FULL MINIMAL

• Numbers are from a specially designed benchmark:• tables have 10 JSON fields,• each transaction modifies

around 10% of the data

Page 37: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

0,0

500,0

1000,0

1500,0

2000,0

2500,0

1 2 3 4

Tran

sact

ion

s p

er s

eco

nd

Throughput on the Master: Partial JSON vs Complete JSON

4 8 16 32 64

Replicate only fields of the document that changed (Partial JSON Updates)

Efficient Replication of JSON Documents

37Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

0

1000

2000

3000

4000

5000

6000

7000

8000

9000

Throughput on the Slave: Partial JSON vs Ccomplete JSON

4 8 16 32 64

FULL MINIMAL FULL MINIMAL FULL MINIMAL FULL MINIMAL

COMPLETE JSON PARTIAL JSON COMPLETE JSON PARTIAL JSON

Page 38: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Enhancements in MySQL 8 (and 5.7)

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

Binary Log Enhancements3.1

3

38

Operations3.2

Performance3.3

Monitoring3.4

Other3.5

Page 39: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Through the entire asynchronous topology

Monitor Lag With Microsecond Precision

39Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

A B C D

How much time does my data take to reachD coming from A?

Page 40: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

From the immediate master

Monitor Lag With Microsecond Precision

40Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

A B C D

How much time does my data originated inA takes to flow from B to C?

Page 41: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

For each stage of the replication applier process

Monitor Lag with Microsecond Precision

41Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

D

Data

Worker ThreadsRelay Log

CoordinatorThread

ReceiverThread

• Per Stage Timestamps

– User can monitor how much time it takes for a specific transaction to traverse the pipeline.

Page 42: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Version, Role and more

Global Group Stats Available on Every Server

42Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

A B C

A is primary.B, C are secondaries.A: 5.7.20B, C: 8.0.3

A is primary.B, C are secondaries.A: 5.7.20B, C: 8.0.3

A is primary.B, C are secondaries.A: 5.7.20B, C: 8.0.3

• Query one Replica, Get status of all

– Every replica reports group-wide information about roles and versions of the members of the group.

– Also available at any replica are group-wide status.

Page 43: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Group Replication Message Cache Memory Usage

• GCS/XCom’s Paxos message cache is instrumented.

• GCS/XCom’s Paxos message cache memory usage is exposed in performance schema.

43Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

-- This is a session open on ServerA and the user is reading stats on GCS_Xcom message cacheServerA> select * from memory_summary_global_by_event_name where event_namelike "%GCS_XCom%"\G*************************** 1. row ***************************

EVENT_NAME: memory/group_rpl/GCS_XCom::xcom_cacheCOUNT_ALLOC: 28890317COUNT_FREE: 28840318

SUM_NUMBER_OF_BYTES_ALLOC: 24499151783SUM_NUMBER_OF_BYTES_FREE: 24470424555

LOW_COUNT_USED: 0CURRENT_COUNT_USED: 49999

HIGH_COUNT_USED: 50000LOW_NUMBER_OF_BYTES_USED: 0

CURRENT_NUMBER_OF_BYTES_USED: 28727228HIGH_NUMBER_OF_BYTES_USED: 135676530

1 row in set (0.01 sec)

New in 8.0.12

Page 44: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Enhancements in MySQL 8 (and 5.7)

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

Binary Log Enhancements 3.1

3

44

Operations3.2

Monitoring3.3

Performance3.4

Other3.5

Page 45: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Changes to defaults in MySQL 8

• Binary log is on by default.

• Logging of slave updates is on by default.

• Replication metadata is stored in InnoDB tables by default instead of files.

• Row-based applier uses hash scans to find rows instead of table scans.

• Transaction write-set extraction is on by default.

• Binary log expiration is set to 30 days by default.

• Server-id is set to 1 by default instead of 0.

High performance replication enabled out-of-the-box

45Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

Page 46: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Other MySQL 8 Replication Enhancements

• Monitoring: Monitor replication even when disk full

• Monitoring: Current query being applied, even for row-based replication

• Monitoring: Replication filters statistics in performance schema

• Monitoring: Group Replication threads instrumented and shown in performance schema

• Monitoring: Group Replication conditional variables and mutexesinstrumented and shown in performance schema

• Monitoring: Replication worker transaction retries counter added to performance schema applier table.

46Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

New in 8.0.13

Page 47: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Other MySQL 8 Replication Enhancements

• Operations: Restore global transaction identifiers metadata on a non-empty server

• Operations: Specify binary log file number after RESET MASTER

• Operations: Specify when binary log files are automatically purged (with second precision)

• Operations: SAVEPOINT support when write sets are being extracted

• Operations: P_S table for consistent log positions (replacing potentially expensive FLUSH TABLE WITH READ LOCKS)

• Operations: Support hostnames in Group Replication whitelist

• Operations: New options to fine tune the cluster automatic flow control.

47Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

Backported to 5.7.19

Backported to 5.7.21

Page 48: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Other MySQL 8 Replication Enhancements

• Troubleshooting: Dynamic and high performance debugging of group replication inter-node messaging

• Recoverability: Recover DDL and binary log together after a crash

48Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

Page 49: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Roadmap

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

4

49

Page 50: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

The Road to MySQL 8 Group Replication and InnoDB Clusters

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

MySQL 5.7.95.7 is GAlifecycle interfacesP_S tables for GRserver side changes

GR 0.2.0 labsHello world!

MySQL 5.7.17GR is GA

MySQL 8.0.1 DMRGR is released with 8InnoDB Cluster is GALots of replication enhancements

MySQL 8.0.3 RC1bug fixespartial json updatesmonitoring enhancements

50

MySQL 8.0.4 RC2bug fixesmonitoring

MySQL 8.0.11 GAbug fixesMySQL 8.0.0 DMR

MySQL 8.0.2 DMRMore replicationenhancements

MySQL 8.0.12 GAMember auto-shutdownInstrumentation

MySQL 8.0.13 GASelect PrimaryMonitoringPerformanceRelax Eviction

Page 51: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

MySQL InnoDB Cluster: The End Goal

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

S1 S2 S3 S4 S…

M

M M

MySQL Connector

Application

MySQL Router

MySQL Connector

Application

MySQL Router

MySQL Shell

HA

Rep

licaS

et1

S1 S2 S3 S4 S…

M

M M

MySQL Connector

Application

MySQL Router

HA

Rep

licaS

etN

51

...

Page 52: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Conclusion

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018

5

52

Page 53: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Conclusion

Latest MySQL 8 GA is out:

• Performance/efficiency improvements

– Group Replication copes better with high latency networks.

• Replication instrumentation

– More memory and replication stats instrumentation.

• Improved Dev-Ops and DBA experience– Options to relax automatic member eviction

– Trigger primary election and select new primary online.

– Automatically shutdown the server if member gets out of the group involuntarily.

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018 53

Page 54: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |

Where to go from here?

• Packages

– http://www.mysql.com/downloads/

• Documentation– https://dev.mysql.com/doc/refman/8.0/en/

• Blogs from the Engineers (news, technical information, and much more)

– http://mysqlhighavailability.com

Wdnesday, 7th Nov 2018, Frankfurt am Main, GER Percona Live Europe 2018 54

Page 55: Replication: What's new in MySQL 8 - Percona · 2018-11-18 · HA aSet 1 •InnoDB Cluster Integrated Solution –Group Replication for high availability. –Asynchronous Replication

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |