couchdb talk jchris nyc

25

Upload: chris-anderson

Post on 11-May-2015

2.896 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: CouchDB Talk JChris NYC
Page 2: CouchDB Talk JChris NYC

Hello

• Chris Anderson <[email protected]>

• Blog: http://jchris.mfdz.com

• Founder, Grabb.it (web analytics for music)

• Ruby on Rails veteran

• CouchDB committer

Page 3: CouchDB Talk JChris NYC

And You?

• Used CouchDB (for fun)

• Evaluating or using it (for a project)

• Interested in contributing?

• Just here for the pizza?

Page 4: CouchDB Talk JChris NYC

History

• Damien Katz <http://damienkatz.net/>

• Worked on Lotus Notes & MySQL

• Started in 2005: C++ and XML, on Windows

• 2006: Moved to Erlang, JSON, and POSIX

• 0.7.0 first release of today’s CouchDB

• Version 1.0 Planned for the end of 2008

Page 5: CouchDB Talk JChris NYC

Why CouchDB?

• Common use cases no longer fit RDBMS

• Native to web applications

• Peer-based replication for freedom

• Takes today’s scalability lessons to heart

Page 6: CouchDB Talk JChris NYC

This Talk

• How is CouchDB different (from RDBMS)?

• Example HTML/Javascript application

• Quick tour of the internals

Page 7: CouchDB Talk JChris NYC

How Is CouchDB Different?RESTful HTTP

Schemaless JSON Documents

Map/Reduce Views

Incremental Replication

Page 8: CouchDB Talk JChris NYC

How Is CouchDB Different?RESTful HTTP

Schemaless JSON Documents

Map/Reduce Views

Incremental Replication

Binary Protocol

Typed Columns & Primary Keys

Ad-hoc Queries

Replication Logs

(from SQL RDBMS)

Page 9: CouchDB Talk JChris NYC

RESTful HTTP

Built for the web

Javascript Test Suite

Standard HTTP Clients, Proxies, Load Balancers & Caches

Page 10: CouchDB Talk JChris NYC

RESTful HTTP

Built for the web

Javascript Test Suite

Standard HTTP Clients, Proxies, Load Balancers & Caches

Enterprisey

Battle Hardened

Protocol Specific Tools

Page 11: CouchDB Talk JChris NYC

Schemaless JSON Documents

Flat Namespace

Arbitrary JSON Structures

Identified By URIs

Optimistic Locking (ACID/MVCC)

Page 12: CouchDB Talk JChris NYC

Schemaless JSON Documents

Flat Namespace

Arbitrary JSON Structures

Identified By URIs

Optimistic Locking (ACID/MVCC)

Tables

Typed Columns and Key Constraints

Primary Keys

Row or Column Level Locking

Page 13: CouchDB Talk JChris NYC

Map/Reduce Views

Functional Javascript

Incremental Updates

Predefined

High-Performance Reads

Page 14: CouchDB Talk JChris NYC

Map/Reduce Views

Functional Javascript

Incremental Updates

Predefined

High-Performance Reads

SQL Statements

Independent

Ad-hoc and Complex

Indexes Computed on Writes

Page 15: CouchDB Talk JChris NYC

Incremental Replication

User Triggered

Offline Clients

Resilient & Restartable

HTTP

Page 16: CouchDB Talk JChris NYC

Incremental Replication

User Triggered

Offline Clients

Resilient & Restartable

HTTP

Continuous

Master/Slave

Critical Path

Log Based

Page 17: CouchDB Talk JChris NYC

CouchDB

HTML / Javascript

_design Documents

p2p Replication

A new way to write web applications.

Page 18: CouchDB Talk JChris NYC

Live Code!http://169.254.251.59:5984/_utils/

Page 19: CouchDB Talk JChris NYC

CouchDB Internals• couch_httpd.erl

• Request Dispatch

• Create Database

• Get Document

• Other Modules

Page 20: CouchDB Talk JChris NYC

Request Dispatch

Page 21: CouchDB Talk JChris NYC

Create Database

Page 22: CouchDB Talk JChris NYC

Get Document

Page 23: CouchDB Talk JChris NYC

Other Modules• couch_btree.erl

• The heart of the storage module (stores Erlang terms sorted by key using user specified sort funtions)

• couch_db_updater.erl

• Translates document requests into Btree actions.

• couch_query_servers.erl

• Communicates with the external (Javascript etc) view servers.

Page 24: CouchDB Talk JChris NYC

Join Us

• #couchdb on irc.freenode.net

• http://couchdb.org

• mailing lists

• links to wiki and subversion checkout

Page 25: CouchDB Talk JChris NYC

Thank You!

Any Questions?