node.js serverside 2d search performance

I plan to store and update user locations (lat, lon, userid) via websocket on a nodejs server. my goal is to broadcast the user locations to every user, as fast as possible. (like the mytaxi position of each taxi in the app)

my concerns / problems

  1. server side performance on lots of simultanious users
  2. pushing the data back (i only need to know about users in my region) -> 2d search (get users which lat / lon is in boundingbox )

questions:

  1. whats the best storage solution (mongodb vs js array / object storage)
  2. is read/write on db faster than array searching?
  3. is there a 2d optimized javascript search solution?

my way

i would go for two arrays (arr1 sorted by lat, arr2 sorted by lon) -> search via divide and conquer -> check on similar ids -> output

is there a better way to do this?

thanks in advance

alex

you can use Redis's pub/sub channels, create a channel for each bounding box and subscribe users to the relevant channels according to their location report, then push messages to entire channels.

this strategy may be naive for big data..