Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
Niklas Gustavsson [email_address] www.callistaenterprise.se
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB Be warned
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB Won't replace your relational database You (probably) won't be us...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB Forget about relational    databases for a while
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB Open source project  started by Damien Katz http://couchdb.org So...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB How does it work?
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB Document oriented Documents are JSON {firstName:”Niklas”, lastNam...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB Views Pre-computed, indexed table Incrementally updated Written i...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB // sort and retrieve documents by first name function (doc) { map...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB 1 2 3 So why should I care?
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB First reason Sometimes availability trumps consistency 1 2 3
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB CAP theorem - pick two: Consistency Availability Partitioning
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB Eventual Consistency http://www.allthingsdistributed.com/2007/12/...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB NODES – the number of nodes that store a replica WRITES – the num...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB Synchronous DB replication NODES = 2 WRITES = 2 READS = 1 2 + 1 >...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB Asynchronous DB replication NODES = 2 WRITES = 1 READS = 1 1 + 1 ...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB What if NODES is 10 or 100 or 1000? Every increase in WRITES mean...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB http://www.allthingsdistributed.com/2007/12/eventually_consistent...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB Second reason: Moore has  changed tactic 1 2 3
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB CPUs are getting slower but more plenty The Free Lunch is over - ...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB We need to start parallelizing our tasks Concurrency in Java is r...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB Used for computing views in CouchDB map/reduce
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB http://www.gotw.ca/publications/concurrency-ddj.htm http://erlang...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB Third reason Web friendly 1 2 3
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB REST - “HTTP used right”
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB REST based API Everything is a resource Every resource has a URL ...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB REST freebies API easily usable from any platform (AJAX, Java, Ru...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm http:/...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB I'm getting sleepy,  show me the goodies!
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB Adding a to do var todoText = $("todoinput").value; thi...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB Adding a tag if(!todo.tags) { todo.tags = [tag]; } else  { todo.t...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB The magic of save()‏ this.save = function(doc, options) { if (doc...
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB Questions? ?
CouchDB, Slide  © Copyright 2008, Callista Enterprise AB Attributions WHY? -  http://www.flickr.com/photos/teflon/12882738...
Nächste SlideShare
Wird geladen in …5
×

CouchDB

5.156 Aufrufe

Veröffentlicht am

CADEC 2007 presentation on three major trends all embodied in CouchDB.

Veröffentlicht in: Technologie, Design
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

CouchDB

  1. 1. Niklas Gustavsson [email_address] www.callistaenterprise.se
  2. 2. CouchDB, Slide © Copyright 2008, Callista Enterprise AB Be warned
  3. 3. CouchDB, Slide © Copyright 2008, Callista Enterprise AB Won't replace your relational database You (probably) won't be using it any time soon
  4. 4. CouchDB, Slide © Copyright 2008, Callista Enterprise AB Forget about relational databases for a while
  5. 5. CouchDB, Slide © Copyright 2008, Callista Enterprise AB Open source project started by Damien Katz http://couchdb.org Soon to be an Apache project
  6. 6. CouchDB, Slide © Copyright 2008, Callista Enterprise AB How does it work?
  7. 7. CouchDB, Slide © Copyright 2008, Callista Enterprise AB Document oriented Documents are JSON {firstName:”Niklas”, lastName: “Gustavsson”} Schema less
  8. 8. CouchDB, Slide © Copyright 2008, Callista Enterprise AB Views Pre-computed, indexed table Incrementally updated Written in JavaScript
  9. 9. CouchDB, Slide © Copyright 2008, Callista Enterprise AB // sort and retrieve documents by first name function (doc) { map(doc.firstName, doc); } // retrieve squares by size function (sq) { map(sq.width * sq.height, {color: sq.color}); }
  10. 10. CouchDB, Slide © Copyright 2008, Callista Enterprise AB 1 2 3 So why should I care?
  11. 11. CouchDB, Slide © Copyright 2008, Callista Enterprise AB First reason Sometimes availability trumps consistency 1 2 3
  12. 12. CouchDB, Slide © Copyright 2008, Callista Enterprise AB CAP theorem - pick two: Consistency Availability Partitioning
  13. 13. CouchDB, Slide © Copyright 2008, Callista Enterprise AB Eventual Consistency http://www.allthingsdistributed.com/2007/12/eventually_consistent.html
  14. 14. CouchDB, Slide © Copyright 2008, Callista Enterprise AB NODES – the number of nodes that store a replica WRITES – the number nodes that confirm a commit READS – the number of nodes that are contacted at a read operation WRITES+READS > NODES : strong consistency http://www.allthingsdistributed.com/2007/12/eventually_consistent.html
  15. 15. CouchDB, Slide © Copyright 2008, Callista Enterprise AB Synchronous DB replication NODES = 2 WRITES = 2 READS = 1 2 + 1 > 2 -> Strong consistency http://www.allthingsdistributed.com/2007/12/eventually_consistent.html
  16. 16. CouchDB, Slide © Copyright 2008, Callista Enterprise AB Asynchronous DB replication NODES = 2 WRITES = 1 READS = 1 1 + 1 > 2 -> Eventual consistency http://www.allthingsdistributed.com/2007/12/eventually_consistent.html
  17. 17. CouchDB, Slide © Copyright 2008, Callista Enterprise AB What if NODES is 10 or 100 or 1000? Every increase in WRITES means less chance for a write to succeed
  18. 18. CouchDB, Slide © Copyright 2008, Callista Enterprise AB http://www.allthingsdistributed.com/2007/12/eventually_consistent.html http://aws.amazon.com/simpledb http://lucene.apache.org/hadoop/ Read more
  19. 19. CouchDB, Slide © Copyright 2008, Callista Enterprise AB Second reason: Moore has changed tactic 1 2 3
  20. 20. CouchDB, Slide © Copyright 2008, Callista Enterprise AB CPUs are getting slower but more plenty The Free Lunch is over - http://www.gotw.ca/publications/concurrency-ddj.htm
  21. 21. CouchDB, Slide © Copyright 2008, Callista Enterprise AB We need to start parallelizing our tasks Concurrency in Java is really, really hard Share nothing Erlang processes and messaging Map/reduce
  22. 22. CouchDB, Slide © Copyright 2008, Callista Enterprise AB Used for computing views in CouchDB map/reduce
  23. 23. CouchDB, Slide © Copyright 2008, Callista Enterprise AB http://www.gotw.ca/publications/concurrency-ddj.htm http://erlang.org/ http://www.scala-lang.org/ http://labs.google.com/papers/mapreduce.html Read more
  24. 24. CouchDB, Slide © Copyright 2008, Callista Enterprise AB Third reason Web friendly 1 2 3
  25. 25. CouchDB, Slide © Copyright 2008, Callista Enterprise AB REST - “HTTP used right”
  26. 26. CouchDB, Slide © Copyright 2008, Callista Enterprise AB REST based API Everything is a resource Every resource has a URL Every resource has the same uniform interface Links guides through states Stateless
  27. 27. CouchDB, Slide © Copyright 2008, Callista Enterprise AB REST freebies API easily usable from any platform (AJAX, Java, Ruby, COBOL, Powerpoint...)‏ Works with existing infrastructure Caches, proxies, firewalls… Optimistic locking
  28. 28. CouchDB, Slide © Copyright 2008, Callista Enterprise AB http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm http://www.infoq.com/articles/rest-introduction http://www.burtongroup.com/Guest/Aps/RestWorkshop.aspx Read more
  29. 29. CouchDB, Slide © Copyright 2008, Callista Enterprise AB I'm getting sleepy, show me the goodies!
  30. 30. CouchDB, Slide © Copyright 2008, Callista Enterprise AB Adding a to do var todoText = $("todoinput").value; this.db.save({text: todoText });
  31. 31. CouchDB, Slide © Copyright 2008, Callista Enterprise AB Adding a tag if(!todo.tags) { todo.tags = [tag]; } else { todo.tags[todo.tags.length] = tag; } this.db.save(todo);
  32. 32. CouchDB, Slide © Copyright 2008, Callista Enterprise AB The magic of save()‏ this.save = function(doc, options) { if (doc._id == undefined) { xhr.open("POST", this.url); } else { xhr.open("PUT", this.url + doc._id); } xhr.send(doc.toJSONString()); … }
  33. 33. CouchDB, Slide © Copyright 2008, Callista Enterprise AB Questions? ?
  34. 34. CouchDB, Slide © Copyright 2008, Callista Enterprise AB Attributions WHY? - http://www.flickr.com/photos/teflon/128827389/ Deep mud - http://www.flickr.com/photos/hubmedia/133598031/ Banana - http://flickr.com/photos/tim_ellis/154225908/ Forget me not - http://flickr.com/photos/doblonaut/456339900/

×