The document discusses the challenges of developing applications using a relational database and how MongoDB provides a more flexible solution. It provides examples of companies that struggled with projects on a relational database due to issues like unstructured data, multiple data sources, and scalability. Their projects were more successful after switching to MongoDB due to its flexible document model. The document also compares how data would be modeled in a relational database versus MongoDB's document model using examples of product catalog data. MongoDB's embedded documents, arrays and dynamic schema allows for easier modeling of complex and varied data structures.
2. Agenda
• What can go wrong?
– Plus, some success stories
• Why are relational projects difficult?
• Why more successful with MongoDB?
3. Part 1 – What can go wrong?
(and how MongoDB customers
got it right)
4. Projects Fail
1. Never get to initial version?
2. Initial success, but then can’t scale?
3. Initial success, but new requirements derail them?
4. Application development is slow
5. Common Reasons
1. Working with unstructured or semi-structure data
2. Polymorphic data
3. Disparate data from multiple sources
4. Platform not architected for scale
5. Development environment does meet developers
needs
6. The problem is in the foundation
Your Application
RDBMS
Lets look at a few organizations that
chose a different foundation
7. Example 1 – Managing Diverse
Products
Delivers agile automated supply chain service to
retailers powered by MongoDB
Problem
• RDBMS poorlyequipped to handle
varying data types
(e.g., SKUs, images)
• Inefficient use of
storage in RDBMS
(i.e., 90% empty
columns)
• Complex joins
degraded performance
Why MongoDB
• Document-oriented model
less complex, easier to
code
Results
• Decreased supplier
onboard time by 12x
• Grew from 400K records to
40M in 12 months
• Single data store for
structured, semi-structured
• Significant cost reductions
and unstructured data
on schema design
• Scalability and availability
time, ongoing developer
effort, and storage usage
• Analytics with MapReduce
8. Example 2 – Multiple Data
Sources
The Wall
–
–
–
–
–
360 real-time view of 100M customers
70 siloed systems
Tried for 2 years on RDBMS
Massive TCO savings
$300M commitment to Big Data
• Why MongoDB?
– Flexible data model
– Fast app development
9. Example 3 - Scalability
Stores billions of posts in myriad formats with
MongoDB
Problem
Why MongoDB
Results
• 1.5M posts per
day, different structures
• Flexible documentbased model
• Inflexible
MySQL, lengthy delays
for making changes
• Horizontal scalability
built in
• Data piling up in
production database
• Easy to use
• Automated failover
provides high
availability
• Interface in familiar
language
• Schema changes are
quick and easy
• Poor performance
• Initial deployment held
over 5B documents and
10TB of data
11. Relational: All Data is Column/Row
Customer ID
0
1
2
3
4
First Name
John
Mark
Jay
Meagan
Edward
Last Name
Doe
Smith
Black
White
Daniels
City
New York
San Francisco
Newark
London
Boston
Account Number
10
11
12
13
14
15
Branch ID
100
101
101
200
200
201
Account Type
Checking
Savings
IRA
Checking
Savings
IRA
Customer ID
0
0
0
1
1
2
12. But, some things are hard to model
Let’s look at a product catalog:
13. Baseball Bat
-3 length to weight ratio
2-5/8" barrel diameter
Two-piece construction
R2 alloy barrel provides outstanding durability, performance and "pop"
R2 composite handle shifts weight into the bat's knob for ultra-fast swing speeds
Rifle Barrel design removes weight from the barrel for thinner wall thickness
Acoustic barrel offers that sweet-sounding "ping"
Contact grip helps eliminate sting and vibration
AIR Elite is RIP-IT's® fastest BBCOR bat and the one with the most performance
BBCOR certified - approved for high school and collegiate play
Includes RIP-IT's® "Love It Or Return It" 30 Day Refund Policy with free return shipping
Manufacturer's warranty: 400 days
Made in the USA
Model: B1403E
14. Bat Product Table
Categor
Model
y
Name
Length
to
Barrel
Brand
weight Dia
ratio
Type
Barrel Handle
Bat
Bat
B1403E Air Elite RIP-IT
B1403 Prototype RIP-IT
-3
-3
Bat
Marucc
i
-3
Composit
2 5/8
e
R2 Alloy
2 5/8 One-piece R1 Alloy
AZ3000
aluminu
2 5/8 One-piece
m
-3
Composit
2 5/8
e
Bat
MCB1B
BB14S1
One
S1
Easton
IMX
R2
composi
te
R1 Alloy
AZ3000
aluminu
m
SIC
Black
Carbon
Cert.
BBCOR
BBCOR
Country Price
USA
USA
$399.99
$199.99
BBCOR Imported $199.99
BBCOR China $399.99
15. Lets Add Gloves
Size: 12"
Infield/Outfield/Pitcher model
2-Piece Web pattern
Most popular MLB® pattern among pitchers
Pro Stock® American steerhide leather offers rugged durability and a superior feel
Dual-Welting™ on "exposed edges" of the fingers helps maintain pocket shape and durability
Pro Stock™ hand-designed pattern for unbeatable craftsmanship
Dri-Lex® ultra-breathable wrist lining repels moisture from your hand
Black leather with rich brown embellishments
Pattern: B212
Model: WTA2000BBB212
Wilson
16. Bat and Glove Product Table
Categor
Model
y
Bat
Name
Length
to
Barrel
Brand
weight Dia
ratio
Type
Barrel
Handle
Cert. Country Price
R2
Composit
composit
e
R2 Alloy
e
BBCOR
USA
$399.99
USA
$199.99
-3
2 5/8
Bat
B1403E Air Elite RIP-IT
Prototyp
B1403
e
RIP-IT
-3
2 5/8 One-piece R1 Alloy R1 Alloy BBCOR
Bat
MCB1B
-3
2 5/8 One-piece
Easton
-3
Composit
e
Brand
Size
Wilson
12"
One
Bat BB14S1
S1
Categor
Model Name
y
WTA200
0BBB21
Glove
2
A2000
PRO112
Glove
PT
HOH
Pro
Marucci
2 5/8
AL
AL
BBCOR Imported $199.99
SIC
Black
Carbon BBCOR China $399.99
IMX
Web
Position Pattern
Material Color Country Price
Pattern
Infield
Rawling
s
11.25" Outfield
B212
Pro
taper
2-piece Leather
Modified Horwee
Trapn
Eze
Leather
black
Vietnam $299.99
black
China $229.99
17. Add some baseballs
Cover: Full grain leather for excellent durability
Core: Cushioned cork core
Additions/Technologies: Made to the exact specifications of MLB
Stitching/Seams: 108 classic red stitches/Rawlings® Major League seaming
League/Certification(s): MLB
Balls included per purchase: individual
Recommended Age: All ages
Model : ROMLB
Rawlings
18. Bat and Glove and Ball Product
Table
Categor
Model
y
Name
Length
to
Barrel
Brand
weight Dia
ratio
Type
Bat
B1403E Air Elite RIP-IT
-3
2 5/8 Composite
Bat
B1403 Prototype RIP-IT
Marucc
MCB1B
One
i
-3
2 5/8 One-piece
-3
2 5/8 One-piece
Easton
Brand
-3
Size
2 5/8 Composite
Position Pattern
Wilson
12"
Bat
Bat
S1
Categor BB14S1
Model Name
y
WTA200
0BBB21
Glove
2
A2000
Infield
B212
PRO112 HOH Rawling
Pro
Categor
Glove Model Name Brand 11.25" Outfield taper
PT
Pro
s
Color Cover
Core
y
DICRLL Little Rawling
Cork
Baseball B1PBG League
s
white Leather rubber
Rawling
Baseball ROML
MLB
s
white Leather cork
Barrel
Handle
Cert. Country Price
R2
BBCO
R2 Alloy composite R
USA $399.99
BBCO
R1 Alloy R1 Alloy
R
USA $199.99
BBCO
AL
AL
R Imported $199.99
SIC Black BBCO
IMX
Carbon
R
China $399.99
Web
Material Color Country Price
Pattern
2-piece Leather
Modified Horwee
Trapn
Eze
Leather
black
Vietnam $299.99
black
Cert.
China
Country $229.99
Price
Little
League
China
$4.99
China
$6.99
19. Sparse Table
Length
Catego
to
Barrel
Model Name Brand
ry
weight Dia
ratio
Type
Barrel Handle
Certific Countr
Price
ation
y
Size
Bat
B1403E
Air Elite
RIP-IT
-3
2 5/8 Composite
R2 Alloy
R2 composite BBCOR
USA
B1403
Prototype
RIP-IT
-3
2 5/8 One-piece
R1 Alloy
R1 Alloy
BBCOR
USA
$199.99
2 5/8 One-piece
AZ3000
aluminum
AZ3000
aluminum
BBCOR
Imported
$199.99
IMX
SIC Black
Carbon
BBCOR
China
$399.99
Vietnam
$299.99 12"
Core
$399.99
Bat
Positio
Web Materia
Pattern
Color Cover
n
Pattern
l
Bat
MCB1B
One
Bat
BB14S1
Glove
WTA2000BBB
212
A2000
S1
HOH Pro
Marucci
Easton
Wilson
-3
-3
2 5/8 Composite
2-piece
Leather
black
Pro taper
Modified
Trap-Eze
Horween
Leather
black
PRO112PT
Rawlings
China
Baseball
DICRLLB1PBG Little League Rawlings
Little League China
$4.99
white
Leather
cork and
rubber
Baseball
ROML
China
$6.99
white
Leather
cork
Rawlings
Outfield
B212
Glove
MLB
$229.99 11.25"
Infield
Continue adding columns as you add new products
20. Maybe this design will work better
prodI
D
Catego
Model
Name
Brand Country Price
ry
prodID
1
Bat B1403E Air Elite RIP-IT
USA $399.99
2
Bat
B1403 Prototype RIP-IT
USA $199.99
Importe
3
Bat
MCB1B
One
Marucci
d
$199.99
4
Bat BB14S1
S1
Easton China $399.99
WTA200
0BBB21
5
Glove
2
A2000 Wilson Vietnam $299.99
PRO112
Rawling
6
Glove
PT
HOH Pro
s
China $229.99
Basebal DICRLL
Little
Rawling
7
l
B1PBG League
s
China
$4.99
Basebal
Rawling
8
l
ROML
MLB
s
China
$6.99
1
1
1
1
property value
length/wei
ght
-3
barrel dia 2 5/8
composi
type
te
certificatio
n
BBCOR
…
5
5
5
5
5
size
position
pattern
material
color
12
infield
B212
leather
black
…
8
8
8
color
cover
core
white
leather
cork
21. What about this product?
One product = a set of products
Lists are hard
Need more tables
Properties
Product
Sub
Products
22. Add this product?
More complexity
There are solutions
Designing/redesigning takes
time
More tables?
23. This is hard…
Long time to develop…
Difficult to change…
Queries are complex…
31. How would we model this
in MongoDB?
Size: 12"
Infield/Outfield/Pitcher model
2-Piece Web pattern
Most popular MLB® pattern among pitchers
Pro Stock® American steerhide leather offers rugged durability and a superior feel
Dual-Welting™ on "exposed edges" of the fingers helps maintain pocket shape and durability
Pro Stock™ hand-designed pattern for unbeatable craftsmanship
Dri-Lex® ultra-breathable wrist lining repels moisture from your hand
Black leather with rich brown embellishments
Pattern: B212
Model: WTA2000BBB212
Wilson
32. We use a document
{
category: “glove”,
model: “PRO112PT”,
name: “Air Elite”,
brand: “Rawlings”,
price: 229.99,
available: Date(“2013-03-31”)
Fields
}
Values
Field values
are typed
37. Variation is easy with document
model
{
category: glove,
model: PRO112PT,
name: Air Elite,
brand: “Rawlings”,
price: “229.99”
category: bat,
model: B1403E,
name: Air Elite,
brand: “Rip-IT”,
price: 399.99
size: 11.25,
position: outfield,
pattern: “Pro taper”,
material: leather,
color: black
diameter: “2 5/8”,
barrel: R2 Alloy,
handle: R2 Composite,
type: composite,
}
{
}
{
category: ball,
model: ROML,
name: MLB,
brand: “Rawlings”,
price: “6.99”
cover: leather,
core: cork,
color: white
}
38. MongoDB: Adapting to new
requirements
meta
meta
meta
meta
…
meta
meta
meta
meta
Legacy
data
New
data
39. Life is much easier for developers
Code
XML Config
DB Schema
Application
Object Relational
Mapping
Relational
Database
Code
Text Search
Rich
Queries
Application
Geospatial
Aggregatio
n
Map Reduce
40. Write queries using familiar language
Drivers
Drivers for most popular
programming languages and
frameworks
Java
Ruby
JavaScript
Perl
Python
Shell
Command-line shell for interacting
directly with database
> db.collection.insert({company:“10gen”, product:“MongoDB”})
>
> db.collection.findOne()
{
“_id”: ObjectId(“5106c1c2fc629bfe52792e86”),
“company”: “10gen”
“product”: “MongoDB”
}
Haskell
49. Relational DBs don’t work for modern
applications
•
Application foundation doesn’t support data
requirements
•
•
Product catalog
Integrating data from multiple systems
•
Developers manage lots of complexity
•
Change is onerous
•
Scaling is expensive
Your Application
RDBMS
50. Life is simpler with MongoDB
•
Flexible Document Model
•
Easily supports
•
•
New data
Changing requirements
•
Developer friendly
•
Scales horizontially
•
Low cost
Your Application
RDBMS
From mainframes, to RAC Oracle servers... People solved problems by adding more resources to a single machine.
secondary indexes, compound indexes, multikey indexes.why is it important to have all of document together? data locality
Large scale operation can be combined with high performance on commodity hardware through horizontal scalingBuild - Document oriented database maps perfectly to object oriented languagesScale - MongoDB presents clear path to scalability that isn't ops intensive - Provides same interface for sharded cluster as single instance