nginx performance using resolver

Igor Sysoev is at rambler-co.ru
Thu Feb 5 09:53:32 MSK 2009


On Wed, Feb 04, 2009 at 11:10:19PM +0100, Nginx Lova wrote:

> Hello
> 
> I have nginx setup to create the upstream on the fly.
> 
> 
> if ($request_uri ~* "^/(.*)/resource")
>   {
>     set $user $1;
>     proxy_pass   http://$user.resource.domain.com:7600$request_uri;
>                  break;
>          }
> 
> so here if the url is
> 
> http://domain.com/nginx/resource
> 
> nginx will send that to nginx.resource.domain.com:7600
> 
> I have setup bind on the same machine (with zone files) and have the
> resolver set to 127.0.0.1;
> 
> Local digs (dig @127.0.0.1 nginx.resource.domain.com +short) take ms.
> 
> When I include the upstream with the ip, the passing is instant, when I
> don't have the upstream which forces the use of the resolver it take
> over 30 seconds.

    resolver_timeout  2s;

> Has anyone seen this behavior ? I didn't find much info on the resolver
> declaration.
> 
> Also how do I tell the resolver to use the systems resolver method ?
> So I want nginx to use whatever the OS uses (dns entries in resolv.conf
> or hardcoded ips in /etc/hosts.

Currently, you have to set up resolver address in configuraton.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list