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
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
11k
ご挨拶「10周年を迎える共創ラボのこれまでとこれから」
iotcomjpadmin
0
170
AI時代における最適なQA組織の作り方
ymty
3
330
AWS Summit の片隅で、体育座りしながらコミュニティがにぎわう理由を考えた
k_adachi_01
2
330
“ID沼入口” - 基本とセキュリティから始める、考え続けるためのID管理技術勉強会 告知&イントロ
ritou
0
370
記録をかんたんに、提案をパーソナルに ── AIであすけんが目指すもの
oprstchn
0
110
製造現場での生成AIの活用、およびエージェントAIの実装のあり方、AVEVAの取り組み
iotcomjpadmin
0
210
攻撃者がいなくてもAIエージェントはインシデントを起こす
nomizone
0
180
小さいから、全部わかる。— 常駐AI "xangi" のすすめ
sugupoko
0
220
Baseline対応のDOMの型定義を作った
uhyo
2
560
そのタスクオンスケですか?
poropinai1966
0
110
Multi-Agent並列開発を 安全に回すための技術 / Technology for Safely Multi-Agent Parallel Development
tooppoo
0
250
Featured
See All Featured
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
880
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
410
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
55k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
860
Into the Great Unknown - MozCon
thekraken
41
2.6k
Tell your own story through comics
letsgokoyo
1
980
Being A Developer After 40
akosma
91
590k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1k
How to make the Groovebox
asonas
2
2.3k
GitHub's CSS Performance
jonrohan
1033
470k
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