Why CouchDB?

1,637
-1

Published on

http://www.infoq.com/presentations/Why-CouchDB

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,637
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
34
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Why CouchDB?

  1. 1. Why CouchDB?
  2. 2. aka built rebuilding on hack atcontribute to work at
  3. 3. So...Why CouchDB?
  4. 4. because...Data is Lonely
  5. 5. Lonely Data?data access depends on (often API-less)app (esp. desktop)web apps are a little better, but not always API’s are not general meant for replication/backupapp may be open source, but data’s stilltangled up (RDBMS)
  6. 6. Enter...
  7. 7. Time to Relax.
  8. 8. Meet CouchDBcoSQL Document Storage Database JSON Documents + attachmentsHTTP/REST (you already know the API)Map/Reduce ViewsPortable Standalone ApplicationsReplication for Freedom
  9. 9. JSON Documents {“json”: “key/value pairs”, “_id” : “some uuid”, “_rev”: “mvcc key”, “string keys”: [1,2,3,”four”,null], “schema free”: “flexible”}Your programming language supports JSON! Adapt data as your application changes.
  10. 10. Attachmentstext/htmlimage/pngapplication/oggapplication/pdftext/javascripttext/cssetc...
  11. 11. HTTP / RESTyou already know the API GET read PUT create or update DELETE delete POST bulk operation
  12. 12. Map/Reduce Views
  13. 13. Some sample docs{“docs”:[ {“user”: “Chris”, “points”: 3}, {“user”: “Joe”, “points”: 10}, {“user”: “Alice”, “points”: 5}, {“user”: “Mary”, “points”: 9}, {“user”: “Bob”, “points”: 7}, {“user”: ”Alice”, “points”: 3}]}
  14. 14. Map functionfunction(doc) { if (doc.user && doc.points) { emit(doc.user, doc.points); }}// output{“rows”:[ {“key”: “Chris”, “value”: 3}, {“key”: “Joe”, “value”: 10}, {“key”: “Alice”, “value”: 5}, {“key”: “Mary”, “value”: 9}, {“key”: “Bob”, “value”: 7}, {“key”: ”Alice”, ”value”: 3}]}
  15. 15. Reduce functionfunction(keys, values, rereduce) { return sum(values);}// output{"key":null,"value":37}// output (?group=true){"rows":[ {"key":"Alice","value": 8}, {"key":"Bob", "value": 7}, {"key":"Chris","value": 3}, {"key":"Joe", "value": 10}, {"key":"Mary", "value": 9}]}
  16. 16. Built-in Reducers_sum_count_statmassively faster than JS reducers
  17. 17. Map/Reduce Queries in CouchDB... run over every document in the db are views that create indexes use keys and view collation for lookups can do simple JOINs (?include_docs=true) are typically written in JS but can also be written in Erlang, Ruby, Python, and other languages
  18. 18. Portable, Standalone, Applications CouchApps live inside CouchDB application server style features in addition to map/reduce views: _rewrite - URL rewriting _show - output rendering _list - output rendering of views _update - document validation .js, .css, .png - AJAX app assets
  19. 19. Replication for Freedom triggered, incremental, filtered,peer-based, interruptible, fabulous
  20. 20. Replicationappend-only file format - MVCCstateless HTTP API “built of the Web” - Jacob Kaplan-Moss (of Django fame)n-master replicationfilterable with JS functionscan run continuous (on change)
  21. 21. so...Why CouchDB? because it replicates!!
  22. 22. Web 2.5?
  23. 23. Web 2.0 Gave Us...Cloud Powers!!1! data-center sized processing & storage for all my junkCrowd Powers sharing stuff with everybody, all the time from anywhere, hurray
  24. 24. for that, we traded ownership privacy security safety stability sanity...?
  25. 25. Next, we need...those things back
  26. 26. to get that, we need replication (saw that coming, probably) closer data closer apps without the loss of our Cloud & Crowd Powers big data storage & processing (as needed) sharing with the world (as needed) or via peer-based replication
  27. 27. Hop on CouchDB!http://iriscouch.com/http://couchbase.com/http://cloudant.com/http://couchdb.apache.org/
  28. 28. Apache CouchDB and friendsIris Couch - single CouchDB “node” hosting;fast & simple setupCouchbase Server or Cloudant’s BigCouchfor big data more “typical” cluster architecturesCouchbase Mobile for your iOS & AndroidDevicesPouchDB for browsers - IndexedDB CouchDB
  29. 29. So...
  30. 30. Let’s Replicate... ...EVERYTHING!!1! take full advantage of CouchDB the future is distributed not just data, but... queries output formats attachments whole applications and everything else in between
  31. 31. CouchDBdoes replicationyou get to do the other stuff
  32. 32. Thanks! any questions?@bigbluehat - github.com/bigbluehat - byoung@bigbluehat.com @couchbase - couchbase.org - benjamin@couchbase.com
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×