Forum Moderators: open

Message Too Old, No Replies

Binary File or MySql DB

Which one is efficient and faster for IP2Location GeoIP lookups?

         

pixellion

3:59 am on Mar 19, 2007 (gmt 0)

10+ Year Member



I recently signed up with IP2Location DB5: IP2Location IP- Country-Region-City- Latitude-Longitude

IP2Location offers three choices:
1) Apache Module and PHP Module which uses a 33MB .BIN file
2) A CSV file that can be readily imported into MySQL

My server will be doing thousands of lookups every second. Should I import the CSV file into the MYSQL DB and cache the entire table of 200MB or should I stick with reading 33MB .BIN file? I have a 15k U320 SCSI RPM drive that will be reading the GeoIP information. I'm not sure which option to go with since I'm not sure if Linux would be storing the entire Binary file into cache when it is being accessed multiple times with fopen/fread. Whereas with MySQL, I can use Memcache and store the entire DB into the memory and hence no disks involved. IP is stored as a decimal number, hence it is stored as an integer of length 10. My DB server is equipped with 2xDual Core Opterons, 8GB ECC, so the server has enough resources to handle the load.

Which option is the fastest and efficient? Binary file or MySQL DB with Memcache?

Thanks
Bill

mcibor

12:28 pm on Mar 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't know how they wrote the binary, but if they optimized it for fast searching, then try that.
Or just, if you can, perform a test:
write a script that checks eg. 1000 IPs and run it through mysql and then apache module.
with microtime [php.net] you can measure speed of the code.

Regards
Michal

PS. Mysql table is also binary files but has many search improvements, so it all depends on how well they did the apache module.