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
110
0
Share
Concurrency + Mongo
Concurrent Operations with MongoDB
gamechanger
August 21, 2012
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
Good Enough Types: Heuristic Type Inference for Ruby
riseshia
0
160
AIエージェントの権限管理 1: MCPサーバー・ツールの Fine grained access control 編
ren8k
3
490
弁護士ドットコム株式会社 エンジニア職向け 会社紹介資料
bengo4com
1
140
みんなで作るAWS Tips 100連発 (FinOps編)
schwrzktz
1
290
AgentCore×VPCでの設計パターンn選と勘所
har1101
3
270
The Journey of Box Building
tagomoris
4
1.9k
[最強DB講義]推薦システム | 基礎編
recsyslab
PRO
1
170
20年前の「OSS革命」に学ぶ AI時代の生存戦略
samakada
0
400
Hacobu Tech Deck
hacobu
PRO
0
100
AWS Agent Registry の基礎・概要を理解する/aws-agent-registry-intro
ren8k
3
360
最近の技術系の話題で気になったもの色々(IoT系以外も) / IoTLT 花見予定会(たぶんBBQ) @都立潮風公園バーベキュー広場
you
PRO
1
220
自分のハンドルは自分で握れ! ― 自分のケイパビリティを増やし、メンバーのケイパビリティ獲得を支援する ― / Take the wheel yourself
takaking22
1
890
Featured
See All Featured
Skip the Path - Find Your Career Trail
mkilby
1
110
The Cult of Friendly URLs
andyhume
79
6.8k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Building an army of robots
kneath
306
46k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
99
Git: the NoSQL Database
bkeepers
PRO
432
67k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.6k
Rails Girls Zürich Keynote
gr2m
96
14k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
Building AI with AI
inesmontani
PRO
1
900
SEO for Brand Visibility & Recognition
aleyda
0
4.5k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
340
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