Demonstrates how an "activity feed" or notification service can be a good fit for a non-relational database. Includes a sketch of an example solution schema with MongoDB.
HTML Injection Attacks: Impact and Mitigation Strategies
Y NoSQL: An Example
1. Y NoSQL
Jim Van Fleet @bigfleet
Jan 2010 http://jimvanfleet.com/
2. Congratulations
✤ You just landed a really sweet gig.
Y NoSQL http://jimvanfleet.com/
3. Congratulations
✤ You’re doing a baseball app
✤ Twitter and OAuth, so no authentication worries
✤ They only have the MLBPA on board, so no team names or logos
✤ Free mobile apps focusing on great design, where you have help
✤ Twitter DM’s for the premium package
Y NoSQL http://jimvanfleet.com/
6. Not So Fast, My Friend
✤ Your boss comes in one day, he’s ecstatic
✤ You got the MLB license!
✤ You’re going to allow fans to follow a team, or particular games.
✤ They also signed a contract with some marketers, the target is 100k
users
Y NoSQL http://jimvanfleet.com/
10. One more thing...
✤ Things are looking great! But...
✤ We want our user’s notifications on their user page
✤ We got a bug report, users are getting some notifications twice
Y NoSQL http://jimvanfleet.com/
15. Math time
✤ 100k user target
✤ Some teams will be more popular than others
✤ Red Sox in ’09: ~ 6050 events over 162 games
✤ Roughly 80 a game
✤ If 20k users follow the Red Sox, you have 160k notifications per game
✤ ... and that’s just when they’re at bat!
Y NoSQL http://jimvanfleet.com/
16. The math gets worse
✤ You’ll come to hate good pitchers.
✤ They’re owned universally, so the top 30 will all be 10% owned
✤ In 2009, Josh Beckett generated 28 events in an average trip to the
mound
✤ At 10k users, that’s 280k for one game.
✤ Good pitchers usually pitch against each other
Y NoSQL http://jimvanfleet.com/
17. So what now?
✤ Let’s take a document-based approach to the modeling the problem
✤ For this particular example, we’ll use MongoDB.
✤ The mantra I heard: “Focus on what you want to show”
✤ Schemaless or relational: row scans are what kill you
Y NoSQL http://jimvanfleet.com/
20. How does that help?
✤ 200k plays in an entire season.
✤ MongoDB has indexes, maintaining all query richness and staying
fast.
✤ Linear user growth is a non-issue
✤ Single-item popularity is similarly a non-issue
Y NoSQL http://jimvanfleet.com/
21. Postlude (NO LOLLIPOPS)
✤ There’s a popular conception that NoSQL is about everything and a
pony.
✤ It’s bleeding edge
✤ Talk about this decision with your ops team or your host
Y NoSQL http://jimvanfleet.com/
22. To Learn More...
✤ Ben Scofield’s overview of the field:
http://www.slideshare.net/bscofield/nosql-death-to-relational-
databases
✤ One-stop shop for NoSQL overview:
http://www.vineetgupta.com/2010/01/nosql-databases-part-1-
landscape.html
Y NoSQL http://jimvanfleet.com/