Easiest Ruby GeoIP gem
There are quite a few geoip gems out there that use the free Maxmind db, but most of the seem to require you to compile another application (available from Maxmind) to use it… It’s too difficult and not even necessary. The Maxmind db is in a binary format, but it is very easy to read… Check out geoip gem on Github for a ruby gem that reads the Maxmind ip database and doesn’t even require compilation! http://github.com/cjheath/geoip/tree/master
Comments
For development I could imagine this being nice to get things up and running, but in production having the C library take care of the heavy lifting is the logical choice.
I can say this with confidence after doing some benchmarking that the pure Ruby library is at least 14 times slower (this was the lowest I could get the difference) than the C-based library.
In the production environment where we depend on the MaxMind data for every request, for hundreds of requests a second, the difference is enormous.
Funny, I just researched this yesterday and came to the same conclusion as Adam, after spending several hours trying to get one of the C-based Ruby libraries to compile (this may have had something to do with my Snow Leopard setup, not sure).
Yes, I’m sure the difference is at least an order of magnitude. Then again, this particular app only needs to perform IP-to-country lookups for a small subset of requests. On my development system, the native Ruby geoip library was able to perform on the order of thousands of lookups per second, so the overhead is negligible at least for our purposes. The ease of deployment wins, in this case.
Post a comment