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
1
240
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
360
Apache Cassandra
trnl
2
220
Other Decks in Technology
See All in Technology
GraphQL 成熟度モデルの紹介と、プロダクトに当てはめた事例 / GraphQL maturity model
mh4gf
5
330
疲弊しない!AWSセキュリティ統制の考え方 #devio_osakaday1
masahirokawahara
6
5.9k
自動生成を活用した、運用保守コストを抑える Error/Alert/Runbook の一元集約管理 / Centralized management of Error/Alert/Runbook to minimize operational costs using automated code generation
biwashi
10
2.2k
コンテナセキュリティの基本と脅威への対策
kyohmizu
3
710
DevOpsDays History and my DevOps story
kawaguti
PRO
8
1.6k
株式会社EventHub・エンジニア採用資料
eventhub
0
1.9k
少数チームで挑む: SwiftUI, TCA, KMPを用いた 新規動画配信アプリ 「ABEMA Live」の開発について
tomu28
0
550
長期間TiDBを使ってきた話 @ 私たちはなぜNewSQLを使うのかTiDB選定5社が語る選定理由と活用LT / Experiences with TiDB Over Time
chibiegg
2
750
小さな開発会社がWebサービスを作る理由
polidog
PRO
1
160
4年前、あるじゃん老害エンジニアLT合戦に登壇、米国西海岸コンピュータ歴史博物館体験記の続編
toshi_atsumi
0
200
Janus
bkuhlmann
1
490
Delivering Millions of Messages within seconds @ Duolingo
pelelgrino
0
340
Featured
See All Featured
How GitHub (no longer) Works
holman
304
140k
Fashionably flexible responsive web design (full day workshop)
malarkey
397
65k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
1
3.4k
Embracing the Ebb and Flow
colly
79
4.1k
Building a Modern Day E-commerce SEO Strategy
aleyda
16
6.4k
A designer walks into a library…
pauljervisheath
199
23k
Designing with Data
zakiwarfel
95
4.8k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
124
32k
Build your cross-platform service in a week with App Engine
jlugia
225
17k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
5
1.5k
How to train your dragon (web standard)
notwaldorf
72
5.1k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
18
1.7k
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/