MySQL load balancers becomes a trend setters in Market for High availability and scalability. What can be the best load balancer ? It varies from case to case. This presentation was made at Mydbops meetup on 04-08-2018 covers the basics of load balancers with their advantages and disadvantages.
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
MySQL Load balancer and its solution
1. MySQL Load Balancers And It’s Solutions
Mydbops Database Meetup - Aug 2018
Presented by
Vinoth Kanna RS
www.mydbops.com info@mydbops.com
2. About Mydbops
● Founded in 2015, HQ in Bangalore India with 150+ customer base across the globe.
● Mydbops is on Database Consulting with core specialization on MySQL and MongoDB Administration and
Support.
● We have expert team with 20+ certified DBA’s providing full time support and currently managing 300+
servers.
● Mydbops was created with a motto of developing a DevOPS model for Database administration offering
24*7 expert remote DBA support.
● We help organisations to architect and scale systems in MySQL/MongoDB by implementing the advanced
technologies in industry which are completely open source.
3. Mydbops is into MySQL/MongoDB Support and Consulting. It is founded by experts
who have scaled database at Yahoo! ,Percona and Datavail. We are providing an
expert level support and 24*7 monitoring for MySQL databases and its related
technologies like MariaDB , Percona ( also clustering ) . We support modern
database technologies in MySQL which includes Galera ( Clustering ), Group
Replication , SQL aware Load balancers like Maxscale / ProxySQL.
About Mydbops
4. Agenda
● Common MySQL Deployments
● Load balancer Goals
● Maxscale
○ Implementation
○ Applications
● MySQL Router
○ Routing
○ Applications
● ProxySQL
○ Features
○ Monitoring
○ Applications
● References
5. About Mydbops
● Founded in 2015, HQ in Bangalore India with 150+ customer base across the globe.
● Mydbops is on Database Consulting with core specialization on MySQL and MongoDB Administration and
Support.
● We have expert team with 20+ certified DBA’s providing full time support and currently managing 300+
servers.
● Mydbops was created with a motto of developing a DevOPS model for Database administration offering
24*7 expert remote DBA support.
● We help organisations to architect and scale systems in MySQL/MongoDB by implementing the advanced
technologies in industry which are completely open source.
6. About Mydbops
● Founded in 2015, HQ in Bangalore India with 150+ customer base across the globe.
● Mydbops is on Database Consulting with core specialization on MySQL and MongoDB Administration and
Support.
● We have expert team with 20+ certified DBA’s providing full time support and currently managing 300+
servers.
● Mydbops was created with a motto of developing a DevOPS model for Database administration offering
24*7 expert remote DBA support.
● We help organisations to architect and scale systems in MySQL/MongoDB by implementing the advanced
technologies in industry which are completely open source.
7. Common MySQL Deployments
Deployment Models:
● Native MySQL Replication
● Group Replication / InnoDB Cluster
● Galera Replication / MariaDB Cluster / PXC
Traffic Routing:
● No balancing, All requests to Master
● Pointing applications to various nodes
○ Master for read write apps / api’s
○ Own set of slaves for read only apps / api’s
● Haproxy
8. Load balancer Goals
● Simple proxy layer to connect database pools
● Share the traffic across the available pool of servers
● Flexible routing algorithms
● Handle availability, In case of node failures
● Ability to understand, Monitor various MySQL deployment models
● Transparency in routing
● Ability to Gather metrics, Statistics from the proxy layer
10. Maxscale
● Maxscale is an intelligent load balancer from MariaDB
● Started as a Open Source project, later adopted BSL
● Current version is 2.2.12
● Under BSL, Maximum usage of 3 nodes only allowed for free
Release License Tentative GPL Adoption
v1.4.* GPL -
v2.0.* BSL 1, BSL 1.1 2019-01-01
v2.1.* BSL 1.1 2019-07-01
v2.2.* BSL 1.1 2020-01-01
11. Maxscale - Implementation
● Maxscale has a modular implementation, For simplicity it classified into 3 categories
○ Monitors
○ Filters
○ Routers
● Monitor: [State Detection]
○ MySQL Replication
○ Galera
○ NDB Cluster
○ Aurora
12. Maxscale - Implementation
● Filter: [Transform, Log, Route]
○ Database firewall filter - Can be used to whitelist, Blacklist
○ Query log filter - Used to log queries based
○ Tee filter - Used to mirror the traffic
○ Top filter - Used to profile the queries
● Routers: [Perform Routing]
○ readconnroute - Simply balanced connections across servers
○ readwritesplit - Direct writes to Master, Balance reads across servers
○ schemarouter - Route connections based on DB name across servers
○ binlogrouter - Copies Binlog from master, Allows slaves to replicate from it
13. Maxscale - Applications
Perfect Fit
● Out of box, ReadWrite spliting
● Perfect solution to be used with 3 node
Galera cluster
● Binlog server is one of the most used
feature in Maxscale
● v1.4.5 is still a good choice
● Maxscale is BSL, Is it best to adopt ?
Missing Features
● Group replication, InnoDB Cluster support
● Reconfiguration is not completely online
● User based sharding not possible
● Cannot connect to admin interface
remotely
● Query statistics are not as rich as
ProxySQL
● Not completely Open Source, Not suitable
for rapidly evolving environment
14. MySQL Router
● Successor of MySQL Proxy
● Current GA release is 8.0.12
● First GA release 2.0.2, focussed to simplify accessing MySQL Fabric
○ It’s caches Topology or Shard information by connecting the Fabric node
○ Routes traffic to designated Shard
○ Deprecated, Last release is 2.0.4
● Release 2.1.3, came as a part of InnoDB cluster, can be deployed through MySQL Shell
○ Added features, Bootstrapping (Auto Config) through mysql_innodb_cluster_metadata
○ Concurrent connection limit increased from 500 to 5000
○ Supports Single primary / Multi primary modes
15. MySQL Router - Routing
● Router requires to have two endpoints / ports configured one for read and another for
read-write, If we need to balance reads across secondaries and writes only to primary.
● It’s difficult for application that don’t have read-write split in application
● Release 2.*
Modes: read-write, read-only
(During bootstrap, routing depends on variable group_replication_single_primary_mode)
ON OFF
read-write primary round-robin
read-only round-robin not configured
16. MySQL Router - Routing
● Release 8.0.*
○ Release named after MySQL 8
○ Modes is renamed as Routing Strategy, Is now configurable
■ first-available
■ next-available
■ round-robin
■ round-robin-with-fallback
○ Bootstrapping is improved
17. MySQL Router - Applications
Perfect Fit
● InnoDB cluster
● Applications with Read / Write
segregation
Missing Features
● Support for replication
● Routing statistics
● Transparency / Missing admin interface
● Run time changes not possible
● Missing out possibilities of being a SQL
Aware proxy
18. ProxySQL
● Lightweight and powerful load balancer
● Current GA is v1.4.9
● Project started by René Cannaò, Open source
● v1.4.9 features cluster support. Now proxy is never a SPOF
● Native support for replication
● Following technologies through external scripts / schedulers
○ Galera replication (available on proxysql-tools repo)
○ Group replication
○ NDB cluster
● Most of the config changes are dynamic (Uses SQLite as Persistent Store For Config)
19. ProxySQL - Features
● TTL based query caching
● User, fingerprint, regex based query routing
● Fingerprint / regex based query rewrite
● Regex based query blocking
● Request mirroring is possible
● Sharding based on Schema, User, Queries possible
● Query digest profiles for all the queries are maintained
● Response time of call types are recorded
● Provides extensive stats to troubleshoot and configure efficiently
● PMM provides ProxySQL exporters and Dashboard to visualize stats
● Zero downtime failover, maintenance plans can be achieved by proper configuration
22. ProxySQL - Applications
Perfect Fit
● Large scale deployments
● Galera cluster
● Envs where query change is not possible
● Cache MySQL results efficiently
● Require little effort to integrate auto
reconfiguration of master slave members
during failover
● Reconfiguration can be automated by
using hook scripts with MHA, Orchestrator
Missing Features
● Auto discovery of topology
● Real time query classifier