Scaling Web Databases Webinar 2
Transcript of Scaling Web Databases Webinar 2
-
8/3/2019 Scaling Web Databases Webinar 2
1/62
Scaling Web Databases: MySQL ClusterAuto-Partitioning, SQL & NoSQL Interfaces, Schema Flexibility
Mat KeepProduct Management, MySQL Cluster
Andrew MorganProduct Management, MySQL Cluster
-
8/3/2019 Scaling Web Databases Webinar 2
2/62
The Reality of Being Successful on the Web
Scale fast
.writes as well as reads, linearly
.on commodity hardware
.without downtime
Choose the right tool for the job
.integrating multiple lightweight services.multiple data access & data integrity requirements
.SQL & NoSQL, when and where
Rapidly iterate
.evolve the app and the database Stay upstay on-line
-
8/3/2019 Scaling Web Databases Webinar 2
3/62
Session Agenda
Best Practices in Scaling Web Services withMySQL Cluster
Scaling Reads & Writes with Auto-Sharding
On-Line Scaling with Commodity Hardware
Choosing the Right Interface(s): NoSQL and SQL
Rapidly Evolving Web Services
On-Line Scale-Out & Schema Updates
Staying Up, Staying On-Line Case Studies
Resources to Get Started
-
8/3/2019 Scaling Web Databases Webinar 2
4/62
The presentation 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 berelied upon in making purchasing decisions.
The development, release, and timing of any
features or functionality described for Oracles
products remains at the sole discretion of Oracle.
-
8/3/2019 Scaling Web Databases Webinar 2
5/62
MySQL Cluster Overview
ACID Compliant Relational DatabaseSQL & NoSQL interfaces
Write-Scalable & Real-TimeDistributed, auto-partitioning (sharding), multi-master
99.999% AvailabilityShared-nothing, integrated clustering & sub-second recovery, local & geographicreplication, on-line operations
Low TCOOpen-source, management & monitoring tools, scale-out on commodity hardware
-
8/3/2019 Scaling Web Databases Webinar 2
6/62
MySQL Cluster Architecture
Data Nodes
Node Group 1
F1
F3
F3
F1
Node
1
Node2
Node Group 2
F2
F4
F4
F2
Node3
Node4
Application Nodes
ClusterMgmt
ClusterMgmt
LDAPREST
-
8/3/2019 Scaling Web Databases Webinar 2
7/62
MySQL Cluster - Extreme Resilience
Data Nodes
Node Group 1
F1
F3
F3
F1
Node
1
Node2
Node Group 2
F2
F4
F4
F2
Node3
Node4
Application Nodes
ClusterMgmt
ClusterMgmt
LDAPREST
-
8/3/2019 Scaling Web Databases Webinar 2
8/62
MySQL Cluster Users & ApplicationsHA, Transactional Services: Web & Telecoms
http://www.mysql.com/customers/cluster/
Web
User profile management Session stores
eCommerce
On-Line Gaming
Application Servers
Telecoms
Subscriber Databases (HLR/HSS)
Service Delivery Platforms
VoIP, IPTV & VoD
Mobile Content Delivery
On-Line app stores and portals
IP Management
Payment Gateways
-
8/3/2019 Scaling Web Databases Webinar 2
9/62
Auto-Sharding
-
8/3/2019 Scaling Web Databases Webinar 2
10/62
Scale-Out Reads & Writes onCommodity Hardware
NDB API Performance 4.33 MQueries per second!
8 Intel servers, dual-6-core [email protected] GHz, 24GB RAM
2 Data Nodes per server flexAsync benchmark
16 parallel threads, each issuing 256simultaneous transactions
Read / Write 100 byte attribute
Interim results from 2 days testing
watch this space:mikaelronstrom.blogspot.com
-
8/3/2019 Scaling Web Databases Webinar 2
11/62
Out of the Box Scalability: Auto-Sharding
Partitioning happens automatically & transparent to the application A little knowledge of how it works though can massively increase application performance
Transparency maintained during failover, upgrades and scale-out
No need for application-layer sharding logic
No need to limit application to single-shard transactions (though can helpefficiency)
http://www.mysql.com/why-mysql/white-papers/mysql_wp_cluster_perfomance.php
-
8/3/2019 Scaling Web Databases Webinar 2
12/62
Data Node 1
Data Node 2
Data Node 3
Data Node 4A fragment is a copy of a partition (aka fragment replica)
Number of fragments = # of partitions * # of replicas
Table T1
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
-
8/3/2019 Scaling Web Databases Webinar 2
13/62
Data Node 1
Data Node 2
F1
Primary Fragment
Secondary Fragment (fragment replica)
Data Node 3
Data Node 4Fx
Fx
Table T1
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
-
8/3/2019 Scaling Web Databases Webinar 2
14/62
Data Node 1
Data Node 2
F1
Primary Fragment
F1
Data Node 3
Data Node 4Fx
Fx
Table T1
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
Secondary Fragment (fragment replica)
-
8/3/2019 Scaling Web Databases Webinar 2
15/62
Data Node 1
Data Node 2
F1
Primary Fragment
F3 F1
Data Node 3
Data Node 4Fx
Fx
Table T1
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
Secondary Fragment (fragment replica)
-
8/3/2019 Scaling Web Databases Webinar 2
16/62
Data Node 1
Data Node 2
F1 F3
Primary Fragment
F3 F1
Data Node 3
Data Node 4Fx
Fx
Table T1
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
Secondary Fragment (fragment replica)
-
8/3/2019 Scaling Web Databases Webinar 2
17/62
Data Node 1
Data Node 2
F1 F3
Primary Fragment
F3 F1
Data Node 3
Data Node 4
F2
Fx
Fx
Table T1
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
Secondary Fragment (fragment replica)
-
8/3/2019 Scaling Web Databases Webinar 2
18/62
Data Node 1
Data Node 2
F1 F3
Primary Fragment
F3 F1
Data Node 3
Data Node 4
F2
F2
Fx
Fx
Table T1
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
Secondary Fragment (fragment replica)
-
8/3/2019 Scaling Web Databases Webinar 2
19/62
Data Node 1
Data Node 2
F1 F3
Primary Fragment
F3 F1
Data Node 3
Data Node 4
F2
F4 F2
4 Partitions * 2 Replicas = 8 Fragments
Fx
Fx
Table T1
P2
P3
P4
Px Partition
P1
Automatic Data Partitioning
Secondary Fragment (fragment replica)
-
8/3/2019 Scaling Web Databases Webinar 2
20/62
Data Node 1
Data Node 2
F1 F3
Primary Fragment
F3 F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Fx
Fx
Table T1
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
Secondary Fragment (fragment replica)
-
8/3/2019 Scaling Web Databases Webinar 2
21/62
Data Node 1
Data Node 2
F3
Primary Fragment
F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Node Group 1
Fx
Fx
Table T1
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
F1
F3
Automatic Data Partitioning
Secondary Fragment (fragment replica)
-
8/3/2019 Scaling Web Databases Webinar 2
22/62
Data Node 1
Data Node 2
F1 F3
Primary Fragment
F3 F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Node Group 1
Node Group 2Fx
Fx
- Node groups are created automatically
- # of groups = # of data nodes / # ofreplicas
Table T1
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
Secondary Fragment (fragment replica)
-
8/3/2019 Scaling Web Databases Webinar 2
23/62
Data Node 1
Data Node 2
F1 F3
Primary Fragment
F3 F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Node Group 1
Node Group 2Fx
Fx
As long as one data node in eachnode group is running we have a
complete copy of the data
Table T1
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
Secondary Fragment (fragment replica)
-
8/3/2019 Scaling Web Databases Webinar 2
24/62
Data Node 1
Data Node 2
F1 F3
Primary Fragment
F3 F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Node Group 1
Node Group 2Fx
Fx
As long as one data node in eachnode group is running we have a
complete copy of the data
Table T1
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
Secondary Fragment (fragment replica)
-
8/3/2019 Scaling Web Databases Webinar 2
25/62
Data Node 1
Data Node 2
F1 F3
Primary Fragment
F3 F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Node Group 1
Node Group 2Fx
Fx
As long as one data node in eachnode group
is running we have a complete copy ofthe data
Table T1
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
Secondary Fragment (fragment replica)
-
8/3/2019 Scaling Web Databases Webinar 2
26/62
Table T1 Data Node 1
Data Node 2
F1 F3
Primary Fragment
P2
P3
P4
Px Partition
F3 F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Node Group 1
Node Group 2
4 Partitions * 2 Replicas = 8 Fragments
Fx
Fx
- No complete copy of thedata
- Cluster shutdownsautomatically
P1
Automatic Data Partitioning
Secondary Fragment (fragment replica)
-
8/3/2019 Scaling Web Databases Webinar 2
27/62
General Design Considerations
Overall design goalMinimize network roundtrips for your
most important requests!
MySQL Cluster is designed for Short transactions
Many parallel transactions
Utilize Simple access patterns to fetch data
Use efficient scans and batching interfaces Analyze what your most typical use cases are
optimize for those
-
8/3/2019 Scaling Web Databases Webinar 2
28/62
Best Practice : Primary Keys
To avoid problems with Cluster 2 Cluster replication
Recovery
Application behavior (KEY NOT FOUND.. etc)
ALWAYS DEFINE A PRIMARY KEY ON THE TABLE!
A hidden PRIMARY KEY is added if no PK is specified. BUT.. .. NOT recommended
The hidden primary key is for example not replicated(between Clusters)!!
There are problems in this area, so avoid the problems!
So always, at least haveid BIGINT AUTO_INCREMENT PRIMARY KEY
Even if you don't need it for you applications
-
8/3/2019 Scaling Web Databases Webinar 2
29/62
Best Practice: Distribution Aware Apps
Partition selected using hash onPartition Key
Primary Key by default
User can override in table definition
MySQL Server (or NDB API) willattempt to send transaction to thecorrect data node
If all data for the transaction are inthe same partition, less messaging -> faster
Aim to have all rows for high-running queries in same partition
Partition Key
Primary Key
town country population
Maidenhead UK 78000
Paris France 2193031
Boston UK 58124
Boston USA 617594
SELECT SUM(population) FROM towns
WHERE country=UK;
Partition Key
Primary Key
town country population
Maidenhead UK 78000
Paris France 2193031
Boston UK 58124
Boston USA 617594
SELECT SUM(population) FROM towns
WHERE town=Boston;
-
8/3/2019 Scaling Web Databases Webinar 2
30/62
Best Practice: Distribution Aware Multiple Tables
Extend partition awareness overmultiple tables
Same rule aim to have all data for
instance of high runningtransactions in the same partition
ALTER TABLE service_ids
PARTITION BY KEY(sub_id);
Partition Key
Primary Key
service sub_id svc_id
twitter 19724 76325732
twitter 84539 67324782
facebook 19724 83753984
facebook 73642 87324793
Partition Key
Primary Key
sub_id age gender
19724 25 male
84539 43 female
19724 16 female
74574 21 female
-
8/3/2019 Scaling Web Databases Webinar 2
31/62
Scaling Distributed JoinsAdaptive Query Localization
Complex joins traditionally slower in
MySQL Cluster
Complex = lots of levels and interimresults in JOIN
JOIN was implemented in the MySQLServer:
Nested Loop join
When data is needed, it must be fetched
over the network from the Data Nodes;row by row
This causes latency and consumesresources
Can now push the execution down intothe data nodes, greatly reducing the
network trips 25x-40x performance gain in
customer PoC!
mysqld
Data Nodes
mysqld
Data Nodes
AQL
http://www.mysql.com/news-and-events/on-demand-webinars/display-od-583.html
The existence, content and timing of future releases described here is included
for information only and may be changed at Oracles discretion. May 26, 2011
7.2DM
-
8/3/2019 Scaling Web Databases Webinar 2
32/62
Testing ofAdaptive Query Localization has yielded over 20xhigher performanceon complex queries within our application,enabling Docudesk to expand our use of MySQL Cluster into abroader range of highly dynamic web services.
Casey BrownManager, Development & DBA Services, Docudesk
Early Adopter Speaks!
-
8/3/2019 Scaling Web Databases Webinar 2
33/62
Data Node 1 Data Node 2
Need more throughput?
Scale Out
-
8/3/2019 Scaling Web Databases Webinar 2
34/62
Data Node 1 Data Node 2
Need more throughput?
Scale Out
-
8/3/2019 Scaling Web Databases Webinar 2
35/62
Data Node 1 Data Node 2
Need more throughput?
Scale Out
Oops, need to increase capacity as well!
-
8/3/2019 Scaling Web Databases Webinar 2
36/62
Data Node 1 Data Node 2
Scale Out
Data Node 3 Data Node 4
-
8/3/2019 Scaling Web Databases Webinar 2
37/62
Scaling Across Data CentersGeographic Replication with Multi-Master Replication
Cluster 1
Synchronousreplication
Cluster 2
InnoDB
Asynchronousreplication
Synchronous replication withina Cluster node group for HA
Bi-Direction asynchronousreplication to remote Cluster forgeographic redundancy
Master-slave or multi-master Automated conflict detection
and resolution
Asynchronous replication tonon-Cluster databases for
specialised activities such asreport generation
Mix and match replication types
InnoDBInnoDB
-
8/3/2019 Scaling Web Databases Webinar 2
38/62
SQL & NoSQL Interfaces
-
8/3/2019 Scaling Web Databases Webinar 2
39/62
PerformanceI FlexibilityI Simplification SQL and NoSQL Access Methods to tables
SQL: complex queries, rich ecosystem of apps & expertise Simple Key/Value interfaces bypassing SQL layer for blazing fast reads &
writes Real-time interfaces for micro-second latency Developers free to work in their preferred environment
-
8/3/2019 Scaling Web Databases Webinar 2
40/62
MySQL Cluster: SQL & NoSQL Combined
NoSQL Multiple ways to bypass SQL, and maximize performance: NDB API. C++ for highest performance, lowest latency Cluster/J for optimized access in Java NEW! Memcached. Use all your existing clients/applications
Mix & Match!
Same data accessedsimultaneously throughSQL & NoSQL interfaces
-
8/3/2019 Scaling Web Databases Webinar 2
41/62
Which to Choose ?
-
8/3/2019 Scaling Web Databases Webinar 2
42/62
NoSQL With NDB APIBest possible performance
MySQL Cluster Data Nodes
Applications with embedded NDB APILibrary
Clients Application embeds the NDB API C++
interface library
NDB API make intelligent decision (wherepossible) about which data node to sendqueries to With a little planning in the schema design,
achieve linear scalability
Used by all of the other application nodes(MySQL, LDAP, ClusterJ,)
Best possible performance but requires >development skill
Favourite API for real-time networkapplications
Foundation for all interfaces
7 2DM
-
8/3/2019 Scaling Web Databases Webinar 2
43/62
NoSQL with memcached
Memcached is a distributed memory
based hash-key/value store with nopersistence to disk
NoSQL, simple API, popular withdevelopers
MySQL Cluster already provides scalable,in-memory performance with NoSQL(hashed) access as well as persistence
Provide the Memcached API but map to NDBAPI calls
Writes-in-place, so no need to invalidate
cache Simplifies architecture as caching &
database integrated into 1 tier
Access data from existing relational tables
7.2DM
Memcached protocol
NoSQL with Memcached 7 2DM
-
8/3/2019 Scaling Web Databases Webinar 2
44/62
NoSQL with MemcachedPre-GA version available from labs.mysql.com
Flexible: Deployment options
Multiple Clusters
Simultaneous SQL Access
Can still cache in Memcached server Flat key-value store or map to multiple
tables/columns
Simple:set maidenhead 0 0 3
SL6
STORED
get maidenhead
VALUE maidenhead 0 3
SL6
END
7.2DM
-
8/3/2019 Scaling Web Databases Webinar 2
45/62
Supporting Rapidly Evolving Services
-
8/3/2019 Scaling Web Databases Webinar 2
46/62
On-Line Operations
Scale the cluster (add data nodes)
Repartition tables
Recover failed nodes
Upgrade / patch servers & OS
Upgrade / patch MySQL Cluster
Back-Up
Evolve the schema on-line, in real-time
-
8/3/2019 Scaling Web Databases Webinar 2
47/62
Online Add Node (1) add node group
Node Group New Node Group
JapanTanizakiJunichiro4
GermanyGoetheJohann3
USAHemingwayErnest2
FranceCamusAlbert1
countrylnamefnameauthid (PK)
JapanTanizakiJunichiro4
GermanyGoetheJohann3
USAHemingwayErnest2
FranceCamusAlbert1
countrylnamefnameauthid (PK)
Application
http://www.mysql.com/why-mysql/white-papers/mysql_wp_cluster7_architecture.php
Copyright 2011 Oracle Corporation 47
-
8/3/2019 Scaling Web Databases Webinar 2
48/62
No extra space needed on existing nodes!JapanTanizakiJunichiro4
GermanyGoetheJohan3
USAHemingwayErnest2
FranceCamusAlbert1
countrylnamefnameauthid (PK)
JapanTanizakiJunichiro4
GermanyGoetheJohann3
USAHemingwayErnest2
FranceCamusAlbert1
countrylnamefnameauthid (PK)
JapanTanizakiJunichiro4
USAHemingwayErnest2
countrylnamefnameauthid (PK)
http://www.mysql.com/why-mysql/white-papers/mysql_wp_cluster7_architecture.php
Node Group New Node Group
Online Add Node (2) copy data
JapanTanizakiJunichiro4
GermanyGoetheJohann3
USAHemingwayErnest2
FranceCamusAlbert1
countrylnamefnameauthid (PK)
Copyright 2011 Oracle Corporation 48
Application
O
-
8/3/2019 Scaling Web Databases Webinar 2
49/62
JapanTanizakiJunichiro4
GermanyGoetheJohan3
USAHemingwayErnest2
FranceCamusAlbert1
countrylnamefnameauthid (PK)
JapanTanizakiJunichiro4
USAHemingwayErnest2
countrylnamefnameauthid (PK)
JapanTanizakiJunichiro4
GermanyGoetheJohann3
USAHemingwayErnest2
FranceCamusAlbert1
countrylnamefnameauthid (PK)
http://www.mysql.com/why-mysql/white-papers/mysql_wp_cluster7_architecture.php
Online Add Node (3) switch distribution
Node Group New Node Group
Application
Copyright 2011 Oracle Corporation 49
O li Add N d ( ) d l
-
8/3/2019 Scaling Web Databases Webinar 2
50/62
Node Group 1 Node Group 2
JapanTanizakiJunichiro4
USAHemingwayErnest2
countrylnamefnameauthid (PK)
GermanyGoetheJohann3
FranceCamusAlbert1
countrylnamefnameauthid (PK)
Node Group 2
JapanTanizakiJunichiro4
GermanyGoetheJohan3
USAHemingwayErnest2
FranceCamusAlbert1
countrylnamefnameauthid (PK)
Dynamic scaling of arunning Cluster no
interruption to service
http://www.mysql.com/why-mysql/white-papers/mysql_wp_cluster7_architecture.php
Online Add Node (4) - delete rows
Application
Copyright 2011 Oracle Corporation 50
R l Ti O Li S h Ch
-
8/3/2019 Scaling Web Databases Webinar 2
51/62
Real-Time, On-Line Schema Changes
Fully online transactionresponse times unchanged
Add and remove indexes,add new columns and tables
No temporary table creation
No recreation of data ordeletion required
Faster and better performingtable maintenanceoperations
Less memory and diskrequirements
CREATE OFFLINE INDEX b ON t1(b);
Query OK, 1356 rows affected (2.20 sec)
DROP OFFLINE INDEX b ON t1;
Query OK, 1356 rows affected (2.03 sec)
CREATE ONLINE INDEX b ON t1(b);
Query OK, 0 rows affected (0.58 sec)
DROP ONLINE INDEX b ON t1;
Query OK, 0 rows affected (0.46 sec)
ALTER ONLINE TABLE t1 ADD COLUMN d INT;
Query OK, 0 rows affected (0.36 sec)
-
8/3/2019 Scaling Web Databases Webinar 2
52/62
Case Studies
Sh t C Pl tf
-
8/3/2019 Scaling Web Databases Webinar 2
53/62
53
Since deploying MySQL Cluster as our eCommerce database, we have had
continuous uptime with linear scalability enabling us to exceed our uptime requirements
Sean Collier, CIO & COO, Shopatron Inc
Shopatron: eCommerce Platform
Applications Ecommerce back-end, user authentication,
order data & fulfilment, payment data &inventory tracking. Supports severalthousand queries per second
Key business benefits Scale quickly and at low cost to meet
demand
Self-healing architecture, reducing TCO
Why MySQL? Low cost scalability
High read and write throughput
Extreme availability
http://www.mysql.com/why-mysql/case-studies/mysql_cs_shopatron.php
-
8/3/2019 Scaling Web Databases Webinar 2
54/62
COMPANY OVERVIEW
UK-based retail and wholesale ISP &Hosting Services
2010 awards for best home broadbandand customer service
Acquired by BT in 2007
CHALLENGES / OPPORTUNITIES
Enter market for wholesale services,demanding more stringent SLAs
Re-architect AAA systems for dataintegrity & continuous availability tosupport billing sytems
Consolidate data to for ease of reportingand operating efficiency
Fast time to market
SOLUTIONS
MySQL Cluster
MySQL Server with InnoDB
CUSTOMER PERSPECTIVESince deploying our latest AAA platform, the MySQL
environment has delivered continuous uptime,enabling us to exceed our most stringent SLAs
-- Geoff Mitchell Network Engineer
RESULTS
Continuous system availability, exceedingwholesale SLAs
2x faster time to market for new services
Agility and scale by separating database
from applications Improved management & infrastructure
efficiency through database consolidation
S
-
8/3/2019 Scaling Web Databases Webinar 2
55/62
Summary
MySQL Cluster
Web-Scale Performance with Carrier-Grade Availability SQL, JSON/REST, memcached protocol and native Java
access
No Compromise Scale-Out, Real Time Performance, 99.999% Uptime
Proven Deployed across telecoms networks
Powering mission-critical web and internet services
G tti St t d
-
8/3/2019 Scaling Web Databases Webinar 2
56/62
Getting Started
Learn More GA Release
Evaluate MySQL Cluster 7.2 Quick Start Guides
Architecture &New FeaturesGuidewww.mysql.com/cluster/
Download Today
http://dev.mysql.com/do
wnloads/cluster/
http://labs.mysql.com(memcached)
Linux, Solaris,
Windowshttp://tinyurl.com/5wkl4dy
Session Management Webinar: http://tinyurl.com/3dmtf9r
http://dev.mysql.com/downloads/cluster/http://dev.mysql.com/downloads/cluster/http://labs.mysql.com/http://labs.mysql.com/http://dev.mysql.com/downloads/cluster/http://dev.mysql.com/downloads/cluster/ -
8/3/2019 Scaling Web Databases Webinar 2
57/62
NDB API E ample
-
8/3/2019 Scaling Web Databases Webinar 2
58/62
NDB API Example
NdbTransaction *tx = ndb->startTransaction();NdbOperation *op = tx->getNdbOperation(myTable);
op->readTuple(NdbOperation::LM_CommittedRead);
op->equal("code", code);
op->getValue("name", name);
tx->execute( NdbTransaction::Commit );
ndb->closeTransaction(tx);
cout
-
8/3/2019 Scaling Web Databases Webinar 2
59/62
MySQL Cluster Connector for Java
New Domain Object Model PersistenceAPI (ClusterJ) :
Java API
High performance, low latency
Feature rich
JPA interface built upon this new Java
layer: Java Persistence API compliant
Uses ClusterJ where possible, reverts toJDBC for some operations
Higher performance than JDBC
More natural for most Java designers
Easier Cluster adoption for webapplications
Data Nodes
Network
JPA P f
-
8/3/2019 Scaling Web Databases Webinar 2
60/62
JPA Performance
Out of the Box Scalability: Data Partitioning
-
8/3/2019 Scaling Web Databases Webinar 2
61/62
Out of the Box Scalability: Data Partitioning
Data partitioned across Data Nodes
Rows are divided into partitions, based on a hash of all/part of the primarykey (you choose)
Each Data Node holds primary fragment for 1 partition Also stores secondary fragment of another partition
Records larger than 8KB stored as BLOBs
-
8/3/2019 Scaling Web Databases Webinar 2
62/62
COMPANY OVERVIEW
Division of Docudesk
Deliver Document Management SaaS
CHALLENGES / OPPORTUNITIES
Provide a single repository for customers tomanage, archive, and distribute documents
Implement scalable, fault tolerant, real timedata management back-end
PHP session state cached for in-servicepersonalization
Store document meta-data, text (asBLOBs), ACL, job queues and billing data
Data volumes growing at 2% per day
SOLUTION
MySQL Cluster deployed on EC2
USER PERSPECTIVEMySQL Cluster exceeds our requirements for low
latency, high throughput performance withcontinuous availability, in a single solution thatminimizes complexity and overall cost.
--Casey Brown, Manager of Dev & DBA Services,Docudesk
RESULTS
Successfully deployed documentmanagement solution, eliminating papertrails from legal processes
Integrate caching and database into onelayer, reducing complexity & cost
Support workload with 50:50 read/writeratio
Low latency for real-time user experienceand document time-stamping
Continuous database availability