Professional Documents
Culture Documents
Couchdbbeijingopenparty 090829084553 Phpapp02
Couchdbbeijingopenparty 090829084553 Phpapp02
litaocheng@gmail.com
2009.8.29
What's CouchDB
Damien Katz<http://damienkatz.net/>
Worked on Lotus Notes & MySQL
2005: C++, XML, on Windows
2006Erlang, JSON, POSIX
0.7.0 Erlang
Apache
0.9.1
HTTPRFC 2616
Why CouchDB?
Document DBJSON
Schema-Free
HTTP RESTful Web
CouchDB Replicationoffline
ACID Storage Engine
MVCC
Views With MapReduce
Single Storage File,
Fault Tolerant
CouchDB
Standalone ():
MVCC()
Append
ACID
Distributed ()
CouchDB Document Partition
ReplicationAvailabity Scalability
Eventual Consistency by using Incremental
Replication
CouchDB
CouchDB
API
JSON
Document
View
ACID
MVCC
CouchDB API
HTTP
CouchDB RUD
GET
read
PUT
create or update
DELETE
delete
POST
bulk operation
)
HTTPCouchDB API
JSON Documents
{
_id
_rev
title
author
tags
post_date
content
:
:
:
:
:
:
:
some uuid,
mvcc key,
a blog post,
foo,
[life, happy],
2008-08-30 15:30:26,
this is an blog....
}
DocumentJsonDocuments
RDBM
Schema-Free,,JS
DB File
All Documents is self Contained
RDBM
View
view index
BTreekeykey-range
DB(*.couch)view
map, reduceDBview
javascript view server
view server( java?
c/c++)
View
javascript)
storage(.couch)
:
view
design documents view
view indexview(BTree)
view
POST DATAview
Querying Options - startkey, endkye, limit ...
View example(js)
map fun:
function(doc) {
emit(doc.post_date, doc.title);
}
result(BTree, sorted):
|
key
|
value
|
-----------------------------------------| "2008-08-30 15:30:06" | "a blog post" |
| "2008-08-31 20:31:24", | "second post" |
| "2008-09-01 10:10:21", | "third post" |
blog post
ACID
Storage (double header)
Appendoverwirte,commit log
crash-only
MVCC, read),write
2BTreedocidseqidkey
:
1. storage
2. header(4K)
consistency
Locking
vs
Multi Version Concurrency Control
Attachment
Inline Attachments
document
base64
Standalone Attachments
textdocument
storage
Create HTTP PUT
Change HTTP PUTrev
Delete - HTTP DELETE rev
CouchDB Internal
headerroot
BTree
kv nodekp node
rootappendcouch
compaction
seq num
continues replaction "_changes" API
Erlang
Ericsson,
(FP)
(OC),
SMP
OTP
, , 20
, ,
Open Source,
Erlang
GC
OTPcallback
bytecode),
grep
...
Erlang""
FPOO
Single Assign
Record
stringlistbinary
...
Erlang.
blog:
http://mryufeng.javaeye.com
http://www.joeandmotorboat.com/
http://damienkatz.net/
http://jchrisa.net/
http://jan.prima.de/plok/
http://johnpwood.net/
http://userprimary.net/user/
website:
http://www.erlang.org
http://www.erlang-china.org
http://erlang-factory.com/
http://planet.couchdb.org/
http://wiki.apache.org/couchdb/
Books
http://books.couchdb.org/relax/
Relax!
Thanks everyone!