Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
2011-MongoDC-Scaling.pdf
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
mongodb
July 12, 2011
Programming
220
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
2011-MongoDC-Scaling.pdf
mongodb
July 12, 2011
Transcript
22 slides
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
More Decks by mongodb
See All by mongodb
NoSQL Now! 2012
mongodb
18
3.5k
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
600
Beanstalk Data - MongoDB In Production Chris Siefken, CTO Beanstalk Data
mongodb
0
610
New LINQ support in C#/.NET driver Robert Stam, 10gen
mongodb
9
41k
Welcome and Keynote Aaron Heckman, 10gen
mongodb
0
580
Webinar Introduction to MongoDB's Java Driver
mongodb
1
1.3k
Webinar Intro to Schema Design
mongodb
4
1.9k
Other Decks in Programming
See All in Programming
joyful-journey-spring-boot.pdf
hollycummins
0
160
はじめてのKubernetesコントリビューション
nasa9084
0
340
自宅サーバはどこまで再現できるのか - Proxmox VE上のVM環境をIaCとバックアップで戻してみた
youto
0
450
Claude Codeのおかげでやりたいことがやれるようになったんだよォー!
sms_tech
0
200
Compiling Your Language to WasmGC & Friends
tanishiking
1
1k
読みやすい!と評判(?)の発表の準備にかける私のこだわり
shoheimitani
0
170
flutter_test のその先へ — Flutter アプリの LLM 機能に「評価」という品質保証を
kosukesaigusa
0
210
Jujutsu で毎日のバージョン管理に「安心」と「直感性」を
oukayuka
0
130
TS 7.0 で baseUrl が使えなくなった今、パスエイリアスをどうするか
bicstone
2
890
どうしても Eloquent でリポジトリパターンをやりたいんだ #phpcon_niigata / phpcon-niigata-2026
shogogg
0
720
例外からRich Errorsまで Kotlinエラーハンドリングの進化を読み解く
shiita0903
0
260
コード生成時代のAPI定義を支えるRequest Spec移行
pvcresin
0
320
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
699
190k
Designing for Performance
lara
612
70k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
560
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
310
Evolving SEO for Evolving Search Engines
ryanjones
0
380
Discover your Explorer Soul
emna__ayadi
2
1.4k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
1
320
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
Agile that works and the tools we love
rasmusluckow
331
22k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3.1k