74
CouchDB Apache

CouchDB - Local Web Platform

Embed Size (px)

DESCRIPTION

This is the first time I gave this particular talk. The focus is CouchDB as a Local Web Platform. It was given at the Google Tech Talk. The video is here: http://www.youtube.com/watch?v=ESDBM9-U804

Citation preview

Page 1: CouchDB - Local Web Platform

CouchDBApache

Page 2: CouchDB - Local Web Platform

HelloChris Anderson

[email protected] / @jchris

Apache CouchDB Committer

REST and JavaScript enthusiastDirector, couch.io

Page 3: CouchDB - Local Web Platform

I’m here to answer the question: What is CouchDB? (from an app devs perspective - and some implementor)How many of you have: built an application around a key value store?written map reduce functions?used Erlang in an application?

Page 4: CouchDB - Local Web Platform

Relax - easy to reason about - reliable - your data is safe with us. - honda accord, not a ferrari - as a debating point among developers

Page 5: CouchDB - Local Web Platform

Bandwidth Explosion

Page 6: CouchDB - Local Web Platform
Page 7: CouchDB - Local Web Platform
Page 8: CouchDB - Local Web Platform
Page 9: CouchDB - Local Web Platform
Page 10: CouchDB - Local Web Platform
Page 11: CouchDB - Local Web Platform
Page 12: CouchDB - Local Web Platform

“no bars”

Page 14: CouchDB - Local Web Platform

Latency Sucks

speed of lightdrawback to cloud computing

Page 15: CouchDB - Local Web Platform

What is CouchDB?

- k/v store with map reduce - http database written in erlang

Page 16: CouchDB - Local Web Platform

Local Web Platform

Local Web

Platform - on your device, local network, in a browser plugin - replication: it just works. makes data portable. - real-time remote backups, ad hoc topologies.

Page 17: CouchDB - Local Web Platform

http://www.flickr.com/photos/mcpig/872293700/

“Ground Computing”@jhuggins

- local to the user, more like desktop web than like Gears - local http server - browser apps - same application on the client and server or the cloud

Page 18: CouchDB - Local Web Platform

http://www.flickr.com/photos/shane-h/280084650

Offline by Default

- low latency & reliable - 2 tier applications

Page 19: CouchDB - Local Web Platform

http://jacobian.org/writing/of-the-web/

http://apod.nasa.gov/apod/ap050930.html

“Of the Web”

Let me tell you something: Django may be built for the Web, but CouchDB is built of the Web. I've never seen software that so completely embraces the philosophies behind HTTP. ... this is what the software of the future looks like. Jacob Kaplan-Moss -- October, 2007

perfect spot - discovered not invented

Page 20: CouchDB - Local Web Platform

- lower barrier for contribution - validate installations - foster interop (CouchDB as a protocol)

Page 21: CouchDB - Local Web Platform

Learning Curve

- doc modeling (mvcc / concurrency) - etags / Functional style of REST - eventual consistency

Page 22: CouchDB - Local Web Platform
Page 23: CouchDB - Local Web Platform
Page 24: CouchDB - Local Web Platform

http://www.longnow.org/projects/clock/

http://www.longnow.org/projects/clock/orrery/

Page 25: CouchDB - Local Web Platform

Robust

- single file - append only - no fixup phase - minimizes seeks

Page 26: CouchDB - Local Web Platform

Robust

- when britain is burning - Enda Farrell - bbc

Page 27: CouchDB - Local Web Platform

{ "_id": "BC4ea69ce1a73aa7d21d23b608d221d0", "_rev": "1-967a00dff5e02add41819138abb3284d",

"type": "person", "name": "Darth Vader", "age": 63, "headware": ["Helmet", "Sombrero"], "dark_side": true}

JSON Documents

- denormalize - natural data behavior - evolve formats with your application - easier to bootstrap in your mind

Page 28: CouchDB - Local Web Platform

{ "_id": "BC4ea69ce1a73aa7d21d23b608d221d0", "_rev": "1-967a00dff5e02add41819138abb3284d",

"type": "person", "name": "Darth Vader", "age": 63, "headware": ["Helmet", "Sombrero"], "dark_side": true}

JSON Documents

- 2 patterns - document update - event log

Page 29: CouchDB - Local Web Platform

{ "_id": "BC4ea69ce1a73aa7d21d23b608d221d0", "_rev": "2-41819138abb32967a00dff5e02add84d",

"type": "person", "name": "Darth Vader", "age": 63, "headware": ["Helmet", "Sombrero"], "dark_side": “More CoWbell!”}

JSON Documents

- MVCC - model for concurrency

Page 30: CouchDB - Local Web Platform
Page 31: CouchDB - Local Web Platform

Map Reduce

Page 35: CouchDB - Local Web Platform
Page 36: CouchDB - Local Web Platform

curl -X POSThttp://127.0.0.1:5984/_replicate

-d '{"source":"http://couch.example.com:5984/remote-db",

"target":"local-db"

}'

Page 37: CouchDB - Local Web Platform

curl -X POSThttp://127.0.0.1:5984/_replicate

-d '{"source":"http://couch.example.com:5984/remote-db",

"target":"local-db"

}'

Page 38: CouchDB - Local Web Platform
Page 39: CouchDB - Local Web Platform
Page 40: CouchDB - Local Web Platform
Page 41: CouchDB - Local Web Platform
Page 42: CouchDB - Local Web Platform

periodic, notifier system

Page 43: CouchDB - Local Web Platform
Page 44: CouchDB - Local Web Platform

“In the fullness of time there is only one CouchDB”

Page 45: CouchDB - Local Web Platform

standalone CouchDB applications

Page 46: CouchDB - Local Web Platform

Scaling Down

Page 47: CouchDB - Local Web Platform

Browser CouchJavaScript port

Uses HTML5 storage

Replicates with CouchDB

http://hg.toolness.com/browser-couch/

Page 48: CouchDB - Local Web Platform

Gives Control to Users

CC-BY-SA http://www.flickr.com/photos/kelleys/492253912/

- want to get kids in trouble for programming too muchclaris

Page 49: CouchDB - Local Web Platform
Page 50: CouchDB - Local Web Platform
Page 51: CouchDB - Local Web Platform
Page 52: CouchDB - Local Web Platform

! !

Stuart Langridge - Canonical

Page 53: CouchDB - Local Web Platform

- good because it's the status quo - easy to address with URLs - bad because users are depending on a remote resource for low latency responses - centralized, so traffic spikes impact all users, who might start refreshing

Page 54: CouchDB - Local Web Platform

- local requests are fast - easier to tune for throughput - plays to the strengths of mobile connections

Page 55: CouchDB - Local Web Platform

- users can run different applications on the same datasetdeployment Independent Personal - dark matter of the information universe

Page 56: CouchDB - Local Web Platform

messaging peer discovery identity Can we trust intermediate servers?

Page 57: CouchDB - Local Web Platform

“Obvious.”

web architecture

Page 58: CouchDB - Local Web Platform

Local Web Platform

Page 59: CouchDB - Local Web Platform

anks!

Page 60: CouchDB - Local Web Platform

Resources@CouchDB

http://couchdb.apache.org/

Dress like a Couch: http://shop.couchdb.com

http://planet.couchdb.org/

https://peepcode.com/products/couchdb-with-rails

Page 61: CouchDB - Local Web Platform

http://books.couchdb.org/relax

@couchdbinaction

Page 62: CouchDB - Local Web Platform

Robust

JSON

HTTP

Local

Page 63: CouchDB - Local Web Platform

couch.io

Conflict resolution by example

A B

Page 64: CouchDB - Local Web Platform

couch.io

Conflict resolution by example

A B

Page 65: CouchDB - Local Web Platform

couch.io

❦❦

Conflict resolution by example

A B

Page 66: CouchDB - Local Web Platform

couch.io

❦ ❦

Conflict resolution by example

A B

Page 67: CouchDB - Local Web Platform

couch.io

Conflict resolution by example

A B

Page 68: CouchDB - Local Web Platform

couch.io

Conflict resolution by example

A B

❦ ✿

Page 69: CouchDB - Local Web Platform

couch.io

Conflict resolution by example

A B

❦ ✿♪

Page 70: CouchDB - Local Web Platform

couch.io

✿♪

Conflict resolution by example

A B

Page 71: CouchDB - Local Web Platform

couch.io

✿♪

Conflict resolution by example

A B

Page 72: CouchDB - Local Web Platform

couch.io

✿♪

Conflict resolution by example

A B

Page 73: CouchDB - Local Web Platform

couch.io

✿♪

Conflict resolution by example

A B