scaling down couchdb - meet touchdb

13
TouchDB – scaling down CouchDB Stefan Baggström 20th Nov 2012

Upload: stefan-baggstroem

Post on 16-May-2015

1.530 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Scaling down CouchDB - Meet TouchDB

TouchDB – scaling down CouchDB

Stefan Baggström

20th Nov 2012

Page 2: Scaling down CouchDB - Meet TouchDB

Background

• We are a research team ”Felix” in TUT/BME developing new ICT solutions in the area of health and wellness technology

• We have built a system prototype with CouchDB technologies – to iterate the product concept rapidly– to pilot with potential customers

2

Page 3: Scaling down CouchDB - Meet TouchDB

Prototyping a wellness application with CouchDB• Goals for prototype:

– Can be used with any Internet devices– Good offline functionality

• Being agile:– Data model evolves across increments

• There is a schedule to meet:– Consider tech learning curves and

development time

3

Page 4: Scaling down CouchDB - Meet TouchDB

System to be built

4

Customer

Wellness Professional

Page 5: Scaling down CouchDB - Meet TouchDB

CouchDB

• CouchDB has some interesting features– JSON document storage – Distributed architecture– Eventual consistency– Bi-directional replication– Serving applications directly from database

• Scaling up - see e.g. BigCouch

5

http://couchdb.apache.org/

Page 6: Scaling down CouchDB - Meet TouchDB

CouchDB – scaling down

• There is CouchDB port for iOS and Android (Couchbase Mobile), but the project is dead– Erlang implementation as in CouchDB– Issues: size (~4MB) and slow startup (5-10s)

6

Source: http://www.funny-potato.com/

Page 7: Scaling down CouchDB - Meet TouchDB

Meet TouchDB• TouchDB is a lightweight

CouchDB-compatible database engine with similar REST API to CouchDB

• Replicates with CouchDB• iOS and Android ports

implemented with Objective-C / Java on top of SQLite

• Native language access via CouchCocoa / Ektorp

7https://github.com/couchbaselabs/TouchDB-iOS/wiki

Page 8: Scaling down CouchDB - Meet TouchDB

Personal Wellness App – What is needed and what not?

• Good enough performance for – Relatively small data sets (may have large

attachments)– A few relatively simple data queries– Good functionality when offline or with

intermittent connectivity

• Support for multi-device-ownership– Use with any device that suits your task and

context

12.04.2023 8

Page 9: Scaling down CouchDB - Meet TouchDB

Wellness Android app – Abstract architecture

9

Application Core

WebView with Java-JavaScript IF

Application UI – HTML5 with JQuery Mobile

TouchDB library

TouchDB – http listener

Android - SQLiteAndroid – MM APIs

Android – BT API

Android – Java VM

TouchDB - Ektorp

Page 10: Scaling down CouchDB - Meet TouchDB

Time for scaled down demo?

10

Page 11: Scaling down CouchDB - Meet TouchDB

How do we use TouchDB? (1/2)

• All documents defined with ”type” property– Database schema emerging

• Using Java Ektorp API for document CRUD• Using HTTP API for application resources

and views– Implemented home brewn access control

• Database provides changes feed– Used to trigger notifications and other actions

11

Page 12: Scaling down CouchDB - Meet TouchDB

How do we use TouchDB? (2/2)

• Single responsive HTML5 application for desktops, tablets, and smart phones– CouchApp used for deployment to CouchDB

• Initial replication in foreground during first time use, and then continuous replication in background

• Data model evolves all the time

12

Page 13: Scaling down CouchDB - Meet TouchDB

TouchDB for wellness appPros• Offline functionality

– All transactions are always fast & predictable as they are local transactions

• Replication– Data– Applications– Supports filtered replication

• NoSQL is supports incremental development

• Meets performance requirements of a personal database

• JavaScript in server and clients

Cons• Immature at the moment

– iOS port just got v1.0 status, Android port is behind iOS

– Small development community

• Fragile security– HTTP API is accessible by

other Android applications within device - better control if used only via Java/Ektorp

• Lack of C/TouchDB professionals out there

13