1
Couchbase
Mobile
Update
Jens
Al(e
Mobile
Engineering
Peer
[email protected]
Feb
20,
2013
Wednesday, February 20, 13
Slide 2
Slide 2 text
2
The
Story
So
Far
• 2011:
First
GeneraFon
– CouchDB
ported
to
iOS/Android
– CouchCocoa
(iOS
client
API)
• 2012:
R&D
– TouchDB
– Syncpoint
• 2013:
Second
GeneraFon
– Couchbase
Lite
– Sync
Gateway
Wednesday, February 20, 13
Slide 3
Slide 3 text
3
CLIENT-‐SIDE
Wednesday, February 20, 13
Slide 4
Slide 4 text
Applica'on
Code
2011:
Couchbase
Mobile
Couchbase
Mobile
Erlang JavaScript
CouchDB
CouchCocoa
/
Ektorp
Mobile
App
}~3.5MB ~3sec
startup
DEPRECATED
Wednesday, February 20, 13
Slide 5
Slide 5 text
Applica'on
Code
2012:
TouchDB
TouchDB
SQLite
CouchCocoa
/
Ektorp
Mobile
App
}~0.8MB ~0.1sec
startup
STABLE
Wednesday, February 20, 13
Slide 6
Slide 6 text
Applica'on
Code
2013:
Couchbase
Lite
Couchbase
Lite
SQLite
Mobile
App
} ~0.5MB ~0.1sec
startup
aka
“TouchDB
1.5”
PRE-ALPHA
Faster
throughput
Wednesday, February 20, 13
Slide 7
Slide 7 text
7
SERVER-‐SIDE
Wednesday, February 20, 13
Slide 8
Slide 8 text
Current
Status
• Mobile
clients
sync
with
Apache
CouchDB
– Open
protocol
– REST-‐based
– MulFple
providers
• This
made
sense
for
Couchbase
in
2011,
but
not
today
– Couchbase
Single
Server
no
longer
exists
– Couchbase
Server
2
is
not
CouchDB-‐compaFble
8
Wednesday, February 20, 13
Slide 9
Slide 9 text
Server-‐Side
Goals
9
• ConnecFvity
with
Couchbase
Server
• Scaling
to
large
numbers
of
users
• Filtering
server-‐side
data
sets
– For
size
– For
access
control
Wednesday, February 20, 13
Slide 10
Slide 10 text
ConnecFng
To
Couchbase
Server
• Server’s
naFve
protocol
is
for
app
servers,
not
clients
– No
access
control
– No
validaFon
– Binary
memcached
protocol
• CouchDB
sync
protocol
is
great
for
client/server
• SoluFon:
Add
a
gateway
between
client
and
server
10
Sync
Gateway
memcached
CouchSync
Wednesday, February 20, 13
Slide 11
Slide 11 text
Database-‐Per-‐User
Doesn’t
Scale
11
Wednesday, February 20, 13
Slide 12
Slide 12 text
Database-‐Per-‐User
Doesn’t
Scale
12
Wednesday, February 20, 13
Slide 13
Slide 13 text
Instead,
share
a
single
database
13
Wednesday, February 20, 13
Slide 14
Slide 14 text
Filtered
ReplicaFon
• Data
Scalability
– Replicate
only
docs
relevant
to
the
client
– “Only
sales
data
for
California
region”
• Access
Control
– Replicate
only
docs
visible
to
the
client
– “Only
pages
of
wikis
I’m
invited
to”
• These
don’t
work
with
the
CouchDB
model
– Filtered
replicaFon
is
inefficient
– No
per-‐document
access
control
14
Wednesday, February 20, 13
Slide 15
Slide 15 text
CHANNELS
Efficient
Filtering
by
Indexing
15
Wednesday, February 20, 13
Slide 16
Slide 16 text
App
Server
Tags
Documents
On
Entry
16
function(doc) {
sync(doc.dept);
if (doc.dept == ”Sales”)
sync(doc.state);
}
{ “dept”: “Sales”,
“state”: “CA”,
“date”: “2013-02-19”
...
CA
Sales
R&D
Sales
WA
Wednesday, February 20, 13
Slide 17
Slide 17 text
Docs
Are
Indexed
By
Channel
17
Sales CA WA
R&D Feb jens
Wednesday, February 20, 13
Slide 18
Slide 18 text
Apps
Sync
From
A
Set
Of
Channels
18
Sales CA WA
RnD Feb jens
jens
Wednesday, February 20, 13
Slide 19
Slide 19 text
…But
Have
Limited
Access
19
Sales CA WA
RnD Feb jens
jens
“jens”: [“jens”,“Sales”]
Wednesday, February 20, 13
Slide 20
Slide 20 text
Current
Status
20
• Pre-‐alpha!
– github.com/couchbase/couchbase-‐lite-‐ios
– github.com/couchbaselabs/sync_gateway
• Preview
in
the
spring
• Scalable
beta
in
summer
• TargeFng
release
by
end
of
2013
Wednesday, February 20, 13
Slide 21
Slide 21 text
21
–github.com/couchbase/couchbase-‐lite-‐ios
–github.com/couchbaselabs/sync_gateway
–groups.google.com/mobile-‐couchbase
Wednesday, February 20, 13