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
320
Mongo and Ops
gamechanger
0
120
Other Decks in Technology
See All in Technology
作るべきものと向き合う - ecspresso 8年間の開発史から学ぶ技術選定 / 技術選定con findy 2026
fujiwara3
6
1.7k
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
95k
Databricksアシスタントが自分で考えて動く時代に! エージェントモード体験もくもく会
taka_aki
0
290
組織のSREを推進するためのPlatform EngineeringとEKS / Platform Engineering and EKS to drive SRE in your organization
chmikata
0
180
Exadata Fleet Update
oracle4engineer
PRO
0
1.3k
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
4k
トップマネジメントとコンピテンシーから考えるエンジニアリングマネジメント
zigorou
3
340
Databricks (と気合い)で頑張るAI Agent 運用
kameitomohiro
0
360
Security Diaries of an Open Source IAM
ahus1
0
190
生成AI活用によるPRレビュー改善の歩み
lycorptech_jp
PRO
4
2k
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
4
22k
AWS CDK の目玉新機能「Mixins」とは / cdk-mixins
gotok365
2
320
Featured
See All Featured
Evolving SEO for Evolving Search Engines
ryanjones
0
150
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
250
Testing 201, or: Great Expectations
jmmastey
46
8.1k
What does AI have to do with Human Rights?
axbom
PRO
1
2k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
230
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.3k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
460
Believing is Seeing
oripsolob
1
68
Are puppies a ranking factor?
jonoalderson
1
3.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
96
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
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