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
Concurrency + Mongo
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
gamechanger
August 21, 2012
Technology
0
110
Concurrency + Mongo
Concurrent Operations with MongoDB
gamechanger
August 21, 2012
Tweet
Share
More Decks by gamechanger
See All by gamechanger
Mongo: Performance and Troubleshooting
gamechanger
0
310
Mongo and Ops
gamechanger
0
120
Other Decks in Technology
See All in Technology
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
13k
15 years with Rails and DDD (AI Edition)
andrzejkrzywda
0
190
usermode linux without MMU - fosdem2026 kernel devroom
thehajime
0
230
Claude_CodeでSEOを最適化する_AI_Ops_Community_Vol.2__マーケティングx_AIはここまで進化した.pdf
riku_423
2
550
AI駆動PjMの理想像 と現在地 -実践例を添えて-
masahiro_okamura
1
110
GSIが複数キー対応したことで、俺達はいったい何が嬉しいのか?
smt7174
3
150
Digitization部 紹介資料
sansan33
PRO
1
6.8k
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
3.8k
データの整合性を保ちたいだけなんだ
shoheimitani
8
3.1k
こんなところでも(地味に)活躍するImage Modeさんを知ってるかい?- Image Mode for OpenShift -
tsukaman
0
130
Amazon S3 Vectorsを使って資格勉強用AIエージェントを構築してみた
usanchuu
3
450
小さく始めるBCP ― 多プロダクト環境で始める最初の一歩
kekke_n
1
400
Featured
See All Featured
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
200
Marketing to machines
jonoalderson
1
4.6k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Ethics towards AI in product and experience design
skipperchong
2
190
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.6k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
0
1.9k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
180
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
56
Building the Perfect Custom Keyboard
takai
2
680
Being A Developer After 40
akosma
91
590k
30 Presentation Tips
portentint
PRO
1
210
Transcript
concurrency + Mongo Doug Woos engineer, gamechanger Monday, August 20,
12
Concurrency • Multiple, interacting computations • Processes modifying same or
dependent records • Relational: solved with transactions (2PC) • Mongo: no transactions (right?) • So, how do we do this? Monday, August 20, 12
Examples • Multiple users scoring one game • One user,
scoring on device, following on web • Background updates run on multiple nodes Monday, August 20, 12
atomic updates • $set, $unset, $inc, $push, $pull, $addToSet .
. . • $ operator, upserts . . . • findAndModify Monday, August 20, 12
Atomic Updates • Don’t support all operations • Schema design
important! • If we need to do a read first, can’t use Monday, August 20, 12
Isolation Queue • Do all modifications in a queue processor
• Only allow a record to be in the queue once • Compare to Java “synchronized” (monitor) Monday, August 20, 12
Isolation Queue • Part of the Dockets library • github.com/gamechanger/dockets
• Guarantees: • Updates will not conflict • Last update will be run • Intermediate updates may not be Monday, August 20, 12
Isolation Queue • Requires a queue • Not everything can
be async • Slower than Mongo atomic operators Monday, August 20, 12
Optimistic Transactions • Like Redis, sort of • Don’t lock,
but detect conflicts using save_date Monday, August 20, 12
Monday, August 20, 12
Optimistic Transactions • Single-record only • Slower than atomic updates
• Inefficient when there’s a lot of contention Monday, August 20, 12
Conclusions • Safe concurrency != ACID • Schema design is
important • No one-size-fits-all solutions in NoSQL! Monday, August 20, 12