Apache
                          CouchDB
Saturday, 21 March 2009
Relax
Saturday, 21 March 2009
Who’s Talking?

                    •     J Chris Anderson / jchris@apache.org / @jchris
                    •     Jan Leh...
Who Are You?


                             Hi Last.fm!



Saturday, 21 March 2009
Damien Katz
 Wassat?
Saturday, 21 March 2009

What’s CouchDB?
Schema Free (JSON)
                    •

                                                 Features
                    • ...
Schema Free (JSON)
                    •

                                                 Features
                    • ...
Schema Free ( JSON)
                          {
                              "_id": "BCCD12CBB",
                        ...
Schema Free ( JSON)
                          {
                              "_id": "BCCD12CBB",
                        ...
Schema Free ( JSON)
                          {
                              "_id": "BCCD12CBB",
                        ...
Schema Free ( JSON)
                          {
                              "_id": "BCCD12CBB",
                        ...
Schema Free (JSON)
                    •

                                                 Features
                    • ...
Document Oriented
                                                         Not Relational
                    •     Docume...
Document Oriented
                                                         Not Relational
                    •     Docume...
Document Oriented
                                       Not Relational

             couch = CouchRest.database!("http://...
Schema Free (JSON)
                    •

                                                 Features
                    • ...
Highly Concurrent
                                   Number Bragging




Saturday, 21 March 2009
Highly Concurrent
                                             Number Bragging


                     •    Silly read-only...
Highly Concurrent
                                              Number Bragging


                     •    Silly read-onl...
Highly Concurrent
                                              Number Bragging


                     •    Silly read-onl...
Highly Concurrent
                                    Erlang Praising




Saturday, 21 March 2009
Highly Concurrent
                                                 Erlang Praising

                     •    Erlang is wo...
Highly Concurrent
                                                 Erlang Praising

                     •    Erlang is wo...
Highly Concurrent
                                                 Erlang Praising

                     •    Erlang is wo...
Schema Free (JSON)
                    •

                                                 Features
                    • ...
ful  
                                                    CRUD
                    •     Create
               ...
Schema Free (JSON)
                    •

                                                 Features
                    • ...
JavaScript powered
                                 Map/Reduce
                    •     Map functions extract data from y...
Map Reduce Views
              Docs                                                                 Map
    { “user” : “Ch...
Schema Free (JSON)
                    •

                                                 Features
                    • ...
Saturday, 21 March 2009
Saturday, 21 March 2009
Saturday, 21 March 2009
Saturday, 21 March 2009
Saturday, 21 March 2009
Saturday, 21 March 2009
Saturday, 21 March 2009
Saturday, 21 March 2009

periodic, notifier system
Saturday, 21 March 2009
Saturday, 21 March 2009

P2P apps
Render JSON Docs as HTML
         shows/post.js                                                            /drl/_show/sofa...
Render Views as HTML
          lists/index.js                                     /drl/_list/sofa/index/recent-posts?desce...
Schema Free (JSON)
                    •

                                                 Features
                    • ...
Robust Storage

                    Append Only

                    Resilient
                    Replication

          ...
Resources
                    •     Twitter: @CouchDB & http://couchdb.org/
                    •     Dress like a Couch:
...
couch.io
                               Berlin – London – Portland


                           If you need professional C...
anks!
Saturday, 21 March 2009
Saturday, 21 March 2009
Upcoming SlideShare
Loading in …5
×

Couch Db In 60 Minutes

2,021 views

Published on

Published in: Technology
  • Be the first to comment

Couch Db In 60 Minutes

  1. 1. Apache CouchDB Saturday, 21 March 2009
  2. 2. Relax Saturday, 21 March 2009
  3. 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. 4. Who Are You? Hi Last.fm! Saturday, 21 March 2009
  5. 5. Damien Katz Wassat? Saturday, 21 March 2009 What’s CouchDB?
  6. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 17. Highly Concurrent Number Bragging Saturday, 21 March 2009
  18. 18. Highly Concurrent Number Bragging • Silly read-only benchmark with memory saturation Saturday, 21 March 2009
  19. 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. 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. 21. Highly Concurrent Erlang Praising Saturday, 21 March 2009
  22. 22. Highly Concurrent Erlang Praising • Erlang is worth its own talk Saturday, 21 March 2009
  23. 23. Highly Concurrent Erlang Praising • Erlang is worth its own talk • Executive Summary Saturday, 21 March 2009
  24. 24. Highly Concurrent Erlang Praising • Erlang is worth its own talk • Executive Summary It’s fucking awesome! Saturday, 21 March 2009
  25. 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. 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. 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. 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. 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. 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. 31. Saturday, 21 March 2009
  32. 32. Saturday, 21 March 2009
  33. 33. Saturday, 21 March 2009
  34. 34. Saturday, 21 March 2009
  35. 35. Saturday, 21 March 2009
  36. 36. Saturday, 21 March 2009
  37. 37. Saturday, 21 March 2009
  38. 38. Saturday, 21 March 2009 periodic, notifier system
  39. 39. Saturday, 21 March 2009
  40. 40. Saturday, 21 March 2009 P2P apps
  41. 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. 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. 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. 44. Robust Storage Append Only Resilient Replication Full fsync() Saturday, 21 March 2009
  45. 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. 46. couch.io Berlin – London – Portland If you need professional CouchDB support talk to the dimwit(s) on stage Saturday, 21 March 2009
  47. 47. anks! Saturday, 21 March 2009
  48. 48. Saturday, 21 March 2009

×