MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

19
© SkySQL Corporation Ab. Company Confidential. MaxScale – The Pluggable Router Serge Frezefond, Cloud Solution Architect, SkySQL

description

MaxScale - The Pluggable Router by Serge Frezefond. Presented 26.6.2014 at the MariaDB Roadshow in Paris, France.

Transcript of MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

Page 1: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© SkySQL Corporation Ab. Company Confidential.

MaxScale – The Pluggable RouterSerge Frezefond,

Cloud Solution Architect, SkySQL

Page 2: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© SkySQL Corporation Ab. Company Confidential.

MaxScale Objectives

• 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 3: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© SkySQL Corporation Ab. Company Confidential.

How? In a nut shell

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

10/06/2014

Client authenticates once - with MaxScale

Alter, block or log client requests and results

Content-aware or unaware routers

Configuration and state aware monitors

Allows multiple protocols for clients and servers

Page 4: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© MariaDB. Company Confidential.

Read Scalability with MySQL Replicationusing MaxScale’s Connection Load Balancing

ClientClient Client For applications that need read scalability and load balancing and can use separate connections for reads and writes.

Each client establishes one connection for writes and one for reads

Master Slave Slave

[write service]type=servicerouter=readconnrouterouter_options=masterservers=s1,s2,s3,..,sn

[read service]type=servicerouter=readconnrouterouter_options=slaveservers=s1,s2,s3,..,sn

Slave Slave...

Page 5: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© MariaDB. Company Confidential.

Consistent Read Scalability with Galerausing MaxScale’s Read/Write Split Router

ClientClient Client For applications that require read scalability with consistent reads and High Availability with fast failovers.

MaxScale selects one as a master and one or more cluster members to slave(s)

If node fails a new master can be chosen immediately.

Page 6: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© MariaDB. Company Confidential.

Query rewrite and filteringby using MaxScale’s filters

ClientClient ClientFor applications with multiple different backend databases. For database firewalling, etc.

CREATE TABLE SUPPLIER(ID INTEGER, NAME VARCHAR) TYPE=INNODB

[regex]type=filtermodule=regexfiltermatch=TYPEreplace=ENGINE

CREATE TABLE SUPPLIER(ID INTEGER, NAME VARCHAR) ENGINE=INNODB

Page 7: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© MariaDB. Company Confidential.

Query rewrite and filtering (cont.)by using MaxScale’s filters

ClientClient ClientFor sloppy administrators :-)

Select count(*) f0rm mysql.user

[regex]type=filtermodule=regexfiltermatch=[Ff][Oo0][Rr][Mm]replace=FROM

Select count(*) FROM mysql.user

Page 8: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© MariaDB. Company Confidential.

MaxScale 0.7

● 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 9: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© MariaDB. Company Confidential.

Basic Setup

● Clients access MaxScale● MaxScale in the app server,

UNIX sockets● Database servers accessed

via TCP

● Clients● Application Server

Database Cluster

Page 10: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© MariaDB. 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)

Page 11: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© MariaDB. Company Confidential.

Inside MaxScaleMySQL Local Authentication

Backends Clients

ok

“read user, host” connect/auth

Users are loaded at start

Page 12: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© MariaDB. Company Confidential.

Inside MaxScaleRead/write splitting

“call my_proc(1)”

Master

Slave

Query Classifier

Page 13: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© MariaDB. Company Confidential.

Inside MaxScale Routing

Page 14: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© MariaDB. Company Confidential.

Inside MaxScale Routing

Page 15: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© MariaDB. Company Confidential.

What’s new in R/W split router

● 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

Page 16: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© MariaDB. 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

Page 17: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© MariaDB. Company Confidential.

Extending with filters

● May be connected to form arbitrary chains ● Allows inspection, modification and rejection of requests and results

● blacklist● data mining / log

Page 18: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© MariaDB. Company Confidential.

Get involved

● 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 19: MaxScale - The Pluggibale Router MariaDB Roadshow 2014 Paris

© MariaDB. Company Confidential.

MaxScale - Thank you!