SlideShare a Scribd company logo
Advanced 
MySQL 
ReplicaCon 
Architectures 
and 
Latest 
Developments 
Mark 
Swarbrick 
Technical 
Presales 
Consultant 
MySQL 
UK&I 
London 
October, 
2014 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
|
Safe 
Harbor 
Statement 
The 
following 
is 
intended 
to 
outline 
our 
general 
product 
direcCon. 
It 
is 
intended 
for 
informaCon 
purposes 
only, 
and 
may 
not 
be 
incorporated 
into 
any 
contract. 
It 
is 
not 
a 
commitment 
to 
deliver 
any 
material, 
code, 
or 
funcConality, 
and 
should 
not 
be 
relied 
upon 
in 
making 
purchasing 
decisions. 
The 
development, 
release, 
and 
Cming 
of 
any 
features 
or 
funcConality 
described 
for 
Oracle’s 
products 
remains 
at 
the 
sole 
discreCon 
of 
Oracle. 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
2
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Agenda 
1 
2 
3 
4 
5 
Background 
Generally 
Available 
Features 
in 
MySQL 
5.6 
Next 
GeneraCon 
ReplicaCon 
Features 
in 
MySQL 
5.7 
DMR 
What 
is 
Next? 
Summary 
3
Background: 
ReplicaCon 
Components 
relay log 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Insert... 
Insert... 
B 
binary log 
Insert... 
Insert... 
A 
binary log 
Client 
Sender 
thread 
Receiver 
thread 
Applier 
Threads 
Network 
Master 
info 
Relay 
Log 
Info
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
§ Binary 
Log 
§ File 
based 
logical 
log 
that 
records 
the 
changes 
on 
the 
master. 
§ Statement 
or 
Row 
based 
format 
(may 
be 
intermixed). 
§ TransacCons 
are 
split 
into 
groups 
of 
events. 
§ Control 
events: 
Rotate, 
Format 
DescripCon, 
GCd, 
... 
Layout of a 
Binary Log File 
Background: 
ReplicaCon 
Components 
BEGIN E1 E2 ... COMMIT BEGIN E1 E2 ... COMMIT
Background: 
What 
is 
ReplicaCon 
Used 
For? 
write clients 
More 
reads? 
More 
slaves! 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
§ Read 
scale-­‐out 
M S 
S 
S 
S 
M 
write clients read clients read clients
What 
about 
Write 
scale-­‐out? 
More 
writes? 
More 
Masters? 
M? 
M M? 
write clients write clients 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
M? 
MySQL 
Fabric
Uh Oh! Phew! 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
§ Redundancy: 
If 
master 
crashes, 
promote 
slave 
to 
master 
C 
B 
A 
Background: 
What 
is 
ReplicaCon 
Used 
For? 
C 
B 
CraAs h 
C 
B 
A 
B is the 
new master
Background: 
What 
is 
ReplicaCon 
Used 
For? 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
§ On-­‐line 
Backup 
and 
ReporBng 
M 
S 
n write 
clients 
n business 
intelligent 
client 
apps 
n reporCng 
client 
apps 
n big 
queries 
client 
apps
CB 
AC BA 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Image 
from 
www.ginkgomaps.com 
Background: 
What 
is 
ReplicaCon 
Used 
For?
Generally 
Available 
Features 
in 
MySQL 
5.6 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
|
relay log 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Insert... 
Insert... 
B 
binary log 
Insert... 
Insert... 
A 
binary log 
Client 
Network 
Master 
info 
Relay 
Log 
Info 
Binary 
Log 
Group 
Commit 
Sender 
thread 
Receiver 
thread 
Applier 
Threads
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Trx1 
… 
TrxN 
Trx1 . . . TrxN 
A 
binary log 
§ TransacCons 
are 
flushed 
and 
synced 
together 
and 
then 
commided 
in 
the 
engine! 
§ Binary 
Log 
is 
the 
conceptual 
commit 
point. 
§ Resilience, 
crash-­‐safeness 
and 
durability 
with 
good 
performance 
(sync_binlog=1). 
§ No 
impact 
on 
single-­‐threaded 
workloads. 
§ Loss-­‐less, 
automaCc 
recovery. 
§ Corrupt 
tail 
of 
the 
binary 
log 
is 
trimmed 
on 
recovery. 
Binary 
Log 
Group 
Commit 
mysql> SET sync_binlog=1
n 5x 
faster 
than 
MySQL 
5.5 
n 4.5x 
even 
when 
sync_binlog=1 
hdps://blogs.oracle.com/MySQL/entry/mysql_5_6_replicaCon_performance 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Binary 
Log 
Group 
Commit
n Days 
of 
losing 
50%+ 
master 
performance 
are 
gone! 
n 10% 
overhead 
when 
configuring 
sync_binlog=0 
n AddiConal 
5% 
when 
configuring 
sync_binlog=1 
hdps://blogs.oracle.com/MySQL/entry/mysql_5_6_replicaCon_performance 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Binary 
Log 
Group 
Commit
OpCmized 
Row-­‐based 
ReplicaCon 
§ Smaller 
storage, 
network 
and 
memory 
footprints. 
§ Each 
record 
change 
may 
require 
its 
before 
and/or 
aker 
images 
to 
be 
stored 
in 
the 
RBR 
event. 
§ Before 
MySQL 
5.6 
the 
server 
would 
log 
full 
images 
only. 
§ In 
MySQL 
5.6 
and 
later, 
the 
server 
can 
log 
images 
with 
just 
the 
needed 
data. 
§ A 
PK-­‐less 
table 
on 
the 
slave 
is 
much 
quicker 
to 
change. 
§ Applier 
does 
at 
most 
one 
table 
scan 
per 
Update 
or 
Delete 
event. 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
|
OpCmized 
Row-­‐based 
ReplicaCon: 
ParCal 
Images 
Before Image After Image 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Full Rows 
Rows without Blobs 
Minimal Rows 
Blob 
Primary 
Key 
Changed 
Columns 
mysql> binlog_row_image={MINIMAL|NOBLOB|FULL}
OpCmized 
Row-­‐based 
ReplicaCon: 
Improved 
Rows 
Lookup 
by 
RBR 
Applier 
mysql> SET slave_rows_search_algorithm={INDEX_SEARCH | TABLE_SCAN | HASH_SCAN } 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
§ slave_rows_search_algorithm 
§ INDEX_SEARCH 
– 
use 
an 
index 
(if 
available) 
to 
locate 
the 
row. 
§ TABLE_SCAN 
– 
do 
a 
table 
scan 
to 
locate 
the 
row. 
§ HASH_SCAN 
– 
do 
at 
most 
ONE 
table 
scan 
to 
locate 
ALL 
rows 
in 
the 
event. 
§ Result: 
large 
tables 
without 
primary 
keys 
are 
now 
updated 
quicker 
by 
the 
slave 
thread. 
NEW
relay log 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Insert... 
Insert... 
B 
binary log 
Insert... 
Insert... 
A 
binary log 
Client 
Network 
Master 
info 
Relay 
Log 
Info 
MulC-­‐Threaded 
Slave 
Applier 
Sender 
thread 
Receiver 
thread 
Applier 
Threads
relay log 
MulC-­‐Threaded 
Slave 
Applier 
Worker 
threads 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Insert... 
B 
binary log 
Insert... 
Client Client 
Insert... 
A 
binary log 
Network 
Client 
Coordinator 
thread (reading) SQL 
thread 
Multiple worker 
threads! (executing) 
One thread reads 
And schedules 
Transactions!
MulC-­‐Threaded 
Slave 
Applier 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
§ Parallelize 
by 
schema 
(database) 
§ Different 
worker 
threads 
never 
update 
same 
schema. 
§ EffecCve 
if 
you 
parBBon 
data 
by 
schema. 
§ Consistency 
§ SequenCal 
consistency 
criteria 
within 
schema. 
§ Eventually 
consistent 
between 
schemas. 
§ Commit 
order 
may 
differ 
between 
master 
and 
slave, 
among 
slaves. 
SET GLOBAL SLAVE_PARALLEL_WORKERS = 4;
MulC-­‐Threaded 
Slave 
Applier 
5x 
Higher 
Performance 
with 
MySQL 
5.6 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
|
relay log 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Tx2: Update... 
Tx1: Insert... 
Trx1 
B 
binary log 
Trx1 
Trx2 
Trx1 
Trx2 
A 
binary log 
Client 
Network 
Master 
info 
Relay 
Log 
Info 
Global 
TransacCon 
IdenCfiers 
Client 
Sender 
thread 
Receiver 
thread 
Applier 
Threads
A 
B 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
§ Handle 
servers 
unavailability 
with 
minimal 
disrupBon. 
§ Switch-­‐over/Fail-­‐over 
§ Topologies: 
§ Tree 
§ Line 
§ Circle 
§ … 
§ Arbitrary 
Topology 
§ Log 
coordinate: 
filename 
+ 
offset 
§ Not 
good 
enough 
– 
The 
need 
for 
a 
logical 
idenCfier. 
C 
D 
E 
F 
Global 
TransacCon 
IdenCfiers
Global 
TransacCon 
IdenCfiers 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
§ Master 
assigns 
Global 
TransacBon 
IdenBfier 
(GTID) 
to 
every 
transacCon: 
§ server_uuid:number 
a61678ba-­‐4889-­‐4279-­‐9e58-­‐45ba840af334:1 
§ server_uuid 
idenCfies 
the 
server 
and 
is 
globally 
unique; 
§ number 
is 
incremented 
by 
1 
for 
each 
transacCon 
on 
this 
server. 
§ GTIDs 
are 
wriden 
to 
the 
binary 
log. 
GTID BEGIN E1 E2 ... COMMIT GTID BEGIN E1 E2 ... COMMIT 
One Id per transaction!
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
§ Purpose: 
Fail-­‐over 
/ 
Switch-­‐over 
§ Very 
simple 
usage: 
§ Fail-­‐over 
has 
very 
small 
admin 
overhead 
§ Basic 
monitoring 
is 
simple 
(Applied 
transacCons) 
(Retrieved 
and 
Executed) 
(Applied 
but 
purged 
from 
binary 
logs 
already) 
Global 
TransacCon 
IdenCfiers 
mysql> CHANGE MASTER TO MASTER_AUTO_POSITION=1, MASTER_HOST='...'; 
mysql> select @@global_gtid_executed 
mysql> SHOW SLAVE STATUS 
mysql> select @@global.gtid_purged
relay log 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Insert... 
Insert... 
B 
binary log 
Insert... 
Insert... 
A 
binary log 
Client 
Network 
Master 
info 
Relay 
Log 
Info 
TransacConal 
ReplicaCon 
Metadata 
Sender 
thread 
Receiver 
thread 
Applier 
Threads
relay log 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
§ Slave 
threads 
maintain 
their 
current 
posiBons 
§ Receiver 
thread: 
where 
to 
read 
from 
master 
§ Applier 
thread: 
where 
to 
read 
from 
relay 
log 
§ PosiCons 
stored 
on 
disk 
§ Before: 
in 
file 
§ 5.6: 
in 
table 
insert... 
B 
binary log 
insert... 
Receiver 
thread 
Applier 
thread 
TransacConal 
ReplicaCon 
Metadata 
Master 
info 
Relay 
Log 
Info
TransacConal 
ReplicaCon 
Metadata 
§ Consistent 
aker 
server 
crash 
§ Requires 
(InnoDB) 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
§ File: 
updated 
aker 
transacCon 
commit 
Trans-action 
Update 
position 
Trans-action 
Upd ate 
position 
Crash 
possible 
§ Table: 
updated 
atomically 
at 
transacCon 
commit 
transacBonal 
table 
master-info-repository=TABLE 
relay-log-info-repository=TABLE
Binary 
Log 
Events 
Checksums 
relay log 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Insert... 
Insert... 
B 
binary log 
Insert... 
SHOW BINLOG ... 
Client 
Insert... 
A 
binary log 
Client 
Sender 
thread 
Network 
Master 
info 
Relay 
Log 
Info 
CRC creation point! 
CRC verification point! 
Receiver 
thread 
Applier 
Threads
Binary 
Log 
Events 
Checksums 
§ Reduce 
the 
Cme 
it 
takes 
to 
discover 
the 
cause 
of 
binary 
log 
corrupCon. 
§ Hard 
disk 
failure 
(?), 
network 
problems 
(?), 
memory 
sCcky 
bits 
(?) 
… 
or 
just 
plain 
server 
bugs 
(?). 
§ Each 
event 
is 
appended 
a 
32bits 
cyclic 
redundancy 
check 
(CRC32). 
§ MulCple 
verificaCons 
points 
(on 
the 
master 
and/or 
on 
the 
slave). 
§ Can 
be 
turned 
on/off 
independently. 
One CRC per Event. 
BEGIN E1 E2 ... COMMIT BEGIN E1 E2 ... COMMIT 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
C 
R 
C 
C 
R 
C 
C 
R 
C 
C 
R 
C 
C 
R 
C 
C 
R 
C 
C 
R 
C 
C 
R 
C
High 
Availability 
+ 
Sharding-­‐Based 
Scale-­‐out 
§ High 
Availability: 
§ Server 
monitoring 
with 
auto-­‐promoCon 
and 
transparent 
applicaCon 
failover 
§ OpConally 
scale-­‐out 
through 
sharding 
§ ApplicaCon 
provides 
shard 
key 
§ Range 
or 
Hash 
§ Tools 
for 
resharding 
§ Global 
updates 
& 
tables 
§ Fabric-­‐aware 
connectors 
rather 
than 
proxy: 
Python, 
Java 
& 
PHP 
§ Lower 
latency, 
bodleneck-­‐free 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
MySQL 
Fabric 
MySQL Fabric 
ApplicaCon 
Connector 
ApplicaCon 
Read-slaves 
mappings 
SQL 
HA group 
Read-slaves 
HA group 
Connector
Next 
GeneraBon 
ReplicaBon 
Features 
in 
MySQL 
5.7 
DMR 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
|
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
What 
is 
New? 
§ MySQL 
5.7.4 
-­‐ 
Development 
Milestone 
Release, 
April 
2014 
§ Higher 
throughput 
§ Slave 
: 
applies 
transacCons 
in 
parallel 
even 
within 
same 
database 
§ Master: 
beder 
synchronizaCon 
between 
replicaCon-­‐user 
sessions 
§ DMR4 
improves 
master 
performance 
for 
Semi-­‐synchronous 
ReplicaCon 
§ Lossless 
ReplicaCon 
through 
enhanced 
Semi-­‐sync 
§ Performance 
Schema 
tables 
for 
monitoring 
slave 
§ Dynamic 
ReplicaCon 
Filters: 
change 
filters 
on 
the 
fly
MySQL 
MulC-­‐Threaded 
Slave 
§ The 
evoluCon… 
§ 2010: 
Inter-­‐schema 
MTS 
(labs) 
§ 2013: 
Inter-­‐schema 
MTS 
(5.6 
GA) 
§ 2013: 
Intra-­‐schema 
MTS 
(5.7.2 
DMR) 
§ Today: 
Tune 
size 
of 
group 
commit 
buckets 
-­‐ 
trading 
commit 
latency 
on 
master 
(labs) 
§ 6X 
slave 
throughput 
Slave 
keeps 
pace 
with 
the 
master 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
labs.mysql.com 
4500" 
4000" 
3500" 
3000" 
2500" 
2000" 
1500" 
1000" 
500" 
0" 
Slave)Throughput) 
0" 4" 8" 12" 16" 22" 24" 28" 32" 36" 40" 44" 48" 
Transac'ons)per)second) 
Slave)Worker)Threads) 
Larger)BGC)bucket) 
No)Master)Impact) 
Baseline)
Higher 
Master 
Throughput: 
Sender, 
aka 
Dump, 
Thread 
Enhancement 
Concurrent 
reads 
by 
the 
sender 
thread 
with 
ongoing 
writes 
from 
user 
threads. 
§ Sender 
thread 
does 
not 
block 
user 
sessions 
more 
than 
necessary. 
§ Higher 
throughput 
for 
both 
sender 
threads 
and 
user 
sessions. 
Sender Thread Reads Binary Log User Thread Writes to Binary Log 
Sender Thread Reads Binary Log 
User Thread Writes to Binary Log 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Time 
pre 5.7.2 
5.7.2+
Higher 
Slave 
Throughput: 
Timestamp 
based 
MulC-­‐ 
threaded 
Applier 
relay log 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Insert... 
Insert... 
B 
binary log 
Insert... 
Insert... 
A 
binary log 
Client 
Network 
Master 
info 
Relay 
Log 
Info 
Sender 
thread 
Receiver 
thread 
Applier 
Threads
Higher 
Slave 
Throughput: 
Timestamp 
based 
MulC-­‐ 
threaded 
Applier 
§ Leverage 
parallelizaCon 
informaCon 
obtained 
from 
the 
execuCon 
on 
the 
master. 
§ TransacCons 
that 
prepare 
on 
the 
same 
“version” 
of 
the 
database, 
are 
assigned 
the 
same 
Cmestamp. 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
§ Meanwhile, 
at 
the 
slave: 
§ TransacCons 
with 
the 
same 
Cmestamp 
can 
be 
executed 
in 
parallel; 
§ Concurrent 
transacCons 
commit 
independently, 
thus 
no 
waiCng 
involved.
Higher 
Slave 
Throughput: 
Timestamp 
based 
MulC-­‐ 
threaded 
Applier 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
T1 
T2 
T3 
Time 
Commit 
Prepare 
Concurrent 
ExecuBon 
History 
on 
the 
Master 
timestamp++ 
Execution 
Prepare 
Commit
Higher 
Slave 
Throughput: 
Timestamp 
based 
MulC-­‐ 
threaded 
Applier 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
T1 
T2 
T3 
Time 
Commit 
Prepare 
Concurrent 
ExecuBon 
History 
on 
the 
Master 
timestamp++ 
Execution 
Prepare 
Commit 
Parallel 
on the Slave. 
Not Executed in 
Parallel.
Higher 
Slave 
Throughput: 
Timestamp 
based 
MulC-­‐ 
threaded 
Applier 
§ Supports 
statement-­‐based 
or 
row-­‐based 
formats. 
§ Scheduling 
policy 
controlled 
through: 
mysql> SET slave_parallel_type= [logical_clock|database] 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
§ Logical_clock 
-­‐ 
means 
schedule 
based 
on 
the 
prepare 
Cmestamp 
§ database 
-­‐ 
the 
scheduling 
policy 
from 
5.6 
(concurrency 
control 
done 
per 
database). 
§ Work 
to 
improve 
slave 
scalability 
conCnues, 
does 
not 
stop 
here.
Beder 
ReplicaCon 
Monitoring: 
P_S 
ReplicaCon 
Tables 
relay log 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Insert... 
Insert... 
B 
binary log 
Insert... 
Insert... 
A 
binary log 
Client 
Network 
Master 
info 
Relay 
Log 
Info 
Sender 
thread 
Receiver 
thread 
Applier 
Threads
Beder 
ReplicaCon 
Monitoring: 
P_S 
ReplicaCon 
Tables 
n Access 
monitoring 
informaCon 
through 
an 
SQL 
interface. 
n Write 
stored 
funcCons 
or 
procedures 
with 
input 
from 
replicaCon 
internals. 
n Logically 
unrelated 
informaCon 
into 
different 
places. 
n Flexible 
and 
easier 
to 
extend 
and 
adapt 
as 
new 
feature 
get 
into 
the 
server. 
n More 
user 
friendly 
names 
idenCfying 
the 
monitoring 
fields. 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
|
Beder 
ReplicaCon 
Monitoring: 
P_S 
ReplicaCon 
Tables 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Connection 
Configuration 
Connection 
Status 
Execution 
Configuration 
Execution 
Status 
Slave Status 
Applier / Coordinator 
Status 
Workers 
Status
Better, Flexible, Loss-less Semi-sync Replication 
relay log 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Insert... 
Insert... 
B 
binary log 
Insert... 
Insert... 
A 
binary log 
Client 
Network 
Master 
info 
Relay 
Log 
Info 
Sender 
thread 
Receiver 
thread 
Applier 
Threads
Beder, 
Flexible, 
Loss-­‐less 
Semi-­‐sync 
ReplicaCon 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
§ Master 
does 
not 
commit 
transacCon 
unCl 
it 
receives 
an 
ACK 
from 
the 
slave. 
§ (as 
opposed 
to: 
Master 
does 
not 
release 
the 
session 
unCl 
it 
receives 
an 
ACK 
from 
the 
slave.) 
§ Therefore, 
concurrent 
transacCons 
do 
not 
externalize 
changes 
while 
waiCng 
for 
ACK. 
§ Should 
a 
master 
fail, 
then 
any 
transacCon 
that 
it 
may 
have 
externalized 
is 
also 
persisted 
on 
a 
slave. 
§ User 
can 
choose 
between 
the 
original 
semisync 
behavior 
and 
the 
new 
one. 
mysql> SET rpl_semi_sync_master_wait_point= [AFTER_SYNC|AFTER_COMMIT]
Beder, 
Flexible, 
Loss-­‐less 
Semi-­‐sync 
ReplicaCon 
§ Master 
can 
wait 
for 
more 
than 
one 
slave. 
§ Increases 
resiliency 
to 
consecuCve 
failures 
§ Increases 
durability 
– 
transacCon 
is 
persisted 
in 
N 
places 
mysql> SET rpl_semi_sync_master_wait_slave_count= 1..1024 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
|
relay log 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Insert... 
Insert... 
B 
binary log 
Insert... 
Insert... 
A 
binary log 
Client 
Network 
Master 
info 
Relay 
Log 
Info 
Dynamic 
ReplicaCon 
Filters 
Sender 
thread 
Receiver 
thread 
Applier 
Threads
Dynamic 
ReplicaCon 
Filters 
n Update 
filters 
without 
shu{ng 
down 
server 
instance. 
mysql> CHANGE REPLICATION FILTER REPLICATE_DO_DB=(db1); 
ERROR 1896 (HY000): This operation cannot be performed with 
a running slave sql thread; run STOP SLAVE SQL_THREAD first 
mysql> STOP SLAVE SQL_THREAD; 
Query OK, 0 rows affected (0.05 sec) 
mysql> CHANGE REPLICATION FILTER REPLICATE_DO_DB=(db1); 
Query OK, 0 rows affected (0.00 sec) 
mysql> START SLAVE SQL_THREAD; 
Query OK, 0 rows affected (0.05 sec) 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
|
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
MySQL 
Labs
Master 
N 
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
MulC-­‐Source 
ReplicaCon 
§ Consolidate 
updates 
from 
mulCple 
Masters 
into 
one 
Slave 
§ Consolidated 
view 
of 
all 
shards 
§ More 
flexible 
topologies 
§ Centralized 
point 
for 
backups, 
easier 
reporCng 
§ CompaCble 
with 
Semi-­‐Synchronous 
ReplicaCon 
& 
enhanced 
MTS 
§ Master-­‐specific 
slave 
filters 
planned 
for 
GA 
§ ApplicaCon 
must 
keep 
data 
sets 
disjoint 
between 
sources 
Master 
1 
Binlog 
Master 
2 
Binlog 
… 
… 
Binlog 
IO 
1 
Relay 
1 
Coordinator 
W1 
W2 
… 
WX 
IO 
2 
Relay 
2 
Coordinator 
W1 
W2 
… 
WX 
… 
… 
Coordinator 
W1 
W2 
… 
WX 
IO 
N 
Relay 
N 
Coordinator 
W1 
W2 
… 
WX 
Slave 
labs.mysql.com
Copyright 
© 
2014 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
MulC-­‐Source 
ReplicaCon 
M M 
S 
Slave can have more than one master. 
Feature preview based on 5.7 is available 
on labs.mysql.com . 
M M 
The 
need 
for 
gathering 
data 
in 
a 
central 
server: 
n Integrated 
backup; 
n Complex 
queries 
for 
analyCcs 
purposes; 
n Data 
HUB 
for 
inter-­‐cluster 
replicaCon.
MySQL Replication

More Related Content

What's hot

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
Olivier DASINI
 
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best PracticesMySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
Kenny Gryp
 
MySQL Connectors 8.0.19 & DNS SRV
MySQL Connectors 8.0.19 & DNS SRVMySQL Connectors 8.0.19 & DNS SRV
MySQL Connectors 8.0.19 & DNS SRV
Kenny Gryp
 
DataOpsbarcelona 2019: Deep dive into MySQL Group Replication... the magic e...
DataOpsbarcelona 2019:  Deep dive into MySQL Group Replication... the magic e...DataOpsbarcelona 2019:  Deep dive into MySQL Group Replication... the magic e...
DataOpsbarcelona 2019: Deep dive into MySQL Group Replication... the magic e...
Frederic Descamps
 
MySQL Group Replication - Ready For Production? (2018-04)
MySQL Group Replication - Ready For Production? (2018-04)MySQL Group Replication - Ready For Production? (2018-04)
MySQL Group Replication - Ready For Production? (2018-04)
Kenny Gryp
 
Fine-tuning Group Replication for Performance
Fine-tuning Group Replication for PerformanceFine-tuning Group Replication for Performance
Fine-tuning Group Replication for Performance
Vitor Oliveira
 
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?
Miguel Araújo
 
MySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB Cluster
Mario Beck
 
Introduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB ClusterIntroduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB Cluster
Frederic Descamps
 
MySQL Database Architectures - 2022-08
MySQL Database Architectures - 2022-08MySQL Database Architectures - 2022-08
MySQL Database Architectures - 2022-08
Kenny Gryp
 
Ndb cluster 80_ycsb_mem
Ndb cluster 80_ycsb_memNdb cluster 80_ycsb_mem
Ndb cluster 80_ycsb_mem
mikaelronstrom
 
MySQL Shell for DBAs
MySQL Shell for DBAsMySQL Shell for DBAs
MySQL Shell for DBAs
Frederic Descamps
 
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
MySQL Innovation Day Chicago  - MySQL HA So Easy : That's insane !!MySQL Innovation Day Chicago  - MySQL HA So Easy : That's insane !!
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
Frederic Descamps
 
MySQL Shell - the best DBA tool !
MySQL Shell - the best DBA tool !MySQL Shell - the best DBA tool !
MySQL Shell - the best DBA tool !
Frederic Descamps
 
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
Kenny Gryp
 
Using The Mysql Binary Log As A Change Stream
Using The Mysql Binary Log As A Change StreamUsing The Mysql Binary Log As A Change Stream
Using The Mysql Binary Log As A Change Stream
Luís Soares
 
Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0
Olivier DASINI
 
Amazon Aurora
Amazon AuroraAmazon Aurora
Amazon Aurora
Amazon Web Services
 
MySQL InnoDB Cluster - Group Replication
MySQL InnoDB Cluster - Group ReplicationMySQL InnoDB Cluster - Group Replication
MySQL InnoDB Cluster - Group Replication
Frederic Descamps
 
MySQL Performance - Best practices
MySQL Performance - Best practices MySQL Performance - Best practices
MySQL Performance - Best practices
Ted Wennmark
 

What's hot (20)

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
 
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best PracticesMySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
 
MySQL Connectors 8.0.19 & DNS SRV
MySQL Connectors 8.0.19 & DNS SRVMySQL Connectors 8.0.19 & DNS SRV
MySQL Connectors 8.0.19 & DNS SRV
 
DataOpsbarcelona 2019: Deep dive into MySQL Group Replication... the magic e...
DataOpsbarcelona 2019:  Deep dive into MySQL Group Replication... the magic e...DataOpsbarcelona 2019:  Deep dive into MySQL Group Replication... the magic e...
DataOpsbarcelona 2019: Deep dive into MySQL Group Replication... the magic e...
 
MySQL Group Replication - Ready For Production? (2018-04)
MySQL Group Replication - Ready For Production? (2018-04)MySQL Group Replication - Ready For Production? (2018-04)
MySQL Group Replication - Ready For Production? (2018-04)
 
Fine-tuning Group Replication for Performance
Fine-tuning Group Replication for PerformanceFine-tuning Group Replication for Performance
Fine-tuning Group Replication for Performance
 
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 InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB Cluster
 
Introduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB ClusterIntroduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB Cluster
 
MySQL Database Architectures - 2022-08
MySQL Database Architectures - 2022-08MySQL Database Architectures - 2022-08
MySQL Database Architectures - 2022-08
 
Ndb cluster 80_ycsb_mem
Ndb cluster 80_ycsb_memNdb cluster 80_ycsb_mem
Ndb cluster 80_ycsb_mem
 
MySQL Shell for DBAs
MySQL Shell for DBAsMySQL Shell for DBAs
MySQL Shell for DBAs
 
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
MySQL Innovation Day Chicago  - MySQL HA So Easy : That's insane !!MySQL Innovation Day Chicago  - MySQL HA So Easy : That's insane !!
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
 
MySQL Shell - the best DBA tool !
MySQL Shell - the best DBA tool !MySQL Shell - the best DBA tool !
MySQL Shell - the best DBA tool !
 
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
 
Using The Mysql Binary Log As A Change Stream
Using The Mysql Binary Log As A Change StreamUsing The Mysql Binary Log As A Change Stream
Using The Mysql Binary Log As A Change Stream
 
Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0
 
Amazon Aurora
Amazon AuroraAmazon Aurora
Amazon Aurora
 
MySQL InnoDB Cluster - Group Replication
MySQL InnoDB Cluster - Group ReplicationMySQL InnoDB Cluster - Group Replication
MySQL InnoDB Cluster - Group Replication
 
MySQL Performance - Best practices
MySQL Performance - Best practices MySQL Performance - Best practices
MySQL Performance - Best practices
 

Similar to MySQL Replication

My sql fabric webinar v1.1
My sql fabric webinar v1.1My sql fabric webinar v1.1
My sql fabric webinar v1.1
Ricky Setyawan
 
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...
Miguel Araújo
 
MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014) MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014)
Frazer Clement
 
Performance Schema and Sys Schema in MySQL 5.7
Performance Schema and Sys Schema in MySQL 5.7Performance Schema and Sys Schema in MySQL 5.7
Performance Schema and Sys Schema in MySQL 5.7
Mark Leith
 
MySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery SolutionMySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery Solution
Miguel Araújo
 
2012 scale replication
2012 scale replication2012 scale replication
2012 scale replication
sqlhjalp
 
20141011 my sql clusterv01pptx
20141011 my sql clusterv01pptx20141011 my sql clusterv01pptx
20141011 my sql clusterv01pptx
Ivan Ma
 
New Not Your Father's Enterprise Manager
New Not Your Father's Enterprise ManagerNew Not Your Father's Enterprise Manager
New Not Your Father's Enterprise Manager
Kellyn Pot'Vin-Gorman
 
MySQL For Linux Sysadmins
MySQL For Linux SysadminsMySQL For Linux Sysadmins
MySQL For Linux Sysadmins
Morgan Tocker
 
Oracle RAC and Your Way to the Cloud by Angelo Pruscino
Oracle RAC and Your Way to the Cloud by Angelo PruscinoOracle RAC and Your Way to the Cloud by Angelo Pruscino
Oracle RAC and Your Way to the Cloud by Angelo Pruscino
Markus Michalewicz
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
Mark Swarbrick
 
Using Databases and Containers From Development to Deployment
Using Databases and Containers  From Development to DeploymentUsing Databases and Containers  From Development to Deployment
Using Databases and Containers From Development to Deployment
Aerospike, Inc.
 
2012 replication
2012 replication2012 replication
2012 replicationsqlhjalp
 
MySQL Developer Day conference: MySQL Replication and Scalability
MySQL Developer Day conference: MySQL Replication and ScalabilityMySQL Developer Day conference: MySQL Replication and Scalability
MySQL Developer Day conference: MySQL Replication and Scalability
Shivji Kumar Jha
 
MySQL Fabric
MySQL FabricMySQL Fabric
MySQL Fabric
Mark Swarbrick
 
2 ivan ma-mysql複製的演進和應用-twn- v1
2 ivan ma-mysql複製的演進和應用-twn- v12 ivan ma-mysql複製的演進和應用-twn- v1
2 ivan ma-mysql複製的演進和應用-twn- v1
Ivan Tu
 
MySQL Fabric - High Availability & Automated Sharding for MySQL
MySQL Fabric - High Availability & Automated Sharding for MySQLMySQL Fabric - High Availability & Automated Sharding for MySQL
MySQL Fabric - High Availability & Automated Sharding for MySQL
Ted Wennmark
 
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
Miguel Araújo
 

Similar to MySQL Replication (20)

My sql fabric webinar v1.1
My sql fabric webinar v1.1My sql fabric webinar v1.1
My sql fabric webinar v1.1
 
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...
 
MySQL NoSQL APIs
MySQL NoSQL APIsMySQL NoSQL APIs
MySQL NoSQL APIs
 
MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014) MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014)
 
Performance Schema and Sys Schema in MySQL 5.7
Performance Schema and Sys Schema in MySQL 5.7Performance Schema and Sys Schema in MySQL 5.7
Performance Schema and Sys Schema in MySQL 5.7
 
MySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery SolutionMySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery Solution
 
2012 scale replication
2012 scale replication2012 scale replication
2012 scale replication
 
20141011 my sql clusterv01pptx
20141011 my sql clusterv01pptx20141011 my sql clusterv01pptx
20141011 my sql clusterv01pptx
 
New Not Your Father's Enterprise Manager
New Not Your Father's Enterprise ManagerNew Not Your Father's Enterprise Manager
New Not Your Father's Enterprise Manager
 
MySQL For Linux Sysadmins
MySQL For Linux SysadminsMySQL For Linux Sysadmins
MySQL For Linux Sysadmins
 
Oracle RAC and Your Way to the Cloud by Angelo Pruscino
Oracle RAC and Your Way to the Cloud by Angelo PruscinoOracle RAC and Your Way to the Cloud by Angelo Pruscino
Oracle RAC and Your Way to the Cloud by Angelo Pruscino
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
 
Using Databases and Containers From Development to Deployment
Using Databases and Containers  From Development to DeploymentUsing Databases and Containers  From Development to Deployment
Using Databases and Containers From Development to Deployment
 
SD Times - Docker v2
SD Times - Docker v2SD Times - Docker v2
SD Times - Docker v2
 
2012 replication
2012 replication2012 replication
2012 replication
 
MySQL Developer Day conference: MySQL Replication and Scalability
MySQL Developer Day conference: MySQL Replication and ScalabilityMySQL Developer Day conference: MySQL Replication and Scalability
MySQL Developer Day conference: MySQL Replication and Scalability
 
MySQL Fabric
MySQL FabricMySQL Fabric
MySQL Fabric
 
2 ivan ma-mysql複製的演進和應用-twn- v1
2 ivan ma-mysql複製的演進和應用-twn- v12 ivan ma-mysql複製的演進和應用-twn- v1
2 ivan ma-mysql複製的演進和應用-twn- v1
 
MySQL Fabric - High Availability & Automated Sharding for MySQL
MySQL Fabric - High Availability & Automated Sharding for MySQLMySQL Fabric - High Availability & Automated Sharding for MySQL
MySQL Fabric - High Availability & Automated Sharding for MySQL
 
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
 

More from Mark Swarbrick

MySQL NoSQL Document Store
MySQL NoSQL Document StoreMySQL NoSQL Document Store
MySQL NoSQL Document Store
Mark Swarbrick
 
MySQL @ the University Of Nottingham
MySQL @ the University Of NottinghamMySQL @ the University Of Nottingham
MySQL @ the University Of Nottingham
Mark Swarbrick
 
InnoDb Vs NDB Cluster
InnoDb Vs NDB ClusterInnoDb Vs NDB Cluster
InnoDb Vs NDB Cluster
Mark Swarbrick
 
MySQL Security & GDPR
MySQL Security & GDPRMySQL Security & GDPR
MySQL Security & GDPR
Mark Swarbrick
 
Intro To MySQL 2019
Intro To MySQL 2019Intro To MySQL 2019
Intro To MySQL 2019
Mark Swarbrick
 
MySQL 8
MySQL 8MySQL 8
MySQL Dublin Event Nov 2018 - MySQL 8
MySQL Dublin Event Nov 2018 - MySQL 8MySQL Dublin Event Nov 2018 - MySQL 8
MySQL Dublin Event Nov 2018 - MySQL 8
Mark Swarbrick
 
MySQL Dublin Event Nov 2018 - State of the Dolphin
MySQL Dublin Event Nov 2018 - State of the DolphinMySQL Dublin Event Nov 2018 - State of the Dolphin
MySQL Dublin Event Nov 2018 - State of the Dolphin
Mark Swarbrick
 
Oracle Code Event - MySQL JSON Document Store
Oracle Code Event - MySQL JSON Document StoreOracle Code Event - MySQL JSON Document Store
Oracle Code Event - MySQL JSON Document Store
Mark Swarbrick
 
TLV - MySQL Security overview
TLV - MySQL Security overviewTLV - MySQL Security overview
TLV - MySQL Security overview
Mark Swarbrick
 
TLV - MySQL Enterprise Edition + Cloud
TLV - MySQL Enterprise Edition + CloudTLV - MySQL Enterprise Edition + Cloud
TLV - MySQL Enterprise Edition + Cloud
Mark Swarbrick
 
TLV - Whats new in MySQL 8
TLV - Whats new in MySQL 8TLV - Whats new in MySQL 8
TLV - Whats new in MySQL 8
Mark Swarbrick
 
MySQL At University Of Nottingham - 2018 MySQL Days
MySQL At University Of Nottingham - 2018 MySQL DaysMySQL At University Of Nottingham - 2018 MySQL Days
MySQL At University Of Nottingham - 2018 MySQL Days
Mark Swarbrick
 
MySQL At Mastercard - 2018 MySQL Days
MySQL At Mastercard - 2018 MySQL DaysMySQL At Mastercard - 2018 MySQL Days
MySQL At Mastercard - 2018 MySQL Days
Mark Swarbrick
 
MySQL 8 - 2018 MySQL Days
MySQL 8 - 2018 MySQL DaysMySQL 8 - 2018 MySQL Days
MySQL 8 - 2018 MySQL Days
Mark Swarbrick
 
MySQL Security + GDPR - 2018 MySQL Days
MySQL Security + GDPR - 2018 MySQL DaysMySQL Security + GDPR - 2018 MySQL Days
MySQL Security + GDPR - 2018 MySQL Days
Mark Swarbrick
 
MySQL InnoDB + NDB Cluster - 2018 MySQL Days
MySQL InnoDB + NDB Cluster - 2018 MySQL DaysMySQL InnoDB + NDB Cluster - 2018 MySQL Days
MySQL InnoDB + NDB Cluster - 2018 MySQL Days
Mark Swarbrick
 
MySQL Cloud - 2018 MySQL Days
MySQL Cloud - 2018 MySQL DaysMySQL Cloud - 2018 MySQL Days
MySQL Cloud - 2018 MySQL Days
Mark Swarbrick
 
MySQL 2018 Intro - 2018 MySQL Days
MySQL 2018 Intro - 2018 MySQL DaysMySQL 2018 Intro - 2018 MySQL Days
MySQL 2018 Intro - 2018 MySQL Days
Mark Swarbrick
 
MySQL + GDPR
MySQL + GDPRMySQL + GDPR
MySQL + GDPR
Mark Swarbrick
 

More from Mark Swarbrick (20)

MySQL NoSQL Document Store
MySQL NoSQL Document StoreMySQL NoSQL Document Store
MySQL NoSQL Document Store
 
MySQL @ the University Of Nottingham
MySQL @ the University Of NottinghamMySQL @ the University Of Nottingham
MySQL @ the University Of Nottingham
 
InnoDb Vs NDB Cluster
InnoDb Vs NDB ClusterInnoDb Vs NDB Cluster
InnoDb Vs NDB Cluster
 
MySQL Security & GDPR
MySQL Security & GDPRMySQL Security & GDPR
MySQL Security & GDPR
 
Intro To MySQL 2019
Intro To MySQL 2019Intro To MySQL 2019
Intro To MySQL 2019
 
MySQL 8
MySQL 8MySQL 8
MySQL 8
 
MySQL Dublin Event Nov 2018 - MySQL 8
MySQL Dublin Event Nov 2018 - MySQL 8MySQL Dublin Event Nov 2018 - MySQL 8
MySQL Dublin Event Nov 2018 - MySQL 8
 
MySQL Dublin Event Nov 2018 - State of the Dolphin
MySQL Dublin Event Nov 2018 - State of the DolphinMySQL Dublin Event Nov 2018 - State of the Dolphin
MySQL Dublin Event Nov 2018 - State of the Dolphin
 
Oracle Code Event - MySQL JSON Document Store
Oracle Code Event - MySQL JSON Document StoreOracle Code Event - MySQL JSON Document Store
Oracle Code Event - MySQL JSON Document Store
 
TLV - MySQL Security overview
TLV - MySQL Security overviewTLV - MySQL Security overview
TLV - MySQL Security overview
 
TLV - MySQL Enterprise Edition + Cloud
TLV - MySQL Enterprise Edition + CloudTLV - MySQL Enterprise Edition + Cloud
TLV - MySQL Enterprise Edition + Cloud
 
TLV - Whats new in MySQL 8
TLV - Whats new in MySQL 8TLV - Whats new in MySQL 8
TLV - Whats new in MySQL 8
 
MySQL At University Of Nottingham - 2018 MySQL Days
MySQL At University Of Nottingham - 2018 MySQL DaysMySQL At University Of Nottingham - 2018 MySQL Days
MySQL At University Of Nottingham - 2018 MySQL Days
 
MySQL At Mastercard - 2018 MySQL Days
MySQL At Mastercard - 2018 MySQL DaysMySQL At Mastercard - 2018 MySQL Days
MySQL At Mastercard - 2018 MySQL Days
 
MySQL 8 - 2018 MySQL Days
MySQL 8 - 2018 MySQL DaysMySQL 8 - 2018 MySQL Days
MySQL 8 - 2018 MySQL Days
 
MySQL Security + GDPR - 2018 MySQL Days
MySQL Security + GDPR - 2018 MySQL DaysMySQL Security + GDPR - 2018 MySQL Days
MySQL Security + GDPR - 2018 MySQL Days
 
MySQL InnoDB + NDB Cluster - 2018 MySQL Days
MySQL InnoDB + NDB Cluster - 2018 MySQL DaysMySQL InnoDB + NDB Cluster - 2018 MySQL Days
MySQL InnoDB + NDB Cluster - 2018 MySQL Days
 
MySQL Cloud - 2018 MySQL Days
MySQL Cloud - 2018 MySQL DaysMySQL Cloud - 2018 MySQL Days
MySQL Cloud - 2018 MySQL Days
 
MySQL 2018 Intro - 2018 MySQL Days
MySQL 2018 Intro - 2018 MySQL DaysMySQL 2018 Intro - 2018 MySQL Days
MySQL 2018 Intro - 2018 MySQL Days
 
MySQL + GDPR
MySQL + GDPRMySQL + GDPR
MySQL + GDPR
 

Recently uploaded

Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 

Recently uploaded (20)

Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 

MySQL Replication

  • 1. Advanced MySQL ReplicaCon Architectures and Latest Developments Mark Swarbrick Technical Presales Consultant MySQL UK&I London October, 2014 Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
  • 2. Safe Harbor Statement The following is intended to outline our general product direcCon. It is intended for informaCon purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or funcConality, and should not be relied upon in making purchasing decisions. The development, release, and Cming of any features or funcConality described for Oracle’s products remains at the sole discreCon of Oracle. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 2
  • 3. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Agenda 1 2 3 4 5 Background Generally Available Features in MySQL 5.6 Next GeneraCon ReplicaCon Features in MySQL 5.7 DMR What is Next? Summary 3
  • 4. Background: ReplicaCon Components relay log Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Insert... Insert... B binary log Insert... Insert... A binary log Client Sender thread Receiver thread Applier Threads Network Master info Relay Log Info
  • 5. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | § Binary Log § File based logical log that records the changes on the master. § Statement or Row based format (may be intermixed). § TransacCons are split into groups of events. § Control events: Rotate, Format DescripCon, GCd, ... Layout of a Binary Log File Background: ReplicaCon Components BEGIN E1 E2 ... COMMIT BEGIN E1 E2 ... COMMIT
  • 6. Background: What is ReplicaCon Used For? write clients More reads? More slaves! Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | § Read scale-­‐out M S S S S M write clients read clients read clients
  • 7. What about Write scale-­‐out? More writes? More Masters? M? M M? write clients write clients Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | M? MySQL Fabric
  • 8. Uh Oh! Phew! Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | § Redundancy: If master crashes, promote slave to master C B A Background: What is ReplicaCon Used For? C B CraAs h C B A B is the new master
  • 9. Background: What is ReplicaCon Used For? Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | § On-­‐line Backup and ReporBng M S n write clients n business intelligent client apps n reporCng client apps n big queries client apps
  • 10. CB AC BA Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Image from www.ginkgomaps.com Background: What is ReplicaCon Used For?
  • 11. Generally Available Features in MySQL 5.6 Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
  • 12. relay log Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Insert... Insert... B binary log Insert... Insert... A binary log Client Network Master info Relay Log Info Binary Log Group Commit Sender thread Receiver thread Applier Threads
  • 13. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Trx1 … TrxN Trx1 . . . TrxN A binary log § TransacCons are flushed and synced together and then commided in the engine! § Binary Log is the conceptual commit point. § Resilience, crash-­‐safeness and durability with good performance (sync_binlog=1). § No impact on single-­‐threaded workloads. § Loss-­‐less, automaCc recovery. § Corrupt tail of the binary log is trimmed on recovery. Binary Log Group Commit mysql> SET sync_binlog=1
  • 14. n 5x faster than MySQL 5.5 n 4.5x even when sync_binlog=1 hdps://blogs.oracle.com/MySQL/entry/mysql_5_6_replicaCon_performance Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Binary Log Group Commit
  • 15. n Days of losing 50%+ master performance are gone! n 10% overhead when configuring sync_binlog=0 n AddiConal 5% when configuring sync_binlog=1 hdps://blogs.oracle.com/MySQL/entry/mysql_5_6_replicaCon_performance Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Binary Log Group Commit
  • 16. OpCmized Row-­‐based ReplicaCon § Smaller storage, network and memory footprints. § Each record change may require its before and/or aker images to be stored in the RBR event. § Before MySQL 5.6 the server would log full images only. § In MySQL 5.6 and later, the server can log images with just the needed data. § A PK-­‐less table on the slave is much quicker to change. § Applier does at most one table scan per Update or Delete event. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
  • 17. OpCmized Row-­‐based ReplicaCon: ParCal Images Before Image After Image Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Full Rows Rows without Blobs Minimal Rows Blob Primary Key Changed Columns mysql> binlog_row_image={MINIMAL|NOBLOB|FULL}
  • 18. OpCmized Row-­‐based ReplicaCon: Improved Rows Lookup by RBR Applier mysql> SET slave_rows_search_algorithm={INDEX_SEARCH | TABLE_SCAN | HASH_SCAN } Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | § slave_rows_search_algorithm § INDEX_SEARCH – use an index (if available) to locate the row. § TABLE_SCAN – do a table scan to locate the row. § HASH_SCAN – do at most ONE table scan to locate ALL rows in the event. § Result: large tables without primary keys are now updated quicker by the slave thread. NEW
  • 19. relay log Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Insert... Insert... B binary log Insert... Insert... A binary log Client Network Master info Relay Log Info MulC-­‐Threaded Slave Applier Sender thread Receiver thread Applier Threads
  • 20. relay log MulC-­‐Threaded Slave Applier Worker threads Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Insert... B binary log Insert... Client Client Insert... A binary log Network Client Coordinator thread (reading) SQL thread Multiple worker threads! (executing) One thread reads And schedules Transactions!
  • 21. MulC-­‐Threaded Slave Applier Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | § Parallelize by schema (database) § Different worker threads never update same schema. § EffecCve if you parBBon data by schema. § Consistency § SequenCal consistency criteria within schema. § Eventually consistent between schemas. § Commit order may differ between master and slave, among slaves. SET GLOBAL SLAVE_PARALLEL_WORKERS = 4;
  • 22. MulC-­‐Threaded Slave Applier 5x Higher Performance with MySQL 5.6 Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
  • 23. relay log Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Tx2: Update... Tx1: Insert... Trx1 B binary log Trx1 Trx2 Trx1 Trx2 A binary log Client Network Master info Relay Log Info Global TransacCon IdenCfiers Client Sender thread Receiver thread Applier Threads
  • 24. A B Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | § Handle servers unavailability with minimal disrupBon. § Switch-­‐over/Fail-­‐over § Topologies: § Tree § Line § Circle § … § Arbitrary Topology § Log coordinate: filename + offset § Not good enough – The need for a logical idenCfier. C D E F Global TransacCon IdenCfiers
  • 25. Global TransacCon IdenCfiers Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | § Master assigns Global TransacBon IdenBfier (GTID) to every transacCon: § server_uuid:number a61678ba-­‐4889-­‐4279-­‐9e58-­‐45ba840af334:1 § server_uuid idenCfies the server and is globally unique; § number is incremented by 1 for each transacCon on this server. § GTIDs are wriden to the binary log. GTID BEGIN E1 E2 ... COMMIT GTID BEGIN E1 E2 ... COMMIT One Id per transaction!
  • 26. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | § Purpose: Fail-­‐over / Switch-­‐over § Very simple usage: § Fail-­‐over has very small admin overhead § Basic monitoring is simple (Applied transacCons) (Retrieved and Executed) (Applied but purged from binary logs already) Global TransacCon IdenCfiers mysql> CHANGE MASTER TO MASTER_AUTO_POSITION=1, MASTER_HOST='...'; mysql> select @@global_gtid_executed mysql> SHOW SLAVE STATUS mysql> select @@global.gtid_purged
  • 27. relay log Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Insert... Insert... B binary log Insert... Insert... A binary log Client Network Master info Relay Log Info TransacConal ReplicaCon Metadata Sender thread Receiver thread Applier Threads
  • 28. relay log Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | § Slave threads maintain their current posiBons § Receiver thread: where to read from master § Applier thread: where to read from relay log § PosiCons stored on disk § Before: in file § 5.6: in table insert... B binary log insert... Receiver thread Applier thread TransacConal ReplicaCon Metadata Master info Relay Log Info
  • 29. TransacConal ReplicaCon Metadata § Consistent aker server crash § Requires (InnoDB) Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | § File: updated aker transacCon commit Trans-action Update position Trans-action Upd ate position Crash possible § Table: updated atomically at transacCon commit transacBonal table master-info-repository=TABLE relay-log-info-repository=TABLE
  • 30. Binary Log Events Checksums relay log Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Insert... Insert... B binary log Insert... SHOW BINLOG ... Client Insert... A binary log Client Sender thread Network Master info Relay Log Info CRC creation point! CRC verification point! Receiver thread Applier Threads
  • 31. Binary Log Events Checksums § Reduce the Cme it takes to discover the cause of binary log corrupCon. § Hard disk failure (?), network problems (?), memory sCcky bits (?) … or just plain server bugs (?). § Each event is appended a 32bits cyclic redundancy check (CRC32). § MulCple verificaCons points (on the master and/or on the slave). § Can be turned on/off independently. One CRC per Event. BEGIN E1 E2 ... COMMIT BEGIN E1 E2 ... COMMIT Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | C R C C R C C R C C R C C R C C R C C R C C R C
  • 32. High Availability + Sharding-­‐Based Scale-­‐out § High Availability: § Server monitoring with auto-­‐promoCon and transparent applicaCon failover § OpConally scale-­‐out through sharding § ApplicaCon provides shard key § Range or Hash § Tools for resharding § Global updates & tables § Fabric-­‐aware connectors rather than proxy: Python, Java & PHP § Lower latency, bodleneck-­‐free Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | MySQL Fabric MySQL Fabric ApplicaCon Connector ApplicaCon Read-slaves mappings SQL HA group Read-slaves HA group Connector
  • 33. Next GeneraBon ReplicaBon Features in MySQL 5.7 DMR Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
  • 34. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | What is New? § MySQL 5.7.4 -­‐ Development Milestone Release, April 2014 § Higher throughput § Slave : applies transacCons in parallel even within same database § Master: beder synchronizaCon between replicaCon-­‐user sessions § DMR4 improves master performance for Semi-­‐synchronous ReplicaCon § Lossless ReplicaCon through enhanced Semi-­‐sync § Performance Schema tables for monitoring slave § Dynamic ReplicaCon Filters: change filters on the fly
  • 35. MySQL MulC-­‐Threaded Slave § The evoluCon… § 2010: Inter-­‐schema MTS (labs) § 2013: Inter-­‐schema MTS (5.6 GA) § 2013: Intra-­‐schema MTS (5.7.2 DMR) § Today: Tune size of group commit buckets -­‐ trading commit latency on master (labs) § 6X slave throughput Slave keeps pace with the master Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | labs.mysql.com 4500" 4000" 3500" 3000" 2500" 2000" 1500" 1000" 500" 0" Slave)Throughput) 0" 4" 8" 12" 16" 22" 24" 28" 32" 36" 40" 44" 48" Transac'ons)per)second) Slave)Worker)Threads) Larger)BGC)bucket) No)Master)Impact) Baseline)
  • 36. Higher Master Throughput: Sender, aka Dump, Thread Enhancement Concurrent reads by the sender thread with ongoing writes from user threads. § Sender thread does not block user sessions more than necessary. § Higher throughput for both sender threads and user sessions. Sender Thread Reads Binary Log User Thread Writes to Binary Log Sender Thread Reads Binary Log User Thread Writes to Binary Log Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Time pre 5.7.2 5.7.2+
  • 37. Higher Slave Throughput: Timestamp based MulC-­‐ threaded Applier relay log Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Insert... Insert... B binary log Insert... Insert... A binary log Client Network Master info Relay Log Info Sender thread Receiver thread Applier Threads
  • 38. Higher Slave Throughput: Timestamp based MulC-­‐ threaded Applier § Leverage parallelizaCon informaCon obtained from the execuCon on the master. § TransacCons that prepare on the same “version” of the database, are assigned the same Cmestamp. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | § Meanwhile, at the slave: § TransacCons with the same Cmestamp can be executed in parallel; § Concurrent transacCons commit independently, thus no waiCng involved.
  • 39. Higher Slave Throughput: Timestamp based MulC-­‐ threaded Applier Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | T1 T2 T3 Time Commit Prepare Concurrent ExecuBon History on the Master timestamp++ Execution Prepare Commit
  • 40. Higher Slave Throughput: Timestamp based MulC-­‐ threaded Applier Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | T1 T2 T3 Time Commit Prepare Concurrent ExecuBon History on the Master timestamp++ Execution Prepare Commit Parallel on the Slave. Not Executed in Parallel.
  • 41. Higher Slave Throughput: Timestamp based MulC-­‐ threaded Applier § Supports statement-­‐based or row-­‐based formats. § Scheduling policy controlled through: mysql> SET slave_parallel_type= [logical_clock|database] Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | § Logical_clock -­‐ means schedule based on the prepare Cmestamp § database -­‐ the scheduling policy from 5.6 (concurrency control done per database). § Work to improve slave scalability conCnues, does not stop here.
  • 42. Beder ReplicaCon Monitoring: P_S ReplicaCon Tables relay log Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Insert... Insert... B binary log Insert... Insert... A binary log Client Network Master info Relay Log Info Sender thread Receiver thread Applier Threads
  • 43. Beder ReplicaCon Monitoring: P_S ReplicaCon Tables n Access monitoring informaCon through an SQL interface. n Write stored funcCons or procedures with input from replicaCon internals. n Logically unrelated informaCon into different places. n Flexible and easier to extend and adapt as new feature get into the server. n More user friendly names idenCfying the monitoring fields. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
  • 44. Beder ReplicaCon Monitoring: P_S ReplicaCon Tables Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Connection Configuration Connection Status Execution Configuration Execution Status Slave Status Applier / Coordinator Status Workers Status
  • 45. Better, Flexible, Loss-less Semi-sync Replication relay log Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Insert... Insert... B binary log Insert... Insert... A binary log Client Network Master info Relay Log Info Sender thread Receiver thread Applier Threads
  • 46. Beder, Flexible, Loss-­‐less Semi-­‐sync ReplicaCon Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | § Master does not commit transacCon unCl it receives an ACK from the slave. § (as opposed to: Master does not release the session unCl it receives an ACK from the slave.) § Therefore, concurrent transacCons do not externalize changes while waiCng for ACK. § Should a master fail, then any transacCon that it may have externalized is also persisted on a slave. § User can choose between the original semisync behavior and the new one. mysql> SET rpl_semi_sync_master_wait_point= [AFTER_SYNC|AFTER_COMMIT]
  • 47. Beder, Flexible, Loss-­‐less Semi-­‐sync ReplicaCon § Master can wait for more than one slave. § Increases resiliency to consecuCve failures § Increases durability – transacCon is persisted in N places mysql> SET rpl_semi_sync_master_wait_slave_count= 1..1024 Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
  • 48. relay log Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Insert... Insert... B binary log Insert... Insert... A binary log Client Network Master info Relay Log Info Dynamic ReplicaCon Filters Sender thread Receiver thread Applier Threads
  • 49. Dynamic ReplicaCon Filters n Update filters without shu{ng down server instance. mysql> CHANGE REPLICATION FILTER REPLICATE_DO_DB=(db1); ERROR 1896 (HY000): This operation cannot be performed with a running slave sql thread; run STOP SLAVE SQL_THREAD first mysql> STOP SLAVE SQL_THREAD; Query OK, 0 rows affected (0.05 sec) mysql> CHANGE REPLICATION FILTER REPLICATE_DO_DB=(db1); Query OK, 0 rows affected (0.00 sec) mysql> START SLAVE SQL_THREAD; Query OK, 0 rows affected (0.05 sec) Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
  • 50. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | MySQL Labs
  • 51. Master N Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | MulC-­‐Source ReplicaCon § Consolidate updates from mulCple Masters into one Slave § Consolidated view of all shards § More flexible topologies § Centralized point for backups, easier reporCng § CompaCble with Semi-­‐Synchronous ReplicaCon & enhanced MTS § Master-­‐specific slave filters planned for GA § ApplicaCon must keep data sets disjoint between sources Master 1 Binlog Master 2 Binlog … … Binlog IO 1 Relay 1 Coordinator W1 W2 … WX IO 2 Relay 2 Coordinator W1 W2 … WX … … Coordinator W1 W2 … WX IO N Relay N Coordinator W1 W2 … WX Slave labs.mysql.com
  • 52. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | MulC-­‐Source ReplicaCon M M S Slave can have more than one master. Feature preview based on 5.7 is available on labs.mysql.com . M M The need for gathering data in a central server: n Integrated backup; n Complex queries for analyCcs purposes; n Data HUB for inter-­‐cluster replicaCon.