Will Shulman, from MongoLab, shows us how to to persist our mobile app data in the cloud using a super-scalable and amazingly developer-friendly MongoDB back-end.
3. Mobile apps do not exist
in a vacuum
• user profile data
• logging
• location-based data collection
• game data (stats, high scores)
• polls and surveys
• user feedback
4. Do I want to host this
myself ?
Java + Spring + Hibernate ?
Ruby on Rails ?
Hmmm… I will probably
need to build a REST API…
5. GET, POST, PUT, DELETE
•EC2
•Rackspace
•App Engine*
•MySQL
•SQLServer
•Postgres
•RoR
•J2EE
General approach
REST API
18. High performance, fault tolerant
clusters made easy
• master / slave replication
• replica sets
• auto-sharding
19. MongoDB is great for mobile
• everything is JSON!
– storage model is JSON
– queries are in JSON
– update operators are in JSON
• geospatial indexing built-in
• GridFS
20. Geospatial indexing
• index on geo coordinate pairs
• search by
– bounding box
– bounding circle (point, radius)
22. Geospatial indexing at
Foursquare
• ~1.3M registered users
• ~615k check-ins a day
• “Who’s here” service tracks last 3 hours for
every user; uses mongo exclusively
• all checkins, tips and venues written to
mongo; reads a mix of mongo / legacy
postgres
23. GridFS
• distributed filesystem inside MongoDB
• stores large files by splitting them into
smaller documents
• leverages existing sharding and
replication configuration
• stores metadata along with files
• works well behind a CDN
24. Street cred
• Shutterfly
• Foursquare
• bit.ly
• Sourceforge
• Etsy
• The New York Times
• Business Insider
• Github
• Gilt Groupe
• Sugar CRM
• Electronic Arts
• Evite
• CollegeHumor
• Disqus
• Justin.tv
• Chartbeat
• Hot potato
• Eventbrite
25. Not so good for
• Complex / multi-operation
transactions
• When you (really) need joins