• Like
  • Save

MaxScale - The Pluggable Router

  • 370 views
Uploaded on

MaxScale - The Pluggable Router by Anders Karlsson, SkySQL …

MaxScale - The Pluggable Router by Anders Karlsson, SkySQL

Presented 24.6.2014 at the MariaDB Roadshow in Maarssen, The Netherlands.

More in: Software
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
370
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
1
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. © SkySQL Corporation Ab. Company Confidential. MaxScale – The Pluggable Router Anders Karlsson Senior Sales Engineer, SkySQL
  • 2. © SkySQL Corporation Ab. Company Confidential. Agenda • What is MaxScale and why do we need it? • MaxScale Design • MaxScale modules • MaxScale use cases • Demo
  • 3. © SkySQL Corporation Ab. Company Confidential. Scaling beyond a single server • Scaling with a single server is expensive • A single large server is more expensive than many small ones • A single large server is more vulnerable than many small ones • Scaling across many small servers can be difficult though • A Load Balancer works but doesn’t know about MariaDB/MySQL traffic
  • 4. © SkySQL Corporation Ab. Company Confidential. Why do we need MaxScale • We need something better and different than just a Load Balancer • We need something that knows about MariaDB traffic • We need something fast and flexible, yet lightweight
  • 5. © SkySQL Corporation Ab. Company Confidential. We need a scale out server • A server that scales out the load to other servers • A server that is transparent to applications and servers • A server that can parse SQL requests and act accordingly depending on the content
  • 6. © SkySQL Corporation Ab. Company Confidential. MaxScale Objectives •Highly scalable •Transparent to the application •Highly available •Extendible •Flexible •Modules define MaxScale functionality •Open source, GPL2 software since 8th of Jan. 2014
  • 7. © SkySQL Corporation Ab. Company Confidential. Implementation details • Mostly written in C (with a little C++) (thank you!) • Multi-threaded • epoll() based mechanism • Dynamic configuration and reconfiguration supported • State of servers determined dynamically • Multiple setup in allowed in a single MaxScale setup
  • 8. © SkySQL Corporation Ab. Company Confidential. MaxScale modules 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
  • 9. © SkySQL Corporation Ab. Company Confidential. Protocol modules • Implements a protocol that can access MaxScale • MySQL / MariaDB Client and server supported • http and telnet for monitoring, configuration and debugging
  • 10. © SkySQL Corporation Ab. Company Confidential. Authentication modules • Authenticates clients • Based on data from connected servers • MaxScale does not in and of itself have an authentication / user database, this is picked up from connected servers
  • 11. © SkySQL Corporation Ab. Company Confidential. Monitor modules • Monitors the state of connected servers • Used to provide information for routing modules • Currently monitors MySQL / MariaDB and Galera Clusters
  • 12. © SkySQL Corporation Ab. Company Confidential. Router modules • Router traffic from clients to servers, using a specified rule • Two router modules are currently available • Connection routing • Read / Write split • This is the most important type of module
  • 13. © SkySQL Corporation Ab. Company Confidential. Filter modules • Optional type of module • Allows filtering and processing of SQL statements and results • Simple regex filter available with MaxScale 0.7 • Queries may be inspected, modified or rejected • Multiple filters may be chained
  • 14. © MariaDB. Company Confidential. Read Scalability with MySQL Replication using MaxScale 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=service router=readconnroute router_options=master servers=s1,s2,s3,..,sn [read service] type=service router=readconnroute router_options=slave servers=s1,s2,s3,..,sn Slave Slave ...
  • 15. © MariaDB. Company Confidential. Consistent Read Scalability with Galera using 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.
  • 16. © MariaDB. Company Confidential. Query rewrite and filtering by using MaxScale’s filters ClientClient Client For applications with multiple different backend databases. For database firewalling, etc. CREATE TABLE SUPPLIER(ID INTEGER, NAME VARCHAR) TYPE=INNODB [regex] type=filter module=regexfilter match=TYPE replace=ENGINE CREATE TABLE SUPPLIER(ID INTEGER, NAME VARCHAR) ENGINE=INNODB
  • 17. © MariaDB. Company Confidential. Query rewrite and filtering (cont.) by using MaxScale’s filters ClientClient Client For sloppy administrators :-) Select count(*) f0rm mysql.user [regex] type=filter module=regexfilter match=[Ff][Oo0][Rr][Mm] replace=FROM Select count(*) FROM mysql.user
  • 18. © 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
  • 19. © 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)
  • 20. © MariaDB. Company Confidential. Inside MaxScale MySQL Local Authentication Backends Clients ok “read user, host” connect/auth Users are loaded at start
  • 21. © MariaDB. Company Confidential. Inside MaxScale Read/write splitting “call my_proc(1)” Master Slave Query Classifier
  • 22. © MariaDB. Company Confidential. Inside MaxScale Routing
  • 23. © MariaDB. Company Confidential. Inside MaxScale Routing
  • 24. © 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
  • 25. © 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 ●Debug Interface enhancements ○Support for wide variety of MaxScale objects ○User mode support
  • 26. © MariaDB. Company Confidential. MaxScale 0.7 ●Maintenance mode for servers ●Configurable monitoring interval ●Replication Lag Heartbeat Monitor ●Filter Modules support ●MariaDB 10 Replication support
  • 27. © MariaDB. Company Confidential. Demo scenarios ● 1 Master ● 2 Slaves
  • 28. © 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
  • 29. © MariaDB. Company Confidential. MaxScale - Thank you!