Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim...

102
Introduction into Percona XtraDB Cluster Vadim Tkachenko Percona Inc, co-founder, CTO www.percona.com www.MySQLPerformanceBlog.com

Transcript of Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim...

Page 1: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Introduction into Percona XtraDB Cluster

Vadim Tkachenko Percona Inc, co-founder, CTO

www.percona.com www.MySQLPerformanceBlog.com

Page 2: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

This talk online

• PowerPoint • http://bit.ly/PXC-cloud-2013

• PDF • http://bit.ly/PXC-cloud-2013-pdf

• Contacts • [email protected] • Twitter @VadimTk

Percona XtraDB Cluster

Page 3: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

This talk

High Availability

Replication

Cluster

Percona XtraDB Cluster

Page 4: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

What is HA

Availability

Avail ~ Ability

Ability to Avail

Percona XtraDB Cluster

Page 5: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Availability by redundancy

Percona XtraDB Cluster

Page 6: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Duplicate resources

Percona XtraDB Cluster

Page 7: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Failover

Percona XtraDB Cluster

Page 8: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Probability of failure

Single server: P

Two servers: P/2

X servers: P/X

Percona XtraDB Cluster

Page 9: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Probability of failure

1 2 3 4 5 6 7 8 9 10

Pro

babi

lity

of fa

ilure

N of servers

Percona XtraDB Cluster

Page 10: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Easy ? Not if we deal with databases

Percona XtraDB Cluster

Page 11: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Database

Percona XtraDB Cluster

Page 12: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Redundancy ?

Percona XtraDB Cluster

Page 13: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Database availability is hard

Service availability

Data availability

Percona XtraDB Cluster

Page 14: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Replication

Percona XtraDB Cluster

Page 15: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Percona XtraDB Cluster

Page 16: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack
Page 17: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

What is wrong with MySQL replication ?

async

Percona XtraDB Cluster

Page 18: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

What is wrong with MySQL replication ?

“async”

vs

“sync”

Percona XtraDB Cluster

Page 19: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Async

Percona XtraDB Cluster

Page 20: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Async

Percona XtraDB Cluster

Page 21: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

sync

Percona XtraDB Cluster

Page 22: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Didn’t we just reinvent DRBD ?

Percona XtraDB Cluster

Page 23: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

DRBD

Percona XtraDB Cluster

Page 24: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Clustering

Percona XtraDB Cluster

Page 25: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Percona XtraDB Cluster Free and Open Source

Percona XtraDB Cluster

Page 26: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Percona XtraDB Cluster

Percona XtraDB Cluster

Page 27: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

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

Percona XtraDB Cluster

Page 28: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Virtually synchronous

Percona XtraDB Cluster

Page 29: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

synchronous replication

multi-master replication

parallel applying on

slaves

data consistency

automatic node

provisioning

Percona XtraDB Cluster

Page 30: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

synchronous replication

multi-master replication

parallel applying on

slaves

data consistency

automatic node

provisioning

Percona XtraDB Cluster

Page 31: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Multi-master: MySQL

Percona XtraDB Cluster

Page 32: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Multi-master: XtraDB Cluster

Percona XtraDB Cluster

Page 33: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

synchronous replication

multi-master replication

parallel applying on

slaves

data consistency

automatic node

provisioning

Percona XtraDB Cluster

Page 34: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Parallel apply: MySQL

Percona XtraDB Cluster

Page 35: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Parallel apply: XtraDB Cluster

Percona XtraDB Cluster

Page 36: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

synchronous replication

multi-master replication

parallel applying on

slaves

data consistency

automatic node

provisioning

Percona XtraDB Cluster

Page 37: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

XtraDB Cluster data consistency

Percona XtraDB Cluster

Page 38: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

synchronous replication

multi-master replication

parallel applying on

slaves

data consistency

automatic node

provisioning

Percona XtraDB Cluster

Page 39: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Node provisioning

Percona XtraDB Cluster

Page 40: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

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

Percona XtraDB Cluster

Page 41: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Pick only TWO

Consistency Node availability

Partition Tolerance

Percona XtraDB Cluster

Page 42: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Network failure

Percona XtraDB Cluster

Page 43: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

MySQL Replication

Percona XtraDB Cluster

Access to all systems - YES

Data consistency - NO

Page 44: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

XtraDB Cluster

Percona XtraDB Cluster

Access to all systems - NO

Data consistency - YES

Page 45: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

3 nodes is the minimal recommended configuration

Percona XtraDB Cluster

Page 46: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Split brain

Percona XtraDB Cluster

Which system to make available ?

Page 47: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Split brain

Percona XtraDB Cluster

But you deal with consequences You still can have this setup

Page 48: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Choice

Percona XtraDB Cluster

MySQL Replication: Access to all systems

Data consistency XtraDB Cluster:

Page 49: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

MySQL replication based

MMM

MHA

Flipper

PRM

Percona XtraDB Cluster

Page 50: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Percona XtraDB Cluster details

Percona XtraDB Cluster

Page 51: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Percona XtraDB Cluster

Percona Server

WSREP patches

Galera library

Percona XtraDB Cluster

Page 52: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Full compatibility with existing

systems

Percona XtraDB Cluster

Page 53: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Minimal efforts to migrate

Percona XtraDB Cluster

Page 54: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Minimal efforts to return back

to MySQL

Percona XtraDB Cluster

Page 55: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

So, is this a perfect solution?

Percona XtraDB Cluster

Page 56: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Limitations

Percona XtraDB Cluster

Page 57: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Only InnoDB tables are fully supported MyISAM support is very basic

Percona XtraDB Cluster

Page 58: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

OPTIMISTIC locking for transactions on different servers http://en.wikipedia.org/wiki/Optimistic_concurrency_control

Percona XtraDB Cluster

Page 59: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Traditional locking

Percona XtraDB Cluster

Page 60: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Optimistic locking

Percona XtraDB Cluster

Page 61: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

The write performance is limited by weakest node

Percona XtraDB Cluster

Page 62: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Write performance

Percona XtraDB Cluster

Page 63: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

For write intensive applications there could be datasize limit per node Not physical but logical

Percona XtraDB Cluster

Page 64: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Join process. Step 1

Percona XtraDB Cluster

Page 65: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Join process. Step 2

Percona XtraDB Cluster

Page 66: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Join process: step 3

Percona XtraDB Cluster

Page 67: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

This is software + hardware solution

Percona XtraDB Cluster

Page 68: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

InnoDB write performance

Percona XtraDB Cluster

Page 69: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

InnoDB performance + ACID

Percona XtraDB Cluster

Page 70: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Cluster performance

• 10 GigE • Infiniband

Network

• SSD • PCI-e Flash

Storage

Percona XtraDB Cluster

Page 71: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Join process

Percona XtraDB Cluster

Page 72: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

State Transfer

Percona XtraDB Cluster

Full data SST

New node

Node long time

disconnected

Incremental IST

Node disconnected short time

Page 73: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Snapshot State Transfer

Percona XtraDB Cluster

Mysqldump

Small databases

Rsync

Donor disconnected for copy time

faster

XtraBackup

Donor disconnected for short time

slower

Page 74: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Incremental State Transfer

Percona XtraDB Cluster

Node was in cluster

Disconnected for

maintenance

Node Crashed

Page 75: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Scaleability

Percona XtraDB Cluster

Page 76: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Scaleability

Scale ~ Ability

Ability to Scale

Percona XtraDB Cluster

Page 77: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Scaleability is similar to availability

Percona XtraDB Cluster

Page 78: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

XtraDB Cluster: Reads scalability is easy

Percona XtraDB Cluster

Page 79: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Write scalability is complicated

Percona XtraDB Cluster

Page 80: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

N servers scale to :

Percona XtraDB Cluster

• N factor 100% reads

• … …

• N/2 factor 50/50

• … …

• 1 or const 100% writes

Page 81: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

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 82: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Load Balancing HAProxy

Percona XtraDB Cluster

Page 83: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

HAProxy on application side

Percona XtraDB Cluster

Credits for the picture: taken from Patrick Galbraith http://capttofu.livejournal.com/29380.html

Page 84: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Deployment in WAN Quite possible http://www.mysqlperformanceblog.com/2012/01/11/making-the-impossible-3-nodes-intercontinental-replication/

Percona XtraDB Cluster

Page 85: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Beware of latencies • Within EUROPE EC2

•  INSERT INTO table :  0.005100 sec

•  EUROPE <-> Japan EC2 •  INSERT INTO table :   0.275642 sec

Percona XtraDB Cluster

Page 86: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

On bright side •  Throughput is less affected

•  Communication is done in parallel

• Combine short query into transactions •  BEGIN <- fast •  INSERT <- fast •  INSERT <- fast •  UPDATE <- fast •  … •  COMMIT; <- slow

Percona XtraDB Cluster

Page 87: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Use cases

Percona XtraDB Cluster

Page 88: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

DNSaaS application MySQL HA solution with Percona XtraDB Cluster (Galera) http://capttofu.livejournal.com/29380.html CloudDNS from HP cloud is to use XtraDB cluster as a backend

Percona XtraDB Cluster

Page 89: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

HA for OpenStack http://thoughtsoncloud.com/index.php/2013/04/high-availability-in-the-cloud-an-openstack-approach/ XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Percona XtraDB Cluster

Page 90: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

FAQ Questions I am asked

Percona XtraDB Cluster

Page 91: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

• What happens if one node temporary unreachable ? • How ALTER tables are handled • What happens if someone runs update of 1000000 rows ? •  Show numbers on latency and throughput • How connect node to a cluster ? Just show an example • How cluster decides what nodes to keep in cluster and what to

throw away • Can I select a specific node as DONOR •  Load balancing ? • XtraBackup SST – locking for short period • How auto_increment is handled ? • What is use case for XtraDB Cluster ?

Percona XtraDB Cluster

Page 92: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

How fast is it? Reasonably fast.

Percona XtraDB Cluster

Page 93: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

2-nodes overhead ~20%

Percona XtraDB Cluster

Page 94: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Can I replicate XtraDB Cluster to MySQL Replication? Yes

Percona XtraDB Cluster

Page 95: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Production system? gutefrage.net Germany’s No. 3 Web Destination  http://www.percona.com/about-us/pressreleases/gutefragenet-standardizes-percona-xtradb-cluster 95% reads

Percona XtraDB Cluster

Page 96: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

How it is compared to MySQL Cluster? It is different

Percona XtraDB Cluster

Page 97: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

XtraDB Cluster

MySQL Cluster

Easy to migrate Easy to use Cloud / EC2 Changes in an application Write scaling 99.999%

Percona XtraDB Cluster

Page 98: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

More questions

• What happens if one node temporary unreachable ? • How ALTER tables are handled • What happens if someone runs update of 1000000 rows ? • How cluster decides what nodes to keep in cluster and what to

throw away • Can I select a specific node as DONOR •  Load balancing ? • How auto_increment is handled ?

Percona XtraDB Cluster

Page 99: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Resources •  http://www.percona.com/software/percona-xtradb-cluster/ •  http://www.codership.com/wiki/doku.php •  Virtual synchrony

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

• CAP Theorem •  http://en.wikipedia.org/wiki/CAP_theorem

• Optimistic locking •  http://en.wikipedia.org/wiki/Optimistic_concurrency_control

•  Percona XtraDB Cluster with HAProxy •  http://www.mysqlperformanceblog.com/2012/06/20/percona-xtradb-

cluster-reference-architecture-with-haproxy/

Percona XtraDB Cluster

Page 100: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Credits • WSREP patches and Galera library is developed by Codership

Oy

•  Both Percona and Codership will present on Percona Live MySQL Conference and Expo, Apr 22-25

Percona XtraDB Cluster

Page 101: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

This talk online

• PowerPoint • http://bit.ly/PXC-cloud-2013

• PDF • http://bit.ly/PXC-cloud-2013-pdf

• Contacts • [email protected] • Twitter @VadimTk

Percona XtraDB Cluster

Page 102: Introduction into Percona XtraDB Cluster · Introduction into Percona XtraDB Cluster Vadim Tkachenko ... XtraDB Cluster/Galera is a good fit for HA of database components of OpenStack

Thank you!

Questions ?

You can try Percona XtraDB Cluster today!

Percona XtraDB Cluster