lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Mar 25, 2011 at 20:33, Tony Finch <dot@dotat.at> wrote:
> Alexander Gladysh <agladysh@gmail.com> wrote:

>> Announcing lua-geoip 0.1.1, a set of bindings for MaxMind's GeoIP library.

> Funnily enough I have been playing around with the MaxMind data this week.
> I have a Lua + LPEG script which converts the MaxMind CSV files into a Lua
> data structure. This script is rather meta because the CSV data parser is
> created by a CSV header parser which is created by the lpeg re parser. Its
> output is a lua module containing the data structure. This output module
> is compiled with luac so that the whole thing can be loaded in a few
> seconds. The compiled file is half a gigabyte and lua uses 1.75GB once it
> is loaded. I have another script that uses this module to process
> logs looking for users whose webmail accounts might have been compromised.
> It takes about a minute to process 200MB of logs and uses 3GB RAM...

I've found that the actual MaxMind library is surprisingly fast.
Binary city DB can process about 100K queries/second on my machine,
and country DB — about 10K. Also, it uses much less RAM or disc space
than you specified.

So — I can recommend you to use my bindings instead :-)

Alexander.