Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
120
Other Decks in Technology
See All in Technology
Snowflake導入から1年、LayerXのデータ活用の現在 / One Year into Snowflake: How LayerX Uses Data Today
civitaspo
0
2.4k
2025-12-27 Claude CodeでPRレビュー対応を効率化する@機械学習社会実装勉強会第54回
nakamasato
4
1k
Amazon Quick Suite で始める手軽な AI エージェント
shimy
1
1.9k
まだ間に合う! Agentic AI on AWSの現在地をやさしく一挙おさらい
minorun365
17
2.8k
さくらのクラウド開発ふりかえり2025
kazeburo
2
1.2k
202512_AIoT.pdf
iotcomjpadmin
0
140
Bedrock AgentCore Evaluationsで学ぶLLM as a judge入門
shichijoyuhi
2
250
Kiro を用いたペアプロのススメ
taikis
4
1.8k
日本の AI 開発と世界の潮流 / GenAI Development in Japan
hariby
1
480
AWSに革命を起こすかもしれない新サービス・アップデートについてのお話
yama3133
0
510
マイクロサービスへの5年間 ぶっちゃけ何をしてどうなったか
joker1007
21
8.1k
SQLだけでマイグレーションしたい!
makki_d
0
1.2k
Featured
See All Featured
Abbi's Birthday
coloredviolet
0
3.8k
The SEO Collaboration Effect
kristinabergwall1
0
310
GraphQLとの向き合い方2022年版
quramy
50
14k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
65
35k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
190
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Navigating Team Friction
lara
191
16k
How to make the Groovebox
asonas
2
1.8k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
260
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
What's in a price? How to price your products and services
michaelherold
246
13k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
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