Confessions of a relational addict

1,831 views
1,773 views

Published on

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,831
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Confessions of a relational addict

  1. 1. Confessions of a relational addict <ul><li>Chandra Patni </li></ul>
  2. 2. Twitter @cpatni
  3. 3. Architecture
  4. 4. http://www.seas.upenn.edu/~zives/03f/cis550/codd.pdf Volume 13 / Number 6 / June 1970 Volume 13 / Number 6 / June 1970
  5. 5. Promise of ACID <ul><li>Atomicity </li></ul><ul><li>Consistency </li></ul><ul><li>Isolation </li></ul><ul><li>Durability </li></ul>
  6. 6. READ COMMITTED may block
  7. 7. ANSI/ISO SQL... <ul><li>READ UNCOMMITTED to allow for non-blocking reads </li></ul>
  8. 8. But allowed dirty reads...
  9. 9. Isolation. Really?
  10. 10. Locking Lock Escalation Read Lock Write Lock Table Lock
  11. 11. MVCC <ul><li>For transactional memory </li></ul>
  12. 12. <ul><li>Readers don’t block readers </li></ul><ul><li>Readers don’t block writers </li></ul><ul><li>Writers don’t block writers </li></ul><ul><li>Writers block writers (serialized) </li></ul>
  13. 13. Living in a bliss
  14. 14. Until...
  15. 15. need redundancy
  16. 16. scale reads
  17. 17. scale writes
  18. 18. horizontally
  19. 19. Solutions...
  20. 20. replication to scale reads
  21. 21. cache through writes
  22. 22. expensive solution for redundancy
  23. 23. mongodb
  24. 24. Distributed database from ground up
  25. 25. replication in a minute (HA)
  26. 26. built-in cache through writes
  27. 27. replicate if you care about your data
  28. 28. sharding (scale out)
  29. 29. Effective Design
  30. 30. Domain objects rarely fit in a table row
  31. 33. join to assemble domain objects
  32. 34. mongo documents as pre-assembled domain objects
  33. 35. in place updates ($set, $push)
  34. 36. New hotness
  35. 37. Multikeys
  36. 38. Map reduce map = function () { for (var i = 0; i < this.tags.length; i++) { emit(this.tags[i], this.state == &quot;published&quot; ? 1 : 0); } } reduce = function (key, values) { var total = 0; for (var i = 0; i < values.length; i++) { total += values[i]; } return total; }
  37. 39. Capped collections
  38. 40. Geospatial
  39. 41. GridFS
  40. 42. Rubber meets the road
  41. 43. Realtime Dashboard
  42. 44. Realtime Dashboard <ul><li>Realtime stats for 1 sec, 5 secs, 15 secs </li></ul><ul><li>4K updates per second </li></ul><ul><li>pywebsocket </li></ul>
  43. 45. IGN Media: Editorial Generated Content
  44. 46. Content in Mongodb <ul><li>Master/slave over filer for instant backups </li></ul><ul><li>100 ops </li></ul><ul><li>Ruby on Rails backend </li></ul><ul><li>MongoMapper </li></ul><ul><li>Integrate Solr Search with MongoMapper: http://github.com/tsxn26/customized-mongomapper-search </li></ul><ul><li>XML/JSON serialization: http://github.com/rubyorchard/mongomapper </li></ul>
  45. 48. RESTful API
  46. 49. Game Schema Design <ul><li>Rapid Schema Revision </li></ul><ul><li>Optimize canonical use-case </li></ul>
  47. 50. IGN Social: User Generated Content <ul><li>Manish Pandit </li></ul>
  48. 51. Activity Streams <ul><li>3M documents @10-15 qps, @5 updates/sec </li></ul><ul><li>Moving to activity propagation: 4 documents for every user, i.e. a total of 2M documents with arrays of 500 activities each </li></ul><ul><li>Move to replica sets on 1.7 </li></ul>
  49. 52. Meta+Level Games
  50. 53. Shadelight <ul><li>Data in MongoDB and Redis </li></ul><ul><li>Replicated in real-time to slave servers </li></ul><ul><li>Master and slave are in different colo </li></ul><ul><li>Ben Myles wrote awesome library called MongoMatic http://mongomatic.com / </li></ul>
  51. 54. Mongomatic <ul><li>Ruby datamapper for MongoDB </li></ul><ul><li>Simple and embraces MongoDB </li></ul><ul><li>Shadelight and Mongo Machine ( http://mongomachine.com/ ) use it </li></ul>
  52. 55. We’re hiring <ul><li>http://corp.ign.com / </li></ul><ul><li>http://labs.ign.com / </li></ul>

×