Why couchdb is cool

3,216 views

Published on

A short presentation (25') focused on why I think couchdb is cool, what he does really well and for what problems he should be used to solve

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

No Downloads
Views
Total views
3,216
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
65
Comments
0
Likes
8
Embeds 0
No embeds

No notes for slide

Why couchdb is cool

  1. 1. Webtechcon Milano 10/11/2010
  2. 2. gabriele lana gabriele.lana@cleancode.it twitter: @gabrielelana
  3. 3. “i can’t tell you how i work in 25’ but i can tell you why i am cool”
  4. 4. what i am #1 document oriented database
  5. 5. key -> document name: “Gabriele” 1 job: “Programmer” born: “02/07/1977” company: “CleanCode” name: “Paolo” 2 job: “Manager” born: “17/12/1965” company: “BadCode” name: “Enzo” 3 job: “Plumber” born: “22/04/1982” company: “CleanPipe”
  6. 6. complex values name: “Gabriele” 1 job: “Programmer” born: [ 2, 7, 1977 ] company: “CleanCode”
  7. 7. map as filter function(document)
{ 



if
(document.job
===
"Programmer")
{ 







emit(document.id,
document) 



} } 1 ... 1 ... 2 ... 2 ... 3 ... 3 ...
  8. 8. map as filter function(document)
{ 



if
(document.job
===
"Programmer")
{ 







emit(document.id,
document) 



} } yep is javascript
  9. 9. map -> index function(document)
{ 



emit(document.born,
document) } 19970702 ... 19651217 ... 19820422 ...
  10. 10. range queries are fast function(document)
{ 



emit(document.born,
document) } 19970702 ... 19651217 ... 19820422 ...
  11. 11. map -> reduce -> index from: “Gabriele” 1 to: “Chiara” at: [2010,11,11,21,30] message: “...” How many messages sended from gabriele?
  12. 12. map -> reduce -> index function(document)
{ function(from,
messages)
{ 



emit(document.from,
1) 



sum(messages) } } “Gabriele” 10 “Chiara” 127 “Renato” 45
  13. 13. index with complex key function(document)
{ 



emit([
document.from
].concat(document.at)),
1) } [ “Gabriele”,2010,11,11,21,30 ] 1
  14. 14. reduce by group levels [ “Gabriele”,2010,11,11,21,30 ] 1 level 3 [ “Gabriele”,2010,11 ] 4 level 2 [ “Gabriele”,2010 ] 7 level 1 [ “Gabriele” ] 10
  15. 15. logarithmic update map/ reduce
  16. 16. logarithmic update map/ reduce
  17. 17. logarithmic update (real time queries) map/ reduce
  18. 18. crash only policy append only multiversion rev/0 rev/1 concurrency control
  19. 19. replication • master -> slave
  20. 20. replication • master -> slave • master -> slaves
  21. 21. replication • master -> slave • master -> slaves • master -> master
  22. 22. replication • master -> slave • master -> slaves • master -> master • PEEr -> peer
  23. 23. sharding
  24. 24. usage patterns oltp olap Relatively Often complex standardized and queries involving simple queries aggregations. Returning Periodic batch relatively few jobs refresh the records data
  25. 25. what i am #2 web server
  26. 26. web server http • crud on documents • documents attachments • long polling changes • proper caching • lots of libraries • firewall friendly
  27. 27. what i am #3 application server
  28. 28. application server
  29. 29. application server
  30. 30. application server • show document • list documents • authentication • url rewrite • good for small applications • good for back offices
  31. 31. i have good friends
  32. 32. books...
  33. 33. questions?
  34. 34. gabriele lana gabriele.lana@cleancode.it twitter: @gabrielelana

×