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
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
110
Other Decks in Technology
See All in Technology
AI機能プロジェクト炎上の 3つのしくじりと学び
nakawai
0
130
AIの個性を理解し、指揮する
shoota
1
230
AI AgentをLangflowでサクッと作って、1日働かせてみた!
yano13
1
160
OSSで50の競合と戦うためにやったこと
yamadashy
3
1k
生成AI時代のPythonセキュリティとガバナンス
abenben
0
140
プロファイルとAIエージェントによる効率的なデバッグ / Effective debugging with profiler and AI assistant
ymotongpoo
1
370
SRE × マネジメントレイヤーが挑戦した組織・会社のオブザーバビリティ改革 ― ビジネス価値と信頼性を両立するリアルな挑戦
coconala_engineer
0
280
MCP ✖️ Apps SDKを触ってみた
hisuzuya
0
390
アウトプットから始めるOSSコントリビューション 〜eslint-plugin-vueの場合〜 #vuefes
bengo4com
3
1.8k
ハノーファーメッセ2025で見た生成AI活用ユースケース.pdf
hamadakoji
1
490
AI時代におけるデータの重要性 ~データマネジメントの第一歩~
ryoichi_ota
0
720
入院医療費算定業務をAIで支援する:包括医療費支払い制度とDPCコーディング (公開版)
hagino3000
0
110
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
59
9.6k
How GitHub (no longer) Works
holman
315
140k
Building Adaptive Systems
keathley
44
2.8k
Music & Morning Musume
bryan
46
6.9k
It's Worth the Effort
3n
187
28k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Statistics for Hackers
jakevdp
799
220k
Side Projects
sachag
455
43k
The Pragmatic Product Professional
lauravandoore
36
7k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.2k
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