• Like
Couch Db In 60 Minutes
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Couch Db In 60 Minutes

  • 1,667 views
Published

 

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,667
On SlideShare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
53
Comments
0
Likes
3

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Apache CouchDB Saturday, 21 March 2009
  • 2. Relax Saturday, 21 March 2009
  • 3. Who’s Talking? • J Chris Anderson / jchris@apache.org / @jchris • Jan Lehnardt / jan@apache.org / @janl • “Open Source Dudes” • Directors, couch.io Saturday, 21 March 2009
  • 4. Who Are You? Hi Last.fm! Saturday, 21 March 2009
  • 5. Damien Katz Wassat? Saturday, 21 March 2009 What’s CouchDB?
  • 6. Schema Free (JSON) • Features • Document Oriented, Not Relational • Highly Concurrent • RESTful HTTP API • JavaScript Powered Map/Reduce • N-Master Replication • Robust Storage Saturday, 21 March 2009
  • 7. Schema Free (JSON) • Features • Document Oriented, Not Relational • Highly Concurrent • RESTful HTTP API • JavaScript Powered Map/Reduce • N-Master Replication • Robust Storage Saturday, 21 March 2009
  • 8. Schema Free ( JSON) { "_id": "BCCD12CBB", "_rev": "1-AB764C", "type": "person", "name": "Darth Vader", "age": 63, "headware": ["Helmet", "Sombrero"], "dark_side": true } Saturday, 21 March 2009
  • 9. Schema Free ( JSON) { "_id": "BCCD12CBB", "_rev": "2-AB764C", "type": "person", "name": "Darth Vader", "age": 63, "headware": ["Helmet", "Sombrero"], "dark_side": true } Saturday, 21 March 2009
  • 10. Schema Free ( JSON) { "_id": "BCCD12CBB", "_rev": "3-AB764C", "type": "person", "name": "Darth Vader", "age": 63, "headware": ["Helmet", "Sombrero"], "dark_side": true } Saturday, 21 March 2009 Access Tokens for MVCC
  • 11. Schema Free ( JSON) { "_id": "BCCD12CBB", "_rev": "3-AB764C", "type": "person", "name": "Darth Vader", "age": 63, "headware": ["Helmet", "Sombrero"], "dark_side": true } Saturday, 21 March 2009 Access Tokens for MVCC
  • 12. Schema Free (JSON) • Features • Document Oriented, Not Relational • Highly Concurrent • RESTful HTTP API • JavaScript Powered Map/Reduce • N-Master Replication • Robust Storage Saturday, 21 March 2009
  • 13. Document Oriented Not Relational • Documents in the Real World™ • Bills, letters, tax forms… • Same type != same structure • Can be out of date (so what?) • No references Saturday, 21 March 2009
  • 14. Document Oriented Not Relational • Documents in the Real World™ Bills, letters, tax forms… Natural Data • • Same type != same structure • Behaviour Can be out of date (so what?) • No references Saturday, 21 March 2009
  • 15. Document Oriented Not Relational couch = CouchRest.database!("http:// 127.0.0.1:5984/tweets") tweets_url = "http://twitter.com/ statuses/user_timeline.json" tweets = http.get(tweets_url) couch.bulk_save(tweets) Saturday, 21 March 2009
  • 16. Schema Free (JSON) • Features • Document Oriented, Not Relational • Highly Concurrent • RESTful HTTP API • JavaScript Powered Map/Reduce • N-Master Replication • Robust Storage Saturday, 21 March 2009
  • 17. Highly Concurrent Number Bragging Saturday, 21 March 2009
  • 18. Highly Concurrent Number Bragging • Silly read-only benchmark with memory saturation Saturday, 21 March 2009
  • 19. Highly Concurrent Number Bragging • Silly read-only benchmark with memory saturation • 2,500 req/s sustained on a 2Ghz dual core 64-bit Athlon Saturday, 21 March 2009
  • 20. Highly Concurrent Number Bragging • Silly read-only benchmark with memory saturation • 2,500 req/s sustained on a 2Ghz dual core 64-bit Athlon • Using 9.8 MB RAM Saturday, 21 March 2009
  • 21. Highly Concurrent Erlang Praising Saturday, 21 March 2009
  • 22. Highly Concurrent Erlang Praising • Erlang is worth its own talk Saturday, 21 March 2009
  • 23. Highly Concurrent Erlang Praising • Erlang is worth its own talk • Executive Summary Saturday, 21 March 2009
  • 24. Highly Concurrent Erlang Praising • Erlang is worth its own talk • Executive Summary It’s fucking awesome! Saturday, 21 March 2009
  • 25. Schema Free (JSON) • Features • Document Oriented, Not Relational • Highly Concurrent • RESTful HTTP API • JavaScript Powered Map/Reduce • N-Master Replication • Robust Storage Saturday, 21 March 2009
  • 26. ful   CRUD • Create HTTP PUT /db/mydocid • Read HTTP GET /db/mydocid • Update HTTP PUT /db/mydocid • Delete HTTP DELETE /db/mydocid Saturday, 21 March 2009
  • 27. Schema Free (JSON) • Features • Document Oriented, Not Relational • Highly Concurrent • RESTful HTTP API • JavaScript Powered Map/Reduce • N-Master Replication • Robust Storage Saturday, 21 March 2009
  • 28. JavaScript powered Map/Reduce • Map functions extract data from your documents • Reduce functions aggregate intermediate values *yawn*. • The kicker: Incremental b-tree storage. Saturday, 21 March 2009
  • 29. Map Reduce Views Docs Map { “user” : “Chris”, { “key” : “Alice”, “value” : 5 } “points” : 3 } function(doc) { { “key” : “Bob”, “value” : 7 } { “user” : “Joe”, if (doc.user && doc.points) { { “key” : “Chris”, “value” : 3 } “points” : 10 } emit(doc.user, doc.points); { “key” : “Joe”, “value” : 10 } } { “user” : “Alice”, } { “key” : “Mary”, “value” : 9 } “points” : 5 } { “user” : “Mary”, “points” : 9 } Reduce { “user” : “Bob”, “points” : 7 } function(keys, values, rereduce) { Alice ... Chris: 15 return sum(values); } Everyone: 34 Saturday, 21 March 2009 • Parallel processing abstraction . Designed to run across many clusters. • Iterate over documents emitting key/value pairs. Queries can be run to fetch key ranges. • Incremental. Subsequent queries are fast.
  • 30. Schema Free (JSON) • Features • Document Oriented, Not Relational • Highly Concurrent • RESTful HTTP API • JavaScript Powered Map/Reduce • N-Master Replication • Robust Storage Saturday, 21 March 2009
  • 31. Saturday, 21 March 2009
  • 32. Saturday, 21 March 2009
  • 33. Saturday, 21 March 2009
  • 34. Saturday, 21 March 2009
  • 35. Saturday, 21 March 2009
  • 36. Saturday, 21 March 2009
  • 37. Saturday, 21 March 2009
  • 38. Saturday, 21 March 2009 periodic, notifier system
  • 39. Saturday, 21 March 2009
  • 40. Saturday, 21 March 2009 P2P apps
  • 41. Render JSON Docs as HTML shows/post.js /drl/_show/sofa/post/Hello-World-For-Real-This-Time Saturday, 21 March 2009 • Side Effect Free JavaScript Function • Converts from a single document into a response with any Content-Type • CouchApp makes it easy to use http://embeddedjs.com templates in your _show functions. • Cacheable with Etags
  • 42. Render Views as HTML lists/index.js /drl/_list/sofa/index/recent-posts?descending=true&limit=8 Saturday, 21 March 2009 • Side effect free and cacheable, like _show • Run with different parameters for the head, tail, and each individual row of the view.
  • 43. Schema Free (JSON) • Features • Document Oriented, Not Relational • Highly Concurrent • RESTful HTTP API • JavaScript Powered Map/Reduce • N-Master Replication • Robust Storage Saturday, 21 March 2009
  • 44. Robust Storage Append Only Resilient Replication Full fsync() Saturday, 21 March 2009
  • 45. Resources • Twitter: @CouchDB & http://couchdb.org/ • Dress like a Couch: http://shop.couchdb.com • http://planet.couchdb.org/ • http://blog.racklabs.com/?p=74 • https://peepcode.com/products/couchdb- with-rails Saturday, 21 March 2009
  • 46. couch.io Berlin – London – Portland If you need professional CouchDB support talk to the dimwit(s) on stage Saturday, 21 March 2009
  • 47. anks! Saturday, 21 March 2009
  • 48. Saturday, 21 March 2009