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
2011-MongoDC-Scaling.pdf
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
mongodb
July 12, 2011
Programming
210
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
2011-MongoDC-Scaling.pdf
mongodb
July 12, 2011
More Decks by mongodb
See All by mongodb
NoSQL Now! 2012
mongodb
18
3.4k
MongoDB 2.2 At the Silicon Valley MongoDB User Group
mongodb
9
1.5k
Turning off the LAMP Hunter Loftis, Skookum Digital Works
mongodb
2
1.6k
Mobilize Your MongoDB! Developing iPhone and Android Apps in the Cloud Grant Shipley, Red Hat
mongodb
0
580
Beanstalk Data - MongoDB In Production Chris Siefken, CTO Beanstalk Data
mongodb
0
590
New LINQ support in C#/.NET driver Robert Stam, 10gen
mongodb
9
41k
Welcome and Keynote Aaron Heckman, 10gen
mongodb
0
560
Webinar Introduction to MongoDB's Java Driver
mongodb
1
1.3k
Webinar Intro to Schema Design
mongodb
4
1.8k
Other Decks in Programming
See All in Programming
仕様書を書く前にハーネスを作る - Agent Native開発は「探索を速く、判定を固く」
gotalab555
5
1.8k
VibeCodingからAgenticWorkflowへ
starfish719
0
940
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
430
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
670
Loosening the Reins: Go Generics Get More Flexible
kuro_kurorrr
0
350
片田舎のおっさん、 Swift Buildのダイアモンド問題解決の不具合修正PRを出すが、解決方法がキャッシュをしないようにすることであり、ビルド時間が伸びると言われてマージされないので高速化もする/swiftbuild
yimajo
0
320
GKE アップグレード前に知っておきたい Blue/Green と PDB の関係
stkk
0
100
バグを直したら useEffect が消えた
colorful12
3
770
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
400
進化を続けるGo toolsの現在地 / The Current State of Ever-Evolving Go Tools
hond0413
0
270
承認済みなのに差戻しできてしまうバグ、型で潰せます
shinchit
0
120
Press start. Python's next generation.
willingc
PRO
3
260
Featured
See All Featured
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
670
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
380
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.4k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
750
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
WCS-LA-2024
lcolladotor
0
810
Embracing the Ebb and Flow
colly
88
5.1k
30 Presentation Tips
portentint
PRO
1
380
Transcript
Eliot Horowitz @eliothorowitz MongoDC June 27, 2011 Practical Scaling and
Sharding
Scaling by Optimization • Schema Design • Index Design •
Hardware Configuration
Horizontal Scaling • Vertical scaling is limited • Hard to
scale vertically in the cloud • Can scale wider than higher
Replica Sets • One master at any time • Programmer
determines if read hits master or a slave • Easy to setup to scale reads
db.people.find( { state : “NY” } ).addOption( SlaveOK ) •
routed to a secondary automatically • will use master if no secondary is available
Not Enough • Writes don’t scale • Reads are out
of date on slaves • RAM/Data Size doesn’t scale
• Distribute write load • Keep working set in RAM
• Consistent reads • Preserve functionality Why Shard?
Sharding Design Goals • Scale linearly • Increase capacity with
no downtime • Transparent to the application • Low administration to add capacity
Sharding and Documents • Rich documents reduce need for joins
• No joins makes sharding solvable
• Choose how you partition data • Convert from single
replica set to sharding with no downtime • Full feature set • Fully consistent by default Basics
Architecture client mongos ... mongos mongod mongod ... Shards mongod
mongod mongod Config Servers mongod mongod mongod mongod mongod mongod mongod client client client
Data Center Primary Data Center Secondary S1 p=1 S1 p=1
S1 p=0 S2 p=0 S3 p=0 S2 p=1 S3 p=1 S2 p=1 S3 p=1 Config 2 Config 2 Config 1 mongos mongos mongos mongos Typical Basic Setup
Range Based • collection is broken into chunks by range
• chunks default to 64mb or 100,000 objects
Choosing a Shard Key • Shard key determines how data
is partitioned • Hard to change • Most important performance decision
Use Case: Photos { photo_id : ???? , data :
<binary> } What’s the right key? • auto increment • MD5( data ) • month() + MD5(data)
Initial Loading • System start with 1 chunk • Writes
will hit 1 shard and then move • Pre-splitting for initial bulk loading can dramatically improve bulk load time
Administering a Cluster • Do not wait too long to
add capacity • Need capacity for normal workload + cost of moving data • Stay < 70% operational capacity
Hardware Considerations • Understand working set and make sure it
can fit in RAM • Choose appropriate sized boxes for shards • Too small and admin/overhead goes up • Too large, and you can’t add capacity smoothly
DEMO
Download MongoDB http://www.mongodb.org and let us know what you think
@eliothorowitz @mongodb 10gen is hiring! http://www.10gen.com/jobs
Use Case: User Profiles { email : “
[email protected]
” , addresses
: [ { state : “NY” } ] } • Shard by email • Lookup by email hits 1 node • Index on { “addresses.state” : 1 }
Use Case: Activity Stream { user_id : XXX, event_id :
YYY , data : ZZZ } • Shard by user_id • Looking up an activity stream hits 1 node • Writing even is distributed • Index on { “event_id” : 1 } for deletes