node-maxmind-db icon indicating copy to clipboard operation
node-maxmind-db copied to clipboard

getGeoDataSync so slow with 3k ip list

Open nvcken opened this issue 11 years ago • 7 comments

I try getGeoDataSync vs geoip.lookup of geoip-lite module with the same 3k IP list getGeoDataSync run so slow what wrong?

nvcken avatar Sep 23 '14 04:09 nvcken

I think this is because of the way the MaxMind provided his data, while geoip-lite uses the legacy database, we use the new MaxMind DB (mmdb). the legacy database allows to predict the position where the record may be, while node-maxmind-db needs to read the whole tree till found.

am I correct @oschwald / @paddek?

the-eater avatar Sep 23 '14 09:09 the-eater

With the new format, cache misses are more likely due to how the data is stored, but I think the primary issue is that the new format provides significantly more data. One possible way to alleviate that is to allow looking up a subset of the data. For instance the C library allows looking up data by a path and the Go reader will only look up data specified in the struct passed in.

That said, I think the easiest speed improvement that I am not seeing in the code currently is to cache the IPv4 start node. This will save you 96 node reads when doing a lookup and is simple to implement. There may also be other simple improvements that profiling would detect.

oschwald avatar Oct 14 '14 22:10 oschwald

+1

mahnunchik avatar Feb 17 '15 20:02 mahnunchik

:+1:

vbauer avatar Feb 21 '15 14:02 vbauer

So is there any option or config to get better throughput form mmdb format ?

vivekkrbajpai avatar Mar 04 '15 10:03 vivekkrbajpai

Sorry for reacting late :( Im currently working on a version that does ipv4 caching and allows a path like suggested by @oschwald, you can see the progress on that here: https://github.com/EaterOfCode/node-maxmind-db/tree/moreSpeed

You can use paths currently by giving the path argument with a path to a value you want to know, f.x. if you only want to have the us name of a ip you can retrieve that by

mmdbreader.getGeoDataSync('8.8.8.8', ['country', 'names', 'en']);

Any feedback would be more then welcome!

the-eater avatar May 06 '15 22:05 the-eater

https://github.com/runk/node-maxmind

knoxcard avatar Dec 28 '18 05:12 knoxcard