Java server- Storing and retrieving large amounts of location- and time-based data

Friday, July 11, 2014

I'm new to server programming (and programming in general), and I'm currently developing an app. The app will allow users to create Games that have a latitude-longitude location and a time and date, among other data, which will be stored on a server. They can also find Games created by other users based on their location. Games are archived (so that they can only be retrieved by Game ID, not location) after the given time.


Additionally, every Game will have a unique numerical ID, and every newly-created Game will have a larger ID number than the previous one (So the data will be in order by ID without any need for sorting), and users can find a Game using this ID (For example, if their friend invites them by sending them the ID).


In summary- Users can find data by proximity or unique ID, and data gets archived (So that it can only be retrieved by ID) after a given date and time (each Game has a separate expiration date).


My question is this: How should the server store this data? What I have considered doing is this, which seems rather inefficient-



  • Store all game data in a key-value database, using the game ID as the key.

  • Keep a list of the IDs of all games that haven't expired, in the order of when they will expire. (That way, every so often, I can check the first item on the list to see if has expired, and if it has, delete it from the list and take other appropriate actions)

  • Somehow store those same IDs in a quadtree based on their location.


Is there any sort of data structure that could do this more efficiently? And for that matter, at what kind of user volume should I even worry about making it more efficient?







http://ift.tt/1mpDwEX