Polyglot Persistence

1,385
-1

Published on

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

No Downloads
Views
Total Views
1,385
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
39
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Polyglot Persistence

  1. 1. POLYGLOT PERSISTENCE alex brandt sr developer Wednesday, August 21, 13
  2. 2. 2 Wednesday, August 21, 13
  3. 3. 3 Wednesday, August 21, 13
  4. 4. 4 Wednesday, August 21, 13
  5. 5. 5 RDBMS may not be the best fit Wednesday, August 21, 13
  6. 6. 6 Wednesday, August 21, 13
  7. 7. 7 Wednesday, August 21, 13
  8. 8. INTRODUCTION TO NOSQL • NoSQL Database (1998) • NoREL • “Not only SQL” • NoSQL (2009) 8 Wednesday, August 21, 13
  9. 9. 9 5 Characteristics Wednesday, August 21, 13
  10. 10. 10 Non-relational Wednesday, August 21, 13
  11. 11. 11 Distributed Wednesday, August 21, 13
  12. 12. 12 Open-source Wednesday, August 21, 13
  13. 13. 13 Horizontally Scalable Wednesday, August 21, 13
  14. 14. 14 Schema-less Wednesday, August 21, 13
  15. 15. orders customers order lines credit cards ID: 1001 line items: customer: Ann 0321293533 0321601912 0131495054 2 1 1 $48 $48 $39 $51 $39 $51 payment details: Card: Amex CC #: 12345 expires: 04/2001 15 Wednesday, August 21, 13
  16. 16. 16 Types in Detail Wednesday, August 21, 13
  17. 17. Key/Value DatabaseS 17 Wednesday, August 21, 13
  18. 18. Key/Value DatabaseS • Good Use Cases: • Storing Session Information • User Profiles & Preferences • Shopping Cart Data • Bad Use Cases: • Data Relationships •Multi-operation Transactions •Query by Data 18 Wednesday, August 21, 13
  19. 19. Key/Value DatabaseS • Good Use Cases: • Storing Session Information • User Profiles & Preferences • Shopping Cart Data • Bad Use Cases: • Data Relationships •Multi-operation Transactions •Query by Data 19 Wednesday, August 21, 13
  20. 20. document Database 20 Wednesday, August 21, 13
  21. 21. document Databases •Good Use Cases: • Event Logging • Blogging Platforms • Real-time Analytics • Article storage • Bad Use Cases: • Complex Transactions •Queries against Varying Aggregate Structures 21 Wednesday, August 21, 13
  22. 22. document Databases •Good Use Cases: • Event Logging • Blogging Platforms • Real-time Analytics • Article storage • Bad Use Cases: • Complex Transactions •Queries against Varying Aggregate Structures 22 Wednesday, August 21, 13
  23. 23. COLUMN FAMILY 23 Wednesday, August 21, 13
  24. 24. 24 Wednesday, August 21, 13
  25. 25. COLUMN-FAMILY datastores •Good Use Cases: • Event Logging • Blogging Platforms • Counters (page visits) • Expiring Usage • Bad Use Cases: • ACID transactions required • Early prototype applications 25 Wednesday, August 21, 13
  26. 26. graph database 26 Wednesday, August 21, 13
  27. 27. Amanda KNOWS KNOWS KNOWS Robert Gerry Lamar KNOWS App 1 BUILT BUILT KNOWS App 2 USES BUILT Christie KNOWS Destiny Jessica KNOWS App 3 BUILT USES USES USES KNOWS graph database 27 Wednesday, August 21, 13
  28. 28. graph databases •Good Use Cases: • Connected Data • Location-based services • Recommendation engines • Bad Use Cases: • Ability to update specific aggregates 28 Wednesday, August 21, 13
  29. 29. Companies using nosql 29 DATABASE COMPANIES Wednesday, August 21, 13
  30. 30. THE FUTURE IS POLYGLOT 30 Neo4J database Cassandra database Couch database MongoDB database RELATIONAL DATABASE Graph-structured domain rules Columnar data access with decentralization Document structures Document structures with offline processing (Actors) (Actors) (Actors)(Actors) Asynchronous message passing MODULE 1 MODULE 2 MODULE 3 MODULE 4 IEEE Software Sept/October 2010 - Debasish Ghosh / Twitter @debasishg Wednesday, August 21, 13
  31. 31. 31 POLYGLOT PATTERN: cache ORDER TAKING RESTAURANT MANAGEMENT REDIS CACHE MYSQL DATABASE SECONDFIRST CONSUMER RESTAURANT OWNER Credit: @crichardson Wednesday, August 21, 13
  32. 32. 32 POLYGLOT PATTERN: write to sql and NOSQL NEW TWEET INSERT LPUSHX LTRIM MySQL TWEETS FOLLOWS FOLLOWERS Redis: Timeline FOLLOWER 1 FOLLOWER 2 FOLLOWER 3 Avoid expensive MySQL joins Credit: @crichardson Wednesday, August 21, 13
  33. 33. 33 POLYGLOT PATTERN: REPLICATE FROM MYsql to NOSQL QUERY SERVICE UPDATE SERVICE REDIS MYSQL DATABASE SYSTEM OF RECORD MATERIALIZED VIEW READER WRITER replicate and denormalize query() update() Credit: @crichardson Wednesday, August 21, 13
  34. 34. 34 Atomic Consistent Isolated Durable ACID to base Basically Available Soft state Eventually consistent Wednesday, August 21, 13

×