Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why...

93
Percona XtraDB Cluster powered by Galera Peter Zaitsev CEO, Percona Slide Credits: Vadim Tkachenko Percona University, Washington,DC Sep 12,2013

Transcript of Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why...

Page 1: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Percona XtraDB Cluster powered by Galera

Peter Zaitsev CEO, Percona

Slide Credits: Vadim Tkachenko Percona University,

Washington,DC Sep 12,2013

Page 2: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

This talk

High Availability

Replication

Cluster

Percona XtraDB Cluster

Page 3: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

What is HA

Availability

Avail ~ Ability

Ability to Avail

Percona XtraDB Cluster

Page 4: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Availability by redundancy

Percona XtraDB Cluster

Page 5: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Duplicate resources

Percona XtraDB Cluster

Page 6: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Failover

Percona XtraDB Cluster

Page 7: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Probability of failure

Single server: P

Two servers: P/2

X servers: P/X

Percona XtraDB Cluster

Page 8: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Probability of failure

1 2 3 4 5 6 7 8 9 10

Pro

bab

ilit

y o

f fa

ilu

re

N of servers

Percona XtraDB Cluster

Page 9: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Easy ?

Not if we deal with databases

Percona XtraDB Cluster

Page 10: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Database

Percona XtraDB Cluster

Page 11: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Redundancy ?

Percona XtraDB Cluster

Page 12: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Database availability is hard

Service availability

Data availability

Percona XtraDB Cluster

Page 13: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Replication

Percona XtraDB Cluster

Page 14: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Percona XtraDB Cluster

Page 15: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication
Page 16: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

What is wrong with MySQL replication ?

“a”

Percona XtraDB Cluster

Page 17: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

What is wrong with MySQL replication ?

“a” in async

Percona XtraDB Cluster

Page 18: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

What is wrong with MySQL replication ?

“async”

vs

“sync”

Percona XtraDB Cluster

Page 19: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Async

Percona XtraDB Cluster

Page 20: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Async

Percona XtraDB Cluster

Page 21: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

sync

Percona XtraDB Cluster

Page 22: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Didn’t we just reinvent

DRBD ?

Percona XtraDB Cluster

Page 23: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

DRBD

Percona XtraDB Cluster

Page 24: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Clustering

Percona XtraDB Cluster

Page 25: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Percona XtraDB Cluster

Free and Open Source

Percona XtraDB Cluster

Page 26: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Percona XtraDB Cluster

Percona XtraDB Cluster

Page 27: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Synchronous or Virtually

synchronous

http://en.wikipedia.org/wiki/Virtual_synchrony

Percona XtraDB Cluster

Page 28: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Virtually synchronous

Percona XtraDB Cluster

Page 29: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

synchronous replication

multi-master replication

parallel applying on

slaves

data consistency

automatic node

provisioning

Percona XtraDB Cluster

Page 30: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

synchronous replication

multi-master replication

parallel applying on

slaves

data consistency

automatic node

provisioning

Percona XtraDB Cluster

Page 31: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Multi-master: MySQL

Percona XtraDB Cluster

Page 32: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Multi-master: XtraDB Cluster

Percona XtraDB Cluster

Page 33: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

synchronous replication

multi-master replication

parallel applying on

slaves

data consistency

automatic node

provisioning

Percona XtraDB Cluster

Page 34: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Parallel apply: MySQL

Percona XtraDB Cluster

Page 35: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Parallel apply: XtraDB Cluster

Percona XtraDB Cluster

Page 36: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

synchronous replication

multi-master replication

parallel applying on

slaves

data consistency

automatic node

provisioning

Percona XtraDB Cluster

Page 37: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

XtraDB Cluster data consistency

Percona XtraDB Cluster

Page 38: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

synchronous replication

multi-master replication

parallel applying on

slaves

data consistency

automatic node

provisioning

Percona XtraDB Cluster

Page 39: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Node provisioning

Percona XtraDB Cluster

Page 40: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

CAP theorem

http://en.wikipedia.org/wiki/CAP_theorem

Percona XtraDB Cluster

Page 41: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Pick only TWO

Consistency Node

availability

Partition Tolerance

Percona XtraDB Cluster

Page 42: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Network failure

Percona XtraDB Cluster

Page 43: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

MySQL Replication

Percona XtraDB Cluster

Access to all systems -

YES

Data consistency -

NO

Page 44: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

XtraDB Cluster

Percona XtraDB Cluster

Access to all systems -

NO

Data consistency -

YES

Page 45: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

3 nodes is the minimal

recommended configuration

Percona XtraDB Cluster

Page 46: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Split brain

Percona XtraDB Cluster

Which system to make available

?

Page 47: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Split brain

Percona XtraDB Cluster

But you deal with consequences

You still can have this setup

Page 48: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Choice

Percona XtraDB Cluster

MySQL Replication:

Access to all systems

Data consistency

XtraDB Cluster:

Page 49: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

MySQL replication based

MMM

MHA

Flipper

PRM

Percona XtraDB Cluster

Page 50: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Percona XtraDB Cluster

details

Percona XtraDB Cluster

Page 51: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Percona

XtraDB Cluster

Percona Server

WSREP patches

Galera library

Percona XtraDB Cluster

Page 52: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Partnership

Percona

Codership

Percona XtraDB Cluster

Page 53: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Full compatibility with existing

systems

Percona XtraDB Cluster

Page 54: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Minimal efforts to migrate

Percona XtraDB Cluster

Page 55: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Minimal efforts to

return back to MySQL

Percona XtraDB Cluster

Page 56: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

So, is this a perfect solution?

Percona XtraDB Cluster

Page 57: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Limitations

Percona XtraDB Cluster

Page 58: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Only InnoDB tables are fully

supported

MyISAM support is limited

Percona XtraDB Cluster

Page 59: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

OPTIMISTIC locking for

transactions on different servers

http://en.wikipedia.org/wiki/Optimistic_concurrency_cont

rol

Percona XtraDB Cluster

Page 60: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Traditional locking

Percona XtraDB Cluster

Page 61: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Optimistic locking

Percona XtraDB Cluster

Page 62: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

The write performance is

limited by weakest node

Percona XtraDB Cluster

Page 63: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Write performance

Percona XtraDB Cluster

Page 64: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

For write intensive applications

there could be datasize limit per

node

Not physical but logical

Percona XtraDB Cluster

Page 65: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Join process. Step 1

Percona XtraDB Cluster

Page 66: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Join process. Step 2

Percona XtraDB Cluster

Page 67: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Join process: step 3

Percona XtraDB Cluster

Page 68: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

This is software + hardware

solution

Percona XtraDB Cluster

Page 69: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

InnoDB write performance

Percona XtraDB Cluster

Page 70: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

InnoDB performance + ACID

Percona XtraDB Cluster

Page 71: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Cluster performance

•10 GigE

•Infiniband Network

•SSD

•PCI-e Flash Storage

Percona XtraDB Cluster

Page 72: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Join process

Percona XtraDB Cluster

Page 73: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

State Transfer

Percona XtraDB Cluster

Full data SST

New node

Node long time

disconnected

Incremental IST

Node disconnected

short time

Page 74: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Snapshot State Transfer

Percona XtraDB Cluster

Mysqldump

Small databases

Rsync

Donor disconnected for copy time

faster

XtraBackup

Donor disconnected for short time

slower

Page 75: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Incremental State Transfer

Percona XtraDB Cluster

Node was in cluster

Disconnected for

maintenance

Node Crashed

Page 76: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Scaleability

Percona XtraDB Cluster

Page 77: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Scaleability

Scale ~ Ability

Ability to Scale

Percona XtraDB Cluster

Page 78: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Scaleability is similar to availability

Percona XtraDB Cluster

Page 79: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

XtraDB Cluster: Reads scalability is easy

Percona XtraDB Cluster

Page 80: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Write scalability is complicated

Percona XtraDB Cluster

Page 81: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

N servers scale to :

Percona XtraDB Cluster

•N factor 100% reads

•… …

•N/2 factor 50/50

•… …

•1 or const 100% writes

Page 82: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

10 servers scale to :

Percona XtraDB Cluster

• 1 server: 100 q/s

• 10 servers: 1000 q/s 100% reads

• 1 server: 100 q/s

• 10 servers: 500 q/s 50/50

• 1 server: 100 q/s

• 10 servers: 100 q/s (can be more)

100% writes

Page 83: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

FAQ

Questions I am asked

Percona XtraDB Cluster

Page 84: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

It looks so easy. Why did

not you implement it earlier?

It is not easy.

Computer science of group communication

and distributed transactions.

Credits to Codership Oy

Percona XtraDB Cluster

Page 85: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

How fast is it?

Reasonably fast.

Percona XtraDB Cluster

Page 86: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Can I replicate XtraDB

Cluster to MySQL

Replication?

Yes

Percona XtraDB Cluster

Page 87: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Percona XtraDB Cluster

Async MySQL Replication

Page 89: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

How it is compared to

MySQL Cluster?

It is different

Percona XtraDB Cluster

Page 90: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

XtraDB

Cluster

MySQL

Cluster

Easy to migrate Easy to use Cloud / EC2 Changes in an

application Write scaling 99.999%

Percona XtraDB Cluster

Page 92: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Credits

• WSREP patches and Galera library is developed by

Codership Oy

Percona XtraDB Cluster

Page 93: Percona XtraDB Cluster · FAQ Questions I am asked Percona XtraDB Cluster . It looks so easy. Why did not you implement it earlier? It is not easy. Computer science of group communication

Thank you!

Questions ?

You can try Percona XtraDB Cluster today!

Percona XtraDB Cluster