Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
mongoDB at Intercom
Search
ciaranlee
May 23, 2012
Technology
400
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
mongoDB at Intercom
These slides are from a talk I gave at the first meeting of the Dublin mongoDB users group.
ciaranlee
May 23, 2012
More Decks by ciaranlee
See All by ciaranlee
Query Fingerprinting
ciaranlee
0
49
Other Decks in Technology
See All in Technology
自律的なチームを作るためにTechPMがやらないこと
ny7760
1
530
レガシーコードに対する loop engineering的なAI開発プロセス導入について
kubell_hr
0
280
BALLAS Technology Deck
ballas_inc
0
160
Microsoft Entra Kerberos で実現するクラウド デバイス管理
tamaiyutaro
2
640
なぜ東京にいる私が、新潟の技術コミュニティを運営するのか by 八雲慎之助
yakumo
0
220
TSKaigi Sendai 2026 - tsgo時代のTypeScript Playgroundはどう動くか
teamlab
PRO
0
110
bpf_arenaとstruct_opsを使うのが難しかった話
masu_mi
0
210
業務でAWSをあまり使っていない私が、AWSへのモチベを保つ方法
smt7174
0
170
Autonomous AI Lakehouse - Live AI Hubから始めるセキュアなAIデータ活用 -
oracle4engineer
PRO
3
200
Context Ontology Accelerator 入門 (業務データの意味を、AI エージェントに渡す)
inariku
PRO
3
510
Building Audio Plugin Ecosystem for Android in 2026
atsushieno
2
160
リアクションエンジニア ― 小さなリアクションから、話しかけやすい組織をつくる ―
ryuguyana
1
130
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.9k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
660
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
670
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
760
4 Signs Your Business is Dying
shpigford
187
23k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k
Ethics towards AI in product and experience design
skipperchong
2
460
30 Presentation Tips
portentint
PRO
1
460
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Automating Front-end Workflow
addyosmani
1370
210k
RailsConf 2023
tenderlove
30
1.6k
Transcript
Wednesday 23 May 12
Ciaran Lee @ciaran_lee CTO of @intercom Wednesday 23 May 12
MongoDB at Intercom Wednesday 23 May 12
• What we do • Why we started using mongoDB
• Learnings • Problems • Hosting Overview Wednesday 23 May 12
CRM & Messaging Tool for Web Apps Wednesday 23 May
12
<script> var intercomSettings = { app_id:"tx2p130c", email:"
[email protected]
" }; </script> <script
src="https://api.intercom.io/api/ js/library.js"</script> Wednesday 23 May 12
Wednesday 23 May 12
Wednesday 23 May 12
• Rails • MySQL • MongoDB • Redis • Memcached
• Solr Technology Stack Wednesday 23 May 12
• Open beta • Installed on thousands of apps •
Tracking millions of end users Current status Wednesday 23 May 12
MySQL • Initially used for all data • We had
a built high traffic apps with it before (@exceptional) Wednesday 23 May 12
Wednesday 23 May 12
var intercomSettings = { app_id:"tx2p130c", email:"
[email protected]
", custom_data: { plan: "Small",
teammates: 4, revenue: 312, } }; Wednesday 23 May 12
http://en.wikipedia.org/wiki/Entity-attribute-value_model Entity–attribute–value pattern Wednesday 23 May 12
Wednesday 23 May 12
class User < ActiveRecord::Base serialize :custom_data end user.custom_data = {
:plan => "Small", :team_mates => 4, :revenue => 312, } Wednesday 23 May 12
• Reading and writing worked fine • Sorting or filtering
was a disaster Results Wednesday 23 May 12
Why MongoDB? • Handles arbitrary document structure • Flexible querying
• Can use an ActiveRecord compatible ORM (mongomapper) • Available as a heroku addon Wednesday 23 May 12
Users -> mongoDB Wednesday 23 May 12
Wednesday 23 May 12
The Mongo way • Different way of thinking to relational
DB • Often denormalised • Desired read scenarios influence design Wednesday 23 May 12
Tagging Wednesday 23 May 12
Tagging • Relational way is users + tags + join
table • Mongo way is a tag_ids array in the user record Wednesday 23 May 12
db.users.update( { app_id: 6, 'custom_data.apps': { $gte: 5 } },
{ $addToSet: { tag_ids:1234 } } ); Wednesday 23 May 12
db.users.update( { app_id: 6, 'custom_data.apps': { $gte: 5 } },
{ $addToSet: { tag_ids:1234 } } ); Wednesday 23 May 12
db.users.update( { app_id: 6, 'custom_data.apps': { $gte: 5 } },
{ $addToSet: { tag_ids:1234 } } ); Wednesday 23 May 12
Challenges Wednesday 23 May 12
Activity Stream Wednesday 23 May 12
Wednesday 23 May 12
Problem #1 • Querying users has gotten slower • Users
collection is 1/4 the size of activities • Activity stream growing too fast • Knocks the users collection out of RAM Wednesday 23 May 12
Solution • Move the activity stream over to a separate
database • We can use the more powerful database for complex user queries • sorting + filtering should be quicker Wednesday 23 May 12
Problem #2 • Can’t index every custom data attribute •
Intend to experiment with app specific user collections (+ index all custom data attrs on that app’s collection) Wednesday 23 May 12
Slowness • Always seems to involve disk access • Slow
performance of simple queries after big addToSet operations (> 200k users) Wednesday 23 May 12
Hosting • MongoHQ • Replica set - heroku addon •
ec2 cluster • Dedicated hardware with SSDs • Amazing service Wednesday 23 May 12
Thanks for listening! Wednesday 23 May 12
Wednesday 23 May 12