开发者

Fastest geolocation (IP to town)? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
开发者_运维问答

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 8 years ago.

Improve this question

I am writing small geolocation service: then user come to my site I should to set his town from his IP-address. Now I found three way to solve this problem:

  1. Create from PHP connection to MySql DB and select town from it.
  2. From PHP go to cgi script (perl,c ?) and select town from file with towns and IP-addrs.
  3. Use services like http://ipinfodb.com/ip_location_api.php and get town from it.

But what way would be fastest? Minimal time etc?

Thanks!


3.

Primarily because of just how much data you'd have to manually compile together to do either 1 or 2.


There is no easy answer to it because a lot depends on unknown factors such as:

  1. Speed of your MySQL DB
  2. Speed of your php inplementation and size of the file
  3. Speed of the location_api service

In other words, there are only two ways to find out the answer:

  1. build them all and test
  2. gather all parameters (speeds, bandwidth, concurrent users of all systems) and calculate/guesstimate.


I've used the MaxMind database for country-level lookup from PHP (there is example code for other languages). The downloadable database is in a binary format optimised for speed of reading - although I've not compared it to a import into Mysql and searching with SQL, I have no doubt of Maxmind when they say it would be faster to use the API and original data rather than via another means, like SQL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜