SlideShare a Scribd company logo
1 of 76
Download to read offline
Persistence                     Michael Bleigh
                                       Intridea, Inc.


      Smoothie
            Blending SQL and NoSQL




      photo by Nikki L. via Flickr

Thursday, March 11, 2010
Thursday, March 11, 2010
Thursday, March 11, 2010
present.ly

Thursday, March 11, 2010
tweetstream hashie
                        acts-as-taggable-on
                      subdomain-fu seed-fu
                           mustache_json

                           github.com/intridea

Thursday, March 11, 2010
@mbleigh

Thursday, March 11, 2010
You’ve (probably)
                       heard a lot about
                            NoSQL


Thursday, March 11, 2010
NoSQL is a new way
                to think about
                  persistence


Thursday, March 11, 2010
Atomicity
                           Consistency
                            Isolation
                            Durability


Thursday, March 11, 2010
Denormalization
               Eventual Consistency
                  Schema-Free
                 Horizontal Scale


Thursday, March 11, 2010
NoSQL tries to scale
                 (more) simply


Thursday, March 11, 2010
NoSQL is going
                            mainstream


Thursday, March 11, 2010
New York Times
                   Business Insider
                   BBC ShopWiki
                    GitHub Meebo
                 Disqus SourceForge
                      Sony Digg

Thursday, March 11, 2010
...but not THAT
                              mainstream.


Thursday, March 11, 2010
A word of caution...



Thursday, March 11, 2010
NoSQL can
                           divide by zero


Thursday, March 11, 2010
sn’t
                d oe s
             QL wait
         oS , it
       N
        s le ep
                            NoSQL can
                           divide by zero
                                NoSQL
                               to infin  counte
                                        ity, twi  d
                                                 ce
Thursday, March 11, 2010
NoSQL is a (growing)
             collection of tools, not
               a new way of life


Thursday, March 11, 2010
Key-Value Stores
            Document Databases
               Column Stores
             Graph Databases

Thursday, March 11, 2010
Key-Value Stores



Thursday, March 11, 2010
Redis

                    • Key-value store + datatypes
                     • Lists, (Scored) Sets, Hashes
                    • Cache-like functions
                           (expiration)
                    • (Mostly) In-Memory
Thursday, March 11, 2010
Riak

                    • Combo key-value store and
                           document database
                    • HTTP REST interface
                    • “Link walking”
                    • Map-Reduce
Thursday, March 11, 2010
Map/Reduce
                    • Massively parallel way to
                           process large datasets
                    • First you scour data and “map” a
                           new set of data
                    • Then you “reduce” the data
                           down to a salient result

Thursday, March 11, 2010
map = function() {
                    this.tags.forEach(function(tag) {
                      emit(tag, {count: 1});
                    });
                  }

                  reduce = function(key, values) {
                    var total = 0;
                    for (var i = 0; i < values.length; i++) {
                      total += values[i].count;
                    return {count: total};
                  }




Thursday, March 11, 2010
Tokyo Cabinet
                             Dynomite
                           MemcachedDB
                             Voldemort

Thursday, March 11, 2010
Document Databases



Thursday, March 11, 2010
MongoDB

                    • Document store that speaks
                           BSON (Binary JSON)
                    • Indexing, simple query syntax
                    • GridFS
                    • Deliberate MapReduce
Thursday, March 11, 2010
CouchDB

                    • JSON Document Store
                    • HTTP REST Interface
                    • Incremental MapReduce
                    • Intelligent Replication
Thursday, March 11, 2010
Column-Oriented
                              Datastores


Thursday, March 11, 2010
Cassandra

                    • Built by Facebook,
                           used by Twitter
                    • Pure horizontal scalability
                    • Schemaless

Thursday, March 11, 2010
Graph Databases



Thursday, March 11, 2010
Neo4J



Thursday, March 11, 2010
When should I use
                        this stuff?


Thursday, March 11, 2010
Complex, slow joins
               for “activity stream”




Thursday, March 11, 2010
Complex, slow joins
               for “activity stream”

                 Denormalize,
              use Key-Value Store
Thursday, March 11, 2010
Variable schema,
                   vertical interaction




Thursday, March 11, 2010
Variable schema,
                   vertical interaction

                Document Database
                 or Column Store
Thursday, March 11, 2010
Modeling multi-step
                relationships




Thursday, March 11, 2010
Modeling multi-step
                relationships


                           Graph Database

Thursday, March 11, 2010
NoSQL solves real
                scalability and data
                   design issues


Thursday, March 11, 2010
Ben Scofield
               bit.ly/state-of-nosql


Thursday, March 11, 2010
Ready to go?



Thursday, March 11, 2010
Just one problem...



Thursday, March 11, 2010
Your data is already
                 in a SQL database


Thursday, March 11, 2010
We CAN all just
                             get along.


Thursday, March 11, 2010
Three Ways



Thursday, March 11, 2010
The Hard(ish) Way



Thursday, March 11, 2010
The Easy Way



Thursday, March 11, 2010
A Better Way?



Thursday, March 11, 2010
The Hard Way:
                           Do it by hand.


Thursday, March 11, 2010
class Post
                    include MongoMapper::Document

                      key   :title, String
                      key   :body, String
                      key   :tags, Array
                      key   :user_id, Integer

                      def user
                        User.find_by_id(self.user_id)
                      end

                    def user=(some_user)
                      self.user_id = some_user.id
                    end
                  end

                  class User < ActiveRecord::Base
                    def posts(options = {})
                      Post.all({:conditions => {:user_id => self.id}}.merge(options))
                    end
                  end




Thursday, March 11, 2010
Pros & Cons
                    •      Simple, maps to your domain

                    •      Works for small, simple ORM intersections

                    •      MUCH simpler in Rails 3

                    •      Complex relationships are a mess

                    •      Makes your models fat

                    •      As DRY as the ocean



Thursday, March 11, 2010
The Easy Way:
                            DataMapper


Thursday, March 11, 2010
DataMapper

                    • Generic, relational ORM
                    • Speaks pretty much everything
                           you’ve ever heard of
                    • Implements Identity Map
                    • Module-based inclusion
Thursday, March 11, 2010
DataMapper.setup(:default, "mysql://localhost")
                  DataMapper.setup(:mongodb, "mongo://localhost/posts")

                  class Post
                    include DataMapper::Resource
                    def self.default_repository_name; :mongodb; end

                      property :title, String
                      property :body, String
                      property :tags, Array

                    belongs_to :user
                  end

                  class User
                    include DataMapper::Resource

                      property :email, String
                      property :name, String

                    has n, :posts
                  end




Thursday, March 11, 2010
Pros & Cons
                    •      The ultimate Polyglot ORM

                    •      Simple relationships between persistence
                           engines are easy

                    •      Jack of all trades, master of none

                    •      Perpetuates (sometimes) false assumptions

                    •      Legacy stuff is in ActiveRecord anyway



Thursday, March 11, 2010
Is there a better way?



Thursday, March 11, 2010
Maybe.



Thursday, March 11, 2010
Gloo: Cross-ORM
           Relationship Mapper

                           github.com/intridea/gloo


Thursday, March 11, 2010
0.0.0.prealpha.1



Thursday, March 11, 2010
Can’t we just sit
                           down and talk to
                             each other?


Thursday, March 11, 2010
class Post
                    include MongoMapper::Resource

                       key :title, String
                       key :body, String
                       key :tags, Array

                    gloo :active_record do
                      belongs_to :user
                    end
                  end

                  class User < ActiveRecord::Base
                    gloo :mongo_mapper do
                      many :posts
                    end
                  end




Thursday, March 11, 2010
Goals/Status
                    • Be able to define relationships
                           on the terms of any ORM from
                           any class, ORM or not
                    • Right Now: Partially working
                           ActiveRecord relationships
                    • Doing it wrong? Maybe
Thursday, March 11, 2010
Code Time:
                           Schema4Less


Thursday, March 11, 2010
Social Storefront
                    • Dummy application of a store that
                           lets others “follow” your purchases (a
                           less creepy Blippy?)
                    • Four requirements:
                            •   users

                            •   purchasing

                            •   listings

                            •   social graph

Thursday, March 11, 2010
Users

                    • I already have an authentication
                           system
                    • I’m happy with it
                    • It’s Devise and ActiveRecord
                    • Stick with SQL
Thursday, March 11, 2010
Purchasing

                    • Users need to be able to purchase
                           items from my storefront
                    • I can’t lose their transactions
                    • I need full ACID
                    • I’ll use MySQL
Thursday, March 11, 2010
Social Graph

                    • I want activity streams and one
                           and two way relationships
                    • I need speed
                    • I don’t need consistency
                    • I’ll use Redis
Thursday, March 11, 2010
Product Listings
                    • I am selling both movies and
                           books
                    • They have very different
                           properties
                    • Products are relatively non-
                           relational
                    • I’ll use MongoDB
Thursday, March 11, 2010
Demo and
                           Walkthrough


Thursday, March 11, 2010
Thursday, March 11, 2010
Wrapping Up



Thursday, March 11, 2010
These systems can
           (and should) live and
              work together


Thursday, March 11, 2010
Most important step
               is to actually think
                about data design


Thursday, March 11, 2010
When you have a
                  whole bag of tools,
                  things stop looking
                       like nails

Thursday, March 11, 2010
Questions?



Thursday, March 11, 2010

More Related Content

Viewers also liked

Fruit Magic Marketing Plan Presentation by Team Fruitilicious
Fruit Magic Marketing Plan Presentation by Team FruitiliciousFruit Magic Marketing Plan Presentation by Team Fruitilicious
Fruit Magic Marketing Plan Presentation by Team Fruitiliciousfiecasivy
 
Chippy Mango New Marketing Plan
Chippy Mango New Marketing PlanChippy Mango New Marketing Plan
Chippy Mango New Marketing PlanShahriar Razin
 
Fruit punch - Launching a New Product - Marketing
Fruit punch - Launching a New Product - MarketingFruit punch - Launching a New Product - Marketing
Fruit punch - Launching a New Product - MarketingCotecna Inspection
 
Smoothie and juice bar business plan
Smoothie and juice bar business planSmoothie and juice bar business plan
Smoothie and juice bar business planchristianhoeller
 

Viewers also liked (8)

Fruit shakes
Fruit shakesFruit shakes
Fruit shakes
 
Shake shack
Shake shackShake shack
Shake shack
 
Fruit Magic Marketing Plan Presentation by Team Fruitilicious
Fruit Magic Marketing Plan Presentation by Team FruitiliciousFruit Magic Marketing Plan Presentation by Team Fruitilicious
Fruit Magic Marketing Plan Presentation by Team Fruitilicious
 
Chippy Mango New Marketing Plan
Chippy Mango New Marketing PlanChippy Mango New Marketing Plan
Chippy Mango New Marketing Plan
 
Marketing for new juice product
Marketing for new juice productMarketing for new juice product
Marketing for new juice product
 
business plan (smoothy juice)
business plan (smoothy juice)business plan (smoothy juice)
business plan (smoothy juice)
 
Fruit punch - Launching a New Product - Marketing
Fruit punch - Launching a New Product - MarketingFruit punch - Launching a New Product - Marketing
Fruit punch - Launching a New Product - Marketing
 
Smoothie and juice bar business plan
Smoothie and juice bar business planSmoothie and juice bar business plan
Smoothie and juice bar business plan
 

Similar to Persistence Smoothie

Best Practices - Mobile Developer Summit
Best Practices - Mobile Developer SummitBest Practices - Mobile Developer Summit
Best Practices - Mobile Developer Summitwolframkriesing
 
Open Content and the Commons
Open Content and the CommonsOpen Content and the Commons
Open Content and the CommonsKaitlin Thaney
 
Node js techtalksto
Node js techtalkstoNode js techtalksto
Node js techtalkstoJason Diller
 
A importância dos dados em sua arquitetura... uma visão muito além do SQL Ser...
A importância dos dados em sua arquitetura... uma visão muito além do SQL Ser...A importância dos dados em sua arquitetura... uma visão muito além do SQL Ser...
A importância dos dados em sua arquitetura... uma visão muito além do SQL Ser...Alexandre Porcelli
 
Addressing vendor weaknesses in user space (Robert Treat)
Addressing vendor weaknesses in user space (Robert Treat)Addressing vendor weaknesses in user space (Robert Treat)
Addressing vendor weaknesses in user space (Robert Treat)Ontico
 
Database Scalability Patterns
Database Scalability PatternsDatabase Scalability Patterns
Database Scalability PatternsRobert Treat
 
Awsome Cloud Meetup 02/09/2010 - Chef 101
Awsome Cloud Meetup 02/09/2010 - Chef 101Awsome Cloud Meetup 02/09/2010 - Chef 101
Awsome Cloud Meetup 02/09/2010 - Chef 101Chef Software, Inc.
 
Jgd User Group Demo
Jgd User Group DemoJgd User Group Demo
Jgd User Group Demobarakmich
 
Data and Information Extraction on the Web
Data and Information Extraction on the WebData and Information Extraction on the Web
Data and Information Extraction on the WebTommaso Teofili
 
TNTBase – a Versioned Database for XML (Mathematical) Documents
TNTBase – a Versioned Database for XML (Mathematical) DocumentsTNTBase – a Versioned Database for XML (Mathematical) Documents
TNTBase – a Versioned Database for XML (Mathematical) DocumentsChristoph Lange
 
Introduction to CouchDB
Introduction to CouchDBIntroduction to CouchDB
Introduction to CouchDBJohn Wood
 
QueryPath: It's like PHP jQuery in Drupal!
QueryPath: It's like PHP jQuery in Drupal!QueryPath: It's like PHP jQuery in Drupal!
QueryPath: It's like PHP jQuery in Drupal!Matt Butcher
 
Model-Driven Software Development - Web Abstractions 1
Model-Driven Software Development - Web Abstractions 1Model-Driven Software Development - Web Abstractions 1
Model-Driven Software Development - Web Abstractions 1Eelco Visser
 
Intertwingularity, Semantic Web and linked Geo data
Intertwingularity, Semantic Web and linked Geo dataIntertwingularity, Semantic Web and linked Geo data
Intertwingularity, Semantic Web and linked Geo dataDan Brickley
 
Introducing Riak and Ripple
Introducing Riak and RippleIntroducing Riak and Ripple
Introducing Riak and RippleSean Cribbs
 
BRAINREPUBLIC - Powered by no-SQL
BRAINREPUBLIC - Powered by no-SQLBRAINREPUBLIC - Powered by no-SQL
BRAINREPUBLIC - Powered by no-SQLAndreas Jung
 
Intro To MongoDB
Intro To MongoDBIntro To MongoDB
Intro To MongoDBAlex Sharp
 

Similar to Persistence Smoothie (20)

Best Practices - Mobile Developer Summit
Best Practices - Mobile Developer SummitBest Practices - Mobile Developer Summit
Best Practices - Mobile Developer Summit
 
Open Content and the Commons
Open Content and the CommonsOpen Content and the Commons
Open Content and the Commons
 
Node js techtalksto
Node js techtalkstoNode js techtalksto
Node js techtalksto
 
Node.js - A Quick Tour II
Node.js - A Quick Tour IINode.js - A Quick Tour II
Node.js - A Quick Tour II
 
A importância dos dados em sua arquitetura... uma visão muito além do SQL Ser...
A importância dos dados em sua arquitetura... uma visão muito além do SQL Ser...A importância dos dados em sua arquitetura... uma visão muito além do SQL Ser...
A importância dos dados em sua arquitetura... uma visão muito além do SQL Ser...
 
Addressing vendor weaknesses in user space (Robert Treat)
Addressing vendor weaknesses in user space (Robert Treat)Addressing vendor weaknesses in user space (Robert Treat)
Addressing vendor weaknesses in user space (Robert Treat)
 
Symfony in the Cloud
Symfony in the CloudSymfony in the Cloud
Symfony in the Cloud
 
Database Scalability Patterns
Database Scalability PatternsDatabase Scalability Patterns
Database Scalability Patterns
 
Awsome Cloud Meetup 02/09/2010 - Chef 101
Awsome Cloud Meetup 02/09/2010 - Chef 101Awsome Cloud Meetup 02/09/2010 - Chef 101
Awsome Cloud Meetup 02/09/2010 - Chef 101
 
Jgd User Group Demo
Jgd User Group DemoJgd User Group Demo
Jgd User Group Demo
 
Data and Information Extraction on the Web
Data and Information Extraction on the WebData and Information Extraction on the Web
Data and Information Extraction on the Web
 
TNTBase – a Versioned Database for XML (Mathematical) Documents
TNTBase – a Versioned Database for XML (Mathematical) DocumentsTNTBase – a Versioned Database for XML (Mathematical) Documents
TNTBase – a Versioned Database for XML (Mathematical) Documents
 
Introduction to CouchDB
Introduction to CouchDBIntroduction to CouchDB
Introduction to CouchDB
 
QueryPath: It's like PHP jQuery in Drupal!
QueryPath: It's like PHP jQuery in Drupal!QueryPath: It's like PHP jQuery in Drupal!
QueryPath: It's like PHP jQuery in Drupal!
 
Model-Driven Software Development - Web Abstractions 1
Model-Driven Software Development - Web Abstractions 1Model-Driven Software Development - Web Abstractions 1
Model-Driven Software Development - Web Abstractions 1
 
Intertwingularity, Semantic Web and linked Geo data
Intertwingularity, Semantic Web and linked Geo dataIntertwingularity, Semantic Web and linked Geo data
Intertwingularity, Semantic Web and linked Geo data
 
Introducing Riak and Ripple
Introducing Riak and RippleIntroducing Riak and Ripple
Introducing Riak and Ripple
 
BRAINREPUBLIC - Powered by no-SQL
BRAINREPUBLIC - Powered by no-SQLBRAINREPUBLIC - Powered by no-SQL
BRAINREPUBLIC - Powered by no-SQL
 
09 Data
09 Data09 Data
09 Data
 
Intro To MongoDB
Intro To MongoDBIntro To MongoDB
Intro To MongoDB
 

More from Michael Bleigh

OmniAuth: From the Ground Up (RailsConf 2011)
OmniAuth: From the Ground Up (RailsConf 2011)OmniAuth: From the Ground Up (RailsConf 2011)
OmniAuth: From the Ground Up (RailsConf 2011)Michael Bleigh
 
OmniAuth: From the Ground Up
OmniAuth: From the Ground UpOmniAuth: From the Ground Up
OmniAuth: From the Ground UpMichael Bleigh
 
The Grapes of Rapid (RubyConf 2010)
The Grapes of Rapid (RubyConf 2010)The Grapes of Rapid (RubyConf 2010)
The Grapes of Rapid (RubyConf 2010)Michael Bleigh
 
Deciphering the Interoperable Web
Deciphering the Interoperable WebDeciphering the Interoperable Web
Deciphering the Interoperable WebMichael Bleigh
 
The Present Future of OAuth
The Present Future of OAuthThe Present Future of OAuth
The Present Future of OAuthMichael Bleigh
 
Hacking the Mid-End (Great Lakes Ruby Bash Edition)
Hacking the Mid-End (Great Lakes Ruby Bash Edition)Hacking the Mid-End (Great Lakes Ruby Bash Edition)
Hacking the Mid-End (Great Lakes Ruby Bash Edition)Michael Bleigh
 

More from Michael Bleigh (9)

OmniAuth: From the Ground Up (RailsConf 2011)
OmniAuth: From the Ground Up (RailsConf 2011)OmniAuth: From the Ground Up (RailsConf 2011)
OmniAuth: From the Ground Up (RailsConf 2011)
 
OmniAuth: From the Ground Up
OmniAuth: From the Ground UpOmniAuth: From the Ground Up
OmniAuth: From the Ground Up
 
The Grapes of Rapid (RubyConf 2010)
The Grapes of Rapid (RubyConf 2010)The Grapes of Rapid (RubyConf 2010)
The Grapes of Rapid (RubyConf 2010)
 
Upgrading to Rails 3
Upgrading to Rails 3Upgrading to Rails 3
Upgrading to Rails 3
 
Deciphering the Interoperable Web
Deciphering the Interoperable WebDeciphering the Interoperable Web
Deciphering the Interoperable Web
 
The Present Future of OAuth
The Present Future of OAuthThe Present Future of OAuth
The Present Future of OAuth
 
Node.js and Ruby
Node.js and RubyNode.js and Ruby
Node.js and Ruby
 
Twitter on Rails
Twitter on RailsTwitter on Rails
Twitter on Rails
 
Hacking the Mid-End (Great Lakes Ruby Bash Edition)
Hacking the Mid-End (Great Lakes Ruby Bash Edition)Hacking the Mid-End (Great Lakes Ruby Bash Edition)
Hacking the Mid-End (Great Lakes Ruby Bash Edition)
 

Recently uploaded

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Recently uploaded (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Persistence Smoothie

  • 1. Persistence Michael Bleigh Intridea, Inc. Smoothie Blending SQL and NoSQL photo by Nikki L. via Flickr Thursday, March 11, 2010
  • 5. tweetstream hashie acts-as-taggable-on subdomain-fu seed-fu mustache_json github.com/intridea Thursday, March 11, 2010
  • 7. You’ve (probably) heard a lot about NoSQL Thursday, March 11, 2010
  • 8. NoSQL is a new way to think about persistence Thursday, March 11, 2010
  • 9. Atomicity Consistency Isolation Durability Thursday, March 11, 2010
  • 10. Denormalization Eventual Consistency Schema-Free Horizontal Scale Thursday, March 11, 2010
  • 11. NoSQL tries to scale (more) simply Thursday, March 11, 2010
  • 12. NoSQL is going mainstream Thursday, March 11, 2010
  • 13. New York Times Business Insider BBC ShopWiki GitHub Meebo Disqus SourceForge Sony Digg Thursday, March 11, 2010
  • 14. ...but not THAT mainstream. Thursday, March 11, 2010
  • 15. A word of caution... Thursday, March 11, 2010
  • 16. NoSQL can divide by zero Thursday, March 11, 2010
  • 17. sn’t d oe s QL wait oS , it N s le ep NoSQL can divide by zero NoSQL to infin counte ity, twi d ce Thursday, March 11, 2010
  • 18. NoSQL is a (growing) collection of tools, not a new way of life Thursday, March 11, 2010
  • 19. Key-Value Stores Document Databases Column Stores Graph Databases Thursday, March 11, 2010
  • 21. Redis • Key-value store + datatypes • Lists, (Scored) Sets, Hashes • Cache-like functions (expiration) • (Mostly) In-Memory Thursday, March 11, 2010
  • 22. Riak • Combo key-value store and document database • HTTP REST interface • “Link walking” • Map-Reduce Thursday, March 11, 2010
  • 23. Map/Reduce • Massively parallel way to process large datasets • First you scour data and “map” a new set of data • Then you “reduce” the data down to a salient result Thursday, March 11, 2010
  • 24. map = function() { this.tags.forEach(function(tag) { emit(tag, {count: 1}); }); } reduce = function(key, values) { var total = 0; for (var i = 0; i < values.length; i++) { total += values[i].count; return {count: total}; } Thursday, March 11, 2010
  • 25. Tokyo Cabinet Dynomite MemcachedDB Voldemort Thursday, March 11, 2010
  • 27. MongoDB • Document store that speaks BSON (Binary JSON) • Indexing, simple query syntax • GridFS • Deliberate MapReduce Thursday, March 11, 2010
  • 28. CouchDB • JSON Document Store • HTTP REST Interface • Incremental MapReduce • Intelligent Replication Thursday, March 11, 2010
  • 29. Column-Oriented Datastores Thursday, March 11, 2010
  • 30. Cassandra • Built by Facebook, used by Twitter • Pure horizontal scalability • Schemaless Thursday, March 11, 2010
  • 33. When should I use this stuff? Thursday, March 11, 2010
  • 34. Complex, slow joins for “activity stream” Thursday, March 11, 2010
  • 35. Complex, slow joins for “activity stream” Denormalize, use Key-Value Store Thursday, March 11, 2010
  • 36. Variable schema, vertical interaction Thursday, March 11, 2010
  • 37. Variable schema, vertical interaction Document Database or Column Store Thursday, March 11, 2010
  • 38. Modeling multi-step relationships Thursday, March 11, 2010
  • 39. Modeling multi-step relationships Graph Database Thursday, March 11, 2010
  • 40. NoSQL solves real scalability and data design issues Thursday, March 11, 2010
  • 41. Ben Scofield bit.ly/state-of-nosql Thursday, March 11, 2010
  • 42. Ready to go? Thursday, March 11, 2010
  • 44. Your data is already in a SQL database Thursday, March 11, 2010
  • 45. We CAN all just get along. Thursday, March 11, 2010
  • 47. The Hard(ish) Way Thursday, March 11, 2010
  • 48. The Easy Way Thursday, March 11, 2010
  • 49. A Better Way? Thursday, March 11, 2010
  • 50. The Hard Way: Do it by hand. Thursday, March 11, 2010
  • 51. class Post include MongoMapper::Document key :title, String key :body, String key :tags, Array key :user_id, Integer def user User.find_by_id(self.user_id) end def user=(some_user) self.user_id = some_user.id end end class User < ActiveRecord::Base def posts(options = {}) Post.all({:conditions => {:user_id => self.id}}.merge(options)) end end Thursday, March 11, 2010
  • 52. Pros & Cons • Simple, maps to your domain • Works for small, simple ORM intersections • MUCH simpler in Rails 3 • Complex relationships are a mess • Makes your models fat • As DRY as the ocean Thursday, March 11, 2010
  • 53. The Easy Way: DataMapper Thursday, March 11, 2010
  • 54. DataMapper • Generic, relational ORM • Speaks pretty much everything you’ve ever heard of • Implements Identity Map • Module-based inclusion Thursday, March 11, 2010
  • 55. DataMapper.setup(:default, "mysql://localhost") DataMapper.setup(:mongodb, "mongo://localhost/posts") class Post include DataMapper::Resource def self.default_repository_name; :mongodb; end property :title, String property :body, String property :tags, Array belongs_to :user end class User include DataMapper::Resource property :email, String property :name, String has n, :posts end Thursday, March 11, 2010
  • 56. Pros & Cons • The ultimate Polyglot ORM • Simple relationships between persistence engines are easy • Jack of all trades, master of none • Perpetuates (sometimes) false assumptions • Legacy stuff is in ActiveRecord anyway Thursday, March 11, 2010
  • 57. Is there a better way? Thursday, March 11, 2010
  • 59. Gloo: Cross-ORM Relationship Mapper github.com/intridea/gloo Thursday, March 11, 2010
  • 61. Can’t we just sit down and talk to each other? Thursday, March 11, 2010
  • 62. class Post include MongoMapper::Resource key :title, String key :body, String key :tags, Array gloo :active_record do belongs_to :user end end class User < ActiveRecord::Base gloo :mongo_mapper do many :posts end end Thursday, March 11, 2010
  • 63. Goals/Status • Be able to define relationships on the terms of any ORM from any class, ORM or not • Right Now: Partially working ActiveRecord relationships • Doing it wrong? Maybe Thursday, March 11, 2010
  • 64. Code Time: Schema4Less Thursday, March 11, 2010
  • 65. Social Storefront • Dummy application of a store that lets others “follow” your purchases (a less creepy Blippy?) • Four requirements: • users • purchasing • listings • social graph Thursday, March 11, 2010
  • 66. Users • I already have an authentication system • I’m happy with it • It’s Devise and ActiveRecord • Stick with SQL Thursday, March 11, 2010
  • 67. Purchasing • Users need to be able to purchase items from my storefront • I can’t lose their transactions • I need full ACID • I’ll use MySQL Thursday, March 11, 2010
  • 68. Social Graph • I want activity streams and one and two way relationships • I need speed • I don’t need consistency • I’ll use Redis Thursday, March 11, 2010
  • 69. Product Listings • I am selling both movies and books • They have very different properties • Products are relatively non- relational • I’ll use MongoDB Thursday, March 11, 2010
  • 70. Demo and Walkthrough Thursday, March 11, 2010
  • 73. These systems can (and should) live and work together Thursday, March 11, 2010
  • 74. Most important step is to actually think about data design Thursday, March 11, 2010
  • 75. When you have a whole bag of tools, things stop looking like nails Thursday, March 11, 2010