mozilla-services / location-leaderboard

A leaderboard service for Mozilla Geolocation Stumbling
Mozilla Public License 2.0
4 stars 5 forks source link

Move point/country lookup to aggregation stage #280

Closed jaredlockhart closed 8 years ago

jaredlockhart commented 8 years ago

When we receive data from a client, we receive a series of coordinates. Presently, at data submission time, we compute the distance from those points to the nearest country(s), however this places heavy strain on the database for computing multiple distances, as well as prevents the server from replying quickly to the client that the data was effectively received.

We need to store the data that we receive from the client as it is (ie store the point), and perform the country lookup during the aggregation stage, preferably by pulling all the country shapes into memory and doing the point distance queries 100% in memory.