Does nginx have resolve cache?

Hi

I have seen sometimes that google dns has banned my servers. Since I use
proxy hostnames instead of ips, does the nginx cache the response from
dns servers or queries them everytime it receives a request?

Regards

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,219569,219569#msg-219569

On Dec 4, 2011, at 12:13 PM, mojiz wrote:

Hi

I have seen sometimes that google dns has banned my servers. Since I use
proxy hostnames instead of ips, does the nginx cache the response from
dns servers or queries them everytime it receives a request?

Check this :slight_smile:
http://nginx.org/en/docs/http/ngx_http_core_module.html#resolver

Basically - yes, and there are more configuration parameters now to use
to tune it more nicely.

I saw the announcement but it looks like Nginx 1.1.11 isn’t still
honoring the DNS ttl or the “valid” parameter at all.

I have 2 related questions to this topic

  1. Is the following configuration correct to get the resolver
    “resolving” at least every 5 secs?

location /mylocation {
resolver 127.0.0.4 valid=5s;
set $myserver “myserver:1000”;
proxy_pass http://$myserver;
proxy_redirect http://myserver.mydomain.in:8000
https://www.myserver.com;
}

  1. If I receive 100 request in 50 seconds and have my DNS (127.0.0.4)
    returning records with TTL=1. How many request to my DNS should Nginx
    perform in that period?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,219569,220133#msg-220133

Hello!

On Thu, Dec 15, 2011 at 05:18:55PM -0500, aficionado wrote:

  set $myserver "myserver:1000";
        proxy_pass   http://$myserver;
        proxy_redirect http://myserver.mydomain.in:8000

https://www.myserver.com;
}

Yes.

  1. If I receive 100 request in 50 seconds and have my DNS (127.0.0.4)
    returning records with TTL=1. How many request to my DNS should Nginx
    perform in that period?

With one worker process - about 10 DNS requests, assuming the
above config.

Maxim D.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs