SlideShare una empresa de Scribd logo
1 de 57
Descargar para leer sin conexión
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Building Scalable High
Availability Systems
using MySQL Fabric
Mats Kindahl
Senior Principal Software Developer
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is
intended for information purposes only, and may not be incorporated
into any contract. It is not a commitment to deliver any material, code,
or functionality, and should not be relied upon in making purchasing
decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole
discretion of Oracle.
2015-10-28
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Session Outline
Introduction to MySQL Fabric1
2
3
4
5
Elements of Scalable High-Availability Systems
Building a High Availability System
Scaling High Availability Systems
Closing Remarks & Thoughts for the Future
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Introduction to MySQL Fabric
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
What is MySQL Fabric?
An extensible and easy-to-
use framework for managing
a farm of MySQL servers
supporting high-availability
and sharding
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2014-10-02
What does all that mean?
●
Management System
– Manages a MySQL Farm
– Distributed Framework
●
Framework
– Resilient executor
– State store
– Transaction routing
●
Extensible
– High-availability
– “Semi-automatic” sharding
●
Written in Python
●
Open Source
– You can participate
– Suggest features
– Report bugs
– Contribute patches
●
MySQL 5.6 is focus
– For now
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2014-10-02
MySQL Fabric: Goals & Features
●
Decision logic in connector
– Eliminates network hop
– Reduce network load
– Eliminate single point of failure
– Scale naturally: not a bottleneck
●
Connector API extensions
– Support transactions
– Support full SQL
●
MySQL Router
– Support for legacy connectors
●
Load balancing
– Read-write split
– Weighted round-robin
●
Cloud integration
– Support elasticity
– Servers on-demand
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2014-10-02
MySQL Fabric: Goals & Features
●
Multi-table sharding
– Co-locate related rows
●
Sharding functions
– Range
– (Consistent) hash
●
Shard operations
– Shard move and split
●
Global updates
– Global tables
– Schema updates
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
MySQL Fabric 1.6 (alpha): What is new
●
MySQL Router (2.0 GA)
– Distributed separately
– Support for legacy connectors
– Connection-based routing
– Connection fail-over support
– Connection load balancing
●
Multi-node Fabric Control
– Geographical Redundancy
– Resilient Execution
– Load distribution
●
Improved Password
Management
– Management passwords in state
store
– Management passwords encrypted
using AES
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Birds-eye View
MySQL
Fabric Node
Application
Operator
High-Availability Groups
(Shards)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2014-10-02
High-Level Components
●
Connecting to the Farm
– Enhanced Connector API
– MySQL Router
●
MySQL Fabric Node
– Manage information about farm
– Provide status information
– Execute procedures
●
MySQL Servers
– Organized in high-availability
groups
– Handling application data
High Availability
Group
Application
Connector
Connector
Connector
MySQL
Fabric
Node
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
MySQL Fabric Node Architecture
MySQL
MySQL Fabric
Framework
Executor State Store
(Persister)
Sh
?HA
MySQL-RPC XML-RPC
Connector
Connector
Connector
Protocols
Extensions
Backing
Store
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2014-10-02
MySQL Router
●
Plugin-based architecture
– Harness with general functionality
●
Connection-based Routing
– Connection-based routing plugin
– Routing decision on connecting
– Raw packet copy: very fast
●
Fabric Info Plugin
– Meta-data Cache
– Use Fabric node to get meta-data
Fabric Info Module
Cache MySQL
MySQL Router
MySQL
Fabric
Routing Module
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Elements of Scalable
High-Availability Systems
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2014-10-02
High-Availability Concepts
●
Redundancy
– Duplicate components
●
Monitoring
– Detecting failing components
– Monitor load
●
Procedures
– Activate replacements
– Distribute load
– Decommission components
– Deploy new components
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Database Scalability Concepts
●
Scalability and Elasticity
– The ability of being able to adapt to changes in load of the system
●
Scaling Reads
– Being able to cope with an increasing read load
●
Scaling Writes
– Being able to cope with an increasing write load
●
Scaling Storage
– Being able to cope with an increasing database size
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
“[Elasticity] is defined as the
degree to which a system is
able to adapt to workload
changes by provisioning and
deprovisioning resources in an
autonomic manner”
What is Elasticity?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Database Read Scalability
●
Coping with increased read traffic
– Typical use-case for many web application
– Usually multiple tiers: web caches and read servers
●
Adding result set caches
– Can offload database server for repeated queries
– Queries have to be identical
– Cannot handle complex queries
●
Adding read servers
– Replicate from primary server to dedicated read servers
– Can handle complex queries
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Database Write Scalability
●
Coping with increased write traffic
– Typical use-case for many large-scale monitoring applications
●
Monitoring database servers
●
Data collection systems
●
Buying better machines
– Straightforward solution
– Cost?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Database Storage Scalability
●
Coping with increased amount of data
– Large-scale monitoring applications
●
Monitoring network
– Business Analysis Systems
●
Collecting and analyzing click-streams
●
Sharding the data
– Database need to be sharded into independent partitions
– Application need to be tailored to sharded data
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Building a High Availability System
A case study
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2014-10-02
Basic system without redundancy
●
Application on the Web
– Deployed on separate hardware
– Connector built into application
– Connections opened for each
request
●
Database Backend
– Store data from many applications
●
High Availability?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2014-10-02
Basic system without redundancy
●
No High Availability
– No redundancy
– No monitoring
– No way to activate replacement
●
What can you do?
– Add redundancy
– Add monitoring
– Add activation of replacement
!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2014-10-02
Basic system with redundancy
●
Server Redundancy
– Keep a secondary around
– Replicate from primary
●
MySQL Router
– Deployed as intermediate
– Monitor servers
– Re-direct connections on primary
failure
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Router Configuration for Static Failover
●
Section header
– Name + Key
●
Bind port
– Port number to listen on
– Connections from localhost only by
default
[routing:failover]
bind_port = 13306
destinations = srv1.example.com,srv2.example.com
mode = read-write
● Destinations
– Servers to open connections to
● Mode
– Read-write queries on the
connection
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2014-10-02
Basic system with redundancy
●
Server crashes
– Replication stops
●
Notices server is gone
– Router notices server disappears
– Server is put in quarantine
●
Find alternative server
– Router picks new server from static
list of candidates
!
?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2014-10-02
Basic system with redundancy
●
Activate replacement
– New connections are sent to
secondary
– Existing connections will time out
?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Basic system with redundancy
●
Server Restored
– The primary is restored into working state
– Replication is set up again
●
Server unquarantined
– Router notices server is available again
– Server is unquarantined
– New connections go to primary
– Old connections still go to secondary
●
Closed once the request is finished
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Using Fabric for Server Management
●
Fabric Control Node
– Provide Information about farm to router
– Monitor servers
– Execute procedures
– Add and remove servers
●
High Availability Group
– Collection of servers
– All servers in group have same data
Fabric
Node
High Availability Group
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Router Configuration with Fabric
● Fabric cache
– Address of Fabric node
[fabric_cache:my_cache]
address = fabric.example.com:32275
[routing:failover]
bind_port = 13306
destinations = fabric+cache://my_cache/group/my_group
mode = read-write
● Destinations
– Reference to Fabric cache instead
of servers.
– Fabric cache is authority in the
URL
– Groups under group key
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Using Fabric for Server Management
●
Initially
– Secondaries have @@READ_ONLY = 1
– Primary has @@READ_ONLY = 0
●
Primary is lost
●
Fabric node notices
– Built-in Failure Detector
!
?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Using Fabric for Server Management
●
Fabric node perform fail-over
– Secondary is selected as new primary
– Other secondaries are changed to replicated from
new primary
– @@READ_ONLY = 0 on new primary
– Router informed of change
●
Router change primary
– New connections go to new primary
– Old connections error out
?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Using Fabric for Server Management
●
Availability
– Router caches information
– Service not interrupted on Fabric node failure
– Note: Failovers not done while Fabric node is
down
●
Meta Data Durability
– Information stored in database backend
– Fabric node just have to be restarted
●
For example, using init.d script
Fabric
Node
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Geographical Redundancy
●
Multiple data centers
– One Fabric node in each
●
Meta data locality
– Node in data center to provide meta-data
●
Resilient execution
– Long-running procedures are not
interrupted
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Geographical Redundancy
●
Fabric Control Cluster
– Multiple Fabric control nodes
– One active node (leader), others passive
– Passive nodes can be used as read replicas
– … but also act as standby
●
Elastic Control Cluster
– Adding or removing nodes on demand
– Added nodes automatically brought up to date
when joining
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Geographical Redundancy
●
Fabric Control Cluster Leader
– There is one leader in the cluster
– The leader can change
●
Leader dies
●
Leader is explicitly changed
– Commands changing meta data have to be
executed on leader
●
Internal Forwarding
– Commands that change meta-data are
automatically forwarded to leader
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Scaling High Availability Systems
A case study
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Scaling Reads
● When to scale for reads
– Read-heavy workloads
– Most web applications
● Result set caching
– If queries are identical
– Done at application layer
– Not covered in this presentation
● Read servers
– For more complex queries
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Scaling Reads
●
Adding read servers to group
– Servers added as spares
– Fabric monitor spares as well
●
Setup router
– Add a read-only query port to router
– Distribute load in round-robin fashion
●
Split traffic
– Updates sent to update port
– Queries sent to query port
Fabric
Node
Queries
Updates
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Router Configuration for Static Load Balancing
● Section header
– Name + Key
● Bind port
– Port number to listen on
– Connections from localhost only by
default
[routing:load_balancing]
bind_port = 13307
destinations = slave1.example.com,slave2.example.com
mode = read-only
● Destinations
– Servers to open connections to
● Mode
– Read-only queries on the
connection
– … can be load balanced
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Scaling Writes
●
Write-heavy workloads
– Data collection networks
– Large-scale monitoring applications
●
Workload Type
– Large number of updates
– Each update change few rows
●
Replication does not help
– Writes are replicated as well
!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Scaling Writes
●
“Sharding” database
– Horizontal partitioning of rows in tables
– Each shard updated independently of others
●
“Sharding” write stream
– Write stream partitioned by key
– Write streams are independent
1000-1999
1-999
2000-2999
3000-3999
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2014-10-02
Scaling Storage
●
Data-intensive applications
– Data collection networks
– Business analysis applications
●
On-Line Analytical Processing
(OLAP) of large data sets
●
Just too much data
– Indexes too large
– Backup time excessive
– Analysis prohibitive
●
“Sharding” the data
– Horizontal partitioning of database
based on sharding key
– Same solution as for scaling writes
●
Analytic Queries
– Parallelization possible
– Inter-shard queries?
– Cross-shard queries?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2014-10-02
Elasticity
●
Scale hardware on demand
– Automatically adapting to changes
in workload
– Useful for changes in read load,
write load, and storage
requirements
– Require monitoring the load of the
system
●
Read load change
– Adapt number of read slaves to
read load
●
Write load change
– Adapt number of shards to
incoming write traffic
●
Storage requirement
change
– Adapt number of shards to storage
requirements
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Scaling through Sharding in Fabric
●
Use Fabric-aware connectors
– … or doing key mapping in application
– Sending transactions to correct shard
– Key need to be given explicitly
●
Provided together with the query
●
Dispatching Analytical Queries
– Done at application level
– Fetch shard information from Fabric
●
Using XML-RPC or MySQL-RPC interface
– Dispatch queries to the shards
– Collect and merge the results
MySQL
Fabric
ServerApplication
High-Availability Groups
(Shards)
Global Group
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Scaling through Sharding in Fabric
●
Schema designed for sharding
– Sharding key need to be picked carefully
●
Sharded Tables
– Application-level “objects” usually spread
over several tables
– Rows for one “object” need to be co-
located on same shard
●
Global Tables
– Tables present on all shards
– Replicated to all shards using the Global
Group
MySQL
Fabric
ServerApplication
High-Availability Groups
(Shards)
Global Group
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
employee
emp_id INT
birth_date DATE
first_name VARCHAR(14)
last_name VARCHAR(16)
gender ENUM('M','F')
hire_date DATE
titles
emp_no INT
title VARCHAR(50)
from_date DATE
to_date DATE
salaries
emp_no INT
salary INT
from_date DATE
to_date DATE
departments
dept_no CHAR(4)
dept_name VARCHAR(40)
dept_emp
emp_no INT
dept_no CHAR(4)
from_date DATE
to_date DATE
dept_manager
dept_no CHAR(4)
emp_no INT
from_date DATE
to_date DATE
Table Rows
salaries 284 404 700
titles 44 330 800
employees 30 002 400
dept_emp 33 160 300
dept_manager 2 400
departments 900
In desperate need
of sharding!
Foreign keySchema for sharding
Global Table (replicated on all shards)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
● OpenStack Controller Node
– Manages Identities
– Manages Images
– Manages Block Storage
● OpenStack Compute Node
– (Virtual) machine host
– Contain hypervisor
– Spawn and destroy virtual
machines
Controller
Compute
(VM Host)
Elasticity through Virtualization
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2014-10-02
MySQL Fabric and OpenStack
MySQL Fabric Node
OpenStack Instance
Application
High-Availability Groups / Shards
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Closing remarks
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Where are we now?
●
High Availability Features
– Slave promotion
– Multi-node Fabric Control Cluster
– Failure detectors
●
Failure detection
– Built-in Failure Detector
– Failure reporting
– Custom failure detectors
●
Connector APIs
– Transaction properties
– “Virtual” connections
– Legacy connector support
●
Using router
●
Interfaces
– Command-line
– XML-RPC
– MySQL-RPC
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Where are we now?
●
Execution
– Node failure stop execution
●
Execution restart on recovery
– Replicated State Machine (RSM)
– Fail-over execution
●
Security
– RFC 2617 for HTTP
authentication
– SSL support over XML-RPC
– Secure Password Management
●
Cloud integration
– “Server providers”
– OpenStack Nova
●
Sharding
– Range and hash sharding
– Shard move and split
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Thoughts for the Future
●
Custom Procedures
– Better support for custom
procedures
– Easy way to write high availability
procedures
●
Cloud support
– OpenStack Trove
– Amazon AWS
– Amazon RDS
●
Frameworks
– Django?
– Symphony?
●
More Fabric-aware
connectors
– C/C++?
●
Improved provisioning
– Using on-line backup?
– Using filesystem snapshots?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Thoughts for the Future
●
Integration Router-Fabric
– Better integration of Router and
Fabric
– Failure reporting in Router
– Multi-node Fabric Support in
Router
●
Integration with Group
Replication
– Router to balance write load
●
Enterprise Monitoring
– Monitor farm status
– Monitor Fabric nodes
●
Dynamic Router Configuration
– On-line configuration changes
●
Transaction Multiplexing
– Allow several incoming clients to use a
single connection to the server
– Transactions are interleaved
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Thoughts for the Future
●
Router Monitoring
– Statistics collection
– Monitoring interfaces
●
Query Consolidation
– Consolidate result sets from
identical queries “in flight”
●
Router Logging
– Logging plugin interface
– Sending logs to different sinks
●
Result set caching
– Allow router to cache result sets
– Transparent to application
●
Session consistency
– We have a distributed database
– It should look like a single database
– Read monotonicity
– Write monotonicity
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
2015-10-28
Thoughts for the Future
●
Automatic sharding
– Single-query transactions?
– Speculative execution?
– Cross-shard queries?
●
Shard aggregation
– Cross-shard queries
●
Connection-based Sharding
– Sharding OLTP workload in router
– Assign shard key range to router port
– Router send session to shard based on
port
●
Multi-way shard split
– Efficient initial sharding
– Better use of resources
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The preceding is intended to outline our general product direction. It is
intended for information purposes only, and may not be incorporated
into any contract. It is not a commitment to deliver any material, code,
or functionality, and should not be relied upon in making purchasing
decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole
discretion of Oracle.
2015-10-28

Más contenido relacionado

La actualidad más candente

Mysql User Camp : 20-June-14 : Mysql Fabric
Mysql User Camp : 20-June-14 : Mysql FabricMysql User Camp : 20-June-14 : Mysql Fabric
Mysql User Camp : 20-June-14 : Mysql Fabric
Mysql User Camp
 
Methods of Sharding MySQL
Methods of Sharding MySQLMethods of Sharding MySQL
Methods of Sharding MySQL
Laine Campbell
 
Mysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesMysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New Features
Tarique Saleem
 

La actualidad más candente (20)

Mysql User Camp : 20-June-14 : Mysql Fabric
Mysql User Camp : 20-June-14 : Mysql FabricMysql User Camp : 20-June-14 : Mysql Fabric
Mysql User Camp : 20-June-14 : Mysql Fabric
 
Why MySQL High Availability Matters
Why MySQL High Availability MattersWhy MySQL High Availability Matters
Why MySQL High Availability Matters
 
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQLMySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
 
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB ClusterMySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
 
MySQL Cluster Basics
MySQL Cluster BasicsMySQL Cluster Basics
MySQL Cluster Basics
 
Conference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance TuningConference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance Tuning
 
MySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB Cluster
 
Methods of Sharding MySQL
Methods of Sharding MySQLMethods of Sharding MySQL
Methods of Sharding MySQL
 
MySQL for Software-as-a-Service (SaaS)
MySQL for Software-as-a-Service (SaaS)MySQL for Software-as-a-Service (SaaS)
MySQL for Software-as-a-Service (SaaS)
 
MySQL Operator for Kubernetes
MySQL Operator for KubernetesMySQL Operator for Kubernetes
MySQL Operator for Kubernetes
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQL
 
MySQL Cluster Scaling to a Billion Queries
MySQL Cluster Scaling to a Billion QueriesMySQL Cluster Scaling to a Billion Queries
MySQL Cluster Scaling to a Billion Queries
 
Mysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesMysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New Features
 
MySQL 5.7 InnoDB Cluster (Jan 2018)
MySQL 5.7 InnoDB Cluster (Jan 2018)MySQL 5.7 InnoDB Cluster (Jan 2018)
MySQL 5.7 InnoDB Cluster (Jan 2018)
 
MySQL HA
MySQL HAMySQL HA
MySQL HA
 
MySQL 5.7: What's New, Nov. 2015
MySQL 5.7: What's New, Nov. 2015MySQL 5.7: What's New, Nov. 2015
MySQL 5.7: What's New, Nov. 2015
 
MySQL Replication Performance Tuning for Fun and Profit!
MySQL Replication Performance Tuning for Fun and Profit!MySQL Replication Performance Tuning for Fun and Profit!
MySQL Replication Performance Tuning for Fun and Profit!
 
Mysql cluster introduction
Mysql cluster introductionMysql cluster introduction
Mysql cluster introduction
 
MySQL 5.7 Replication News
MySQL 5.7 Replication News MySQL 5.7 Replication News
MySQL 5.7 Replication News
 
MySQL Cluster performance best practices
MySQL Cluster performance best practicesMySQL Cluster performance best practices
MySQL Cluster performance best practices
 

Destacado

Ora mysql bothGetting the best of both worlds with Oracle 11g and MySQL Enter...
Ora mysql bothGetting the best of both worlds with Oracle 11g and MySQL Enter...Ora mysql bothGetting the best of both worlds with Oracle 11g and MySQL Enter...
Ora mysql bothGetting the best of both worlds with Oracle 11g and MySQL Enter...
Ivan Zoratti
 

Destacado (20)

Laravel 5 and SOLID
Laravel 5 and SOLIDLaravel 5 and SOLID
Laravel 5 and SOLID
 
Strip your TEXT fields
Strip your TEXT fieldsStrip your TEXT fields
Strip your TEXT fields
 
Exploring MongoDB & Elasticsearch: Better Together
Exploring MongoDB & Elasticsearch: Better TogetherExploring MongoDB & Elasticsearch: Better Together
Exploring MongoDB & Elasticsearch: Better Together
 
MySQL Sharding: Tools and Best Practices for Horizontal Scaling
MySQL Sharding: Tools and Best Practices for Horizontal ScalingMySQL Sharding: Tools and Best Practices for Horizontal Scaling
MySQL Sharding: Tools and Best Practices for Horizontal Scaling
 
Coding like a girl - DjangoCon
Coding like a girl - DjangoConCoding like a girl - DjangoCon
Coding like a girl - DjangoCon
 
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
 
Sharding using MySQL and PHP
Sharding using MySQL and PHPSharding using MySQL and PHP
Sharding using MySQL and PHP
 
[스마트스터디]MongoDB 의 역습
[스마트스터디]MongoDB 의 역습[스마트스터디]MongoDB 의 역습
[스마트스터디]MongoDB 의 역습
 
Strip your TEXT fields - Exeter Web Feb/2016
Strip your TEXT fields - Exeter Web Feb/2016Strip your TEXT fields - Exeter Web Feb/2016
Strip your TEXT fields - Exeter Web Feb/2016
 
Mongodb
MongodbMongodb
Mongodb
 
LaravelSP - MySQL 5.7: introdução ao JSON Data Type
LaravelSP - MySQL 5.7: introdução ao JSON Data TypeLaravelSP - MySQL 5.7: introdução ao JSON Data Type
LaravelSP - MySQL 5.7: introdução ao JSON Data Type
 
MySQL 5.7 - 
Tirando o Máximo Proveito
MySQL 5.7 - 
Tirando o Máximo ProveitoMySQL 5.7 - 
Tirando o Máximo Proveito
MySQL 5.7 - 
Tirando o Máximo Proveito
 
LAMP: Desenvolvendo além do trivial
LAMP: Desenvolvendo além do trivialLAMP: Desenvolvendo além do trivial
LAMP: Desenvolvendo além do trivial
 
SunshinePHP 2017 - Making the most out of MySQL
SunshinePHP 2017 - Making the most out of MySQLSunshinePHP 2017 - Making the most out of MySQL
SunshinePHP 2017 - Making the most out of MySQL
 
MEAN Stack
MEAN StackMEAN Stack
MEAN Stack
 
MySQL Enterprise Cloud
MySQL Enterprise Cloud MySQL Enterprise Cloud
MySQL Enterprise Cloud
 
Ora mysql bothGetting the best of both worlds with Oracle 11g and MySQL Enter...
Ora mysql bothGetting the best of both worlds with Oracle 11g and MySQL Enter...Ora mysql bothGetting the best of both worlds with Oracle 11g and MySQL Enter...
Ora mysql bothGetting the best of both worlds with Oracle 11g and MySQL Enter...
 
The MySQL Server Ecosystem in 2016
The MySQL Server Ecosystem in 2016The MySQL Server Ecosystem in 2016
The MySQL Server Ecosystem in 2016
 
20171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v120171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v1
 
MySQL Cluster Whats New
MySQL Cluster Whats NewMySQL Cluster Whats New
MySQL Cluster Whats New
 

Similar a Building Scalable High Availability Systems using MySQL Fabric

01 demystifying mysq-lfororacledbaanddeveloperv1
01 demystifying mysq-lfororacledbaanddeveloperv101 demystifying mysq-lfororacledbaanddeveloperv1
01 demystifying mysq-lfororacledbaanddeveloperv1
Ivan Ma
 

Similar a Building Scalable High Availability Systems using MySQL Fabric (20)

MySQL London Tech Tour March 2015 - MySQL Fabric
MySQL London Tech Tour March 2015 - MySQL FabricMySQL London Tech Tour March 2015 - MySQL Fabric
MySQL London Tech Tour March 2015 - MySQL Fabric
 
Netherlands Tech Tour 02 - MySQL Fabric
Netherlands Tech Tour 02 -   MySQL FabricNetherlands Tech Tour 02 -   MySQL Fabric
Netherlands Tech Tour 02 - MySQL Fabric
 
My sql fabric webinar v1.1
My sql fabric webinar v1.1My sql fabric webinar v1.1
My sql fabric webinar v1.1
 
MySQL & Oracle Linux Keynote at Open Source India 2014
MySQL & Oracle Linux Keynote at Open Source India 2014MySQL & Oracle Linux Keynote at Open Source India 2014
MySQL & Oracle Linux Keynote at Open Source India 2014
 
MySQL Fabric - High Availability & Automated Sharding for MySQL
MySQL Fabric - High Availability & Automated Sharding for MySQLMySQL Fabric - High Availability & Automated Sharding for MySQL
MySQL Fabric - High Availability & Automated Sharding for MySQL
 
MySQL Fabric
MySQL FabricMySQL Fabric
MySQL Fabric
 
20140722 Taiwan MySQL User Group Meeting Tech Updates
20140722 Taiwan MySQL User Group Meeting Tech Updates20140722 Taiwan MySQL User Group Meeting Tech Updates
20140722 Taiwan MySQL User Group Meeting Tech Updates
 
MySQL Enterprise Portfolio
MySQL Enterprise PortfolioMySQL Enterprise Portfolio
MySQL Enterprise Portfolio
 
MySQL High Availability - Managing Farms of Distributed Servers
MySQL High Availability - Managing Farms of Distributed ServersMySQL High Availability - Managing Farms of Distributed Servers
MySQL High Availability - Managing Farms of Distributed Servers
 
Oracle Enterprise Manager for MySQL
Oracle Enterprise Manager for MySQLOracle Enterprise Manager for MySQL
Oracle Enterprise Manager for MySQL
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
MySQL Cluster - Latest Developments (up to and including MySQL Cluster 7.4)
MySQL Cluster - Latest Developments (up to and including MySQL Cluster 7.4)MySQL Cluster - Latest Developments (up to and including MySQL Cluster 7.4)
MySQL Cluster - Latest Developments (up to and including MySQL Cluster 7.4)
 
MySQL Web Reference Architecture
MySQL Web Reference Architecture MySQL Web Reference Architecture
MySQL Web Reference Architecture
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
MySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disksMySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disks
 
Basic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAsBasic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAs
 
2_MySQL_Cluster_Introduction.pdf
2_MySQL_Cluster_Introduction.pdf2_MySQL_Cluster_Introduction.pdf
2_MySQL_Cluster_Introduction.pdf
 
01 demystifying mysq-lfororacledbaanddeveloperv1
01 demystifying mysq-lfororacledbaanddeveloperv101 demystifying mysq-lfororacledbaanddeveloperv1
01 demystifying mysq-lfororacledbaanddeveloperv1
 
200 million qps on commodity hardware : Getting started with MySQL Cluster 7.4
200 million qps on commodity hardware : Getting started with MySQL Cluster 7.4200 million qps on commodity hardware : Getting started with MySQL Cluster 7.4
200 million qps on commodity hardware : Getting started with MySQL Cluster 7.4
 
OUG Scotland 2014 - NoSQL and MySQL - The best of both worlds
OUG Scotland 2014 - NoSQL and MySQL - The best of both worldsOUG Scotland 2014 - NoSQL and MySQL - The best of both worlds
OUG Scotland 2014 - NoSQL and MySQL - The best of both worlds
 

Más de Mats Kindahl

Más de Mats Kindahl (7)

Why rust?
Why rust?Why rust?
Why rust?
 
MySQL Applier for Apache Hadoop: Real-Time Event Streaming to HDFS
MySQL Applier for Apache Hadoop: Real-Time Event Streaming to HDFSMySQL Applier for Apache Hadoop: Real-Time Event Streaming to HDFS
MySQL Applier for Apache Hadoop: Real-Time Event Streaming to HDFS
 
Replication Tips & Trick for SMUG
Replication Tips & Trick for SMUGReplication Tips & Trick for SMUG
Replication Tips & Trick for SMUG
 
Replication Tips & Tricks
Replication Tips & TricksReplication Tips & Tricks
Replication Tips & Tricks
 
MySQL Binary Log API Presentation - OSCON 2011
MySQL Binary Log API Presentation - OSCON 2011MySQL Binary Log API Presentation - OSCON 2011
MySQL Binary Log API Presentation - OSCON 2011
 
Python Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL DatabasesPython Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL Databases
 
Mysteries of the binary log
Mysteries of the binary logMysteries of the binary log
Mysteries of the binary log
 

Último

Último (20)

Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Building Scalable High Availability Systems using MySQL Fabric

  • 1. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Building Scalable High Availability Systems using MySQL Fabric Mats Kindahl Senior Principal Software Developer Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
  • 2. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2015-10-28
  • 3. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Session Outline Introduction to MySQL Fabric1 2 3 4 5 Elements of Scalable High-Availability Systems Building a High Availability System Scaling High Availability Systems Closing Remarks & Thoughts for the Future
  • 4. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Introduction to MySQL Fabric
  • 5. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 What is MySQL Fabric? An extensible and easy-to- use framework for managing a farm of MySQL servers supporting high-availability and sharding
  • 6. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2014-10-02 What does all that mean? ● Management System – Manages a MySQL Farm – Distributed Framework ● Framework – Resilient executor – State store – Transaction routing ● Extensible – High-availability – “Semi-automatic” sharding ● Written in Python ● Open Source – You can participate – Suggest features – Report bugs – Contribute patches ● MySQL 5.6 is focus – For now
  • 7. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2014-10-02 MySQL Fabric: Goals & Features ● Decision logic in connector – Eliminates network hop – Reduce network load – Eliminate single point of failure – Scale naturally: not a bottleneck ● Connector API extensions – Support transactions – Support full SQL ● MySQL Router – Support for legacy connectors ● Load balancing – Read-write split – Weighted round-robin ● Cloud integration – Support elasticity – Servers on-demand
  • 8. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2014-10-02 MySQL Fabric: Goals & Features ● Multi-table sharding – Co-locate related rows ● Sharding functions – Range – (Consistent) hash ● Shard operations – Shard move and split ● Global updates – Global tables – Schema updates
  • 9. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 MySQL Fabric 1.6 (alpha): What is new ● MySQL Router (2.0 GA) – Distributed separately – Support for legacy connectors – Connection-based routing – Connection fail-over support – Connection load balancing ● Multi-node Fabric Control – Geographical Redundancy – Resilient Execution – Load distribution ● Improved Password Management – Management passwords in state store – Management passwords encrypted using AES
  • 10. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Birds-eye View MySQL Fabric Node Application Operator High-Availability Groups (Shards)
  • 11. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2014-10-02 High-Level Components ● Connecting to the Farm – Enhanced Connector API – MySQL Router ● MySQL Fabric Node – Manage information about farm – Provide status information – Execute procedures ● MySQL Servers – Organized in high-availability groups – Handling application data High Availability Group Application Connector Connector Connector MySQL Fabric Node
  • 12. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 MySQL Fabric Node Architecture MySQL MySQL Fabric Framework Executor State Store (Persister) Sh ?HA MySQL-RPC XML-RPC Connector Connector Connector Protocols Extensions Backing Store
  • 13. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2014-10-02 MySQL Router ● Plugin-based architecture – Harness with general functionality ● Connection-based Routing – Connection-based routing plugin – Routing decision on connecting – Raw packet copy: very fast ● Fabric Info Plugin – Meta-data Cache – Use Fabric node to get meta-data Fabric Info Module Cache MySQL MySQL Router MySQL Fabric Routing Module
  • 14. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Elements of Scalable High-Availability Systems
  • 15. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2014-10-02 High-Availability Concepts ● Redundancy – Duplicate components ● Monitoring – Detecting failing components – Monitor load ● Procedures – Activate replacements – Distribute load – Decommission components – Deploy new components
  • 16. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Database Scalability Concepts ● Scalability and Elasticity – The ability of being able to adapt to changes in load of the system ● Scaling Reads – Being able to cope with an increasing read load ● Scaling Writes – Being able to cope with an increasing write load ● Scaling Storage – Being able to cope with an increasing database size
  • 17. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 “[Elasticity] is defined as the degree to which a system is able to adapt to workload changes by provisioning and deprovisioning resources in an autonomic manner” What is Elasticity?
  • 18. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Database Read Scalability ● Coping with increased read traffic – Typical use-case for many web application – Usually multiple tiers: web caches and read servers ● Adding result set caches – Can offload database server for repeated queries – Queries have to be identical – Cannot handle complex queries ● Adding read servers – Replicate from primary server to dedicated read servers – Can handle complex queries
  • 19. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Database Write Scalability ● Coping with increased write traffic – Typical use-case for many large-scale monitoring applications ● Monitoring database servers ● Data collection systems ● Buying better machines – Straightforward solution – Cost?
  • 20. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Database Storage Scalability ● Coping with increased amount of data – Large-scale monitoring applications ● Monitoring network – Business Analysis Systems ● Collecting and analyzing click-streams ● Sharding the data – Database need to be sharded into independent partitions – Application need to be tailored to sharded data
  • 21. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Building a High Availability System A case study
  • 22. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2014-10-02 Basic system without redundancy ● Application on the Web – Deployed on separate hardware – Connector built into application – Connections opened for each request ● Database Backend – Store data from many applications ● High Availability?
  • 23. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2014-10-02 Basic system without redundancy ● No High Availability – No redundancy – No monitoring – No way to activate replacement ● What can you do? – Add redundancy – Add monitoring – Add activation of replacement !
  • 24. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2014-10-02 Basic system with redundancy ● Server Redundancy – Keep a secondary around – Replicate from primary ● MySQL Router – Deployed as intermediate – Monitor servers – Re-direct connections on primary failure
  • 25. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Router Configuration for Static Failover ● Section header – Name + Key ● Bind port – Port number to listen on – Connections from localhost only by default [routing:failover] bind_port = 13306 destinations = srv1.example.com,srv2.example.com mode = read-write ● Destinations – Servers to open connections to ● Mode – Read-write queries on the connection
  • 26. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2014-10-02 Basic system with redundancy ● Server crashes – Replication stops ● Notices server is gone – Router notices server disappears – Server is put in quarantine ● Find alternative server – Router picks new server from static list of candidates ! ?
  • 27. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2014-10-02 Basic system with redundancy ● Activate replacement – New connections are sent to secondary – Existing connections will time out ?
  • 28. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Basic system with redundancy ● Server Restored – The primary is restored into working state – Replication is set up again ● Server unquarantined – Router notices server is available again – Server is unquarantined – New connections go to primary – Old connections still go to secondary ● Closed once the request is finished
  • 29. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Using Fabric for Server Management ● Fabric Control Node – Provide Information about farm to router – Monitor servers – Execute procedures – Add and remove servers ● High Availability Group – Collection of servers – All servers in group have same data Fabric Node High Availability Group
  • 30. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Router Configuration with Fabric ● Fabric cache – Address of Fabric node [fabric_cache:my_cache] address = fabric.example.com:32275 [routing:failover] bind_port = 13306 destinations = fabric+cache://my_cache/group/my_group mode = read-write ● Destinations – Reference to Fabric cache instead of servers. – Fabric cache is authority in the URL – Groups under group key
  • 31. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Using Fabric for Server Management ● Initially – Secondaries have @@READ_ONLY = 1 – Primary has @@READ_ONLY = 0 ● Primary is lost ● Fabric node notices – Built-in Failure Detector ! ?
  • 32. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Using Fabric for Server Management ● Fabric node perform fail-over – Secondary is selected as new primary – Other secondaries are changed to replicated from new primary – @@READ_ONLY = 0 on new primary – Router informed of change ● Router change primary – New connections go to new primary – Old connections error out ?
  • 33. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Using Fabric for Server Management ● Availability – Router caches information – Service not interrupted on Fabric node failure – Note: Failovers not done while Fabric node is down ● Meta Data Durability – Information stored in database backend – Fabric node just have to be restarted ● For example, using init.d script Fabric Node
  • 34. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Geographical Redundancy ● Multiple data centers – One Fabric node in each ● Meta data locality – Node in data center to provide meta-data ● Resilient execution – Long-running procedures are not interrupted
  • 35. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Geographical Redundancy ● Fabric Control Cluster – Multiple Fabric control nodes – One active node (leader), others passive – Passive nodes can be used as read replicas – … but also act as standby ● Elastic Control Cluster – Adding or removing nodes on demand – Added nodes automatically brought up to date when joining
  • 36. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Geographical Redundancy ● Fabric Control Cluster Leader – There is one leader in the cluster – The leader can change ● Leader dies ● Leader is explicitly changed – Commands changing meta data have to be executed on leader ● Internal Forwarding – Commands that change meta-data are automatically forwarded to leader
  • 37. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Scaling High Availability Systems A case study
  • 38. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Scaling Reads ● When to scale for reads – Read-heavy workloads – Most web applications ● Result set caching – If queries are identical – Done at application layer – Not covered in this presentation ● Read servers – For more complex queries
  • 39. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Scaling Reads ● Adding read servers to group – Servers added as spares – Fabric monitor spares as well ● Setup router – Add a read-only query port to router – Distribute load in round-robin fashion ● Split traffic – Updates sent to update port – Queries sent to query port Fabric Node Queries Updates
  • 40. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Router Configuration for Static Load Balancing ● Section header – Name + Key ● Bind port – Port number to listen on – Connections from localhost only by default [routing:load_balancing] bind_port = 13307 destinations = slave1.example.com,slave2.example.com mode = read-only ● Destinations – Servers to open connections to ● Mode – Read-only queries on the connection – … can be load balanced
  • 41. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Scaling Writes ● Write-heavy workloads – Data collection networks – Large-scale monitoring applications ● Workload Type – Large number of updates – Each update change few rows ● Replication does not help – Writes are replicated as well !
  • 42. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Scaling Writes ● “Sharding” database – Horizontal partitioning of rows in tables – Each shard updated independently of others ● “Sharding” write stream – Write stream partitioned by key – Write streams are independent 1000-1999 1-999 2000-2999 3000-3999
  • 43. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2014-10-02 Scaling Storage ● Data-intensive applications – Data collection networks – Business analysis applications ● On-Line Analytical Processing (OLAP) of large data sets ● Just too much data – Indexes too large – Backup time excessive – Analysis prohibitive ● “Sharding” the data – Horizontal partitioning of database based on sharding key – Same solution as for scaling writes ● Analytic Queries – Parallelization possible – Inter-shard queries? – Cross-shard queries?
  • 44. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2014-10-02 Elasticity ● Scale hardware on demand – Automatically adapting to changes in workload – Useful for changes in read load, write load, and storage requirements – Require monitoring the load of the system ● Read load change – Adapt number of read slaves to read load ● Write load change – Adapt number of shards to incoming write traffic ● Storage requirement change – Adapt number of shards to storage requirements
  • 45. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Scaling through Sharding in Fabric ● Use Fabric-aware connectors – … or doing key mapping in application – Sending transactions to correct shard – Key need to be given explicitly ● Provided together with the query ● Dispatching Analytical Queries – Done at application level – Fetch shard information from Fabric ● Using XML-RPC or MySQL-RPC interface – Dispatch queries to the shards – Collect and merge the results MySQL Fabric ServerApplication High-Availability Groups (Shards) Global Group
  • 46. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Scaling through Sharding in Fabric ● Schema designed for sharding – Sharding key need to be picked carefully ● Sharded Tables – Application-level “objects” usually spread over several tables – Rows for one “object” need to be co- located on same shard ● Global Tables – Tables present on all shards – Replicated to all shards using the Global Group MySQL Fabric ServerApplication High-Availability Groups (Shards) Global Group
  • 47. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 employee emp_id INT birth_date DATE first_name VARCHAR(14) last_name VARCHAR(16) gender ENUM('M','F') hire_date DATE titles emp_no INT title VARCHAR(50) from_date DATE to_date DATE salaries emp_no INT salary INT from_date DATE to_date DATE departments dept_no CHAR(4) dept_name VARCHAR(40) dept_emp emp_no INT dept_no CHAR(4) from_date DATE to_date DATE dept_manager dept_no CHAR(4) emp_no INT from_date DATE to_date DATE Table Rows salaries 284 404 700 titles 44 330 800 employees 30 002 400 dept_emp 33 160 300 dept_manager 2 400 departments 900 In desperate need of sharding! Foreign keySchema for sharding Global Table (replicated on all shards)
  • 48. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 ● OpenStack Controller Node – Manages Identities – Manages Images – Manages Block Storage ● OpenStack Compute Node – (Virtual) machine host – Contain hypervisor – Spawn and destroy virtual machines Controller Compute (VM Host) Elasticity through Virtualization
  • 49. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2014-10-02 MySQL Fabric and OpenStack MySQL Fabric Node OpenStack Instance Application High-Availability Groups / Shards
  • 50. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Closing remarks
  • 51. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Where are we now? ● High Availability Features – Slave promotion – Multi-node Fabric Control Cluster – Failure detectors ● Failure detection – Built-in Failure Detector – Failure reporting – Custom failure detectors ● Connector APIs – Transaction properties – “Virtual” connections – Legacy connector support ● Using router ● Interfaces – Command-line – XML-RPC – MySQL-RPC
  • 52. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Where are we now? ● Execution – Node failure stop execution ● Execution restart on recovery – Replicated State Machine (RSM) – Fail-over execution ● Security – RFC 2617 for HTTP authentication – SSL support over XML-RPC – Secure Password Management ● Cloud integration – “Server providers” – OpenStack Nova ● Sharding – Range and hash sharding – Shard move and split
  • 53. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Thoughts for the Future ● Custom Procedures – Better support for custom procedures – Easy way to write high availability procedures ● Cloud support – OpenStack Trove – Amazon AWS – Amazon RDS ● Frameworks – Django? – Symphony? ● More Fabric-aware connectors – C/C++? ● Improved provisioning – Using on-line backup? – Using filesystem snapshots?
  • 54. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Thoughts for the Future ● Integration Router-Fabric – Better integration of Router and Fabric – Failure reporting in Router – Multi-node Fabric Support in Router ● Integration with Group Replication – Router to balance write load ● Enterprise Monitoring – Monitor farm status – Monitor Fabric nodes ● Dynamic Router Configuration – On-line configuration changes ● Transaction Multiplexing – Allow several incoming clients to use a single connection to the server – Transactions are interleaved
  • 55. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Thoughts for the Future ● Router Monitoring – Statistics collection – Monitoring interfaces ● Query Consolidation – Consolidate result sets from identical queries “in flight” ● Router Logging – Logging plugin interface – Sending logs to different sinks ● Result set caching – Allow router to cache result sets – Transparent to application ● Session consistency – We have a distributed database – It should look like a single database – Read monotonicity – Write monotonicity
  • 56. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 2015-10-28 Thoughts for the Future ● Automatic sharding – Single-query transactions? – Speculative execution? – Cross-shard queries? ● Shard aggregation – Cross-shard queries ● Connection-based Sharding – Sharding OLTP workload in router – Assign shard key range to router port – Router send session to shard based on port ● Multi-way shard split – Efficient initial sharding – Better use of resources
  • 57. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2015-10-28