The document describes an analytics platform that tracks requests and events from web applications. It tracks every user interaction like form submissions and exceptions. Request and event data is written to MySQL and MongoDB for querying and analysis. Events are normalized and aggregated to calculate funnels, counts, sums and rankings over time. This data is used for customer support, UX analysis, and debugging.
7. GuiceyMongo?
• Generates Wrapper/Builder code from a simple DDL
Person p = personCollection.findOne();
System.out(p.getName());
System.out(StringUtil.join(p.getAliasSet(), ", "));
if (p.hasPicture()) {
Image picture = ImageIO.read(p.getPictureInputStream());
// do something with the picture
}
data Person {
string name;
set<string> alias;
blob picture;
}
Person.Builder p = Person.newBuilder()
.setName("Matt Insler")
.addAlias("Matt")
.addAlias("Guice & Mongo Guru")
.setPictureBucket("pictures");
ImageIO.write(picture, format, p.getPictureOutputStream());
personCollection.save(p.build());
7
10. Cement?
• MVC Framework wriSen for Guice/MongoDB
• Efficient rouDng and built‐in logging and excepDon handling
• Wrote it because I was bored and I could
• Definitely not producDon‐ready whatsoever
10
14. Request Tracking
• Queued and wriSen from a low‐priority thread from Java
― WriSen to MySQL first
― WriSen to MongoDB with MySQL Primary Key for differenDaDon
• Visitor Key ‐ Cookied browser/computer
• Session Key ‐ Per User session
• Stripe sessions with extra informaDon
― acquisiDon/referrer informaDon
14
23. Event Tracking
• Queued and wriSen from a low‐priority thread from Java
― WriSen to MySQL first
― WriSen to MongoDB with MySQL Primary Key for differenDaDon
• Events are wriSen into a “raw” collecDon
• Event Fixer process normalizes events into “fixed” collecDon
― Drops bot traffic
― Accounts for historical naming changes (user || userId || u ‐> user_id)
― Converts Strings to Numbers if necessary for later indexing
• Event Indexer calculates and updates “rollup” collecDon
23
33. Tracking Events ‐ Problems
• Rollups taking up too much space
― Need to move to document format from Kyle Banker’s “The MongoDB
Gamut: Four ApplicaDon Designs”
― Tell business to track fewer permutaDons? (yea right)
• Fixer skipping events
― Moved from {_id: {$gt: ObjectId(...)}} to {version: {$lt: 5}}
• Fixer running slow
― Moved from findAndModify to find(...).limit(...) and then update in bulk
― {version: {$lt: 5}} is slower than {version: {$lte: 4}} !!!
• KEEP INDEXES IN MEMORY!!!
― We had > 12G indexes on a 7.5G box
33