I'm currently designing a set of webservices related to travel industry. one of this service need to be take in input a airport code and a locale, and return the localized city name.
fn(cityCode) => localizedCityName
fn(airportCode) => cityCode, localizedCityName, localizedAirportName
I have currently in the mongodb a collection of cities which contains, among other stuff, for each city, localized infos, and airports list :
{cityCode:'lon',
localized:{
'en':{name:'london'},
'fr':{name:'londres'}
},
airports:[{code:'GTW', name:'Gatwick'}]
}
I'm wondering what would be the best performant and scalable since :
- The pivotal format is json (so moving data from solution to another is easy)
- There are about 200 cities, but each city can contain a significant amount of data not related to our use)
- The data we need is rarely or never changing (gatwick airport will always be in london ...)
- There is need to localize a few cities at a time (20 to 100).
- the api is only on one server (with redis installed) but we hope to get one day to the point where clustering would be required.
I was considering :
Leave the data in MongoDB, and query as needed, and use index to optimise. Pros : data consistency, unique source for the queries. Cons : not performant
Re-arrange my json, and store it to many files, by rearrange i mean having a assoc json array with cityCode as the key , and airportCode for the other files pros: Uber faster cons: no consistency, not scalable ??
Re-arrange my json and store to a redis same as before except it's on a redis cache pros: Same as before except more scalable maybe cons: need to read and parse the json (i couldn't really see anything else)
NOw the questions :
- Do you have some other strategies to recommend ?
- Which one should i go for and why ?