3

Because Nginx requires the geoip_ directives to go into the main http{ } block of the nginx.conf file, does that mean the geoip data is being pulled for every single request?

In other words, does NginX look up the geoip data for ALL of the requests coming in, even for those not needing the data?

mgorven
  • 30,036
  • 7
  • 76
  • 121
Miko
  • 1,709
  • 4
  • 22
  • 28
  • 1
    Also interested in an actual answer on this question. Adding this something running PHP is little overhead I assume, but also looking up every request for a site serving static content feels uneccesary. But how to avoid if the geoip directives must be specified in the http block rather than in the server block? – stpe Mar 26 '12 at 20:00

2 Answers2

1

Nginx parses and loads geoip data into memory once the config file only on (re)start or SIGHUP.

What about expanding $geoip_* variables - I'm not sure, but hope they calculates only when required (in "if" or "log" or "map" or whatever construction). Anyway, it doesn't reread and reload whole dat the file each request.

Slava K
  • 66
  • 1
  • 4
0

GeoIP lookups come from a distributed database rather than from a dynamic server, so unlike DNS, the worst-case performance hit is minimal.

mattdm
  • 6,550
  • 1
  • 25
  • 48