©	
  SkySQL	
  Corporation	
  Ab.	
  Company	
  Confidential.
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
©	
  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
©	
  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
©	
  SkySQL	
  Corporation	
  Ab.	
  Company	
  Confidential.
Read	
  Scalability	
  with	
  MySQL	
  
5
Using MaxScale’s Connection Load Balancing
©	
  SkySQL	
  Corporation	
  Ab.	
  Company	
  Confidential.
Consistent	
  Read	
  Scalability	
  with	
  Galera
6
using MaxScale’s Read/Write Split Router
©	
  SkySQL	
  Corporation	
  Ab.	
  Company	
  Confidential.
Query	
  rewrite	
  and	
  filtering
7
By using MaxScale’s filters
©	
  SkySQL	
  Corporation	
  Ab.	
  Company	
  Confidential.
Query	
  rewrite	
  and	
  filtering	
  (cont.)
8
By using MaxScale’s filters
©	
  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
©	
  SkySQL	
  Corporation	
  Ab.	
  Company	
  Confidential.
Basic	
  Setup	
  
• Clients	
  access	
  MaxScale	
  
• MaxScale	
  in	
  the	
  app	
  server,	
  UNIX	
  sockets	
  
• Database	
  servers	
  accessed	
  via	
  TCP
10
Database
Database
Database Database Database
MaxScale
• Clients	

• Application Servers
Database Cluster
©	
  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
Database
Database
Database Database Database
MaxScale
©	
  SkySQL	
  Corporation	
  Ab.	
  Company	
  Confidential.
Inside	
  MaxScale	
  
MySQL	
  Local	
  Authentication	
  
12
“read user, host”
connect/auth
Users	
  are	
  loaded	
  at	
  start
Backends
ok
Clients
©	
  SkySQL	
  Corporation	
  Ab.	
  Company	
  Confidential. 13
“call my_proc(1)”
Inside	
  MaxScale	
  
Read/Write	
  Splitting	
  
Master
Slaves
!
Call	
  parser	
  and	
  examine	
  
parse	
  treeQuery
Classifier
©	
  SkySQL	
  Corporation	
  Ab.	
  Company	
  Confidential.
Inside	
  MaxScale	
  Routing
14
SQL
MySQL packets
TCP packets
MySQL
MySQL
MySQL
Client
Router
MySQL client
Core
AuhenicationQuery
classifier
Monitor
MySQL
backend
©	
  SkySQL	
  Corporation	
  Ab.	
  Company	
  Confidential.
Inside	
  MaxScale	
  Routing
15
SQL
MySQL packets
TCP packets
MySQL
MySQL
MySQL
Client
Router
MySQL client
Core
AuhenicationQuery
classifier
Monitor
MySQL
backend
©	
  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
©	
  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
©	
  SkySQL	
  Corporation	
  Ab.	
  Company	
  Confidential.
Extending	
  with	
  filters	
  
18
Filter
Router
MaxScale
Router
Filter
Auth
Protocol
Monitor
Filter
Router
Monitor
©	
  SkySQL	
  Ab	
  2014	
  
Protocol
ProtocolProtocol
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
©	
  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
©	
  SkySQL	
  Corporation	
  Ab.	
  Company	
  Confidential.
Demo	
  scenarios
20
Database
Database
Database Database Database
MaxScale
‣1	
  Master	
  
‣4	
  Slaves
©	
  SkySQL	
  Corporation	
  Ab.	
  Company	
  Confidential.
Demo	
  scenarios
21
Database Database Database
MaxScale
‣3	
  Galera	
  servers
©	
  SkySQL	
  Corporation	
  Ab.	
  Company	
  Confidential. 22
Thank you !
MaxScale

MaxScale - The Pluggable Router

  • 1.
    ©  SkySQL  Corporation  Ab.  Company  Confidential. MaxScale The  Pluggable  Router
  • 2.
    ©  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
  • 3.
    ©  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
  • 4.
    ©  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
  • 5.
    ©  SkySQL  Corporation  Ab.  Company  Confidential. Read  Scalability  with  MySQL   5 Using MaxScale’s Connection Load Balancing
  • 6.
    ©  SkySQL  Corporation  Ab.  Company  Confidential. Consistent  Read  Scalability  with  Galera 6 using MaxScale’s Read/Write Split Router
  • 7.
    ©  SkySQL  Corporation  Ab.  Company  Confidential. Query  rewrite  and  filtering 7 By using MaxScale’s filters
  • 8.
    ©  SkySQL  Corporation  Ab.  Company  Confidential. Query  rewrite  and  filtering  (cont.) 8 By using MaxScale’s filters
  • 9.
    ©  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
  • 10.
    ©  SkySQL  Corporation  Ab.  Company  Confidential. Basic  Setup   • Clients  access  MaxScale   • MaxScale  in  the  app  server,  UNIX  sockets   • Database  servers  accessed  via  TCP 10 Database Database Database Database Database MaxScale • Clients • Application Servers Database Cluster
  • 11.
    ©  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 Database Database Database Database Database MaxScale
  • 12.
    ©  SkySQL  Corporation  Ab.  Company  Confidential. Inside  MaxScale   MySQL  Local  Authentication   12 “read user, host” connect/auth Users  are  loaded  at  start Backends ok Clients
  • 13.
    ©  SkySQL  Corporation  Ab.  Company  Confidential. 13 “call my_proc(1)” Inside  MaxScale   Read/Write  Splitting   Master Slaves ! Call  parser  and  examine   parse  treeQuery Classifier
  • 14.
    ©  SkySQL  Corporation  Ab.  Company  Confidential. Inside  MaxScale  Routing 14 SQL MySQL packets TCP packets MySQL MySQL MySQL Client Router MySQL client Core AuhenicationQuery classifier Monitor MySQL backend
  • 15.
    ©  SkySQL  Corporation  Ab.  Company  Confidential. Inside  MaxScale  Routing 15 SQL MySQL packets TCP packets MySQL MySQL MySQL Client Router MySQL client Core AuhenicationQuery classifier Monitor MySQL backend
  • 16.
    ©  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
  • 17.
    ©  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
  • 18.
    ©  SkySQL  Corporation  Ab.  Company  Confidential. Extending  with  filters   18 Filter Router MaxScale Router Filter Auth Protocol Monitor Filter Router Monitor ©  SkySQL  Ab  2014   Protocol ProtocolProtocol 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
  • 19.
    ©  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
  • 20.
    ©  SkySQL  Corporation  Ab.  Company  Confidential. Demo  scenarios 20 Database Database Database Database Database MaxScale ‣1  Master   ‣4  Slaves
  • 21.
    ©  SkySQL  Corporation  Ab.  Company  Confidential. Demo  scenarios 21 Database Database Database MaxScale ‣3  Galera  servers
  • 22.
    ©  SkySQL  Corporation  Ab.  Company  Confidential. 22 Thank you ! MaxScale