Beruflich Dokumente
Kultur Dokumente
7 Replication
Enhancements
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
Program Agenda
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
Program Agenda
1
Background
Roadmap
Summary
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
Background
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
Client
Receiver
thread
Sender
thread
binary log
relay log
binary log
Insert...
Insert...
Applier
Threads
Insert...
Network
Receiver
Meta-data
Update
Tuesday, April 19, 2016
Applier
Meta-data
Update
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
BEGIN
E1
E2
...
COMMIT
BEGIN
E1
E2
...
COMMIT
Layout of a
Binary Log File
Tuesday, April 19, 2016
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
More
reads?
More
slaves!
S
write clients
write clients
read clients
read clients
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
10
B
Uh Oh!
B
Whew!
A
Crash
C
B is the
new master
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
11
S
M
write clients
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
12
A
C
B
C
Image from
www.ginkgomaps.com
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
13
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
3
3.1
Usability / Online
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
Client
Receiver
thread
Sender
thread
binary log
relay log
binary log
Insert...
Insert...
Applier
Threads
Insert...
Network
Receiver
Meta-data
Update
Tuesday, April 19, 2016
Applier
Meta-data
Update
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
16
Should anything happen in the middle of the procedure, you can always roll
back.
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
17
Details: http://dev.mysql.com/doc/refman/5.7/en/replication-modechange-online-enable-gtids.html
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
18
Client
Receiver
thread
Sender
thread
binary log
relay log
binary log
Insert...
Insert...
Applier
Threads
Insert...
Network
Receiver
Meta-data
Update
Tuesday, April 19, 2016
Applier
Meta-data
Update
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
19
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
20
Client
Receiver
thread
Sender
thread
binary log
relay log
binary log
Insert...
Insert...
Applier
Threads
Insert...
Network
Receiver
Meta-data
Update
Tuesday, April 19, 2016
Applier
Meta-data
Update
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
21
B
Uh Oh!
B
Whew!
A
Crash
C
B is the
new master
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
22
B
Uh Oh!
B
Whew!
A
Crash
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
23
Stopping, changing master and restarting the receiver thread are all done
while the applier thread is running.
Change applier properties while the receiver thread is working:
mysql> STOP SLAVE SQL_THREAD;
mysql> CHANGE MASTER TO MASTER_DELAY=3600, ;
mysql> START SLAVE SQL_THREAD;
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
24
Client
Receiver
thread
Sender
thread
binary log
DBA
relay log
binary log
Insert...
Insert...
Applier
Threads
Insert...
Network
Receiver
Meta-data
Update
Tuesday, April 19, 2016
Applier
Meta-data
Update
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
25
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
26
Connection
Configuration
Connection
Status
Applier
Configuration
Applier
Status
Applier / Coordinator
Status
Workers
Status
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
27
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
28
3
3.1
Usability / Online
3.2
Performance
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
Client
Receiver
thread
Sender
thread
binary log
relay log
binary log
Insert...
Insert...
Applier
Threads
Insert...
Network
Receiver
Meta-data
Update
Tuesday, April 19, 2016
Applier
Meta-data
Update
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
30
200%
10X
150%
100%
50%
0%
Single Threaded Apply
8 Threads Applier
24 Threads Applier
48 Threads Applier
96 Threads Applier
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
31
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
32
T1 and T2 execute in
parallel on the slave.
T1
T2 and T3 execute in
parallel on the slave.
T2
T3
Time
Execution
Commit
Commit Finishes
Last Lock Acquired
Tuesday, April 19, 2016
T2 is scheduled to execute
together with T1.
T3 is scheduled to execute
as soon as T1 finishes.
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
33
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
34
Client
Receiver
thread
Sender
thread
binary log
relay log
binary log
Insert...
Insert...
Applier
Threads
Insert...
Network
Receiver
Meta-data
Update
Tuesday, April 19, 2016
Applier
Meta-data
Update
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
35
5.7.2+
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
36
Client
Receiver
thread
Sender
thread
binary log
relay log
binary log
Insert...
Insert...
Applier
Threads
Insert...
Network
Receiver
Meta-data
Update
Tuesday, April 19, 2016
Applier
Meta-data
Update
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
37
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
38
Masters Throughput
16000
14000
1M queries, concurrency=200,
commit=1
12000
QpS
10000
8000
6000
4000
2000
0
0
5
10
20
30
40
Number of Connected Sender Threads
MySQL 5.6.16
50
100
MySQL 5.7.4
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
39
Client
ACK
Receiver
thread
Receiver
thread
binary log
Applier
Threads
relay log
binary log
Insert...
Insert...
Insert...
Network
Sender
thread
Receiver
Meta-data
Update
Applier
Meta-data
Update
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
40
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
41
Orange bar percentage shows the throughput gain (orange) when compared to the corresponding
blue bar. Blue and stacked bars show throughput ratio computed against the best blue bar.
Tuesday, April 19, 2016
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
42
3
3.1
Usability / Online
3.2
Performance
3.3
Dependability
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
Client
Receiver
thread
Sender
thread
binary log
relay log
binary log
Insert...
Insert...
Applier
Threads
Insert...
Network
Receiver
Meta-data
Update
Tuesday, April 19, 2016
Applier
Meta-data
Update
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
44
Master
execute
prepare
Slave
binlog
empty set
execute
relay log
commit
ACK
Time
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
45
Should a master fail, then any transaction that it may have externalized is
also persisted on a slave.
User can choose between the original semi-sync behavior and the new
one.
mysql> SET rpl_semi_sync_master_wait_point= [AFTER_SYNC|AFTER_COMMIT]
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
46
Client
Receiver
thread
Sender
thread
binary log
relay log
binary log
Insert...
Insert...
Applier
Threads
Insert...
Network
Receiver
Meta-data
Update
Tuesday, April 19, 2016
Applier
Meta-data
Update
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
47
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
48
T1: COMMIT
succeeds
Master
Slave 1
Slave 2
Slave 3
ACK
relay log
relay log
relay log
ACK
ACK
Time
mysql> SET GLOBAL rpl_semi_sync_master_wait_for_slave_count= 2
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
49
3
3.1
Usability / Online
3.2
Performance
3.3
Dependability
3.4
Flexibility
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
Client
Receiver
thread
Sender
thread
binary log
relay log
Insert...
Insert...
Applier
Threads
Network
Receiver
Meta-data
Update
Tuesday, April 19, 2016
Applier
Meta-data
Update
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
51
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
52
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
53
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
54
Multi-Source Replication
M
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
55
Multi-Source Replication
Integrated with Multi-threaded Slave (each channel has its own multithreaded applier set of threads).
Integrated with the new P_S tables.
replication_applier_status_by_coordinator shows multiple entries, one per
channel/source coordinator.
replication_applier_status_by_worker shows multiple entries, multiple entries per
channel
replication_connection_status shows multiple entries, one per connection to different
sources.
Tuesday, April 19, 2016
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
56
Multi-Source Replication
Integrated with GTIDs.
Integrated with crash-safe tables.
Progress state is stored in these tables for recoverability purposes.
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
57
3
3.1
Usability / Online
3.2
Performance
3.3
Dependability
3.4
Flexibility
3.5
Misc
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
59
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
Replication Group
Tuesday, April 19, 2016
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
61
Roadmap
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
What is Next?
MySQL Group Replication
Rapid releases.
Improve performance, stability and usability.
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
63
Summary
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
Summary
Replication feature set in MySQL 5.7 shows many improvements:
Semi-sync is more flexible and faster.
Less contention on the binary log.
Slave is faster and provides an inter-transaction parallelization scheme.
More online reconfiguration: Global Transaction Identifiers, filters, configuration.
Improved monitoring.
Even more flexible replication with multi-source enabling new deployment scenarios.
Enhancements all over: transaction retries, sequential commits, XA support, new
replication functions, security.
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
65
Reference Documentation
http://dev.mysql.com/doc/refman/5.7/en/replication.html
Blogs from the Engineers (news, quirks, technical information and much
more)
http://mysqlhighavailability.com
Copyright 2016, Oracle and/or its affiliates. All rights reserved. | Percona Live 2016 @ Santa Clara, California, US
66