2. Lorraine JUG - 19-JUN-2013
Send
a
mail
to:
winning@couchbase.com
LorraineJUG
in
the
subject...
Join
the
French
Couchbase
Meetup
h3p://www.meetup.com/Couchbase-‐France/
Thursday, June 20, 13
3. Lorraine JUG - 19-JUN-2013
Introduc)on
to
NoSQL
with
Couchbase
Tugdual
Grall
Technical
Evangelist
Thursday, June 20, 13
4. Lorraine JUG - 19-JUN-2013
About
me...
• Tugdual
“Tug”
Grall
Couchbase
• Technical
Evangelist
eXo
• CTO
Oracle
• Developer/Product
Manager
Mainly
Java/SOA
Developer
in
consul)ng
firms
• Web
@tgrall
hIp://blog.grallandco.com
tgrall
NantesJUG
co-‐founder
Pet
Project
:
hIp://www.resultri.com
Thursday, June 20, 13
5. Lorraine JUG - 19-JUN-2013
Agenda
• Why
NoSQL
?
• NoSQL
Landscape
• Document
Design
• Use
Cases
• Couchbase
Server
2.0
Thursday, June 20, 13
6. Lorraine JUG - 19-JUN-2013
$30B
Database
Market
Being
Disrupted
<50%?
2027
95%
RelaVonal
Technology
2012
All
new
database
growth
will
be
NoSQL
RelaVonal
Technology
RelaVonal
Technology
RelaVonal
Technology
NoSQL
Technology
Other
Thursday, June 20, 13
7. Lorraine JUG - 19-JUN-2013
Three
Macro
Trends
Driving
DisrupVon
Big
Data
SaaS/Cloud
CompuVngBig
Users
Thursday, June 20, 13
8. Lorraine JUG - 19-JUN-2013
Smartphone
UsersHours
Spent
Online
35Billion
Hours
1Billion
+
Global
Online
PopulaVon
2Billion
+
Thursday, June 20, 13
9. Lorraine JUG - 19-JUN-2013
Big
Data
High
Data
Variety
and
Velocity
Source:
IDC
2011
Digital
Universe
Study
(hIp://www.emc.com/collateral/demos/microsites/emc-‐digital-‐universe-‐2011/index.htm)
Trillions
of
Gigabytes
(ZeIabytes)
0
0.50
1.00
1.50
2.00
2000 2006 2011
Unstructured
and
Semi-‐
Structured
Data
Structured
Data
Text,
Log
Files,
Click
Streams,
Blogs,
Tweets,
Audio,
Video,
etc.
More
Flexible
Data
Model
Required
Thursday, June 20, 13
10. Lorraine JUG - 19-JUN-2013
RDBMS
are
not
Enough?
Thursday, June 20, 13
11. Lorraine JUG - 19-JUN-2013
Growth
is
the
New
Reality
• Instagram
gained
nearly
1
million
users
overnight
when
then
expanded
to
Android
Thursday, June 20, 13
13. Lorraine JUG - 19-JUN-2013
RDBMS
is
good
for
many
thing,
but
hard
to
scale
RDBMS
Scales
Up
Get
a
bigger,
more
complex
server
Users
ApplicaVon
Scales
Out
Just
add
more
commodity
web
servers
Users
System
Cost
Applica)on
Performance
RelaVonal
Database
Web/App
Server
Tier
System
Cost
Applica)on
Performance
Won’t
scale
beyond
this
point
How
do
you
take
this
growth?
Thursday, June 20, 13
14. Lorraine JUG - 19-JUN-2013
Web/App
Server
Tier
Memcached
Tier
MySQL
Tier
Scaling
out
RDBMS
• Run
Many
SQL
Servers
• Data
could
be
sharded
Done
by
the
applica)on
code
• Caching
for
faster
response
Vme
Thursday, June 20, 13
15. Lorraine JUG - 19-JUN-2013
Scaling
out
flafens
the
cost
and
performance
curves
NoSQL
Database
Scales
Out
Cost
and
performance
mirrors
app
Ver
Users
NoSQL
Distributed
Data
Store
Web/App
Server
Tier
ApplicaVon
Scales
Out
Just
add
more
commodity
web
servers
Users
System
Cost
Applica)on
Performance
Applica)on
Performance
System
Cost
NoSQL
Technology
Scales
Out
Thursday, June 20, 13
16. Lorraine JUG - 19-JUN-2013
Dynamo
October
2007
Cassandra
August
2008
Bigtable
November
2006
Voldemort
February
2009
Very
few
organizaVons
want
to
(fewer
can)
build
and
maintain
database
sojware
technology.
But
every
organizaVon
building
interacVve
web
applicaVons
needs
this
technology.
A
New
Technology?
• Building
new
database
to
answer
the
following
requirements
No
schema
required
before
inser)ng
data
No
schema
change
required
to
change
data
format
Auto-‐sharding
without
applica)on
par)cipa)on
Distributed
queries
Integrated
main
memory
caching
Data
synchroniza)on
(
mul)-‐datacenter)
Thursday, June 20, 13
17. Lorraine JUG - 19-JUN-2013
Lack
of
flexibility/
rigid
schemas
Inability
to
scale
out
data Performance
challenges Cost All
of
these Other
49%
35%
29%
16%
12%
11%
What
Is
Biggest
Data
Management
Problem
Driving
Use
of
NoSQL
in
Coming
Year?
Source:
Couchbase
Survey,
December
2011,
n
=
1351.
Thursday, June 20, 13
19. Lorraine JUG - 19-JUN-2013
OperaVonal
vs.
AnalyVc
Databases
Cloudera
Hortonworks
Mapr
Couchbase
MongoDB
Cassandra
Hbase
Analy9c
Databases
Get
insights
from
data
Real-‐9me,
Interac9ve
Databases
Fast
access
to
data
NoSQL
Thursday, June 20, 13
21. Lorraine JUG - 19-JUN-2013
Use
Cases
Key
Value •
Session
Management
•
User
Profile/Preferences
•
Shopping
Cart
Document •
Event
Logging
•
Content
Management
•
Web
AnalyFcs
•
E-‐Commerce
ApplicaFon
Columns •
Event
Logging
•
Content
Management
•
Counters
Graph •
Connected
Data
/
Social
Networks
•
RouFng,
Dispatch
•
RecommendaFons
based
on
Social
Graph
Thursday, June 20, 13
22. Lorraine JUG - 19-JUN-2013
Data
Models
Thursday, June 20, 13
23. Lorraine JUG - 19-JUN-2013
RelaVonal
vs
Document
Data
Model
RelaVonal
data
model Document
data
model
Collec)on
of
complex
documents
with
arbitrary,
nested
data
formats
and
varying
“record”
format.
Highly-‐structured
table
organiza)on
with
rigidly-‐defined
data
formats
and
record
structure.
C1 C2 C3 C4
JSON
JSON
JSON
{
}
Thursday, June 20, 13
24. Lorraine JUG - 19-JUN-2013
The
RelaVonal
Approach
to
Storing
Data
Rela)onal
databases
were
not
designed
with
clusters
in
mind,
which
is
why
people
have
cast
around
for
an
alterna)ve.
Storing
aggregates
as
fundamental
units
makes
a
lot
of
sense
for
running
on
a
cluster.
hIp://mar)nfowler.com/bliki/AggregateOrientedDatabase.html
Thursday, June 20, 13
25. Lorraine JUG - 19-JUN-2013
Document
Database
by
Comparison
o::1001
{
uid: “ji22jd”,
customer: “Ann”,
line_items: [
{ sku: 0321293533, quan: 2, unit_price:
48.0 },
{ sku: 0321601912, quan: 1, unit_price:
39.0 },
{ sku: 0131495054, quan: 1, unit_price: 51.0 }
],
payment: {
type: “Amex”,
expiry: “04/2001”,
last5: 12345
}
}
Easy
to
distribute
data
Makes
sense
to
applicaFon
programmers
Thursday, June 20, 13
26. Lorraine JUG - 19-JUN-2013
Objects
Serialized
to
JSON
and
Back
User
Object
string uid
string firstname
string lastname
int age
array favorite_colors
string email
u::john@couchbase.com
{
“uid”:
123456,
“firstname”:
“John”,
“lastname”:
“Smith”,
“age”:
22,
“favorite_colors”:
[“blue”,
“black”],
“email”:
“john@couchbase.com”
}
User
Object
string uid
string firstname
string lastname
int age
array favorite_colors
string email
u::john@couchbase.com
{
“uid”:
123456,
“firstname”:
“john”,
“lastname”:
“smith”,
“age”:
22,
“favorite_colors”:
[“blue”,
“black”],
“email”:
“john@couchbase.com”
}
set()
get()
Thursday, June 20, 13
27. Lorraine JUG - 19-JUN-2013
Use
Cases
Thursday, June 20, 13
28. Lorraine JUG - 19-JUN-2013
Common
Use
Cases
Social
Gaming
• Couchbase
stores
player
and
game
data
• Examples
customers
include:
Zynga
• Tapjoy,
Ubisor,
Tencent
Mobile
Apps
• Couchbase
stores
user
info
and
app
content
• Examples
customers
include:
Kobo,
Play)ka
Ad
TargeVng
• Couchbase
stores
user
informa)on
for
fast
access
• Examples
customers
include:
AOL,
Mediamind,
Convertro
Session
store
• Couchbase
Server
as
a
key-‐
value
store
• Examples
customers
include:
Concur,
Sabre
User
Profile
Store
• Couchbase
Server
as
a
key-‐
value
store
• Examples
customers
include:
Tunewiki
High
availability
cache
• Couchbase
Server
used
as
a
cache
)er
replacement
• Examples
customers
include:
Orbitz
Content
&
Metadata
Store
• Couchbase
document
store
with
Elas)c
Search
• Examples
customers
include:
McGraw
Hill
3rd
party
data
aggregaVon
• Couchbase
stores
social
media
and
data
feeds
• Examples
customers
include:
Sambacloud
Thursday, June 20, 13
30. Lorraine JUG - 19-JUN-2013
Couchbase
Server
NoSQL
Document
Database
Thursday, June 20, 13
31. Lorraine JUG - 19-JUN-2013
Easy
Scalability Consistent
High
Performance
Always
On
24x365
Grow
cluster
without
applica)on
changes,
without
down)me
with
a
single
click
Consistent
sub-‐millisecond
read
and
write
response
)mes
with
consistent
high
throughput
No
down)me
for
sorware
upgrades,
hardware
maintenance,
etc.
Flexible
Data
Model
JSON
document
model
with
no
fixed
schema.
Couchbase
Server
Thursday, June 20, 13
32. Lorraine JUG - 19-JUN-2013
Open
Source
Project
Thursday, June 20, 13
33. Lorraine JUG - 19-JUN-2013
Couchbase
Handles
Real
World
Scale
Thursday, June 20, 13
34. Lorraine JUG - 19-JUN-2013
Heartbeat
Process
monitor
Global
singleton
supervisor
Configura)on
manager
on
each
node
Rebalance
orchestrator
Node
health
monitor
one
per
cluster
vBucket
state
and
replica)on
manager
hSp
REST
management
API/Web
UI
HTTP
8091
Erlang
port
mapper
4369
Distributed
Erlang
21100
-‐
21199
Erlang/OTP
storage
interface
Couchbase
EP
Engine
11210
Memcapable
2.0
Moxi
11211
Memcapable
1.0
Memcached
New
Persistence
Layer
8092
Query
API
Query
Engine
Data
Manager Cluster
Manager
Couchbase
Server
Architecture
Thursday, June 20, 13
35. Lorraine JUG - 19-JUN-2013
Heartbeat
Process
monitor
Global
singleton
supervisor
Configura)on
manager
on
each
node
Rebalance
orchestrator
Node
health
monitor
one
per
cluster
vBucket
state
and
replica)on
manager
hSp
REST
management
API/Web
UI
HTTP
8091
Erlang
port
mapper
4369
Distributed
Erlang
21100
-‐
21199
Erlang/OTP
storage
interface
Couchbase
EP
Engine
11210
Memcapable
2.0
Moxi
11211
Memcapable
1.0
Memcached
New
Persistence
Layer
8092
Query
API
Query
Engine
Couchbase
Server
Architecture
Thursday, June 20, 13
36. Lorraine JUG - 19-JUN-2013
Couchbase
Opera)ons
Thursday, June 20, 13
37. Lorraine JUG - 19-JUN-2013
33 2
Single
node
-‐
Couchbase
Write
Opera)on
Managed
Cache
Disk
Queue
Disk
Replica)on
Queue
App
Server
Couchbase
Server
Node
Doc
1Doc
1
Doc
1
To
other
node
Thursday, June 20, 13
38. Lorraine JUG - 19-JUN-2013
COUCHBASE
SERVER
CLUSTER
Basic
Opera)on
• Docs
distributed
evenly
across
servers
• Each
server
stores
both
ac9ve
and
replica
docs
Only
one
server
ac)ve
at
a
)me
• Client
library
provides
app
with
simple
interface
to
database
• Cluster
map
provides
map
to
which
server
doc
is
on
App
never
needs
to
know
• App
reads,
writes,
updates
docs
• Mul9ple
app
servers
can
access
same
document
at
same
9me
User
Configured
Replica
Count
=
1
READ/WRITE/UPDATE
ACTIVE
SERVER
1
ACTIVE
Doc
4
Doc
7
Doc
Doc
Doc
SERVER
2
Doc
8
ACTIVE
Doc
1
Doc
2
Doc
Doc
Doc
REPLICA
Doc
4
Doc
1
Doc
8
Doc
Doc
Doc
REPLICA
Doc
6
Doc
3
Doc
2
Doc
Doc
Doc
REPLICA
Doc
7
Doc
9
Doc
5
Doc
Doc
Doc
SERVER
3
Doc
6
Doc
5
Doc
2
Doc
Doc
DocDoc
9
APP
SERVER
1
COUCHBASE
Client
Library
CLUSTER
MAP
COUCHBASE
Client
Library
CLUSTER
MAP
APP
SERVER
2
Thursday, June 20, 13
39. Lorraine JUG - 19-JUN-2013
Client
SDK
www.couchbase.com/develop
Clojure
Python
Ruby
libcouchbase
Go
Thursday, June 20, 13
40. Lorraine JUG - 19-JUN-2013
Demo
Time
Thursday, June 20, 13
41. Lorraine JUG - 19-JUN-2013
Cross
Data
ReplicaVon
US
DATA
CENTER EUROPE
DATA
CENTER ASIA
DATA
CENTER
Replica9on Replica9on
Replica9on
• Data
close
to
users
• MulVple
locaVons
for
disaster
recovery
• Independently
managed
clusters
serving
local
data
Thursday, June 20, 13
42. Lorraine JUG - 19-JUN-2013
www.couchbase.com/download
Couchbase
Server
Thursday, June 20, 13
43. Lorraine JUG - 19-JUN-2013
Q
&
A
Meetup
hIp://meetup.com/Couchbase-‐France/
Contacts
@tgrall
/
tug@couchbase.com
Thursday, June 20, 13
44. Lorraine JUG - 19-JUN-2013
Thank
you!
tug@couchbase.com
@tgrall
Join
the
French
Couchbase
Meetup
h3p://www.meetup.com/Couchbase-‐France/
Thursday, June 20, 13