Early this year I wrote a blog article about using
IP2Location to identify a users location and ISP based upon their IP.
You can find the previous articles here:
The flaw with this approach is that the data was stored into a
database of 4 million rows and it was very expensive to do the lookups
even with the performance optimizations of splitting the data up across
multiple tables. Recent research has turned up a more optimal approach
using GeoIP with a binary based solution that will support several hundred requests
per second. Yes that is right, several hundred requests per second. The
initial setup and configuration takes a bit of time to get going but it
is very simple to update and maintain.
GeoIP is a technology from MaxMind that provides developers with a
non-invasive way to determine geographical and other information about
their Internet visitors in real-time. When a person visits your
website, GeoIP can determine which country, region, city, postal code,
area code the visitor is coming from. Furthermore, GeoIP can provide
information such as longitude/latitude, connection speed, ISP, company
name, domain name, and whether the IP address is an anonymous proxy or
satellite provider. In my findings and experimentation I have found
that GeoIP is also more accurate than IP2Location.
GeoIP features multiple binary files with different features
available based on the price that you pay. A listing of the different
versions can be found here. For my practical purposes I used both the City and ISP versions. Another great thing that MaxMind offers is a GeoLite City version that is free that you can use to test integration with your system. All
of the API's are exactly the same but it is less accurate than the
version you purchase.
The final selling point for me with GeoIP is the different API's
that they support. You can integrate it with almost any system using
(Java, C, Perl, PHP, VB.net, MS Com....and many others).
Since I was using ColdFusion I chose to go the Java route. If you are
not experienced with Java you may stumble a bit here but I plan on
posting the Jar that I built for integration along with sample code to
make it very easy to first try the Lite version then use the full
version if it works well for you. You can find the Java source here along with the GeoLite version.
If you are experienced with Java and ColdFusion it is pretty
straightforward to get up and running. You will just need to compile
the java source and build a jar, then place it in the classpath of
ColdFusion. It is as easy as instantiating the Java object from CF then
making calls to retrieve the information. I recommend encapsulating
this into a function and loading the reference to the Java object in an
application scope variable that is loaded when the application starts.
I did have to work around a few issues in the Java source to get it
working properly with CF but there were not too many changes needed.
I have posted a very easy to follow step by step set of instructions on this posting http://www.bpurcell.org/blog/index.cfm?mode=entry&entry=1100 so that you can use to get GeoIP up and running on your site.
There are no comments on this entry.