December 14, 2010 6:30 PM - 146 attended

Scaling foursquare with MongoDB

SpringSource @ EMC (map)

Selected By: Meghan

Harry Heymann, the Engineering Lead for foursquare, will present on scaling foursquare with MongoDB. Before joining foursquare, Harry spent five years at Google where he worked on Google Payments, Dodgeball and various backend advertising systems. Previously, he held roles at Microsoft and Intel. Harry has a bachelor's degree in engineering from Carnegie Mellon University. In addition to pursuing his obvious interest in mobile technologies, Harry is currently obsessed with exploring the Scala programming language.

  • harryh
    harryh

    If anyone has anything in particular you'd like me to discuss in my presentation feel free to mention it here and I will do my best.

    Posted December 8, 2010 at 1:44 AM
  • A former member

    I do not want you to go off on too big of a tangent, but I would like to know how Lift fits in with MongoDB/scalability.

    Posted December 8, 2010 at 9:49 AM
  • Toby Matejovsky
    Toby Matejovsky

    @Ivan - I think that would be interesting as well.

    Posted December 8, 2010 at 10:40 AM
  • Doug Tangren
    Doug Tangren

    I'd like to hear about how this affected your domain design choices and how you handle corrupt data, if any, in a schema-less data store

    Posted December 8, 2010 at 11:03 AM
  • Prajwal Tuladhar
    Prajwal Tuladhar

    Are you guys using MongoDB as sole DB system or hybrid with PostgreSQL?
    Anything new about the last Foursquare outage that you can share?

    Posted December 8, 2010 at 11:04 AM
  • Gennady Borukhovich
    Gennady Borukhovich

    I second @doug's suggestion

    Posted December 8, 2010 at 11:09 AM
  • Nate Kidwell
    Nate Kidwell

    I'd be curious about the geolocation benefits mongo gave you.

    Posted December 13, 2010 at 11:36 AM
  • Doug Tangren
    Doug Tangren

    @nate you might want to check out http://www.mongodb.org/display/DOCS/Geospatial+Indexing I'm guessing 4sq makes heavy use of this

    Posted December 13, 2010 at 12:04 PM
  • Oleksii Iepishkin
    Oleksii Iepishkin

    Does anyone use or created his own java lib to do data migrations in mongo? Something like http://liquibase.org/ I only know one for ruby - https://github.com/terrbear/mongrations

    Posted December 13, 2010 at 12:33 PM
  • eli jones
    eli jones

    I've read the postmortems (FourSquare and 10gen ones) from the October outage so I understand the technical reasons adding the new shard did not work as expected.

    I'm interested to know what method you were using to determine when to commission the new EC2 instance with MongoDB. What happened to make the one db shard grow larger than available RAM ahead of schedule so suddenly? Were there certain pressures pushing you guys to delay creation of the new EC2 shard?

    Posted December 13, 2010 at 2:50 PM | 1 like
  • Meghan
    Meghan

    Harry posted his slides here: http://bit.ly/e0p3b4

    Will work on getting the video up ASAP!

    Posted December 14, 2010 at 11:46 PM
  • eli jones
    eli jones

    For the fellow asking about compound indexes on two arrays, here's the relevant mongoDB doc:

    http://www.mongodb.org/display/DOCS/Multikeys

    See the part about "Parallel Arrays".

    There is, I believe, a 30 index limit for collections but its best to check mongodb IRC for official word on the limit... and/or working around it. As usual, depending on your query pattern, there are many potential workarounds.

    Posted December 15, 2010 at 3:24 PM
  • Aryeh Goldsmith
    Aryeh Goldsmith

    @eli Thank you for confirming my issue. This states that you cannot insert a document containing two arrays in indexed fields.

    "Topper"? made a good suggestion at the meetup. He advised try putting the the arrays together grouped as a subelement in the document and then index on the parent element:

    {
    '_id': ObjectId('.....'),
    'name': 'some test',
    'indexed_arrays':
    {
    'arr1': [],
    'arr2': []
    }
    }

    then index on 'indexed_arrays'

    Posted December 15, 2010 at 3:37 PM
  • Topper Bowers
    Topper Bowers

    @Aryeh - yup that was me :-) (Topper)

    Here's what I was suggesting though (let's pretend you have tags and categories).

    {
    '_id': ObjectId('...'),
    name: 'some test',
    tags_and_categories: [{type: 'tag', value: 'taggytaggy}, {type:category, value: 'cattycat'}]
    }

    Posted December 15, 2010 at 3:46 PM
  • Aryeh Goldsmith
    Aryeh Goldsmith

    @Topper, ah I see. - interesting. I think the way I proposed (if it works ) would allow me to create less complicated queries.

    I'm going to play around with it and see what works.

    Posted December 15, 2010 at 4:02 PM
  • eli jones
    eli jones

    Aryeh,

    Is there a naive representation of the query you're trying to do? Like this one that can't use the compound index on the two arrays:

    db.things.find( { array1 : "blah", array2 : "glorb" } );

    Where you want things that have "blah" somewhere in array1 and "glorb" somewhere in array2.. How many items can be in each array? Are the arrays fixed length? (e.g. these are 10 item subsets from some larger sets?)

    Anyway, feel free to e-mail me offline if you want.

    Posted December 15, 2010 at 4:17 PM
  • Meghan
    Meghan

    Video is now available here: http://www.10gen.com/video/misc/foursquare

    Posted December 17, 2010 at 3:56 PM
  • You must be a member to post a comment. Join or login.

146 attended

RSVPs closed

5.00 5.0017 (17 ratings)

10gen

10gen organizes the NY MongoDB User Group

SpringSource

SpringSource hosts the MongoDB User Group

Gilt Groupe

Gilt provides space for the NY MongoDB User Group.

O'Reilly

Members save 40% off print and 50% off ebooks use discount code DSUG

Buddy Media

Buddy Media hosts the MongoDB User Group.

ZocDoc

ZocDoc kindly provides space for the MongoDB User Group

Offer a perk for our members and get exposure.

Offer a perk →
Other nearby
Meetups
Why these groups?
x

The Meetup Groups shown here are topically similar to New York MongoDB User Group.

Groups are more likely to be displayed here if they:

  • have a Meetup scheduled
  • have a high rating
  • have a group photo
  • are "public" and not "private"
  • have shown they are likely to stick around (older than 30 days)
Find more Meetup Groups
near New York

Log in

  • Not registered with us yet?
or

Log in to Meetup with your Facebook account.

Log in using Facebook

Sign up

or

Join this Meetup Group even quicker with your Facebook account.

Sign up using Facebook
By clicking the "Sign up using Facebook" or "Sign up" buttons above, you agree to Meetup's Terms of Service