comparison of querying IP addresses in SQLite vs Redis
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
db
.gitignore
README.md
benchmark.py
index_redis.py
index_sql.py
requirements.txt
test_redis.py
test_sql.py

README.md

Benchmark querying IP geodata

Download the MaxMind GeoLite2 data:

MaxMind GeoLite2 databases

Setup a Virtualenv and run:

pip install -r requirements.txt

Create a SQLite DB

python index_sql.py

Create a Redis DB

python index_redis.py

This generates a migration.txt that contains the Redis protocol data that defines the three indexes:

  • cidr:{{ cidr }}
  • cidr:index
  • geoid:{{ geonameid }}

Run benchmarks

python benchmark.py

This will try to associate 2,000 random IPv4 addresses but will most likely find 1,200 - 1,700. These benchmarks can be found in the generated benchmarks.csv.