Ordered List
John Nunemaker
MongoChi 2011
October 18, 2011
MongoDB for Analytics
A loving conversation with @jnunemaker
Slide 2
Slide 2 text
Background
As presented through interpretive dance
Slide 3
Slide 3 text
No content
Slide 4
Slide 4 text
No content
Slide 5
Slide 5 text
No content
Slide 6
Slide 6 text
~1 month
Of evenings and weekends
Slide 7
Slide 7 text
~4 dog years
Since public launch
Slide 8
Slide 8 text
~6 tiny servers
2 web, 2 app, 2 db
Slide 9
Slide 9 text
~1-2 Million
Page views per day
Slide 10
Slide 10 text
No content
Slide 11
Slide 11 text
No content
Slide 12
Slide 12 text
Implementation
Imma show you how we do what we do baby
Slide 13
Slide 13 text
Doing It Live
No aggregate querying
Slide 14
Slide 14 text
get('/track.gif') do
Hit.record(...)
TrackGif
end
Slide 15
Slide 15 text
class Hit
def record
site.atomic_update(site_updates)
Resolution.record(self)
Technology.record(self)
Location.record(self)
Referrer.record(self)
Content.record(self)
Search.record(self)
Notification.record(self)
View.record(self)
end
end
Slide 16
Slide 16 text
class Resolution
def record(hit)
query = {'_id' => "..."}
update = {'$inc' => {}}
update['$inc']["sx.#{hit.screenx}"] = 1
update['$inc']["bx.#{hit.browserx}"] = 1
update['$inc']["by.#{hit.browsery}"] = 1
collection(hit.created_on)
.update(query, update, :upsert => true)
end
end
end
Slide 17
Slide 17 text
Pros
Slide 18
Slide 18 text
Pros
Space
Slide 19
Slide 19 text
Pros
Space
RAM
Slide 20
Slide 20 text
Pros
Space
RAM
Reads
Slide 21
Slide 21 text
Pros
Space
RAM
Reads
Live
Slide 22
Slide 22 text
Cons
Slide 23
Slide 23 text
Cons
Writes
Slide 24
Slide 24 text
Cons
Writes
Constraints
Slide 25
Slide 25 text
Cons
Writes
Constraints
More Forethought
Slide 26
Slide 26 text
Cons
Writes
Constraints
More Forethought
No raw data
Slide 27
Slide 27 text
Time Frame
Minute, hour, month, day, year, forever?