Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
How MongoDB Works
Search
Uladzimir Mihura
February 01, 2013
Technology
1
260
How MongoDB Works
Deck for a short talk I've given on a EPAM Software Engineering Conference 2013.
Uladzimir Mihura
February 01, 2013
Tweet
Share
More Decks by Uladzimir Mihura
See All by Uladzimir Mihura
What is to be a senior engineer?
trnl
1
370
Apache Cassandra
trnl
2
240
Other Decks in Technology
See All in Technology
ページの可視領域を算出する方法について整理する
yamatai1212
0
140
プラットフォームエンジニアリングとは何であり、なぜプラットフォームエンジニアリングなのか
doublemarket
1
480
Flutter Thread Merge - Flutter Tokyo #11
itsmedreamwalker
1
120
Kill the Vibe?Architecture in the age of AI
stoth
1
140
あなたの知らないDateのひみつ / The Secret of "Date" You Haven't known #tqrk16
expajp
0
110
Eight Engineering Unit 紹介資料
sansan33
PRO
0
5.6k
その意思決定、まだ続けるんですか? ~痛みを超えて未来を作る、AI時代の撤退とピボットの技術~
applism118
45
25k
レガシーシステム刷新における TypeSpec スキーマ駆動開発のすゝめ
tsukuha
4
890
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
5
46k
生成AIシステムとAIエージェントに関する性能や安全性の評価
shibuiwilliam
2
290
原理から解き明かす AIと人間の成長 - Progate BAR
teba_eleven
2
250
LangChain v1.0にトライ~ AIエージェントアプリの移行(v0.3 → v1.0) ~
happysamurai294
0
140
Featured
See All Featured
Building Adaptive Systems
keathley
44
2.8k
Thoughts on Productivity
jonyablonski
73
4.9k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
1
65
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
How to Ace a Technical Interview
jacobian
280
24k
Code Reviewing Like a Champion
maltzj
527
40k
The Cult of Friendly URLs
andyhume
79
6.7k
A better future with KSS
kneath
240
18k
Building Applications with DynamoDB
mza
96
6.8k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
For a Future-Friendly Web
brad_frost
180
10k
Speed Design
sergeychernyshev
33
1.3k
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/