Vidoop CouchDB Talk

3,067 views

Published on

Overview of CouchDB,
Demo of CouchApp,
Future of Distributed Identity

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

No Downloads
Views
Total views
3,067
On SlideShare
0
From Embeds
0
Number of Embeds
212
Actions
Shares
0
Downloads
52
Comments
0
Likes
9
Embeds 0
No embeds

No notes for slide

Vidoop CouchDB Talk

  1. 1. Who Am I? • Chris Anderson <jchris@apache.org> • CouchDB committer • Blog: http://jchrisa.net
  2. 2. Couch History • Damien Katz <http://damienkatz.net/> • Worked on Lotus Notes & MySQL • Started CouchDB in 2005 • 2006: Moved to Erlang, JSON and JavaScript • Approaching 0.9 Release
  3. 3. 2008 Erlang User of the Year
  4. 4. This Talk • Hello CouchDB • Hands on with CouchApp • The Future • Get Involved
  5. 5. Hello CouchDB • JSON Documents • HTTP / REST (You already know the API) • ACID Storage Engine • Map Reduce Views • Replication for Freedom • Portable Standalone Applications
  6. 6. JSON Documents {“json” : “key / value pairs”, “_id” : “some uuid”, “_rev” : “mvcc key”, “string keys” : [1,2,3,”four”,null], “schema free” : true} Your programming language supports JSON.
  7. 7. JSON Documents {“json” : “key / value pairs”, “_id” : “some uuid”, “_rev” : “mvcc key”, “string keys” : [1,2,3,”four”,null], “schema free” : “flexible”} Adapt data as your application changes.
  8. 8. HTTP / CRUD You already know the API. GET read PUT create or update DELETE delete POST bulk operation
  9. 9. ACID Storage Engine • Append Only • Multi Version Concurrency Control • B-Tree Indexes O(log n) • Attachment Streaming Oooh, self-similar
  10. 10. 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 } emit(doc.user, doc.points); “points” : 10 } { “key” : “Joe”, “value” : 10 } } { “user” : “Alice”, { “key” : “Mary”, “value” : 9 } } “points” : 5 } { “user” : “Mary”, Reduce “points” : 9 } { “user” : “Bob”, “points” : 7 } function(keys, values, rereduce) { Alice ... Chris: 15 return sum(values); Everyone: 34 }
  11. 11. Peer-Based Replication for Freedom Triggered Incremental Filtered*
  12. 12. Let’s Replicate Everything! • Take full advantage of CouchDB • View-source Open Source • The Future is Distributed
  13. 13. But that’s not RESTful! Representational State Transfer... it’s more than just verbs, it’s the hyperlinks. Webpage Webpage Webpage Webpage ∴ We need HTML.
  14. 14. Render JSON Docs as HTML shows/post.js /drl/_show/sofa/post/Hello-World-For-Real-This-Time
  15. 15. Render Views as HTML lists/index.js /drl/_list/sofa/index/recent-posts?descending=true&limit=8
  16. 16. Hands On with CouchApp • CouchApp is just some filesystem helpers • Embodies “best practices” • CouchApp is not opinionated, CouchDB is. • Don’t shoot the messenger.
  17. 17. Install CouchApp sudo easy_install couchapp or git clone git://github.com/jchris/couchapp.git
  18. 18. Check Your CouchDB http://127.0.0.1:5984/_utils/
  19. 19. Setup Credentials Leaky Abstraction! edit: /usr/local/etc/couchdb/local.ini add: [admins] username = secretpassword
  20. 20. Get the Example App (ajax version) couchapp clone http://jchrisa.net/sofa-ajax/_design/sofa cd sofa couchapp push http://user:pass@localhost:5984/sofa-ajax
  21. 21. The Guts
  22. 22. First Post!
  23. 23. Firebug to see requests
  24. 24. Upgrade to real HTML couchapp clone http://jchrisa.net/drl/_design/sofa cd sofa couchapp push http://user:pass@localhost:5984/sofa
  25. 25. How’s it Work? Macros so functions can be in multiple files.
  26. 26. Templating
  27. 27. The Future • Key-Centric Identity? • P2P Topologies don’t leave room to trust the server. • Multi-Node clusters • High performance, large databases
  28. 28. Resources • #couchdb and #couchapp on irc.freenode.net • http://couchdb.apache.org for mailing lists • http://planet.couchdb.org/ • http://books.couchdb.org/relax/ • Twitter search for “couchdb”
  29. 29. Thank You!

×