More Related Content Similar to NoSQL and SQL - Why Choose? Enjoy the best of both worlds with MySQL (20) More from Andrew Morgan (15) NoSQL and SQL - Why Choose? Enjoy the best of both worlds with MySQL1. NoSQL
and
SQL:
The
Best
of
Both
Worlds
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
Andrew
Morgan
@andrewmorgan
clusterdb.com
18th
November
2014
2. Safe
Harbor
Statement
The
following
is
intended
to
outline
our
general
product
direcPon.
It
is
intended
for
informaPon
purposes
only,
and
may
not
be
incorporated
into
any
contract.
It
is
not
a
commitment
to
deliver
any
material,
code,
or
funcPonality,
and
should
not
be
relied
upon
in
making
purchasing
decisions.
The
development,
release,
and
Pming
of
any
features
or
funcPonality
described
for
Oracle’s
products
remains
at
the
sole
discrePon
of
Oracle.
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
4. Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
Session
Agenda
• NoSQL
–
What
are
people
looking
for?
• RDBMS
–
What
advantages
do
they
sPll
have?
• How
MySQL
Delivers
the
Best
of
Both
Worlds
– MySQL
Cluster
• NoSQL
aXributes:
Scale-‐out,
performance,
ease-‐of-‐use,
schema
flexibility,
on-‐line
operaPons
• NoSQL
APIs
– Key-‐Value
store
access
to
InnoDB
(Memcached)
5. Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
Types
of
NoSQL
stores
Key-‐Value
• Cassandra
• Memcached
• BigTable
• Hadoop
• Voldermort
Document
• MongoDB
• CouchDB
Graph
• Neo4J
• FlockDB
6. Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
Key-‐Value
Store
8. Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
Graph
Database
9. Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
• Massive
scalability
– No
applicaPon-‐level
sharding
• Performance
• High
Availability/Fault
Tolerance
• Ease
of
use
– Simple
operaPons/administraPon
– Simple
APIs
– Quickly
evolve
applicaPon
&
schema
Scalability
Performance
HA
Ease
of
use
What
NoSQL
must
deliver
11. Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
NoSQL
Simple
access
paXerns
Compromise
on
consistency
for
performance
Ad-‐hoc
data
format
Simple
operaPon
SQL
Complex
queries
with
joins
ACID
transacPons
Well
defined
schemas
Rich
set
of
tools
• No
best
single
soluPon
fits
all
• Mix
and
match
SPll
a
role
for
SQL
(RDBMS)?
Scalability
Performance
HA
Ease
of
use
SQL/Joins
ACID
Transac>ons
12. The
TemptaPon
to
Jejson
RelaPonal
Model
• RelaPonal
commenter
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
Model:
– Data
stored
in
mulPple
tables
– Many
lookups
to
retrieve
a
user’s
Pmeline
– Is
it
worth
the
effort
in
sejng
up
this
complex
data
model?
• Simpler
just
to
store
as
one
document?
The
allure
of
document
stores
Examples
borrowed
from
@sarahmei
one
hXps://speakerdeck.com/sarahmei/switching-‐data-‐stores-‐a-‐postmodern-‐comedy
user
friend
post
comment
like
liker
many
many
many
one
many
13. The
TemptaPon
to
Jejson
RelaPonal
Model
• Document
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
Model:
– EnPre
Pmeline
in
a
single
document
(row)
– Single
lookup
to
retrieve
the
user’s
Pmeline
– Brilliantly
efficient
model
when
the
document
truly
contains
self-‐
contained
informaPon
• Like
a
real-‐world
document!
The
allure
of
document
stores
{name: ‘Joe’,
url: ‘http://clusterdb.com’,
stream:[
{friend:{
name: ‘Jane’,
posts:[{content: ‘…’,
comments:[
{comment: ‘…’,
commenter: ‘Joe’},
{…}
],
likes: [‘Joe’, ‘Fred’, ‘Billy’]
},
{…},{…},…
]
}, {…},{…},…
}
15. The
TemptaPon
to
Jejson
RelaPonal
Model
• These
are
all
people
who
have
their
own
data
that
users
will
want
to
view
or
click
through:
– Name
– url
– Timeline
• Easy
to
represent
with
FKs
in
a
relaPonal
model
commenter
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
But
when
the
data
isn’t
self
contained…
user
friend
post
comment
one
like
liker
many
many
many
one
many
16. The
TemptaPon
to
Jejson
RelaPonal
Model
• Do
I
store
all
data
for
all
friends
and
likers
again
at
every
point
they
appear
in
the
document?
• Massive
amount
of
repeated
data
– Wasted
space
– Needs
to
be
kept
in
sync
(and
you
don’t
have
transacPons
to
provide
consistency)
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
The
allure
of
document
stores
{name: ‘Joe’,
url: ‘http://clusterdb.com’,
stream:[
{friend:{
name: ‘Jane’,
posts:[{content: ‘…’,
comments:[
{comment: ‘…’,
commenter: ‘Joe’},
{…}
],
likes: [‘Joe’, ‘Fred’, ‘Billy’]
},
{…},{…},…
]
}, {…},{…},…
}
18. The
TemptaPon
to
Jejson
RelaPonal
Model
• The
reality
is
that
the
developer
will
store
the
user-‐ids
instead
• Developer
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
is
responsible
for
implemenPng
‘joins’
in
the
applicaPon
– e.g.
scanning
all
Pmelines
for
where
a
user
made
a
comment
or
liked
a
post
• No
transacPons
to
ensure
consistency
between
documents
The
allure
of
document
stores
{name: 83746251,
url: ‘…’
stream:[
{friend:{
name: 9384726153,
posts:[{content: ‘…’,
comments:[
{comment: ‘…’,
commenter: 83746251},
{…}
],
likes: [83746251, 750730283,
2938493820]
},
{…},{…},…
]
}, {…},{…},…
}
19. The
TemptaPon
to
Jejson
RelaPonal
Model
• Each
aXribute’s
labels
are
stored
in
every
document
– More
wasted
space
– Developers
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
compensate
by
replacing
with
short
names
The
allure
of
document
stores
{n5: 83746251,
u2: ‘…’
s1:[
{f2:{
n5: 9384726153,
p4:[{c4: ‘…’,
c3:[
{c2: ‘…’,
c8: 83746251},
{…}
],
l5: [83746251, 750730283,
2938493820]
},
{…},{…},…
]
}, {…},{…},…
}
21. Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
MySQL
Cluster
Overview
• Auto-‐Sharding,
MulP-‐Master
• ACID
Compliant,
OLTP
+
Real-‐Time
AnalyPcs
HIGH
SCALE,
READS
+
WRITES
• Shared
nothing,
no
Single
Point
of
Failure
• Self
Healing
99.999%
AVAILABILITY
+
On-‐Line
OperaPons
• In-‐Memory
OpPmizaPon
+
Disk-‐Data
REAL-‐TIME
• Predictable
Low-‐Latency,
Bounded
Access
Time
• Key/Value
+
Complex,
RelaPonal
Queries
SQL
+
NoSQL
• SQL
+
Memcached
+
JavaScript
+
Java
+
HTTP/REST
&
C++
• Open
Source
+
Commercial
EdiPons
LOW
TCO
• Commodity
hardware
+
Management,
Monitoring
Tools
22. Who’s
Using
MySQL
Cluster?
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
23. MySQL
Cluster
Architecture
MySQL
Cluster
Data
Nodes
Clients
ApplicaPon
Layer
Data
Layer
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
24. Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
MySQL
Cluster
Scaling
MySQL
Cluster
Data
Nodes
Clients
ApplicaPon
Layer
Data
Layer
26. Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
MySQL
Cluster
HA
MySQL
Cluster
Data
Nodes
Clients
ApplicaPon
Layer
Data
Layer
27. Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
On-‐line
OperaPons
• Scale
the
cluster
(add
&
remove
nodes
on-‐line)
• ReparPPon
tables
• Upgrade
/
patch
servers
&
OS
• Upgrade
/
patch
MySQL
Cluster
• Back-‐Up
• Evolve
the
schema
on-‐line,
in
real-‐Pme
30. 1.2
Billion
UPDATEs
per
Minute
• NoSQL
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
C++
API,
flexaSynch
benchmark
• 30
x
Intel
E5-‐2600
Intel
Servers,
2
socket,
64GB
• ACID
TransacPons,
with
Synchronous
ReplicaPon
25
Millions of UPDATEs per Second MySQL Cluster Data Nodes
20
15
10
5
0
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
31. Query Execution Time Seconds
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
Join
Performance
100
90
80
70
60
50
40
30
20
10
• Web-‐Based
87.23
seconds
Content
Management
System
– JOINs
11-‐tables,
33.5k
rows
– Returns
2k
rows,
19
columns
per
row
0
MySQL Cluster 7.1 MySQL Cluster 7.2
1.26
seconds
70x
Faster
Scalability
!"
Performance
!"
HA
!"
Ease
of
use
SQL/Joins
!"
ACID
Transac>ons
!"
32. MySQL Cluster 7.4.1 DMR
Better performance and operational simplicity
9000"
8000"
7000"
6000"
5000"
4000"
3000"
2000"
1000"
Sysbench)R/W)
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
10000"
9000"
8000"
7000"
6000"
5000"
4000"
3000"
2000"
1000"
• Performance
Sysbench)RO)
gain
over
7.3
– 47%
(Read-‐Only)
– 38%
(Read-‐Write)
0"
64" 128" 256" 512"
Transac'on)per)second)
Threads)
7.4.0"
7.3.5"
7.2.16"
0"
64" 128" 256" 512"
Transac'ons)per)second)
Threads)
7.4.0"
7.3.5"
7.2.16"
• Faster
node
restarts
34. CreaPng
&
running
your
first
Cluster
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
Download
&
Extract
• edelivery.oracle.com
• www.mysql.com
• dev.mysql.com
Configure
• Cluster-‐wide
“config.ini”
• Per-‐mysqld
“my.cnf”
Start
processes
• Management
Nodes
• Data
Nodes
• MySQL
Servers
35. Scalability
!"
Performance
!"
HA
!"
Ease
of
use
!"
SQL/Joins
!"
ACID
Transac>ons
!"
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
37. MySQL
Cluster
Auto-‐Installer
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
• Fast
configuraPon
• Auto-‐discovery
• Workload
opPmized
• Repeatable
best
pracPces
Specify
Workload
Auto-‐
Discover
Define
Deploy
Topology
39. MySQL
Cluster
Manager
1. Download
MCM/Cluster
package
from
edelivery.oracle.com:
2. Unzip
3. Run
agent,
define,
create
&
start
Cluster!
$> binmcmd --bootstrap
MySQL Cluster Manager 1.1.2 started
Connect to MySQL Cluster Manager by running "D:AndrewDocumentsMySQLmcmbinmcm" -a NOVA:1862
Configuring default cluster 'mycluster'...
Starting default cluster 'mycluster'...
Cluster 'mycluster' started successfully
ndb_mgmd NOVA:1186
ndbd NOVA
ndbd NOVA
mysqld NOVA:3306
mysqld NOVA:3307
ndbapi *
Connect to the database by running "D:AndrewDocumentsMySQLmcmclusterbinmysql" -h NOVA -P 3306 -u root
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
40. Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
MCM:
Upgrade
Cluster
mysql> upgrade cluster
--package=7.3 mycluster;
41. Scalability
!"
Performance
!"
HA
!"
Ease
of
use
!"
SQL/Joins
!"
ACID
Transac>ons
!"
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
44. 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
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
Memcached
MySQL
JNI
Node.JS
mod_ndb
ndb_eng
NDB
API
(C++)
MySQL
Cluster
Data
Nodes
45. Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
Schema-‐Free
apps
• Rapid
applicaPon
evoluPon
– New
types
of
data
constantly
added
– No
Pme
to
get
schema
extended
– Missing
skills
to
extend
schema
– IniPally
roll
out
to
just
a
few
users
– Constantly
adding
to
live
system
46. Cluster
&
Memcached
–
Schema-‐Free
key
value
<town:maidenhead,SL6>
key
value
<town:maidenhead,SL6>
Key
Value
town:maidenhead
SL6
generic
table
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
ApplicaPon
view
SQL
view
47. Cluster
&
Memcached
-‐
Configured
Schema
key
value
<town:maidenhead,SL6>
prefix
key
value
<town:maidenhead,SL6>
Prefix
Table
Key-‐col
Val-‐col
policy
town:
map.zip
town
code
cluster
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
Config
tables
town
...
code
...
maidenhead
...
SL6
...
map.zip
ApplicaPon
view
SQL
view
48. MySQL
5.6
Memcached
with
InnoDB
80000
70000
60000
50000
40000
30000
20000
10000
0
8 32 128 512
TPS
SQL
Memcached
Protocol
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
Client Connections
Memcached API
SQL
Clients
and
Applica>ons
MySQL
Server
Memcached
Plug-‐in
innodb_
memcached
local
cache
(opPonal)
Handler
API
InnoDB
API
InnoDB
Storage
Engine
mysqld
process
Up
to
9x
Higher
“SET
/
INSERT”
Throughput
49. Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
Node.js
NoSQL
API
• NaPve
JavaScript
access
to
MySQL
Cluster
– End-‐to-‐End
JavaScript:
browser
to
the
app
&
DB
– Storing
and
retrieving
JavaScript
objects
directly
in
MySQL
Cluster
– Eliminate
SQL
transformaPon
• Implemented
as
a
module
for
node.js
– Integrates
Cluster
API
library
within
the
web
app
• Couple
high
performance,
distributed
apps,
with
high
performance
distributed
database
• OpPonally
routes
through
MySQL
Server
– Use
with
InnoDB
V8 JavaScript Engine
MySQL Cluster Node.js Module
MySQL Cluster Data Nodes
Clients
50. NoSQL
API
for
Node.js
&
FKs
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
FKs
enforced
on
all
APIs:
{ message: 'Error',
sqlstate: '23000',
ndb_error: null,
cause:
{message: 'Foreign key constraint violated: No parent row found [255]',
sqlstate: '23000',
ndb_error:
{ message: 'Foreign key constraint violated: No parent row found',
code: 255,
classification: 'ConstraintViolation',
handler_error_code: 151,
status: 'PermanentError' },
cause: null } }
51. Oracle University MySQL Training Services
Prepare Your Organization to Enable Reliable and High-Performance Web-Based Database Applications
Top Courses for Administrators and Developers
Top Certifications
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
“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
RECENTLY
RELEASED
!!ALL
NEW!!
MySQL
Cluster
Training
To
Register
your
interest
to
influence
the
schedule
on
this
newly
released
course
–
go
to
educaPon.oracle.com/mysql
and
click
on
the
MySQL
Cluster
Course
52. • Tomas
Ulin
– Vice
President
of
the
MySQL
Engineering
Team
• Oracle
DBAs,
Make
the
Most
of
MySQL
• Wednesday
11:00-‐11:45
MySQL
Keynote
@
DOAG2014
Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
53. Copyright
©
2014,
Oracle
and/or
its
affiliates.
All
rights
reserved.
|
Next
Steps
Learn
More
• www.mysql.com/cluster
• AuthenPc
MySQL
Curriculum:
hXp://oracle.com/educaPon/mysql
Try
it
Out
• dev.mysql.com/downloads/cluster/
Let
us
know
what
you
think
• clusterdb.com
• @clusterdb
• forums.mysql.com/list.php?25