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
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Concurrency + Mongo
Concurrent Operations with MongoDB
gamechanger
August 21, 2012
More Decks by gamechanger
See All by gamechanger
Mongo: Performance and Troubleshooting
gamechanger
0
330
Mongo and Ops
gamechanger
0
120
Other Decks in Technology
See All in Technology
変更し続けられるシステムをどう保つか — AI時代のSSoTという設計原則
kawauso
1
1.4k
副作用のある Lambda でも Lambda Power Tuning は使えるのか / lambda-power-tuning-side-effects
koukihosaka
2
160
最新IoT事例11選に学ぶ!現場の成功パターンと実践のコツ【SORACOM Discovery 2026】
soracom
PRO
0
100
AI工学特論: MLOps・継続的評価
asei
11
2.9k
セキュリティ研修【MIXI 26新卒技術研修】
mixi_engineers
PRO
24
20k
BigQuery を検索ソースとした AI Agent の作り方って 〇〇 通りあんねん
satohjohn
0
130
コンテナ・K8s研修【MIXI 26新卒技術研修】#2
mixi_engineers
PRO
1
280
AI驚き屋発見器
yama3133
1
360
AI Native なプロダクト組織の立ち上げ方 : 生産性 100 倍への挑戦
mikesorae
0
1.6k
探索・可視化・自動化を一本化 Amazon Quickでデータ活用スピードを上げる方法
koheiyoshikawa
0
230
事業成長とAI活用を止めないデータ基盤アーキテクチャの設計思想
hiracky16
0
750
Jitera Company Deck
jitera
0
630
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Darren the Foodie - Storyboard
khoart
PRO
3
3.5k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.5k
Are puppies a ranking factor?
jonoalderson
1
3.7k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
410
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
910
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
430
Embracing the Ebb and Flow
colly
88
5.1k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
67
56k
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