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
コーポレートサイトのアクセシビリティ改善とJIS準拠への実践
lycorptech_jp
PRO
2
140
Loadbalancing exporter internals
ymotongpoo
1
130
社内RAGの導入で気を付けたポイント
yakumo
2
150
NFLコンペ2026 解法
lycorptech_jp
PRO
0
100
【禁断】Obsidianの第二の脳に「知の巨人」と呼ばれた師匠の脳をロードしてみた
nagatsu
0
6.3k
AI時代の私の技術インプットとアウトプット術
tonkotsuboy_com
3
630
組織の中で自分を経営する技術
shoota
0
130
基礎から解説!Icebergで紐解くSnowflake×Databricks連携の現在地
cm_yasuhara
0
280
TSKaigi 2026 - Auth.jsからBetter Authへの 移行に見る「型とランタイム」の 設計思想の変化
teamlab
PRO
1
260
ラズパイ & Picoで入門:Zephyr(RTOS)の環境構築からビルドまでの紹介
iotengineer22
0
220
AI時代に改めて考える、ドメイン駆動設計 - モデリングが「AIへの共通言語」になる
littlehands
7
2.3k
ソフトウェアサプライチェーン攻撃対策として今からサクッとできること
flatt_security
2
130
Featured
See All Featured
Become a Pro
speakerdeck
PRO
31
5.9k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
280
So, you think you're a good person
axbom
PRO
2
2k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
400
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
370
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
140
The Cost Of JavaScript in 2023
addyosmani
55
9.9k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
430
Crafting Experiences
bethany
1
160
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