Welcome! Log In Create A New Profile

Advanced

GeoIP database cache to disk

Posted by HittingSmoke 
GeoIP database cache to disk
February 08, 2014 01:58PM
mod_geoip2 by default reads the GeoIP database from disk and only caches to RAM when it's explicitly configured to. Nginx only caches the GeoIP database to RAM, increasing the RAM usage many times over for each worker. For situations where GeoIP data is seldom used it would be extremely valuable to sacrifice some speed to save RAM by caching the database to disk instead of keeping it in RAM 24/7.

See: MaxMind's mod_geoip2 documentation under the : http://dev.maxmind.com/geoip/legacy/mod_geoip2/#File_and_Caching_Directives-3
Re: GeoIP database cache to disk
February 08, 2014 03:38PM
I did a bit of digging in the source with some help from the uWSGI creator and found that this is a really easy fix. You can simply find/replace for GEOIP_MEMORY_CACHE/GEOIP_STANDARD in src/http/modules/ngx_http_geoip_module.c. Nginx compiles fine and GeoIP support works. RAM usage has returned to normal.

I'm not an experienced dev but this should be easy to turn into a config option with a patch. Perhaps I'll try my hand at it to submit.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 152
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready