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


       Smoothie
       Blending SQL and NoSQL




      photo by Nikki L. via Flickr

Saturday, April 10, 2010
Saturday, April 10, 2010
present.ly

Saturday, April 10, 2010
The Buzz


Saturday, April 10, 2010
You’ve (probably)
                           heard a lot about
                                NoSQL


Saturday, April 10, 2010
NoSQL is a new way
                 to think about
                   persistence


Saturday, April 10, 2010
Atomicity
                           Consistency
                            Isolation
                            Durability


Saturday, April 10, 2010
Denormalization
                 Eventual Consistency
                    Schema-Free
                   Horizontal Scale
                     Map Reduce

Saturday, April 10, 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

Saturday, April 10, 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};
                   }




Saturday, April 10, 2010
NoSQL tries to scale
                  (more) simply


Saturday, April 10, 2010
NoSQL is going
                            mainstream


Saturday, April 10, 2010
New York Times
                     Business Insider
                     BBC ShopWiki
                      GitHub Meebo
                   Disqus SourceForge
                        Sony Digg

Saturday, April 10, 2010
...but not THAT
                              mainstream.


Saturday, April 10, 2010
A word of caution...



Saturday, April 10, 2010
Saturday, April 10, 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
Saturday, April 10, 2010
NoSQL is a (growing)
              collection of tools, not
                a new way of life


Saturday, April 10, 2010
The Ecosystem


Saturday, April 10, 2010
Key-Value Stores

                                   • Voldemort
                      •    Redis
                                   • Tokyo Cabinet
                      • Riak       • MemcachedDB

Saturday, April 10, 2010
Document Stores


                      •    MongoDB   • Riak
                      • CouchDB      • FleetDB

Saturday, April 10, 2010
Column(ish) Stores


                      •    Cassandra
                      • HBase


Saturday, April 10, 2010
Graph Databases

                      •    Neo4j
                      • HypergraphDB
                      • InfoGrid

Saturday, April 10, 2010
When should I use
                this stuff?


Saturday, April 10, 2010
Complex, slow joins
                 for “activity stream”




Saturday, April 10, 2010
Complex, slow joins
                 for “activity stream”

                   Denormalize,
                use Key-Value Store
Saturday, April 10, 2010
Variable schema,
                    vertical interaction




Saturday, April 10, 2010
Variable schema,
                    vertical interaction

                 Document Database
                  or Column Store
Saturday, April 10, 2010
Modeling deep
                           relationships




Saturday, April 10, 2010
Modeling deep
                           relationships


                           Graph Database

Saturday, April 10, 2010
NoSQL solves real
                 scalability and data
                    design issues


Saturday, April 10, 2010
Ben Scofield
                bit.ly/state-of-nosql


Saturday, April 10, 2010
Ready to go?



Saturday, April 10, 2010
Just one problem...



Saturday, April 10, 2010
Your data is already
                  in a SQL database


Saturday, April 10, 2010
So now we need to
                      ask the question...


Saturday, April 10, 2010
Saturday, April 10, 2010
Yeah, it blends.



Saturday, April 10, 2010
The “Hard” Way:
                            Do it by hand.


Saturday, April 10, 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




Saturday, April 10, 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



Saturday, April 10, 2010
The “Easy” Way:
                            DataMapper


Saturday, April 10, 2010
DataMapper

                      • Generic, relational ORM
                      • Speaks pretty much everything
                           you’ve ever heard of
                      • Implements Identity Map
                      • Module-based inclusion
Saturday, April 10, 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




Saturday, April 10, 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



Saturday, April 10, 2010
Show and Tell:
                   Social Storefront


Saturday, April 10, 2010
Saturday, April 10, 2010
The Application
                      • Dummy version of a store that lets
                           others “follow” your purchases (like a
                           less creepy version of Blippy)
                      • Four requirements:
                            •   users

                            •   purchasing

                            •   listings

                            •   social graph

Saturday, April 10, 2010
Users

                      • I already have an authentication
                           system
                      • I’m happy with it
                      • It’s Devise and ActiveRecord
                      • Stick with SQL
Saturday, April 10, 2010
Purchasing

                      • Users need to be able to purchase
                           items from my storefront
                      • I can’t lose their transactions
                      • I need full ACID
                      • SQL Again
Saturday, April 10, 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
Saturday, April 10, 2010
Product Listings
                      • I am selling both books about
                           Ruby and movies about zombies
                      • They have very different
                           properties
                      • Products are relatively non-
                           relational
                      • I’ll use MongoDB
Saturday, April 10, 2010
Demo and
                           Walkthrough


Saturday, April 10, 2010
Wrapping Up



Saturday, April 10, 2010
These systems can
            (and should) live and
               work together


Saturday, April 10, 2010
Most important step
                is to actually think
                 about data design


Saturday, April 10, 2010
When you have a
                   whole bag of tools,
                   things stop looking
                        like nails

Saturday, April 10, 2010
@mbleigh

Saturday, April 10, 2010
Questions?



Saturday, April 10, 2010

More Related Content

Viewers also liked

Its Not About The Smoothie
Its Not About The SmoothieIts Not About The Smoothie
Its Not About The SmoothieChris Finlay
 
20 cheap and easy marketing and advertising ideas
20 cheap and easy marketing and advertising ideas20 cheap and easy marketing and advertising ideas
20 cheap and easy marketing and advertising ideasSusana Gallardo
 
NoSQL Plus MySQL From MySQL Practitioner\'s Point Of View
NoSQL Plus MySQL From MySQL Practitioner\'s Point Of ViewNoSQL Plus MySQL From MySQL Practitioner\'s Point Of View
NoSQL Plus MySQL From MySQL Practitioner\'s Point Of ViewAlex Esterkin
 
NoSQL, Growing up at Oracle
NoSQL, Growing up at OracleNoSQL, Growing up at Oracle
NoSQL, Growing up at OracleDATAVERSITY
 
Automated Schema Design for NoSQL Databases
Automated Schema Design for NoSQL DatabasesAutomated Schema Design for NoSQL Databases
Automated Schema Design for NoSQL DatabasesMichael Mior
 
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015NoSQLmatters
 
7 Databases in 70 minutes
7 Databases in 70 minutes7 Databases in 70 minutes
7 Databases in 70 minutesKaren Lopez
 
NoSE: Schema Design for NoSQL Applications
NoSE: Schema Design for NoSQL ApplicationsNoSE: Schema Design for NoSQL Applications
NoSE: Schema Design for NoSQL ApplicationsMichael Mior
 
Jamba Juice Facebook Analysis
Jamba Juice Facebook AnalysisJamba Juice Facebook Analysis
Jamba Juice Facebook Analysisjennyyparkk
 
NoSQL and Data Modeling for Data Modelers
NoSQL and Data Modeling for Data ModelersNoSQL and Data Modeling for Data Modelers
NoSQL and Data Modeling for Data ModelersKaren Lopez
 
Software Developer and Architecture @ LinkedIn (QCon SF 2014)
Software Developer and Architecture @ LinkedIn (QCon SF 2014)Software Developer and Architecture @ LinkedIn (QCon SF 2014)
Software Developer and Architecture @ LinkedIn (QCon SF 2014)Sid Anand
 
Become an Expert in Local Marketing
Become an Expert in Local MarketingBecome an Expert in Local Marketing
Become an Expert in Local MarketingHubSpot
 
Operational Analytics Using Spark and NoSQL Data Stores
Operational Analytics Using Spark and NoSQL Data StoresOperational Analytics Using Spark and NoSQL Data Stores
Operational Analytics Using Spark and NoSQL Data StoresDATAVERSITY
 
SCOM 388 Final Report
SCOM 388 Final ReportSCOM 388 Final Report
SCOM 388 Final ReportHayley Hall
 
Non-Relational Databases & Key/Value Stores
Non-Relational Databases & Key/Value StoresNon-Relational Databases & Key/Value Stores
Non-Relational Databases & Key/Value StoresJoël Perras
 
A Strategic Analysis of Jamba Juice Using Mathematical Models
A Strategic Analysis of Jamba Juice Using Mathematical ModelsA Strategic Analysis of Jamba Juice Using Mathematical Models
A Strategic Analysis of Jamba Juice Using Mathematical ModelsJerry Morales
 
Wakanda: NoSQL for Model-Driven Web applications - NoSQL matters 2012
Wakanda: NoSQL for Model-Driven Web applications - NoSQL matters 2012Wakanda: NoSQL for Model-Driven Web applications - NoSQL matters 2012
Wakanda: NoSQL for Model-Driven Web applications - NoSQL matters 2012Alexandre Morgaut
 

Viewers also liked (20)

Tropical Smoothie Cafe (VA, MD & WV): 2014 in Review
Tropical Smoothie Cafe (VA, MD & WV): 2014 in ReviewTropical Smoothie Cafe (VA, MD & WV): 2014 in Review
Tropical Smoothie Cafe (VA, MD & WV): 2014 in Review
 
Its Not About The Smoothie
Its Not About The SmoothieIts Not About The Smoothie
Its Not About The Smoothie
 
20 cheap and easy marketing and advertising ideas
20 cheap and easy marketing and advertising ideas20 cheap and easy marketing and advertising ideas
20 cheap and easy marketing and advertising ideas
 
NoSQL Plus MySQL From MySQL Practitioner\'s Point Of View
NoSQL Plus MySQL From MySQL Practitioner\'s Point Of ViewNoSQL Plus MySQL From MySQL Practitioner\'s Point Of View
NoSQL Plus MySQL From MySQL Practitioner\'s Point Of View
 
NoSQL, Growing up at Oracle
NoSQL, Growing up at OracleNoSQL, Growing up at Oracle
NoSQL, Growing up at Oracle
 
Automated Schema Design for NoSQL Databases
Automated Schema Design for NoSQL DatabasesAutomated Schema Design for NoSQL Databases
Automated Schema Design for NoSQL Databases
 
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
 
7 Databases in 70 minutes
7 Databases in 70 minutes7 Databases in 70 minutes
7 Databases in 70 minutes
 
NoSE: Schema Design for NoSQL Applications
NoSE: Schema Design for NoSQL ApplicationsNoSE: Schema Design for NoSQL Applications
NoSE: Schema Design for NoSQL Applications
 
Step By Step Local Marketing Action Guide
Step By Step Local Marketing Action Guide Step By Step Local Marketing Action Guide
Step By Step Local Marketing Action Guide
 
Jamba Juice Facebook Analysis
Jamba Juice Facebook AnalysisJamba Juice Facebook Analysis
Jamba Juice Facebook Analysis
 
NoSQL and Data Modeling for Data Modelers
NoSQL and Data Modeling for Data ModelersNoSQL and Data Modeling for Data Modelers
NoSQL and Data Modeling for Data Modelers
 
Software Developer and Architecture @ LinkedIn (QCon SF 2014)
Software Developer and Architecture @ LinkedIn (QCon SF 2014)Software Developer and Architecture @ LinkedIn (QCon SF 2014)
Software Developer and Architecture @ LinkedIn (QCon SF 2014)
 
Become an Expert in Local Marketing
Become an Expert in Local MarketingBecome an Expert in Local Marketing
Become an Expert in Local Marketing
 
Operational Analytics Using Spark and NoSQL Data Stores
Operational Analytics Using Spark and NoSQL Data StoresOperational Analytics Using Spark and NoSQL Data Stores
Operational Analytics Using Spark and NoSQL Data Stores
 
SCOM 388 Final Report
SCOM 388 Final ReportSCOM 388 Final Report
SCOM 388 Final Report
 
Non-Relational Databases & Key/Value Stores
Non-Relational Databases & Key/Value StoresNon-Relational Databases & Key/Value Stores
Non-Relational Databases & Key/Value Stores
 
A Strategic Analysis of Jamba Juice Using Mathematical Models
A Strategic Analysis of Jamba Juice Using Mathematical ModelsA Strategic Analysis of Jamba Juice Using Mathematical Models
A Strategic Analysis of Jamba Juice Using Mathematical Models
 
Wakanda: NoSQL for Model-Driven Web applications - NoSQL matters 2012
Wakanda: NoSQL for Model-Driven Web applications - NoSQL matters 2012Wakanda: NoSQL for Model-Driven Web applications - NoSQL matters 2012
Wakanda: NoSQL for Model-Driven Web applications - NoSQL matters 2012
 
NoSQL meets Microservices
NoSQL meets MicroservicesNoSQL meets Microservices
NoSQL meets Microservices
 

Similar to Persistence Smoothie: Blending SQL and NoSQL (RubyNation Edition)

Edted 2010 Ruby on Rails
Edted 2010 Ruby on RailsEdted 2010 Ruby on Rails
Edted 2010 Ruby on RailsFabio Akita
 
Introducing Riak and Ripple
Introducing Riak and RippleIntroducing Riak and Ripple
Introducing Riak and RippleSean Cribbs
 
Node js techtalksto
Node js techtalkstoNode js techtalksto
Node js techtalkstoJason Diller
 
Caelum dicas web 2010
Caelum dicas web 2010Caelum dicas web 2010
Caelum dicas web 2010Fabio Akita
 
Building Brilliant APIs
Building Brilliant APIsBuilding Brilliant APIs
Building Brilliant APIsbencollier
 
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
 
Web Development With Ruby - From Simple To Complex
Web Development With Ruby - From Simple To ComplexWeb Development With Ruby - From Simple To Complex
Web Development With Ruby - From Simple To ComplexBrian Hogan
 
Opscode Lightning Talk - Operations as Code
Opscode Lightning Talk - Operations as CodeOpscode Lightning Talk - Operations as Code
Opscode Lightning Talk - Operations as CodeJohn Willis
 
MySQL Sandbox - A toolkit for laziness
MySQL Sandbox - A toolkit for lazinessMySQL Sandbox - A toolkit for laziness
MySQL Sandbox - A toolkit for lazinessGiuseppe Maxia
 
Making your oss project more like rails
Making your oss project more like railsMaking your oss project more like rails
Making your oss project more like railsYehuda Katz
 
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
 
Sencha Touch beta — Amazing Mobile Web Apps with HTML5, CSS3 & JavaScript
Sencha Touch beta — Amazing Mobile Web Apps with HTML5, CSS3 & JavaScriptSencha Touch beta — Amazing Mobile Web Apps with HTML5, CSS3 & JavaScript
Sencha Touch beta — Amazing Mobile Web Apps with HTML5, CSS3 & JavaScriptDavid Kaneda
 
A Match Made In The Cloud
A Match Made In The CloudA Match Made In The Cloud
A Match Made In The CloudChapter Three
 
Database Scalability Patterns
Database Scalability PatternsDatabase Scalability Patterns
Database Scalability PatternsRobert Treat
 
The Mobile Web @ 2010 JSConf
The Mobile Web @ 2010 JSConfThe Mobile Web @ 2010 JSConf
The Mobile Web @ 2010 JSConfdion
 

Similar to Persistence Smoothie: Blending SQL and NoSQL (RubyNation Edition) (20)

Node.js - A Quick Tour II
Node.js - A Quick Tour IINode.js - A Quick Tour II
Node.js - A Quick Tour II
 
Edted 2010 Ruby on Rails
Edted 2010 Ruby on RailsEdted 2010 Ruby on Rails
Edted 2010 Ruby on Rails
 
noSQL @ QCon SP
noSQL @ QCon SPnoSQL @ QCon SP
noSQL @ QCon SP
 
Introducing Riak and Ripple
Introducing Riak and RippleIntroducing Riak and Ripple
Introducing Riak and Ripple
 
Node.js and Ruby
Node.js and RubyNode.js and Ruby
Node.js and Ruby
 
Node js techtalksto
Node js techtalkstoNode js techtalksto
Node js techtalksto
 
Caelum dicas web 2010
Caelum dicas web 2010Caelum dicas web 2010
Caelum dicas web 2010
 
Java to scala
Java to scalaJava to scala
Java to scala
 
Building Brilliant APIs
Building Brilliant APIsBuilding Brilliant APIs
Building Brilliant APIs
 
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!
 
Web Development With Ruby - From Simple To Complex
Web Development With Ruby - From Simple To ComplexWeb Development With Ruby - From Simple To Complex
Web Development With Ruby - From Simple To Complex
 
Opscode Lightning Talk - Operations as Code
Opscode Lightning Talk - Operations as CodeOpscode Lightning Talk - Operations as Code
Opscode Lightning Talk - Operations as Code
 
MySQL Sandbox - A toolkit for laziness
MySQL Sandbox - A toolkit for lazinessMySQL Sandbox - A toolkit for laziness
MySQL Sandbox - A toolkit for laziness
 
Operations as Code
Operations as CodeOperations as Code
Operations as Code
 
Making your oss project more like rails
Making your oss project more like railsMaking your oss project more like rails
Making your oss project more like rails
 
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
 
Sencha Touch beta — Amazing Mobile Web Apps with HTML5, CSS3 & JavaScript
Sencha Touch beta — Amazing Mobile Web Apps with HTML5, CSS3 & JavaScriptSencha Touch beta — Amazing Mobile Web Apps with HTML5, CSS3 & JavaScript
Sencha Touch beta — Amazing Mobile Web Apps with HTML5, CSS3 & JavaScript
 
A Match Made In The Cloud
A Match Made In The CloudA Match Made In The Cloud
A Match Made In The Cloud
 
Database Scalability Patterns
Database Scalability PatternsDatabase Scalability Patterns
Database Scalability Patterns
 
The Mobile Web @ 2010 JSConf
The Mobile Web @ 2010 JSConfThe Mobile Web @ 2010 JSConf
The Mobile Web @ 2010 JSConf
 

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 (8)

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
 
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

UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 

Recently uploaded (20)

UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 

Persistence Smoothie: Blending SQL and NoSQL (RubyNation Edition)

  • 1. Michael Bleigh Persistence Intridea, Inc. Smoothie Blending SQL and NoSQL photo by Nikki L. via Flickr Saturday, April 10, 2010
  • 5. You’ve (probably) heard a lot about NoSQL Saturday, April 10, 2010
  • 6. NoSQL is a new way to think about persistence Saturday, April 10, 2010
  • 7. Atomicity Consistency Isolation Durability Saturday, April 10, 2010
  • 8. Denormalization Eventual Consistency Schema-Free Horizontal Scale Map Reduce Saturday, April 10, 2010
  • 9. 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 Saturday, April 10, 2010
  • 10. 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}; } Saturday, April 10, 2010
  • 11. NoSQL tries to scale (more) simply Saturday, April 10, 2010
  • 12. NoSQL is going mainstream Saturday, April 10, 2010
  • 13. New York Times Business Insider BBC ShopWiki GitHub Meebo Disqus SourceForge Sony Digg Saturday, April 10, 2010
  • 14. ...but not THAT mainstream. Saturday, April 10, 2010
  • 15. A word of caution... Saturday, April 10, 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 Saturday, April 10, 2010
  • 18. NoSQL is a (growing) collection of tools, not a new way of life Saturday, April 10, 2010
  • 20. Key-Value Stores • Voldemort • Redis • Tokyo Cabinet • Riak • MemcachedDB Saturday, April 10, 2010
  • 21. Document Stores • MongoDB • Riak • CouchDB • FleetDB Saturday, April 10, 2010
  • 22. Column(ish) Stores • Cassandra • HBase Saturday, April 10, 2010
  • 23. Graph Databases • Neo4j • HypergraphDB • InfoGrid Saturday, April 10, 2010
  • 24. When should I use this stuff? Saturday, April 10, 2010
  • 25. Complex, slow joins for “activity stream” Saturday, April 10, 2010
  • 26. Complex, slow joins for “activity stream” Denormalize, use Key-Value Store Saturday, April 10, 2010
  • 27. Variable schema, vertical interaction Saturday, April 10, 2010
  • 28. Variable schema, vertical interaction Document Database or Column Store Saturday, April 10, 2010
  • 29. Modeling deep relationships Saturday, April 10, 2010
  • 30. Modeling deep relationships Graph Database Saturday, April 10, 2010
  • 31. NoSQL solves real scalability and data design issues Saturday, April 10, 2010
  • 32. Ben Scofield bit.ly/state-of-nosql Saturday, April 10, 2010
  • 33. Ready to go? Saturday, April 10, 2010
  • 35. Your data is already in a SQL database Saturday, April 10, 2010
  • 36. So now we need to ask the question... Saturday, April 10, 2010
  • 38. Yeah, it blends. Saturday, April 10, 2010
  • 39. The “Hard” Way: Do it by hand. Saturday, April 10, 2010
  • 40. 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 Saturday, April 10, 2010
  • 41. 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 Saturday, April 10, 2010
  • 42. The “Easy” Way: DataMapper Saturday, April 10, 2010
  • 43. DataMapper • Generic, relational ORM • Speaks pretty much everything you’ve ever heard of • Implements Identity Map • Module-based inclusion Saturday, April 10, 2010
  • 44. 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 Saturday, April 10, 2010
  • 45. 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 Saturday, April 10, 2010
  • 46. Show and Tell: Social Storefront Saturday, April 10, 2010
  • 48. The Application • Dummy version of a store that lets others “follow” your purchases (like a less creepy version of Blippy) • Four requirements: • users • purchasing • listings • social graph Saturday, April 10, 2010
  • 49. Users • I already have an authentication system • I’m happy with it • It’s Devise and ActiveRecord • Stick with SQL Saturday, April 10, 2010
  • 50. Purchasing • Users need to be able to purchase items from my storefront • I can’t lose their transactions • I need full ACID • SQL Again Saturday, April 10, 2010
  • 51. Social Graph • I want activity streams and one and two way relationships • I need speed • I don’t need consistency • I’ll use Redis Saturday, April 10, 2010
  • 52. Product Listings • I am selling both books about Ruby and movies about zombies • They have very different properties • Products are relatively non- relational • I’ll use MongoDB Saturday, April 10, 2010
  • 53. Demo and Walkthrough Saturday, April 10, 2010
  • 55. These systems can (and should) live and work together Saturday, April 10, 2010
  • 56. Most important step is to actually think about data design Saturday, April 10, 2010
  • 57. When you have a whole bag of tools, things stop looking like nails Saturday, April 10, 2010