DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
MySQL Cluster
1. MySQL Cluster
In-Memory Real-Time Performance, Web Scalability & 99.999% Availability
Mario Beck
MySQL Sales Consulting Manager EMEA
mario.beck@oracle.com
http://mablomy.blogspot.de
March 19th , 2015
2. 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.
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 2
3. Focus on driving the business rather than on infrastructure
Driving new Database Requirements
In-Memory
Real-Time
Performance
Extreme
Read &
Write
Scalability
Rock Solid
Availability
Rapid
Service
Innovation
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 3
4. MySQL Cluster Overview
• Memory optimized tables with durability
• Predictable Low-Latency, Bounded Access Time
REAL-TIME
• Auto-Sharding, Multi-Master
• ACID Compliant, OLTP + Real-Time Analytics
HIGH SCALE, READS +
WRITES
• Shared nothing, no Single Point of Failure
• Self Healing + On-Line Operations
99.999% AVAILABILITY
• Key/Value + Complex, Relational Queries
• SQL + Memcached + JavaScript + Java + HTTP/REST & C++
SQL + NoSQL
• Open Source + Commercial Editions
• Commodity hardware + Management, Monitoring Tools
LOW TCO
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 4
6. Company Overview
PayPal allows any business or individual with an email
address to securely, conveniently and cost-effectively send
and receive payments online.
Application
PayPal built a cloud-based globally-distributed database
with 100 TB of user-related data based on MySQL Cluster.
“Must NOT lose data” system, delivering 99,999%
availability, transactional, with data available WW
anywhere in < 1 Sec.
Why MySQL Cluster?
“You can achieve high performance and availability
without giving up relational models and read
consistency.” Daniel Austin, Chief Architect, PayPal
PayPal
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 6
7. Company Overview
Global telecommunications equipment company, focuses on
fixed, mobile, and converged networking hardware, IP
technologies, software, and services.
Application
MySQL Cluster CGE is at the heart of Alcatel-Lucent’s
Subscriber Data Manager to deliver converged IMS services
to mobile and fixed line users.
Why MySQL Cluster CGE?
• Delivers the performance, scalability and availability
required by this mission critical real-time application
• Real-time read & write access for tens of millions of
subscribers in a single system
• Always-on service: no offline maintenance window for
services users depend on (voice, SMS, email, Web, social
media…)
• Rapid delivery & low TCO
Alcatel-Lucent
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 7
8. MySQL Cluster Architecture
MySQL Cluster Data Nodes
Clients
Application Layer
Data Layer
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 8
9. MySQL Cluster Scaling
MySQL Cluster Data Nodes
Clients
Application Layer
Data Layer
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 9
10. MySQL Cluster HA
MySQL Cluster Data Nodes
Clients
Application Layer
Data Layer
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 10
11. Node Group
Data Node 1
Data Partitioning
• Data transparently sharded between Node Groups
• Each fragment active in one Data Node with synchronous replication to
2nd Data Node in same Node Group
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 11
Fragment 1
Fragment 2’
Data Node 2
Fragment 1’
Fragment 2
Node Group
Data Node 3
Fragment 3
Fragment 4’
Data Node 4
Fragment 3’
Fragment 4
12. Data Partitioning
• DBA chooses which part of
Primary Key to use as shard
key
• Fragment for each row
decided by hashing the
sharding key
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 12
User-id (PK) Service (PK) Data
1773467253 chat xxx
6257346892 chat xxx
1773467253 photos xxx
7234782739 photos xxx
8235602099 reminders xxx
8437829249 location xxx
Shard Key
13. D1 D2 D3 D4
API
----------
----------
----------
TC TC TC TC
1
2
Accessing data: Primary Key lookup
• The API (e.g. MySQL
Server) transparently
hashes the row’s PK to
find the right data node
• Very fast, efficient and
scalable
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 13
14. D1 D2 D3 D4
API
----------
----------
----------
TC TC TC TC
1 3
2
Accessing data: Table scan
• Random node chosen to
co-ordinate distributed
scan
• Data nodes return data
directly to API
– Data merged before the
application receives it
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 14
15. On-line Operations
• Scale the cluster
– Add all nodes
– Remove MySQL Server nodes
• Repartition tables
• Upgrade / patch servers & OS
• Upgrade / patch MySQL Cluster
• Back-Up
• Evolve the schema on-line, in real-time
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 15
16. MySQL Cluster 7.2: 1.2 Billion UPDATEs per Minute
• NoSQL C++ API,
flexaSynch benchmark
• 30 x Intel E5-2600 Intel
Servers, 2 socket, 64GB
• ACID Transactions, with
Synchronous Replication
http://www.mysql.com/why-
mysql/white-papers/mysql-cluster-
benchmarks-1-billion-writes-per-minute/0
5
10
15
20
25
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
MillionsofUPDATEsperSecond
MySQL Cluster Data Nodes
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 16
17. MySQL Cluster 7.2 Join Performance
• Web-Based Content Management System
– JOINs 11-tables, 33.5k rows
– Returns 2k rows, 19 columns per row
0
10
20
30
40
50
60
70
80
90
100
MySQL Cluster 7.1 MySQL Cluster 7.2
Query Execution Time Seconds
87.23 seconds
1.26 seconds
70x
Faster
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 17
18. NoSQL Access to MySQL Cluster data
Apps Apps Apps Apps Apps Apps Apps Apps Apps Apps Apps Apps
JPA
Cluster JPA
PHP Perl Python Ruby JDBC Cluster J JS Apache Memcached
MySQL JNI Node.JS mod_ndb ndb_eng
NDB API (C++)
MySQL Cluster Data Nodes
19. Cluster & Memcached - Configured Schema
<town:maidenhead,SL6>
prefix key value
<town:maidenhead,SL6>
key value
Prefix Table Key-col Val-col policy
town: map.zip town code cluster
Config tables
town ... code ...
maidenhead ... SL6 ...
map.zip
Application view
SQL view
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 19
20. MySQL 5.6 Memcached with InnoDB
0
10000
20000
30000
40000
50000
60000
70000
80000
8 32 128 512
TPS
Client Connections
Memcached API
SQL
Clients and Applications
MySQL Server
Memcached Plug-in
innodb_
memcached
local cache
(optional)
Handler API InnoDB API
InnoDB Storage Engine
mysqld process
SQL Memcached Protocol
Up to 9x Higher “SET / INSERT” Throughput
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 20
21. MySQL Cluster 7.4 GA
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 21
22. MySQL Cluster 7.4 GA
• 200 Million NoSQL
Reads/Sec
• 2.5M SQL Ops/Sec
• 50% Faster Reads
• 40% Faster Mixed
Performance
• Active-Active
Geographic
Redundancy
• Conflict
Detection/Resolution
Active-Active
• 5X Faster
Maintenance Ops
• Detailed Reporting
Management
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 22
23. • Memory optimized tables
– Durable
– Mix with disk-based tables
• Massively concurrent OLTP
• Distributed Joins for analytics
• Parallel table scans for non-indexed
searches
• MySQL Cluster 7.4 FlexAsych
– 200M NoSQL Reads/Second
19/03/2015 23
MySQL Cluster 7.4 NoSQL Performance
200 Million NoSQL Reads/Second
Copyright 2015, oracle and/or its affiliates. All rights reserved
-
50,000,000
100,000,000
150,000,000
200,000,000
250,000,000
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32
Readspersecond
Data Nodes
FlexAsync Reads
24. • Memory optimized tables
– Durable
– Mix with disk-based tables
• Massively concurrent OLTP
• Distributed Joins for analytics
• Parallel table scans for non-indexed
searches
• MySQL Cluster 7.4 DBT2 BM
– 2.5M SQL Statements/Second
19/03/2015 24
MySQL Cluster 7.4 SQL Performance
2.5M SQL Statements/Second
Copyright 2015, oracle and/or its affiliates. All rights reserved
-
500,000
1,000,000
1,500,000
2,000,000
2,500,000
3,000,000
2 4 6 8 10 12 14 16
SQLStatements/sec
Data Nodes
DBT2 SQL Statements per Second
25. • Asynchronous replication between
MySQL Clusters
• Active-Active
– Update anywhere
– Conflict detection
• Application notified through exception tables
• Can opt to have conflicts resolved
automatically
– Auto-conflict-resolution
• Conflicting transaction and dependent ones
are rolled-back
• No changes to application schema
Active-Active Geo-Replication
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 25
26. How to Use Conflict Detection/Resolution
Decide which
tables need
protecting
For each table,
specify what to
do on conflicts
Just record in
exception table
Application or
DBA acts on
content
Rollback the
conflicting row
Rollback the
conflicting
transaction
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 26
27. MySQL Cluster 7.4 Restart Improvements
• Duration of long-running maintenance activities dominated by Data Node
restart times
• MySQL Cluster 7.4 = 5.5X faster restarts
• Benefits both nodal and rolling restarts
– Upgrades, add-node,…
• Benefits both SQL and NoSQL APIs
• Benefits both ”manual” and MySQL Cluster Manager operations
• Achieve 5x as much during a single maintenance window
Make Data Node Restarts Fast!
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 27
28. Enhanced Memory Reporting
mysql> CREATE DATABASE clusterdb;USE clusterdb;
mysql> CREATE TABLE simples (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=NDB;
mysql> select node_id AS node, fragment_num AS frag, fixed_elem_alloc_bytes alloc_bytes,
fixed_elem_free_bytes AS free_bytes, fixed_elem_free_rows AS spare_rows from
memory_per_fragment where fq_name like '%simples%';
+------+------+-------------+------------+------------+
| node | frag | alloc_bytes | free_bytes | spare_rows |
+------+------+-------------+------------+------------+
| 1 | 0 | 131072 | 5504 | 172 |
| 1 | 2 | 131072 | 1280 | 40 |
| 2 | 0 | 131072 | 5504 | 172 |
| 2 | 2 | 131072 | 1280 | 40 |
| 3 | 1 | 131072 | 3104 | 97 |
| 3 | 3 | 131072 | 4256 | 133 |
| 4 | 1 | 131072 | 3104 | 97 |
| 4 | 3 | 131072 | 4256 | 133 |
+------+------+-------------+------------+------------+
See how much memory a table is using
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 28
29. When to Consider MySQL Cluster
Scalability demands
Sharding for write performance?
Latency demands
Cost of each millisecond?
Uptime requirements
Cost per minute of downtime?
Failure versus maintenance?
Application agility
Developer languages and frameworks?
SQL or NoSQL?
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 29
30. General Usage Considerations
• MySQL Cluster is designed for
– Short transactions
– Many parallel transactions
• Utilize simple access patterns for high running transactions
– Use efficient scans and batching interfaces
– AQL gives huge performance in JOIN operations
– MySQL Cluster 7.4 speeds up table scans
• Storage engine configurable for each table…InnoDB or NDB
MySQL Cluster Evaluation Guide
http://mysql.com/why-mysql/white-papers/mysql_cluster_eval_guide.php
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 30
35. Enhancing DevOps Agility,
Reducing Downtime
Automated Management
• Start / Stop node or
whole cluster
• On-Line Scaling
• On-Line Reconfiguration
• On-Line Upgrades
• On-Line Backup &
Restore
• Import Running Cluster
Self-Healing
• Node monitoring
• Auto-recovery extended
to SQL + mgmt nodes
HA Operations
• Cluster-wide
configuration
consistency
• Persistent
configurations
• HA Agents
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 35
36. Without MySQL Cluster Manager
• 1 x preliminary check of cluster state
• 8 x ssh commands per server
• 8 x per-process stop commands
• 4 x scp of config files (2 x mgmd & 2 x mysqld)
• 8 x per-process start commands
• 8 x checks for started and re-joined processes
• 8 x process completion verifications
• 1 x verify completion of the whole cluster.
• Excludes manual editing of each configuration file.
• Total: 46 commands
– 2.5 hours of attended operation
With MySQL Cluster Manager
mcm> upgrade cluster
--package=7.4 mycluster;
• Total: 1 Command -
– Unattended Operation
Software Upgrade – example of benefits of MCM?
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 36
37. Oracle Premier Support for MySQL
• Straight from the Source
• Largest Team of MySQL Experts
• Backed by MySQL Developers
• Forward Compatible Hot Fixes
• MySQL Maintenance Releases
• MySQL Support in 29 Languages
• 24/7/365
• Unlimited Incidents
• Knowledge Base
• MySQL Consultative Support
Rely on The Experts - Get Unique Benefits
"The MySQL support service has been essential
in helping us with troubleshooting and
providing recommendations for the production
cluster, Thanks."
-- Carlos Morales – Playfulplay.com
Only From
Oracle
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 37
38. Next Steps
Learn More
• www.mysql.com/cluster
• Authentic MySQL Curriculum: http://oracle.com/education/mysql
Try it Out
• dev.mysql.com/downloads/cluster/
Let us know what you think
• clusterdb.com
• @clusterdb
• forums.mysql.com/list.php?25
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 38
39. Evaluate MySQL Cluster CGE
• Navigate to
http://edelivery.oracle.com/ and
step through (selecting “MySQL
Database” as the Product Pack)
• Select MySQL Cluster Manager
30-Day Trial
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 39
40. Oracle University MySQL Training Services
Prepare Your Organization to Enable Reliable and High-Performance Web-Based Database Applications
“Training and team skill
have the most significant impact on overall performance of
technology and success of technology projects.” - IDC, 2013
Premier Support customers eligible to
save 20% on learning credits.
Benefits
Expert-led training to support your MySQL learning needs
Flexibility to train in the classroom or online
Hands-on experience to gain real world experience
Key skills needed for database administrators and developers
• MySQL for Beginners
MySQL for Database Administrators
MySQL Performance Tuning
MySQL Cluster – NEW - Register Your Interest!
MySQL and PHP - Developing Dynamic Web Applications
MySQL for Developers
MySQL Developer Techniques
MySQL 5.6 Database Administrator
MySQL 5.6 Developer
To find out more about available MySQL Training & Certification
offerings, go to: education.oracle.com/mysql
Top Courses for Administrators and Developers
Top Certifications
RECENTLY RELEASED
!!ALL NEW!! MySQL Cluster Training
To Register your interest to influence the
schedule on this newly released course – go to
education.oracle.com/mysql and click on the
MySQL Cluster Course
19/03/2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 40