Skip to content

Configure Redis for Hosting GeoIP data

Alexey Zilber edited this page Jan 24, 2020 · 3 revisions

GEOIP on Redis

Redis is perhaps the best server for hosting GEOIP data. Why? Because Redis:

  • stores the data in-memory and GEOIP data is usually small enough for that to work really well.
  • is Fast!
  • has a well documented, well known, and highly accessible API that's supported everywhere.
  • is easily queryable via practically anything.

Why deal with inefficient BIN blobs delivered by providers that have to be queried by your application directly? Churning through megabytes for every request can bog your application down significantly!

Configure Redis for optimal GEOIP serving. You will need a dedicated Redis server for this:

Edit /etc/redis.conf and make the following changes.

Your Redis server should be dedicated for this. Due to the live migration memory usage will vary significantly during updating. You may hit an OOM situation if you're not careful.

Set maxmemory-policy noeviction, you don't want Redis purging out entries from infrequently queried visitors.

Set:

maxmemory 0
maxmemory-policy noeviction
activerehashing no
timeout 5
tcp-backlog 6000
save 10800 1
rdbcompression yes
rdbchecksum yes

The above options will help your Redis server be highly responsive with many, many users. We've clocked over 50k QPS with no issues. It can handle a lot more.

Clone this wiki locally