CouchDB - · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer [email protected] And...

83
CouchDB

Transcript of CouchDB - · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer [email protected] And...

Page 1: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

CouchDB

Page 2: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Relax!Actually 50 slides for 60 minutes. Good luck.

Page 3: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Who’s talking?

Jan Lehnardt

CouchDB Developer

[email protected]

And you? Developers, DBAs, architects?Know CouchDB? Like CouchDB? Use CouchDB?

Page 4: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

CouchDB — Built for the Future“640k processors should be enough for anybody.”

Page 5: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Single-User MachinesBack then

Page 6: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Multi-User MachinesNow

Page 7: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Application: ScienceBack then

Page 8: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Application: The WebToday

Page 9: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Monolithic MachinesBack then

Page 10: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Lots of Small ServersToday

Page 11: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

CPU, RAM and Disks == $$$Back then

Page 12: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Components cheaperNow

Page 13: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

RDBMS vsJust Storing Data

Sorry for bashing!

Page 14: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Real World Data

Bills, tax forms, letters…

Same type != same structure

Can be out of date

Natural data behaviour

Actual data record, no pointer

Page 15: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

RDBMSs

1) beware of speed considerations without having an app to measure2) or use an ORM which turns out to be a pain in the back for all sorts of reasons3) Most Data is not inherently relational

Page 16: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

RDBMSs

Design schema upfront

1) beware of speed considerations without having an app to measure2) or use an ORM which turns out to be a pain in the back for all sorts of reasons3) Most Data is not inherently relational

Page 17: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

RDBMSs

Design schema upfront

Write or use software to translate your data into that schema … and back

1) beware of speed considerations without having an app to measure2) or use an ORM which turns out to be a pain in the back for all sorts of reasons3) Most Data is not inherently relational

Page 18: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

RDBMSs

Design schema upfront

Write or use software to translate your data into that schema … and back

Friction?1) beware of speed considerations without having an app to measure2) or use an ORM which turns out to be a pain in the back for all sorts of reasons3) Most Data is not inherently relational

Page 19: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Attendee Confusion Diagram

not interested in low-concurrency sites, denormalization

Page 20: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Attendee Confusion Diagram

not interested in low-concurrency sites, denormalization

Page 21: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

CouchDB Documents

Page 22: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

CouchDB Documents

Isolated data records called Documents

No schema (!)

and semi-structured

data records that make up the app’s data objects

Page 23: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

{ "_id": "BCCD12CBB", "_rev": "AB764C",

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

Page 24: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

{ "_id": "BCCD12CBB", "_rev": "AB764C",

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

UUID

Page 25: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

{ "_id": "BCCD12CBB", "_rev": "AB764C",

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

optimistic locking

Page 26: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

{ "_id": "BCCD12CBB", "_rev": "AB764C",

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

Page 27: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

CouchDB Documents

Supported by all major languages

No database abstraction needed

Revisions, Attachments

Page 28: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Create: HTTP POST /db/BCCD12CBB Read: HTTP GET /db/BCCD12CBBUpdate: HTTP PUT /db/BCCD12CBBDelete: HTTP DELETE /db/BCCD12CBB

Working with Documents

Page 29: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

— Jacob Kaplan-Moss, jacobian.org

“Django may be built for the Web, but CouchDB is built of the Web.”

Page 30: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

“Reading the CouchDB API. Smiling.”

— Tim Bray, on Twitter

Page 31: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

$ curl -X GET http://server/ \

database/document

{"_id":"ABC","_rev":"1D4","data":...}

$

Page 32: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Recap

Versioned Object Store

Optimistic Locking

REST API

Revisions, Attachments

Page 33: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Viewsof Keys and Values

Page 34: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Views

Filter, Collate, Aggregate

Powered by MapReduce

Design documentsfunctions get executed, you don’t do that

Page 35: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

View Examples – Docs by Date

Key Value

"2007-10-12 20:13:12" {"_id":"..."}

"2007-12-26 08:37:55" {"_id":"..."}

"2008-02-03 10:22:34" {"_id":"..."}

"2008-05-01 14:16:11" {"_id":"..."}

Page 36: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

View Examples – Docs by Date

function(doc) { emit(doc.date, doc);}

"2007-10-12 20:13:12" {"_id":"..."}

Page 37: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Views

Built incrementally…

…and on demand

Reduce optional

map/reduce can be parallelised

Page 38: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Recap

Versioned Object Store, Op-timistic Locking, REST API

MapReduce Views

Revisions, Attachments

Page 39: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Replication

Page 40: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

ReplicationEasy Data Synchronization Without Headaches

Page 41: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Replication

Take your data with you

CouchDB makes it easy to synchronise machines

rsync-likeLarge spectrum of architectures: - P2P, Failover, Load Balancing, BackupConflicts: auto-detect & resolve, data consistency

Page 42: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Built for the Future

Written in Erlang – a telco-grade concurrent platform

Non-locking MVCC and ACID compliant data store

Erlang Processes + messagingEricsson AXD 301 - nine nines - 1/30th second per yearCrash resistant

Page 43: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Recap

Versioned Object Store, Op-timistic Locking, REST API, MapReduce Views

Insane Concurrency Re-plication & Crash Resistant

Revisions, Attachments

Page 44: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Recap

Versioned Object Store, Op-timistic Locking, REST API, MapReduce Views

Replication & Crash Resistance

Awesome!Awesome!

Revisions, Attachments

Page 45: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

A Little History

Damien Katz self funded fulltime development for 2 years

Now backed by IBM

Page 46: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?
Page 47: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?
Page 48: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

A Little History

Top Level Apache Project

Apache 2.0 License

Page 49: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

A Little History

5th year of development

Prototype in C++

0.8.1: 6666 Lines of Code

Page 50: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

ResourcesTwitter: @CouchDB & http://couchdb.org/

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

http://damienkatz.net/ & http://jan.prima.de/

http://blog.racklabs.com/?p=74

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

not covered everything,other talks + tutorials

Page 51: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Commercial Break

Page 52: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

The Book

O'Reilly

http://books.couchdb.org/relax

Apache 2.0 Licensed

Summer 2009

Page 53: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

The Book —Can’t wait?

Help CouchDB

Hire me for Consulting, Training & Development

[email protected]

Page 54: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Thank YouReally, thanks.

Page 55: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Got it?Questions

Page 56: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?
Page 57: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Bonus Slides

Page 58: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Where is my auto increment

What is auto_increment?

Unique identifier

Sequence denominator

Page 59: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Where is my auto_increment?

Documents have `_id`s

Sequences in distributed applications are not

Timestamps get you a long way, though.

Page 60: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Relation(ship)s

JOINs please!

What for?

Get data that “belongs together”

Page 61: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Relation(ship)s

One big fat doc?

Pros: Easy – Cons: Bad with concurrent updates

Use for: Low volume updates e.g. user-supplied tags

Page 62: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Relation(ship)s

Master Doc – Slave Doc

Pros: A little complex – Cons: Fast, good with concurrent updates, tree operations

Use for: Everything else

Page 63: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Relation(ship)s

function(doc) { if(doc.ismaster) { emit([doc._id, doc.date], doc); } else { emit([doc.master_id, doc.date], doc); }}

Page 64: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Relation(ship)s

... ...

["BAAC67", "2008-09-21"] {"is_parent",true}

["BAAC67", "2008-09-22"] {"...","..."}

["BAAC67", "2008-09-23"] {"...","..."}

["BAAC67", "2008-09-24"] {"...","..."}

... ...

Page 65: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Transactions!

Run multiple operations at once

They all succeed or none gets applied

Page 66: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Transactions

{ "docs": [ {"_id": "0", "int": 0, "str": "0"}, {"_id": "1", "int": 1, "str": "1"}, {"_id": "2", "int": 2, "str": "2"} ]}

POST

Page 67: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Transactions!

Caveats:

Statement transaction

No data transaction

No multi-node transactions

Page 68: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Multi-Node Transactions!Why? – Data redundancy

Use an HTTP proxy

Nice to build on standard protocols

Caveat: 2-phase-commit in disguise

Page 69: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

MapReduce

Page 70: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

View Examples – Docs by Date

Key Value

[2007, 10, 12, 20, 13, 12] 3465

[2007, 12, 26, 8, 37, 55] 4200

[2008, 2, 3, 10, 22, 34] 3782

[2008, 5, 1, 14, 16, 11] 5984

Map

Page 71: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

View Examples – Docs by Date

Key Value

null 17431

Reduce

Page 72: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

View Examples – Docs by Date

Key Value

[2007] 7665

[2008] 9766

Reduce with group_level=1

Page 73: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

View Examples – Docs by Date

Key Value

[2007, 10, 12, 20, 13, 12] 3465

[2007, 12, 26, 8, 37, 55] 4200

[2008, 2, 3, 10, 22, 34] 3782

[2008, 5, 1, 14, 16, 11] 5984

Map

Page 74: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Views - Map Tags

Keys Values

family 1

friends 1

friends 1

work 1

work 1

youtube 1

… …

Page 75: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Views - Reduce Tag Count

Keys Values

family 1

friends 1

friends 1

work 1

work 1

youtube 1

… …

Keys Values

family 1

friends 2

work 2

youtube 1

… …

Page 76: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Views - Map Tags

function (doc) { for(var i in doc.tags) emit(doc.tags[i], 1);}

Page 77: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Views - Reduce Tag Count

Keys Values

family 1

friends 1

friends 1

work 1

work 1

youtube 1

… …

Keys Values

family 1

friends 2

work 2

youtube 1

… …

Page 78: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Views - Reduce Tag Count

function (Key, Values) { var sum = 0; for(var i in Values) sum += Values[i]; return sum;}

Incremental, On-demandreduce optional

Page 79: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Hot backup?

POSIX compliant

Page 80: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Hot backup?

$ cp -r /var/lib/couchdb/* \ /mnt/backup

Page 81: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Number Bragging

Silly read-only benchmark with memory saturation

2,500 req/s sustained on a 2Ghz dual core Athlon

Page 82: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

Number Bragging

Silly read-only benchmark with memory saturation

2,500 req/s sustained on a 2Ghz dual core Athlon

Using 9.8 MB RAM

Page 83: CouchDB -   · PDF fileWho’s talking? Jan Lehnardt CouchDB Developer jan@apache.org And you? Developers, DBAs, architects? Know CouchDB? Like CouchDB? Use CouchDB?

ResourcesTwitter: @CouchDB & http://couchdb.org/

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

http://damienkatz.net/ & http://jan.prima.de/

http://blog.racklabs.com/?p=74

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

not covered everything,other talks + tutorials