geo-ip latency, or lazy load variables

Markus Jelsma markus.jelsma at
Thu Jun 21 16:50:14 UTC 2012


After i read your e-mail i tested again and there was a clear difference in performance but more repeated tests showed no difference in performance at all.  Something else must be acting up.

-----Original message-----
> From:Maxim Dounin <mdounin at>
> Sent: Thu 21-Jun-2012 17:59
> To: nginx at
> Subject: Re: geo-ip latency, or lazy load variables
> Hello!
> On Thu, Jun 21, 2012 at 03:24:50PM +0000, Markus Jelsma wrote:
> > Hi,
> > 
> > We are testing the Geo-IP module with the city and country databases and noticed a decrease in performance for all locations on the server. It seems that whenever the geoip_country and geoip_city directives are specified the module looks up the geo variables for the IP address even if the variables are not used inside the location. We did the simplest test with Apache Bench against two identical servers on a location that doesn't use the geo variables. One server has the geo databases loaded and the other has them commented out.
> > 
> > We did several tests, here are the averages for a few thousand HTTP requests with concurrency level 30:
> > 
> > Without geo databases loaded:
> > Time per request:       12.260 [ms]
> > Requests per second:    2446.91 [#/sec]
> > 
> > With geo databases loaded:
> > Time per request:       35.352 [ms]
> > Requests per second:    848.60 [#/sec]
> > 
> > Is it possible to lazy lookup the values for the geo variables when they are requested? 
> Geoip module variables are looked up in a database only when 
> actually used.
> Maxim Dounin
> _______________________________________________
> nginx mailing list
> nginx at

More information about the nginx mailing list