Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
How MongoDB Works
Search
Uladzimir Mihura
February 01, 2013
Technology
260
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
How MongoDB Works
Deck for a short talk I've given on a EPAM Software Engineering Conference 2013.
Uladzimir Mihura
February 01, 2013
More Decks by Uladzimir Mihura
See All by Uladzimir Mihura
What is to be a senior engineer?
trnl
1
380
Apache Cassandra
trnl
2
250
Other Decks in Technology
See All in Technology
なぜ Temporal の大小比較には compare しかないのか / Why Does Temporal Only Have compare() for Comparisons
kazukihayase
1
150
My broken English still works: speaking at global OSS events
naruoga
0
110
What's new in Go 1.27?
ciarana
0
170
PLATEAU で バーチャル花火大会
tatsuya1970
0
160
Software Supply Chain Attackからクラウド環境を守るためにできること
lhazy
2
270
FPGAが実現する遠方宇宙の高空間分解能天体撮影 -大型地上望遠鏡の視力を補正する「補償光学」とは?-
komei_mt
0
280
Digitization部 紹介資料
sansan33
PRO
2
7.7k
Bits AI を制するものは Datadog を制す / The player that controls Bits AI, controls Datadog
kaminashi
0
120
FDEの心得
noriakioji
5
6.2k
[ChatGPT Work LT]事務作業が苦手な人のための バックオフィスの「半」自動化
chimaki_iot
0
310
関東Kaggler会発表資料
takoi
1
250
ハーレムエンジニアリング
kazuma777777
0
180
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.4k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
990
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
580
sira's awesome portfolio website redesign presentation
elsirapls
0
320
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
650
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.5k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
230
Code Reviewing Like a Champion
maltzj
528
40k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
1.1k
Transcript
How MongoDB works Uladzimir Mihura Senior Software Engineer, EPAM Systems
Software Engineering Conference 2013
Data Model {name:'mongo', type:'DB'}
Data Model: Document oriented { _id: 1, name:
{ first: 'Michael', last: 'Faraday' }, birth: new Date('Sep 22, 1791'), death: new Date('Aug 25, 1867'), contribs: ['Chemistry', 'Electricity', 'Diamagnetism'] }
{ hello: 'SEC 2013'} \x19\x00\x00\x00 \x02hello \x09\x00\x00\x00 SEC 2013\x00 Data
Model: BSON
Data Model: Structure Document Collection Database MongoDB Instance
db.foo.find({name:'Niels', surname:'Bohr'}) Reading
• find, findOne • accepts a conditions object • regex,
strings, numbers, etc... • rich operators • $lt, $gt, $or, $and, $in, $ne, ... • projections • specify fields to return Reading: Dynamic Queries
Reading: Indexes • B-Tree • multiply fields • options •
unique • sparse • 2d • full text search (≥2.4) Di Lu Rh B C Cr Zo St Sa Ka H F B C Cr
Reading: Query Optimizer x x remember db.foo.find({ x: 10, y:'bar'})
index on y index on x full scan
Writing db.foo.insert({name:'Georg', surname:'Ohm'})
• Errors ignored (even network errors) • Unacknowledged (fire &
forget) • Acknowledged (write accepted) • Journaled • Propagated to the replica set members Writing: Write Concerns
Writing: Isolation db.foo.update( { field1 : 1 , $isolated
: 1 }, { $inc : { field2 : 1 } } , { multi: true } )
Storage Management {name:'mongo', type:'DB'}
Storage: Padding factor ... Padding Header BSON Data Padding Header
...
Storage: Directory Layout -‐rw-‐-‐-‐-‐-‐-‐-‐ 1 trnl trnl
64M Jan 28 14:38 foo.0 -‐rw-‐-‐-‐-‐-‐-‐-‐ 1 trnl trnl 128M Jan 28 14:26 foo.1 -‐rw-‐-‐-‐-‐-‐-‐-‐ 1 trnl trnl 256M Jan 28 14:31 foo.2 -‐rw-‐-‐-‐-‐-‐-‐-‐ 1 trnl trnl 512M Jan 28 14:38 foo.3 -‐rw-‐-‐-‐-‐-‐-‐-‐ 1 trnl trnl 1.0G Jan 28 14:38 foo.4 -‐rw-‐-‐-‐-‐-‐-‐-‐ 1 trnl trnl 2.0G Jan 28 14:38 foo.5 -‐rw-‐-‐-‐-‐-‐-‐-‐ 1 trnl trnl 16M Jan 28 14:38 foo.ns • Separate files per database • Aggressive preallocation
Storage: Memory mapped files foo.1 foo.2 foo.3 ... foo.n Virtual
Memory
Scaling {name:'mongo', type:'DB'}
Scaling: Replication Node 3 Primary Node 1 Secondary Node 2
Secondary Replication Replication client read read read write
Scaling: Replication Node 3 Primary Node 1 Primary Node 2
Secondary Replication client read read write
Scaling: Replication Node 3 Secondary Node 1 Primary Node 2
Secondary Replication client read read write read Replication
Scaling: Sharding Client mongos mongos ... mongod mongod mongod Replica
Set mongod mongod mongod Replica Set mongod mongod mongod Replica Set Shards mongod mongod mongod Config Servers
MongoDB Drivers Team @ 10gen
• MongoLab.com • MongoHQ.com • HostedMongo.com • MongoMachine.com • ObjectRocket
• etc Hosted Solutions
Thank you. Let’s ask. http://try.mongodb.org/ http://on.fb.me/bymongo/