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
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
110
Other Decks in Technology
See All in Technology
Claude Code でアプリ開発をオートパイロットにするためのTips集 Zennの場合 / Claude Code Tips in Zenn
wadayusuke
5
1.5k
Codeful Serverless / 一人運用でもやり抜く力
_kensh
7
450
RSCの時代にReactとフレームワークの境界を探る
uhyo
10
3.5k
まずはマネコンでちゃちゃっと作ってから、それをCDKにしてみよか。
yamada_r
2
120
自作JSエンジンに推しプロポーザルを実装したい!
sajikix
1
190
要件定義・デザインフェーズでもAIを活用して、コミュニケーションの密度を高める
kazukihayase
0
120
Platform開発が先行する Platform Engineeringの違和感
kintotechdev
4
590
エンジニアが主導できる組織づくり ー 製品と事業を進化させる体制へのシフト
ueokande
1
100
共有と分離 - Compose Multiplatform "本番導入" の設計指針
error96num
2
1.2k
COVESA VSSによる車両データモデルの標準化とAWS IoT FleetWiseの活用
osawa
1
400
なぜテストマネージャの視点が 必要なのか? 〜 一歩先へ進むために 〜
moritamasami
0
240
AIエージェント開発用SDKとローカルLLMをLINE Botと組み合わせてみた / LINEを使ったLT大会 #14
you
PRO
0
130
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.1k
The Language of Interfaces
destraynor
161
25k
Building an army of robots
kneath
306
46k
A Modern Web Designer's Workflow
chriscoyier
696
190k
RailsConf 2023
tenderlove
30
1.2k
GraphQLの誤解/rethinking-graphql
sonatard
72
11k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
850
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Visualization
eitanlees
148
16k
Building Applications with DynamoDB
mza
96
6.6k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
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