how often will nginx query the dns when configured with fastcgi_pass=domain.name ?

i'm expecting to configure nginx to load balance the load among a changing bunch of backend servers and do not want to loose reactivity ( nor send a dns query per http connection ).

do you know how often the hostname is resolved ?
is this configurable ?


<side optional question>
do you know if this setup prevents cookie-based stickiness ( which i do not strictly require but would like to have if possible nevertheless ) ?
... actually i'm not even sure stickiness is even supported for fastcgi backends

the doc suggests each IP will be used in round-robin fashion. i'm assuming nginx grabs all the IPs in one query and does not rely on the dns itself to perform the round-robin.

i'm also interested if you know whether this can be weighted by specifying the same ip multiple times ( assuming the dns handles it )
</side>

thanks a lot for your help

please do not elaborate on how dangerous this is/might be or better setups or whatever different subject unless you know the answer to my question or possess helpful experience. i'm aware of alternatives, pros, cons...

i might be interested in alternative software providing they provide the above feature AND are event-driven or equally efficient. apache does not even come close (please do not debate). lighttpd only provides such a feature in an abandoned branch AFAIK. other less common fast implementations i know of usually do not do fastcgi.
LVL 27
skullnobrainsAsked:
Who is Participating?
 
Dmitri FarafontovConnect With a Mentor Linux Systems AdminCommented:
You can configure something like this:

resolver <DNS Server>;
set $upstream_endpoint1 https://FQDN;

      location /LocationMatch {
                proxy_pass $upstream_endpoint1;
      }
0
 
skullnobrainsAuthor Commented:
my question is :

do you know how often the hostname is resolved ?
is this configurable ?

i'm not asking for a trivial google answer, and i need fastcgi, not proxypass
0
 
Dmitri FarafontovLinux Systems AdminCommented:
By default, nginx caches answers using the TTL value of a response. If you set a resolver parameter your Nginx would always resolve to a fresh IP every time.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
skullnobrainsAuthor Commented:
wip. no force auto close
0
 
skullnobrainsAuthor Commented:
this is actually a bit more complex. resolver does not behave the way you describe.
i'm not working on that topic and won't be for a few more weeks
i'll post complete details when i'm done
... and most likely accept your comment anyway
0
 
Dmitri FarafontovLinux Systems AdminCommented:
Closing.
0
 
skullnobrainsAuthor Commented:
why the hell would you force close the question ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.