SlideShare a Scribd company logo
When NOT to use
MongoDB
MongoDB (NoSQL)
• What is it?
• How Does it Work?
• Where did it come from?
MongoDB (NoSQL): What is it?
Tables of data with
defined fields,
related by foreign
keys and join tables.
Collections of JSON-like
documents which can
have any data structure
at all.
MongoDB (NoSQL): How does it work?
Relationships
• NO Join queries. One doc is MUCH faster. Several
related docs can be MUCH slower and probably
more complicated.
• Linking through storing an array of related doc ids.
• No querying embedded documents, have to pull
em all. (How many posts has Joe ‘Liked’?)
• Either denormalization or link id arrays or both can
quickly get out of control.
MongoDB (NoSQL): How does it work?
CAP Theorem
C: Consistency ~ All Clients always have the same

view of the data.
A: Availability ~ All clients can always read and write.

P: Partition Tolerance ~ The system can survive and
function while parts are

separated, for the sake of

scaling or by failures of

servers or the network.
(A Little Background)
MongoDB (NoSQL): How does it work?
Define ‘Partition’
• Some separation of members of the system.
• DB Partition: Vertical or horizontal (sharding) division of
the database on to separate servers for the sake of
scaling
• Fault Partition: A failure (of one or more) of the database
servers, or of the network between them, or of the
connection to the client.
• All require a reconciliation, either ongoing, or when the
system is restored, called ‘recovery’.
(A Little Background)
MongoDB (NoSQL): How does it work?
Strong Consistency, at the expense of:
• Availability: If one of the database shards goes
down, or the network between them goes down, or
we just need to synch up, everything stops. We
MUST make sure everyone will see the same thing.
Client(s) must wait.
• Partition Tolerance: It is very difficult, or
impossible to separate the database. One
machine, one socket, one client at a time. Its the
only way to be sure.
(A Little Background)
MongoDB (NoSQL): How does it work?
Strong Availability, at the expense of:
• Consistency: If one of the database shards or
replicas goes down or becomes unreachable, we
change or serve what we can for the given client.
• Partition tolerance: Because we changed or
served what we could, given what we knew with
part of the db down, we may not be able to restore
a complete and correct DB state once things link
back up, but we don’t really care.
(A Little Background)
MongoDB (NoSQL): How does it work?
Strong Partition Tolerance, at the expense of:
• Consistency: We abandon the requirement of
consistent representation of data to all clients in
favor of doing the best we can while stuff is on
separate servers, or while something is broken.
• Availability: Our focus is on making a system that
can be split up on to many servers, if we require
consistency as well, then availability must suffer
since all server shards MUST be in sync before we
serve anything. Clients must wait.
(A Little Background)
MongoDB (NoSQL): How does it work?
CAP Theorem
(A Little Background)
A: Atomicity ~ Transactions are all or nothing. If anything
fails at any point, no change is made.
C: Consistency ~ Database will NEVER exist in an invalid
state. It will transition from valid state to valid state only.
I: Isolation ~ Database will maintain a state which
represents all transactions having occurred in isolation
and serially (threadsafety).
D: Durability ~ All transactions, once committed, will
survive failures, crashes, power outages, etc…
DB Stoichiometry
ACID vs. BASE
B A: Basic Availability ~ Focuses on availability
despite multiple system failures, at the expense of
consistency.
S: Soft State ~ DB Abdicates the responsibility of
maintaining ‘valid’ data state. Control of data
structure is relegated to a higher level in the stack.
E: Eventually Consistent ~ If all goes well, all clients
on all partitions will eventually be seeing the same
thing. Probably.
DB Stoichiometry
ACID vs. BASE
MongoDB (NoSQL): How does it work?
The Nitty Gritty
• No Multi-Document transactions. (two bank accounts)
• Queries are processed in RAM, journaled usually
within 100ms (default), and written to the db files on
disk for replication within a minute or so (usually).
• NOT irresponsible, just differently optimized.
Misusing it is irresponsible.
MongoDB (NoSQL): Where did it come from?
• Indexing the interwebs
• Extraordinarily easy (nearly automatic) to scale up
to massive database clusters without losing much
performance
• Unstructured data provides HUGE flexibility at
every stage of an application's lifecycle
• Lots of useful, built in data aggregation tools
• Everyone else seems to love it, how can everyone
else be wrong?
Why we love MongoDB:
Important weaknesses of MongoDB:
• NO Multi-Document transactions. Period.
• NO DB level joins. Period. (No relating embedded records
without manual tricks)
• EVENTUAL Durability. Probably. (Caching nightmares, risks
increase with increased collection interrelationships)
• Unstructured data is awesome. And Terrifying.
“With great power…”
• You know your data will be highly relational and you can foresee situations
where you will want to run novel, varied, highly interrelated queries any
more than occasionally.
• You will have multi-doc transactions that MUST be all or nothing
• You will be storing data that MUST NOT get lost or corrupted.
• It is imperative that all clients see the same thing when they query the DB
or DB clusters.
• You are concerned about the long term cost of managing all of the
responsibilities and risks of storing data without a schema.
• Remember that you can use MongoDB for less critical data, and sql for the
sensitive stuff.
Bottom Line
Do NOT use MongoDB if:
mike@catalpalabs.com
Mike Michaud

More Related Content

What's hot

Building Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff StanoBuilding Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff Stano
Sencha
 
Store
StoreStore
Store
ESUG
 
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERAGeek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
IDERA Software
 
WordPress at Scale Webinar
WordPress at Scale WebinarWordPress at Scale Webinar
WordPress at Scale Webinar
Pantheon
 
In Memory Cahce Structure
In Memory Cahce StructureIn Memory Cahce Structure
In Memory Cahce Structure
Mehmet Ali Tastan
 
RavenDB 4.0
RavenDB 4.0RavenDB 4.0
RavenDB 4.0
Oren Eini
 
SPA vs. MPA
SPA vs. MPASPA vs. MPA
SPA vs. MPA
Mehmet Ali Tastan
 
Eat Your Data and Have It Too: Get the Blazing Performance of In-Memory Opera...
Eat Your Data and Have It Too: Get the Blazing Performance of In-Memory Opera...Eat Your Data and Have It Too: Get the Blazing Performance of In-Memory Opera...
Eat Your Data and Have It Too: Get the Blazing Performance of In-Memory Opera...
VoltDB
 
Why Wordnik went non-relational
Why Wordnik went non-relationalWhy Wordnik went non-relational
Why Wordnik went non-relational
Tony Tam
 
How to make APEX print through Node.js
How to make APEX print through Node.jsHow to make APEX print through Node.js
How to make APEX print through Node.js
Dimitri Gielis
 
NoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOONoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOOJames Hollingworth
 
Zapping ever faster: how Zap sped up by two orders of magnitude using RavenDB
Zapping ever faster: how Zap sped up by two orders of magnitude using RavenDBZapping ever faster: how Zap sped up by two orders of magnitude using RavenDB
Zapping ever faster: how Zap sped up by two orders of magnitude using RavenDB
Oren Eini
 
RavenDB 3.5
RavenDB 3.5RavenDB 3.5
RavenDB 3.5
Oren Eini
 
Community day 2013 applied architectures
Community day 2013   applied architecturesCommunity day 2013   applied architectures
Community day 2013 applied architecturesPanagiotis Kefalidis
 
Data consistency: Analyse, understand and decide
Data consistency: Analyse, understand and decideData consistency: Analyse, understand and decide
Data consistency: Analyse, understand and decide
Louis Jacomet
 
RavenDB embedded at massive scales
RavenDB embedded at massive scalesRavenDB embedded at massive scales
RavenDB embedded at massive scales
Oren Eini
 
Building Search Engines - Lucene, SolR and Elasticsearch
Building Search Engines - Lucene, SolR and ElasticsearchBuilding Search Engines - Lucene, SolR and Elasticsearch
Building Search Engines - Lucene, SolR and Elasticsearch
Rahul Singh
 
Designing Modern Web Applications
Designing Modern Web ApplicationsDesigning Modern Web Applications
Designing Modern Web Applications
Lucas Carlson
 
Hexagonal Architecture using Grails
Hexagonal Architecture using GrailsHexagonal Architecture using Grails
Hexagonal Architecture using Grails
David Dawson
 

What's hot (20)

Building Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff StanoBuilding Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff Stano
 
Store
StoreStore
Store
 
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERAGeek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
 
WordPress at Scale Webinar
WordPress at Scale WebinarWordPress at Scale Webinar
WordPress at Scale Webinar
 
In Memory Cahce Structure
In Memory Cahce StructureIn Memory Cahce Structure
In Memory Cahce Structure
 
RavenDB 4.0
RavenDB 4.0RavenDB 4.0
RavenDB 4.0
 
SPA vs. MPA
SPA vs. MPASPA vs. MPA
SPA vs. MPA
 
Eat Your Data and Have It Too: Get the Blazing Performance of In-Memory Opera...
Eat Your Data and Have It Too: Get the Blazing Performance of In-Memory Opera...Eat Your Data and Have It Too: Get the Blazing Performance of In-Memory Opera...
Eat Your Data and Have It Too: Get the Blazing Performance of In-Memory Opera...
 
Why Wordnik went non-relational
Why Wordnik went non-relationalWhy Wordnik went non-relational
Why Wordnik went non-relational
 
noSQL choices
noSQL choicesnoSQL choices
noSQL choices
 
How to make APEX print through Node.js
How to make APEX print through Node.jsHow to make APEX print through Node.js
How to make APEX print through Node.js
 
NoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOONoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOO
 
Zapping ever faster: how Zap sped up by two orders of magnitude using RavenDB
Zapping ever faster: how Zap sped up by two orders of magnitude using RavenDBZapping ever faster: how Zap sped up by two orders of magnitude using RavenDB
Zapping ever faster: how Zap sped up by two orders of magnitude using RavenDB
 
RavenDB 3.5
RavenDB 3.5RavenDB 3.5
RavenDB 3.5
 
Community day 2013 applied architectures
Community day 2013   applied architecturesCommunity day 2013   applied architectures
Community day 2013 applied architectures
 
Data consistency: Analyse, understand and decide
Data consistency: Analyse, understand and decideData consistency: Analyse, understand and decide
Data consistency: Analyse, understand and decide
 
RavenDB embedded at massive scales
RavenDB embedded at massive scalesRavenDB embedded at massive scales
RavenDB embedded at massive scales
 
Building Search Engines - Lucene, SolR and Elasticsearch
Building Search Engines - Lucene, SolR and ElasticsearchBuilding Search Engines - Lucene, SolR and Elasticsearch
Building Search Engines - Lucene, SolR and Elasticsearch
 
Designing Modern Web Applications
Designing Modern Web ApplicationsDesigning Modern Web Applications
Designing Modern Web Applications
 
Hexagonal Architecture using Grails
Hexagonal Architecture using GrailsHexagonal Architecture using Grails
Hexagonal Architecture using Grails
 

Viewers also liked

ACID & CAP: Clearing CAP Confusion and Why C In CAP ≠ C in ACID
ACID & CAP:  Clearing CAP Confusion and Why C In CAP ≠ C in ACIDACID & CAP:  Clearing CAP Confusion and Why C In CAP ≠ C in ACID
ACID & CAP: Clearing CAP Confusion and Why C In CAP ≠ C in ACID
Aerospike, Inc.
 
Databases, CAP, ACID, BASE, NoSQL... oh my!
Databases, CAP, ACID, BASE, NoSQL... oh my!Databases, CAP, ACID, BASE, NoSQL... oh my!
Databases, CAP, ACID, BASE, NoSQL... oh my!
DATAVERSITY
 
Streaming Plattformen und die Qual der Wahl
Streaming Plattformen und die Qual der WahlStreaming Plattformen und die Qual der Wahl
Streaming Plattformen und die Qual der Wahl
Matthias Niehoff
 
Big data analytics with Spark & Cassandra
Big data analytics with Spark & Cassandra Big data analytics with Spark & Cassandra
Big data analytics with Spark & Cassandra
Matthias Niehoff
 
Cassandra & Spark for IoT
Cassandra & Spark for IoTCassandra & Spark for IoT
Cassandra & Spark for IoT
Matthias Niehoff
 
How Hadoop Exploits Data Locality
How Hadoop Exploits Data LocalityHow Hadoop Exploits Data Locality
How Hadoop Exploits Data LocalityUday Vakalapudi
 
Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2
DataStax Academy
 
Palestra Encontro Gamer 2016 - FCS na Indústria de Jogos
Palestra Encontro Gamer 2016 - FCS na Indústria de JogosPalestra Encontro Gamer 2016 - FCS na Indústria de Jogos
Palestra Encontro Gamer 2016 - FCS na Indústria de Jogos
Fabio Lima
 
DevOps Boston - Heartbleed at Acquia
DevOps Boston - Heartbleed at AcquiaDevOps Boston - Heartbleed at Acquia
DevOps Boston - Heartbleed at Acquia
Marc Seeger
 
12 formas básicas de enseñar
12 formas básicas de enseñar12 formas básicas de enseñar
12 formas básicas de enseñar
Patty LóMar
 
Arquitetura de informação
Arquitetura de informaçãoArquitetura de informação
Arquitetura de informação
Princi Agência Web
 
คุฏบะฮฺ อีดิลฟิฏริ ฮ.ศ. 1436
คุฏบะฮฺ อีดิลฟิฏริ ฮ.ศ. 1436คุฏบะฮฺ อีดิลฟิฏริ ฮ.ศ. 1436
คุฏบะฮฺ อีดิลฟิฏริ ฮ.ศ. 1436
สำนักจุฬาราชมนตรี
 
The Most effective models for Customer Support Operations
The Most effective models for Customer Support OperationsThe Most effective models for Customer Support Operations
The Most effective models for Customer Support Operations
David Loia
 
รูปพื้นที่ผิว
รูปพื้นที่ผิวรูปพื้นที่ผิว
รูปพื้นที่ผิวKrueed Huaybong
 
งานโลหะแผ่น5 2
งานโลหะแผ่น5 2งานโลหะแผ่น5 2
งานโลหะแผ่น5 2Pannathat Champakul
 

Viewers also liked (20)

ACID & CAP: Clearing CAP Confusion and Why C In CAP ≠ C in ACID
ACID & CAP:  Clearing CAP Confusion and Why C In CAP ≠ C in ACIDACID & CAP:  Clearing CAP Confusion and Why C In CAP ≠ C in ACID
ACID & CAP: Clearing CAP Confusion and Why C In CAP ≠ C in ACID
 
Databases, CAP, ACID, BASE, NoSQL... oh my!
Databases, CAP, ACID, BASE, NoSQL... oh my!Databases, CAP, ACID, BASE, NoSQL... oh my!
Databases, CAP, ACID, BASE, NoSQL... oh my!
 
CAP and BASE
CAP and BASECAP and BASE
CAP and BASE
 
Streaming Plattformen und die Qual der Wahl
Streaming Plattformen und die Qual der WahlStreaming Plattformen und die Qual der Wahl
Streaming Plattformen und die Qual der Wahl
 
Big data analytics with Spark & Cassandra
Big data analytics with Spark & Cassandra Big data analytics with Spark & Cassandra
Big data analytics with Spark & Cassandra
 
Cassandra & Spark for IoT
Cassandra & Spark for IoTCassandra & Spark for IoT
Cassandra & Spark for IoT
 
How Hadoop Exploits Data Locality
How Hadoop Exploits Data LocalityHow Hadoop Exploits Data Locality
How Hadoop Exploits Data Locality
 
Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2
 
Palestra Encontro Gamer 2016 - FCS na Indústria de Jogos
Palestra Encontro Gamer 2016 - FCS na Indústria de JogosPalestra Encontro Gamer 2016 - FCS na Indústria de Jogos
Palestra Encontro Gamer 2016 - FCS na Indústria de Jogos
 
Romanos 10 palavra
Romanos 10   palavraRomanos 10   palavra
Romanos 10 palavra
 
DevOps Boston - Heartbleed at Acquia
DevOps Boston - Heartbleed at AcquiaDevOps Boston - Heartbleed at Acquia
DevOps Boston - Heartbleed at Acquia
 
Presentation_NEW.PPTX
Presentation_NEW.PPTXPresentation_NEW.PPTX
Presentation_NEW.PPTX
 
Fb alopecia in a bulldog
Fb alopecia in a bulldogFb alopecia in a bulldog
Fb alopecia in a bulldog
 
12 formas básicas de enseñar
12 formas básicas de enseñar12 formas básicas de enseñar
12 formas básicas de enseñar
 
Arquitetura de informação
Arquitetura de informaçãoArquitetura de informação
Arquitetura de informação
 
คุฏบะฮฺ อีดิลฟิฏริ ฮ.ศ. 1436
คุฏบะฮฺ อีดิลฟิฏริ ฮ.ศ. 1436คุฏบะฮฺ อีดิลฟิฏริ ฮ.ศ. 1436
คุฏบะฮฺ อีดิลฟิฏริ ฮ.ศ. 1436
 
The Most effective models for Customer Support Operations
The Most effective models for Customer Support OperationsThe Most effective models for Customer Support Operations
The Most effective models for Customer Support Operations
 
Brin 3 q12
Brin   3 q12Brin   3 q12
Brin 3 q12
 
รูปพื้นที่ผิว
รูปพื้นที่ผิวรูปพื้นที่ผิว
รูปพื้นที่ผิว
 
งานโลหะแผ่น5 2
งานโลหะแผ่น5 2งานโลหะแผ่น5 2
งานโลหะแผ่น5 2
 

Similar to When NOT to use MongoDB

Introduction to mongodb
Introduction to mongodbIntroduction to mongodb
Introduction to mongodb
Mohammed Ragab
 
MongoDB
MongoDBMongoDB
MongoDB
fsbrooke
 
Relational and non relational database 7
Relational and non relational database 7Relational and non relational database 7
Relational and non relational database 7
abdulrahmanhelan
 
NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]
Huy Do
 
مقدمة عن NoSQL بالعربي
مقدمة عن NoSQL بالعربيمقدمة عن NoSQL بالعربي
مقدمة عن NoSQL بالعربي
Mohamed Galal
 
MongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data scienceMongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data science
bitragowthamkumar1
 
Why no sql ? Why Couchbase ?
Why no sql ? Why Couchbase ?Why no sql ? Why Couchbase ?
Why no sql ? Why Couchbase ?
Ahmed Rashwan
 
MongoDB vs Mysql. A devops point of view
MongoDB vs Mysql. A devops point of viewMongoDB vs Mysql. A devops point of view
MongoDB vs Mysql. A devops point of view
Pierre Baillet
 
Some NoSQL
Some NoSQLSome NoSQL
Some NoSQL
Malk Zameth
 
Understanding data
Understanding dataUnderstanding data
Understanding data
Shahd Salama
 
Modern databases and its challenges (SQL ,NoSQL, NewSQL)
Modern databases and its challenges (SQL ,NoSQL, NewSQL)Modern databases and its challenges (SQL ,NoSQL, NewSQL)
Modern databases and its challenges (SQL ,NoSQL, NewSQL)
Mohamed Galal
 
How and when to use NoSQL
How and when to use NoSQLHow and when to use NoSQL
How and when to use NoSQL
Amazon Web Services
 
NoSQL and Couchbase
NoSQL and CouchbaseNoSQL and Couchbase
NoSQL and Couchbase
Sangharsh agarwal
 
Relational databases vs Non-relational databases
Relational databases vs Non-relational databasesRelational databases vs Non-relational databases
Relational databases vs Non-relational databases
James Serra
 
Dropping ACID: Wrapping Your Mind Around NoSQL Databases
Dropping ACID: Wrapping Your Mind Around NoSQL DatabasesDropping ACID: Wrapping Your Mind Around NoSQL Databases
Dropping ACID: Wrapping Your Mind Around NoSQL Databases
Kyle Banerjee
 
Big Data Platforms: An Overview
Big Data Platforms: An OverviewBig Data Platforms: An Overview
Big Data Platforms: An Overview
C. Scyphers
 
NoSQL Introduction, Theory, Implementations
NoSQL Introduction, Theory, ImplementationsNoSQL Introduction, Theory, Implementations
NoSQL Introduction, Theory, Implementations
Firat Atagun
 
NoSQL and MongoDB
NoSQL and MongoDBNoSQL and MongoDB
NoSQL and MongoDB
Rajesh Menon
 

Similar to When NOT to use MongoDB (20)

Introduction to mongodb
Introduction to mongodbIntroduction to mongodb
Introduction to mongodb
 
MongoDB
MongoDBMongoDB
MongoDB
 
Relational and non relational database 7
Relational and non relational database 7Relational and non relational database 7
Relational and non relational database 7
 
NoSql Databases
NoSql DatabasesNoSql Databases
NoSql Databases
 
NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]
 
مقدمة عن NoSQL بالعربي
مقدمة عن NoSQL بالعربيمقدمة عن NoSQL بالعربي
مقدمة عن NoSQL بالعربي
 
MongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data scienceMongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data science
 
Why no sql ? Why Couchbase ?
Why no sql ? Why Couchbase ?Why no sql ? Why Couchbase ?
Why no sql ? Why Couchbase ?
 
MongoDB vs Mysql. A devops point of view
MongoDB vs Mysql. A devops point of viewMongoDB vs Mysql. A devops point of view
MongoDB vs Mysql. A devops point of view
 
Some NoSQL
Some NoSQLSome NoSQL
Some NoSQL
 
Understanding data
Understanding dataUnderstanding data
Understanding data
 
Modern databases and its challenges (SQL ,NoSQL, NewSQL)
Modern databases and its challenges (SQL ,NoSQL, NewSQL)Modern databases and its challenges (SQL ,NoSQL, NewSQL)
Modern databases and its challenges (SQL ,NoSQL, NewSQL)
 
How and when to use NoSQL
How and when to use NoSQLHow and when to use NoSQL
How and when to use NoSQL
 
NoSQL and Couchbase
NoSQL and CouchbaseNoSQL and Couchbase
NoSQL and Couchbase
 
NoSQL Evolution
NoSQL EvolutionNoSQL Evolution
NoSQL Evolution
 
Relational databases vs Non-relational databases
Relational databases vs Non-relational databasesRelational databases vs Non-relational databases
Relational databases vs Non-relational databases
 
Dropping ACID: Wrapping Your Mind Around NoSQL Databases
Dropping ACID: Wrapping Your Mind Around NoSQL DatabasesDropping ACID: Wrapping Your Mind Around NoSQL Databases
Dropping ACID: Wrapping Your Mind Around NoSQL Databases
 
Big Data Platforms: An Overview
Big Data Platforms: An OverviewBig Data Platforms: An Overview
Big Data Platforms: An Overview
 
NoSQL Introduction, Theory, Implementations
NoSQL Introduction, Theory, ImplementationsNoSQL Introduction, Theory, Implementations
NoSQL Introduction, Theory, Implementations
 
NoSQL and MongoDB
NoSQL and MongoDBNoSQL and MongoDB
NoSQL and MongoDB
 

Recently uploaded

一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
ewymefz
 
Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)
TravisMalana
 
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
g4dpvqap0
 
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
u86oixdj
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
NABLAS株式会社
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
ewymefz
 
Everything you wanted to know about LIHTC
Everything you wanted to know about LIHTCEverything you wanted to know about LIHTC
Everything you wanted to know about LIHTC
Roger Valdez
 
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
dwreak4tg
 
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
2023240532
 
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
pchutichetpong
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
u86oixdj
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
oz8q3jxlp
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
ewymefz
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
ahzuo
 
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
ahzuo
 
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Subhajit Sahu
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
AbhimanyuSinha9
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
Timothy Spann
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
slg6lamcq
 

Recently uploaded (20)

一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
 
Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)
 
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
 
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
 
Everything you wanted to know about LIHTC
Everything you wanted to know about LIHTCEverything you wanted to know about LIHTC
Everything you wanted to know about LIHTC
 
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
 
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
 
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
 
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
 
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
 

When NOT to use MongoDB

  • 1. When NOT to use MongoDB
  • 2. MongoDB (NoSQL) • What is it? • How Does it Work? • Where did it come from?
  • 3. MongoDB (NoSQL): What is it? Tables of data with defined fields, related by foreign keys and join tables. Collections of JSON-like documents which can have any data structure at all.
  • 4. MongoDB (NoSQL): How does it work? Relationships • NO Join queries. One doc is MUCH faster. Several related docs can be MUCH slower and probably more complicated. • Linking through storing an array of related doc ids. • No querying embedded documents, have to pull em all. (How many posts has Joe ‘Liked’?) • Either denormalization or link id arrays or both can quickly get out of control.
  • 5. MongoDB (NoSQL): How does it work? CAP Theorem C: Consistency ~ All Clients always have the same
 view of the data. A: Availability ~ All clients can always read and write.
 P: Partition Tolerance ~ The system can survive and function while parts are
 separated, for the sake of
 scaling or by failures of
 servers or the network. (A Little Background)
  • 6. MongoDB (NoSQL): How does it work? Define ‘Partition’ • Some separation of members of the system. • DB Partition: Vertical or horizontal (sharding) division of the database on to separate servers for the sake of scaling • Fault Partition: A failure (of one or more) of the database servers, or of the network between them, or of the connection to the client. • All require a reconciliation, either ongoing, or when the system is restored, called ‘recovery’. (A Little Background)
  • 7. MongoDB (NoSQL): How does it work? Strong Consistency, at the expense of: • Availability: If one of the database shards goes down, or the network between them goes down, or we just need to synch up, everything stops. We MUST make sure everyone will see the same thing. Client(s) must wait. • Partition Tolerance: It is very difficult, or impossible to separate the database. One machine, one socket, one client at a time. Its the only way to be sure. (A Little Background)
  • 8. MongoDB (NoSQL): How does it work? Strong Availability, at the expense of: • Consistency: If one of the database shards or replicas goes down or becomes unreachable, we change or serve what we can for the given client. • Partition tolerance: Because we changed or served what we could, given what we knew with part of the db down, we may not be able to restore a complete and correct DB state once things link back up, but we don’t really care. (A Little Background)
  • 9. MongoDB (NoSQL): How does it work? Strong Partition Tolerance, at the expense of: • Consistency: We abandon the requirement of consistent representation of data to all clients in favor of doing the best we can while stuff is on separate servers, or while something is broken. • Availability: Our focus is on making a system that can be split up on to many servers, if we require consistency as well, then availability must suffer since all server shards MUST be in sync before we serve anything. Clients must wait. (A Little Background)
  • 10. MongoDB (NoSQL): How does it work? CAP Theorem (A Little Background)
  • 11. A: Atomicity ~ Transactions are all or nothing. If anything fails at any point, no change is made. C: Consistency ~ Database will NEVER exist in an invalid state. It will transition from valid state to valid state only. I: Isolation ~ Database will maintain a state which represents all transactions having occurred in isolation and serially (threadsafety). D: Durability ~ All transactions, once committed, will survive failures, crashes, power outages, etc… DB Stoichiometry ACID vs. BASE
  • 12. B A: Basic Availability ~ Focuses on availability despite multiple system failures, at the expense of consistency. S: Soft State ~ DB Abdicates the responsibility of maintaining ‘valid’ data state. Control of data structure is relegated to a higher level in the stack. E: Eventually Consistent ~ If all goes well, all clients on all partitions will eventually be seeing the same thing. Probably. DB Stoichiometry ACID vs. BASE
  • 13. MongoDB (NoSQL): How does it work? The Nitty Gritty • No Multi-Document transactions. (two bank accounts) • Queries are processed in RAM, journaled usually within 100ms (default), and written to the db files on disk for replication within a minute or so (usually). • NOT irresponsible, just differently optimized. Misusing it is irresponsible.
  • 14. MongoDB (NoSQL): Where did it come from? • Indexing the interwebs
  • 15. • Extraordinarily easy (nearly automatic) to scale up to massive database clusters without losing much performance • Unstructured data provides HUGE flexibility at every stage of an application's lifecycle • Lots of useful, built in data aggregation tools • Everyone else seems to love it, how can everyone else be wrong? Why we love MongoDB:
  • 16. Important weaknesses of MongoDB: • NO Multi-Document transactions. Period. • NO DB level joins. Period. (No relating embedded records without manual tricks) • EVENTUAL Durability. Probably. (Caching nightmares, risks increase with increased collection interrelationships) • Unstructured data is awesome. And Terrifying. “With great power…”
  • 17. • You know your data will be highly relational and you can foresee situations where you will want to run novel, varied, highly interrelated queries any more than occasionally. • You will have multi-doc transactions that MUST be all or nothing • You will be storing data that MUST NOT get lost or corrupted. • It is imperative that all clients see the same thing when they query the DB or DB clusters. • You are concerned about the long term cost of managing all of the responsibilities and risks of storing data without a schema. • Remember that you can use MongoDB for less critical data, and sql for the sensitive stuff. Bottom Line Do NOT use MongoDB if: