CouchDB Google

Preview:

Citation preview

CouchDBApache

HelloChris Anderson

jchris@apache.org / @jchris

Apache CouchDB Committer

REST and JavaScript enthusiastDirector, couch.io

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?

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

Bandwidth Explosion

“no bars”

Latency Sucks

speed of lightdrawback to cloud computing

What is CouchDB?

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

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.

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

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

Offline by Default

- low latency & reliable - 2 tier applications

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

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

Learning Curve

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

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

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

Robust

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

Robust

- when britain is burning - Enda Farrell - bbc

{ "_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

{ "_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

{ "_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

Map Reduce

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

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

"target":"local-db"

}'

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

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

"target":"local-db"

}'

periodic, notifier system

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

standalone CouchDB applications

Scaling Down

Browser CouchJavaScript port

Uses HTML5 storage

Replicates with CouchDB

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

Gives Control to Users

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

- want to get kids in trouble for programming too muchclaris

! !

Stuart Langridge - Canonical

- 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

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

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

messaging peer discovery identity Can we trust intermediate servers?

“Obvious.”

web architecture

Local Web Platform

anks!

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

http://books.couchdb.org/relax

@couchdbinaction

Robust

JSON

HTTP

Local

couch.io

Conflict resolution by example

A B

couch.io

Conflict resolution by example

A B

couch.io

❦❦

Conflict resolution by example

A B

couch.io

❦ ❦

Conflict resolution by example

A B

couch.io

Conflict resolution by example

A B

couch.io

Conflict resolution by example

A B

❦ ✿

couch.io

Conflict resolution by example

A B

❦ ✿♪

couch.io

✿♪

Conflict resolution by example

A B

couch.io

✿♪

Conflict resolution by example

A B

couch.io

✿♪

Conflict resolution by example

A B

couch.io

✿♪

Conflict resolution by example

A B

Recommended