SlideShare une entreprise Scribd logo
1  sur  27
NOSQL
agile data storage
SQL: THE BEGINNING
• Data structured on tables
 using columns

• Data on one column is the
 key for making relationships
 with other tables

• Normalization

• RDBMS
SQL EXAMPLES
RDBMS BENEFITS
• Normalization  (a common
 standard format for
 accessing data)

• Data   consistency

• Persistence

• Consistency

• Replication
RDBMS PROBLEMS
RDBMS PROBLEMS
• Highcost on performing
 complex operations over a
 big database

• High
     system load: scalability
 needs

• Difficult   failover recovery

• Difficult   denormalization
NOSQL TO THE RESCUE!
NOSQL IS...
•A  storage system for format
 free data

• Web   scale

• Software    darwinism

• Different
          types of solutions
 depending on the needs:
 Key-value, Documents,
 Graphs, Objects...
REDIS
• http://redis.io               Redis is SEXY

• Key-value    store

• In   memory

• Persistent
          (periodical
 asynchronous writes to disk)

• All   operations are atomic
REDIS
Types of data          Cool operations
• Hashes
                       • RPOPLPUSH
• Sets    (arrays)
                       • Pub/Sub
• Lists
REDIS
HSET myuser “email” “ivan@ivanhq.net”
HSET myuser “web” “http://ibelmonte.com”
HSET myuser “blog” “http://ivanh.net”

HGET myuser “email”
- ivan@ivanhq.net
REDIS
sadd myuser:books “jackass”
sadd myuser:books “jackass2”
sadd myuser:books “Dude, where’s my car?”
sadd myuser:books “The hangover”

smembers myuser:books
1. jackass
2. jackass2
3. Dude, where’s my car?
4. The hangover
REDIS

rpush friends “John Doe”
rpush friends “Foo”
rpush friends “Bar”

lrange friends 0 -1
1. John Doe
2. Foo
3. Bar
REDIS

rpush nonfriends “Peter Pan”
rpush nonfriends “Batman”
rpush nonfriends “Betty Boop”

lrange nonfriends 0 -1
1. Peter Pan
2. Batman
3. Betty Boop
REDIS
rpoplpush nonfriends friends

lrange friends 0 -1
1. John Doe
2. Foo
3. Bar
4. Betty Boop

lrange nonfriends 0 -1
1. Peter Pan
2. Batman
REDIS
Pub/Sub.... a freaking AWESOME messaging queue
REDIS

Pro’s:
- Highly performant
- Highly scalable
- Interfaces available for many languages (Ruby: Ohm)

Cons:
- Eats your server’s memory
- Manually sharding
MONGODB
• http://mongodb.org

• Document      store

• Writes   to disk

• Hight   scalability

• Easy   sharding
MONGODB

• Organizes    data using
 collections

• Stores documents in BSON
 format, a binary-encoded
 serialization of JSON
MONGODB

use users
u = { name: “ivan”, company: “Sysdivision”, age: “32” }
users.insert(u)

users.find();
- { "_id" : ObjectId("4d5ea4e79faeda067681e214"),
"name" : "ivan", company: “Sysdivision”, "age" : "32" }
MONGODB
use users
u = { name: “ivan”, company: “Sysdivision”, age: “32” }
users.insert(u)

db.users.find({name: “ivan”});
- { "_id" : ObjectId("4d5ea4e79faeda067681e214"),
"name" : "ivan", company: “Sysdivision”, "age" : "32" }

db.users.find();
db.users.find().skip(20).limit(10);
MONGOID
class User
  include Mongoid::Document
  field :name
  field :birthday, :type => date
  field :money, :type => float, :default => 0.0
  embedded_in :company
end
class Company
  field :name
  embeds_one :user
end
MONGOID
company = Company.create(:name => ‘Sysdivision’)

company.create_user(
                        :name => ‘John Doe’,
                        :birthday => ’12/7/1982’,
                        : money => 0
                       )

User.find(:name => ‘John Doe’)
User.where(:name => /.*ohn.*/)
MONGOID
User.any_of(
              { :name => ‘John Doe’ },
              { :money.gt 10 }
             )

User.any_in(:name => [‘John’, ‘Foo’, ‘Bar’])

User.where(:name => ‘John Doe’).and(:money.gt 10)

Post.all_in(:tags => [‘ruby’, ‘code’, ‘mongo’])
MONGODB

Pro’s:
- Highly performant
- Highly scalable
- Easy sharding
- Ultra powerful querying
- Interfaces available for many languages (Ruby:
mongo_mapper, mongoid)
NOSQL AWESOMENESS
QUESTIONS?




        Ivan Belmonte
        http://ibelmonte.com
        ivan@ivanhq.net

Contenu connexe

En vedette

Remote monitoring system
Remote monitoring systemRemote monitoring system
Remote monitoring systemPk Doctors
 
Internationalization(i18n) of Web Page
Internationalization(i18n) of Web PageInternationalization(i18n) of Web Page
Internationalization(i18n) of Web PageWilliam Lee
 
Video Streaming
Video StreamingVideo Streaming
Video StreamingVideoguy
 
Remote Management of Embedded Android Devices
Remote Management of Embedded Android DevicesRemote Management of Embedded Android Devices
Remote Management of Embedded Android DevicesVIA Embedded
 
FFMPEG on android
FFMPEG on androidFFMPEG on android
FFMPEG on androidYoss Cohen
 
Streaming Media Server Setup Manual
Streaming Media Server Setup ManualStreaming Media Server Setup Manual
Streaming Media Server Setup ManualWilliam Lee
 
Lecture Slides for Location based Services [Android]
Lecture Slides for Location based Services [Android]Lecture Slides for Location based Services [Android]
Lecture Slides for Location based Services [Android]Nehil Jain
 
Operational Agriculture Monitoring System Using Remote Sensing
Operational Agriculture Monitoring System Using Remote SensingOperational Agriculture Monitoring System Using Remote Sensing
Operational Agriculture Monitoring System Using Remote SensingMary Adel
 
Location-Based Services on Android
Location-Based Services on AndroidLocation-Based Services on Android
Location-Based Services on AndroidJomar Tigcal
 
Location Tracking of Android Device Based on SMS.
Location Tracking of Android Device Based on SMS.Location Tracking of Android Device Based on SMS.
Location Tracking of Android Device Based on SMS.iCreateWorld
 
Internet of things for Smart Home
Internet of things for Smart Home Internet of things for Smart Home
Internet of things for Smart Home Khwaja Aamer
 
Smart Home technologies
Smart Home technologiesSmart Home technologies
Smart Home technologiesloggcity
 
Bus tracking application in Android
Bus tracking application in AndroidBus tracking application in Android
Bus tracking application in Androidyashonil
 
Android College Application Project Report
Android College Application Project ReportAndroid College Application Project Report
Android College Application Project Reportstalin george
 

En vedette (17)

Remote monitoring system
Remote monitoring systemRemote monitoring system
Remote monitoring system
 
FFMPEG TOOLS
FFMPEG TOOLSFFMPEG TOOLS
FFMPEG TOOLS
 
Internationalization(i18n) of Web Page
Internationalization(i18n) of Web PageInternationalization(i18n) of Web Page
Internationalization(i18n) of Web Page
 
Video Streaming
Video StreamingVideo Streaming
Video Streaming
 
Remote Management of Embedded Android Devices
Remote Management of Embedded Android DevicesRemote Management of Embedded Android Devices
Remote Management of Embedded Android Devices
 
FFMPEG on android
FFMPEG on androidFFMPEG on android
FFMPEG on android
 
Streaming Media Server Setup Manual
Streaming Media Server Setup ManualStreaming Media Server Setup Manual
Streaming Media Server Setup Manual
 
Lecture Slides for Location based Services [Android]
Lecture Slides for Location based Services [Android]Lecture Slides for Location based Services [Android]
Lecture Slides for Location based Services [Android]
 
Rtsp
RtspRtsp
Rtsp
 
Operational Agriculture Monitoring System Using Remote Sensing
Operational Agriculture Monitoring System Using Remote SensingOperational Agriculture Monitoring System Using Remote Sensing
Operational Agriculture Monitoring System Using Remote Sensing
 
Location-Based Services on Android
Location-Based Services on AndroidLocation-Based Services on Android
Location-Based Services on Android
 
Location Tracking of Android Device Based on SMS.
Location Tracking of Android Device Based on SMS.Location Tracking of Android Device Based on SMS.
Location Tracking of Android Device Based on SMS.
 
Internet of things for Smart Home
Internet of things for Smart Home Internet of things for Smart Home
Internet of things for Smart Home
 
Smart Home technologies
Smart Home technologiesSmart Home technologies
Smart Home technologies
 
Smart homes
Smart homesSmart homes
Smart homes
 
Bus tracking application in Android
Bus tracking application in AndroidBus tracking application in Android
Bus tracking application in Android
 
Android College Application Project Report
Android College Application Project ReportAndroid College Application Project Report
Android College Application Project Report
 

Similaire à Nosql redis-mongo

MongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overviewMongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overviewAntonio Pintus
 
SDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and modelsSDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and modelsKorea Sdec
 
No SQL : Which way to go? Presented at DDDMelbourne 2015
No SQL : Which way to go?  Presented at DDDMelbourne 2015No SQL : Which way to go?  Presented at DDDMelbourne 2015
No SQL : Which way to go? Presented at DDDMelbourne 2015Himanshu Desai
 
Blazing Data With Redis (and LEGOS!)
Blazing Data With Redis (and LEGOS!)Blazing Data With Redis (and LEGOS!)
Blazing Data With Redis (and LEGOS!)Justin Carmony
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Chris Richardson
 
MongoDB - Ruby document store that doesn't rhyme with ouch
MongoDB - Ruby document store that doesn't rhyme with ouchMongoDB - Ruby document store that doesn't rhyme with ouch
MongoDB - Ruby document store that doesn't rhyme with ouchWynn Netherland
 
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...Ontico
 
10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCup10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCupWebGeek Philippines
 
CouchDB Open Source Bridge
CouchDB Open Source BridgeCouchDB Open Source Bridge
CouchDB Open Source BridgeChris Anderson
 
MongoDB, E-commerce and Transactions
MongoDB, E-commerce and TransactionsMongoDB, E-commerce and Transactions
MongoDB, E-commerce and TransactionsSteven Francia
 
NOSQL, CouchDB, and the Cloud
NOSQL, CouchDB, and the CloudNOSQL, CouchDB, and the Cloud
NOSQL, CouchDB, and the Cloudboorad
 
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
OSDC 2012 | Building a first application on MongoDB by Ross LawleyOSDC 2012 | Building a first application on MongoDB by Ross Lawley
OSDC 2012 | Building a first application on MongoDB by Ross LawleyNETWAYS
 
Mongodb intro
Mongodb introMongodb intro
Mongodb introchristkv
 

Similaire à Nosql redis-mongo (20)

MongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overviewMongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overview
 
SDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and modelsSDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and models
 
No SQL : Which way to go? Presented at DDDMelbourne 2015
No SQL : Which way to go?  Presented at DDDMelbourne 2015No SQL : Which way to go?  Presented at DDDMelbourne 2015
No SQL : Which way to go? Presented at DDDMelbourne 2015
 
NoSQL, which way to go?
NoSQL, which way to go?NoSQL, which way to go?
NoSQL, which way to go?
 
Blazing Data With Redis (and LEGOS!)
Blazing Data With Redis (and LEGOS!)Blazing Data With Redis (and LEGOS!)
Blazing Data With Redis (and LEGOS!)
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)
 
MongoDB - Ruby document store that doesn't rhyme with ouch
MongoDB - Ruby document store that doesn't rhyme with ouchMongoDB - Ruby document store that doesn't rhyme with ouch
MongoDB - Ruby document store that doesn't rhyme with ouch
 
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
 
10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCup10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCup
 
CouchDB Open Source Bridge
CouchDB Open Source BridgeCouchDB Open Source Bridge
CouchDB Open Source Bridge
 
MongoDB, E-commerce and Transactions
MongoDB, E-commerce and TransactionsMongoDB, E-commerce and Transactions
MongoDB, E-commerce and Transactions
 
Mongodb my
Mongodb myMongodb my
Mongodb my
 
MongoDB
MongoDBMongoDB
MongoDB
 
MongoDB
MongoDBMongoDB
MongoDB
 
Practical Use of a NoSQL
Practical Use of a NoSQLPractical Use of a NoSQL
Practical Use of a NoSQL
 
Hadoop - Introduction to Hadoop
Hadoop - Introduction to HadoopHadoop - Introduction to Hadoop
Hadoop - Introduction to Hadoop
 
NOSQL, CouchDB, and the Cloud
NOSQL, CouchDB, and the CloudNOSQL, CouchDB, and the Cloud
NOSQL, CouchDB, and the Cloud
 
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
OSDC 2012 | Building a first application on MongoDB by Ross LawleyOSDC 2012 | Building a first application on MongoDB by Ross Lawley
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
 
Mongodb intro
Mongodb introMongodb intro
Mongodb intro
 
Couchdb Nosql
Couchdb NosqlCouchdb Nosql
Couchdb Nosql
 

Dernier

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
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
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
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
 
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
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
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
 

Dernier (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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?
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 
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
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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
 

Nosql redis-mongo

  • 2. SQL: THE BEGINNING • Data structured on tables using columns • Data on one column is the key for making relationships with other tables • Normalization • RDBMS
  • 4. RDBMS BENEFITS • Normalization (a common standard format for accessing data) • Data consistency • Persistence • Consistency • Replication
  • 6. RDBMS PROBLEMS • Highcost on performing complex operations over a big database • High system load: scalability needs • Difficult failover recovery • Difficult denormalization
  • 7. NOSQL TO THE RESCUE!
  • 8. NOSQL IS... •A storage system for format free data • Web scale • Software darwinism • Different types of solutions depending on the needs: Key-value, Documents, Graphs, Objects...
  • 9. REDIS • http://redis.io Redis is SEXY • Key-value store • In memory • Persistent (periodical asynchronous writes to disk) • All operations are atomic
  • 10. REDIS Types of data Cool operations • Hashes • RPOPLPUSH • Sets (arrays) • Pub/Sub • Lists
  • 11. REDIS HSET myuser “email” “ivan@ivanhq.net” HSET myuser “web” “http://ibelmonte.com” HSET myuser “blog” “http://ivanh.net” HGET myuser “email” - ivan@ivanhq.net
  • 12. REDIS sadd myuser:books “jackass” sadd myuser:books “jackass2” sadd myuser:books “Dude, where’s my car?” sadd myuser:books “The hangover” smembers myuser:books 1. jackass 2. jackass2 3. Dude, where’s my car? 4. The hangover
  • 13. REDIS rpush friends “John Doe” rpush friends “Foo” rpush friends “Bar” lrange friends 0 -1 1. John Doe 2. Foo 3. Bar
  • 14. REDIS rpush nonfriends “Peter Pan” rpush nonfriends “Batman” rpush nonfriends “Betty Boop” lrange nonfriends 0 -1 1. Peter Pan 2. Batman 3. Betty Boop
  • 15. REDIS rpoplpush nonfriends friends lrange friends 0 -1 1. John Doe 2. Foo 3. Bar 4. Betty Boop lrange nonfriends 0 -1 1. Peter Pan 2. Batman
  • 16. REDIS Pub/Sub.... a freaking AWESOME messaging queue
  • 17. REDIS Pro’s: - Highly performant - Highly scalable - Interfaces available for many languages (Ruby: Ohm) Cons: - Eats your server’s memory - Manually sharding
  • 18. MONGODB • http://mongodb.org • Document store • Writes to disk • Hight scalability • Easy sharding
  • 19. MONGODB • Organizes data using collections • Stores documents in BSON format, a binary-encoded serialization of JSON
  • 20. MONGODB use users u = { name: “ivan”, company: “Sysdivision”, age: “32” } users.insert(u) users.find(); - { "_id" : ObjectId("4d5ea4e79faeda067681e214"), "name" : "ivan", company: “Sysdivision”, "age" : "32" }
  • 21. MONGODB use users u = { name: “ivan”, company: “Sysdivision”, age: “32” } users.insert(u) db.users.find({name: “ivan”}); - { "_id" : ObjectId("4d5ea4e79faeda067681e214"), "name" : "ivan", company: “Sysdivision”, "age" : "32" } db.users.find(); db.users.find().skip(20).limit(10);
  • 22. MONGOID class User include Mongoid::Document field :name field :birthday, :type => date field :money, :type => float, :default => 0.0 embedded_in :company end class Company field :name embeds_one :user end
  • 23. MONGOID company = Company.create(:name => ‘Sysdivision’) company.create_user( :name => ‘John Doe’, :birthday => ’12/7/1982’, : money => 0 ) User.find(:name => ‘John Doe’) User.where(:name => /.*ohn.*/)
  • 24. MONGOID User.any_of( { :name => ‘John Doe’ }, { :money.gt 10 } ) User.any_in(:name => [‘John’, ‘Foo’, ‘Bar’]) User.where(:name => ‘John Doe’).and(:money.gt 10) Post.all_in(:tags => [‘ruby’, ‘code’, ‘mongo’])
  • 25. MONGODB Pro’s: - Highly performant - Highly scalable - Easy sharding - Ultra powerful querying - Interfaces available for many languages (Ruby: mongo_mapper, mongoid)
  • 27. QUESTIONS? Ivan Belmonte http://ibelmonte.com ivan@ivanhq.net

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n