22
© SkySQL Corporation Ab. Company Confidential. MaxScale The Pluggable Router

MaxScale - The Pluggable Router

Embed Size (px)

DESCRIPTION

MaxScale - The Pluggable Router - by Vilho Raatikka, developer of MaxScale Presented 10.6.2014 at the MariaDB Roadshow in Helsinki, Finland.

Citation preview

Page 1: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

MaxScaleThe  Pluggable  Router

Page 2: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

The  Presenter:  Vilho  Raatikka

2

• MaxScale Developer • Read/write split router • Query classifier • Log manager • Concurrency control, availability,

error handling, build & test env !

• IBM solidDB 2004-2013 • In-Memory Engine • High Availability Controller !

• M.Sc., University of Helsinki • Researcher • Teaching assistant

Page 3: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

MaxScale  Objectives

3

• Highly  scalable    

• Transparent  to  the  application  

• Highly  available  

• Extendible  

• Flexible  

• Modules  specify  what  MaxScale  is  :  router  /  firewall  /  data  extract  tool  /…  

• Open  source,  GPL2  software  since  8th  of  Jan.  2014

Page 4: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

How?  In  a  nutshell  

4

Allows  mulVple  protocols  for  clients  and  servers

Alter,  block  or  log  client  requests  and  results

ConfiguraVon  and  state  aware  monitors

Content-­‐aware  or  unaware  routers

Client  authenVcates  once  -­‐  with  MaxScale

Core of MaxScale is multi-threaded, event-driven network IO processor

Page 5: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

Read  Scalability  with  MySQL  

5

Using MaxScale’s Connection Load Balancing

Page 6: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

Consistent  Read  Scalability  with  Galera

6

using MaxScale’s Read/Write Split Router

Page 7: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

Query  rewrite  and  filtering

7

By using MaxScale’s filters

Page 8: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

Query  rewrite  and  filtering  (cont.)

8

By using MaxScale’s filters

Page 9: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

MaxScale  0.7

9

• Galera  Support  ‣ Read/Write  Split  router  for  Galera  Cluster  

• Multiple  slaves  support  ‣ Read/Write  Split  router  allows  multiple  slave  connections  and  balancing  load  between  them  

• Debug  Interface  enhancements  ‣ Support  for  wide  variety  of  MaxScale  objects  which  can  be  referenced  by  their  names  instead  of  memory  addresses  ‣ User  mode  to  prevent  access  by  using  memory  addresses  

• Maintenance  mode  for  servers  

• Configurable  monitoring  interval  

• Replication  Lag  Heartbeat  Monitor  

• Filters  API  

• MariaDB  10  Replication  support  in  MySQL  monitor  

Release  notes:  https://github.com/skysql/MaxScale/blob/release-­‐0.7/Documentation/Debug%20And%20Diagnostic%20Support.pdf

Page 10: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

Basic  Setup  

• Clients  access  MaxScale  

• MaxScale  in  the  app  server,  UNIX  sockets  

• Database  servers  accessed  via  TCP

10

DatabaseDatabase

Database Database Database

MaxScale

• Clients • Application Servers

Database Cluster

Page 11: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

Typical  Scenarios  

• MySQL  Replication  with  

‣ Read  connection  load  balancing  ‣ Read/Write  statement  splitting  

• Galera  Cluster  

‣ Connection  load  balancing  ‣ Read/Write  statement  splitting  ‣Write  conflict  avoidance  (planned)

11

DatabaseDatabase

Database Database Database

MaxScale

Page 12: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

Inside  MaxScale  MySQL  Local  Authentication  

12

“read user, host”connect/auth

Users  are  loaded  at  start

Backends

ok

Clients

Page 13: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential. 13

“call my_proc(1)”

Inside  MaxScale  Read/Write  Splitting  

Master

Slaves

!Call  parser  and  examine  

parse  treeQuery Classifier

Page 14: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

Inside  MaxScale  Routing

14

SQL

MySQL packets

TCP packets

MySQL MySQL

MySQL

Client

Router

MySQL client

Core

Auhenication Query classifier

Monitor

MySQL backend

Page 15: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

Inside  MaxScale  Routing

15

SQL

MySQL packets

TCP packets

MySQL MySQL

MySQL

Client

Router

MySQL client

Core

Auhenication Query classifier

Monitor

MySQL backend

Page 16: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

What's  new  in  R/W  split  router

16

• Session  Commands  ‣ Local  variables,  User  change,  SET  auto  commit  

‣ Execute  in  master  &  slave  but  maintain  

execution  order  

‣ Current  limitation  :  queries  not  supported  in  

session  commands  

        SET  @a=(SELECT  COUNT(*)  FROM  mysql.user)  is  executed  in  both  nodes.  

• Galera  H/A  Support  

• Fault  Tolerance  

• Replication  consistency  

• Transaction  support  ‣ Within  active  transaction  everything  is  routed  to  

master  

‣ Detection  of  implicit  BEGIN  and  ROLLBACK/

COMMIT  

M

S

Page 17: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

What’s  coming•  Filters  

•  Routing  hints  

•Multiple  Slave  Support  

•Weight  based  routing  

•  Backend  failure  tolerance  

•  Enforce  Node  Replication  consistency  for  MariaDB  10  &  MySQL  5.6

17

Page 18: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

Extending  with  filters  

18

Filter

Router

MaxScale

Router

Filter

Auth Protoco

l

Mon

itorFilter

Router

Mon

itor

©  SkySQL  Ab  2014  

Protoco

l

Protoco

lProtocol

INSERT INTO DWH.T1 (....)

Log Entry

• May  be  connected  to  form  arbitrary  chains    

• Allows  inspection,  modification  and  rejection  of  requests  and  results  

‣ blacklist  

‣ data  mining  /  log

Routing Hint

Page 19: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

Get  involved

19

• Check on GitHub https://github.com/skysql/MaxScale

• MariaDB Source https://downloads.mariadb.org/

• Bugs report http://bugs.skysql.com/buglist.cgi?product=Maxscale

• Google groups https://groups.google.com/forum/#!forum/maxscale

• Binary Tarball http://downloads.skysql.com/files/SkySQL/MaxScale

• SkySQL website http://www.skysql.com

Page 20: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

Demo  scenarios

20

DatabaseDatabase

Database Database Database

MaxScale‣1  Master  

‣4  Slaves

Page 21: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential.

Demo  scenarios

21

Database Database Database

MaxScale‣3  Galera  servers

Page 22: MaxScale - The Pluggable Router

©  SkySQL  Corporation  Ab.  Company  Confidential. 22

Thank you !

MaxScale