You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Kevin Giles <kg...@gmx.com> on 2011/12/07 11:28:35 UTC

Disable dns lookups on ATS

Hi, 

There was an issue raised in the user mail thread about disabling dns. I have also been looking at this. 

I am using TS 3.0.1 on fedora 14 and ubuntu 10.04. 
 
When this flag is set the DNS lookup event before the HTTP_OS_DNS_HOOK does not appear to be called.
However there is a DNS lookup performed after the cache lookup when it is a miss.

Here is an extract from the logfile, with the DNS lookup:
  [Dec 6 10:16:01.619] Server {3066604400} DEBUG: (http) [0] [&HttpSM::state_api_callout, HTTP_API_CONTINUE]
  [Dec 6 10:16:01.619] Server {3066604400} DEBUG: (http_trans) [HttpTransact::HandleCacheOpenRead]
  [Dec 6 10:16:01.619] Server {3066604400} DEBUG: (http_trans) CacheOpenRead -- miss
  [Dec 6 10:16:01.619] Server {3066604400} DEBUG: (http_trans) Next action DNS_LOOKUP; OSDNSLookup
  [Dec 6 10:16:01.619] Server {3066604400} DEBUG: (http) [0] State Transition: CACHE_LOOKUP -> DNS_LOOKUP
  [Dec 6 10:16:01.619] Server {3066604400} DEBUG: (http_seq) [HttpStateMachineGet::do_hostdb_lookup] Doing DNS Lookup
  [Dec 6 10:16:01.639] Server {3066604400} DEBUG: (dns) received query trafficserver.apache.org type = 1, timeout = 0
  [Dec 6 10:16:01.640] Server {3086886720} DEBUG: (dns) enqueing query trafficserver.apache.org
  [Dec 6 10:16:01.640] Server {3086886720} DEBUG: (dns) adding first to collapsing queue
  [Dec 6 10:16:01.640] Server {3086886720} DEBUG: (dns) send query for trafficserver.apache.org to fd 38
  [Dec 6 10:16:01.640] Server {3086886720} DEBUG: (dns) sent qname = trafficserver.apache.org, id = 4377, nameserver = 0
  [Dec 6 10:16:01.640] Server {3086886720} DEBUG: (dns) sent_one: failover_number for resolver 0 is 1
  [Dec 6 10:16:02.082] Server {3086886720} DEBUG: (dns) received packet size = 274
  [Dec 6 10:16:02.082] Server {3086886720} DEBUG: (dns) primary DNS response code = 0
  [Dec 6 10:16:02.082] Server {3086886720} DEBUG: (dns) received A name = trafficserver.apache.org
  [Dec 6 10:16:02.082] Server {3086886720} DEBUG: (dns) received A = 140.211.11.131
  [Dec 6 10:16:02.082] Server {3086886720} DEBUG: (dns) SUCCESS result for trafficserver.apache.org = 140.211.11.131 retry 0
  [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (dns) called back continuation for trafficserver.apache.org
  [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http) [0] [HttpSM::main_handler, EVENT_HOST_DB_LOOKUP]
  [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http) [0] [&HttpSM::state_hostdb_lookup, EVENT_HOST_DB_LOOKUP]
  [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http_trans) [HttpTransact::OSDNSLookup] This was attempt 1
  [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http_seq) [HttpTransact::OSDNSLookup] DNS Lookup successful
  [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http_trans) [OSDNSLookup] DNS lookup for O.S. successful IP: 140.211.11.131
  [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http_trans) Next action HttpTransact::HTTP_API_OS_DNS; HandleCacheOpenReadMiss
  [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http) [0] State Transition: DNS_LOOKUP -> API_OS_DNS
  [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http_trans) [HandleCacheOpenReadMiss] --- MISS
  [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http_seq) [HttpTransact::HandleCacheOpenReadMiss] Miss in cache
  [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http_trans) Next action DNS_LOOKUP; HttpTransact::PPDNSLookup
  [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http) [0] State Transition: API_OS_DNS -> DNS_LOOKUP
  [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (dns) [HttpTransact::HandleRequest] Skipping DNS lookup, provided by plugin
  [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http_trans) [HttpTransact::PPDNSLookup] This was attempt 1
  
It maybe related to the following issues:
https://issues.apache.org/jira/browse/TS-859
https://issues.apache.org/jira/browse/TS-905

I have applied the fix for 859 to my copy.

I have also made the following change and it appears to fix the problem with the DNS lookup, the code was added to line 6413 in HttpSM.cc. I probably should
added something to check that a parent has been specified also, if somebody could review and comment I would be really grateful.

      } else if (t_state.parent_result.r == PARENT_UNDEFINED && t_state.dns_info.lookup_success) { 
        Debug("dns", "[HttpTransact::HandleRequest] Skipping DNS lookup, provided by plugin");
        call_transact_and_set_next_state(NULL);
        break;
/* change start */
      } else if (t_state.dns_info.looking_up == HttpTransact::ORIGIN_SERVER && t_state.http_config_param->no_dns_forward_to_parent){
        Debug("dns", "[HttpTransact::HandleRequest] Skipping DNS lookup, no_dns_forward_to_parent turned on");
        t_state.dns_info.lookup_success = true;
        call_transact_and_set_next_state(NULL);
        break;
/* change end */
      }


Regards,

Kevin.   

Re: Disable dns lookups on ATS

Posted by Igor Galić <i....@brainsware.org>.

----- Original Message -----
> Hi,
> 
> There was an issue raised in the user mail thread about disabling
> dns. I have also been looking at this.
> 
> I am using TS 3.0.1 on fedora 14 and ubuntu 10.04.
>  
> When this flag is set the DNS lookup event before the

For context, quoting myself from users@

 in forward proxy mode:

   CONFIG proxy.config.http.no_dns_just_forward_to_parent INT 1



> HTTP_OS_DNS_HOOK does not appear to be called.
> However there is a DNS lookup performed after the cache lookup when
> it is a miss.
> 
> Here is an extract from the logfile, with the DNS lookup:
>   [Dec 6 10:16:01.619] Server {3066604400} DEBUG: (http) [0]
>   [&HttpSM::state_api_callout, HTTP_API_CONTINUE]
>   [Dec 6 10:16:01.619] Server {3066604400} DEBUG: (http_trans)
>   [HttpTransact::HandleCacheOpenRead]
>   [Dec 6 10:16:01.619] Server {3066604400} DEBUG: (http_trans)
>   CacheOpenRead -- miss
>   [Dec 6 10:16:01.619] Server {3066604400} DEBUG: (http_trans) Next
>   action DNS_LOOKUP; OSDNSLookup
>   [Dec 6 10:16:01.619] Server {3066604400} DEBUG: (http) [0] State
>   Transition: CACHE_LOOKUP -> DNS_LOOKUP
>   [Dec 6 10:16:01.619] Server {3066604400} DEBUG: (http_seq)
>   [HttpStateMachineGet::do_hostdb_lookup] Doing DNS Lookup
>   [Dec 6 10:16:01.639] Server {3066604400} DEBUG: (dns) received
>   query trafficserver.apache.org type = 1, timeout = 0
>   [Dec 6 10:16:01.640] Server {3086886720} DEBUG: (dns) enqueing
>   query trafficserver.apache.org
>   [Dec 6 10:16:01.640] Server {3086886720} DEBUG: (dns) adding first
>   to collapsing queue
>   [Dec 6 10:16:01.640] Server {3086886720} DEBUG: (dns) send query
>   for trafficserver.apache.org to fd 38
>   [Dec 6 10:16:01.640] Server {3086886720} DEBUG: (dns) sent qname =
>   trafficserver.apache.org, id = 4377, nameserver = 0
>   [Dec 6 10:16:01.640] Server {3086886720} DEBUG: (dns) sent_one:
>   failover_number for resolver 0 is 1
>   [Dec 6 10:16:02.082] Server {3086886720} DEBUG: (dns) received
>   packet size = 274
>   [Dec 6 10:16:02.082] Server {3086886720} DEBUG: (dns) primary DNS
>   response code = 0
>   [Dec 6 10:16:02.082] Server {3086886720} DEBUG: (dns) received A
>   name = trafficserver.apache.org
>   [Dec 6 10:16:02.082] Server {3086886720} DEBUG: (dns) received A =
>   140.211.11.131
>   [Dec 6 10:16:02.082] Server {3086886720} DEBUG: (dns) SUCCESS
>   result for trafficserver.apache.org = 140.211.11.131 retry 0
>   [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (dns) called back
>   continuation for trafficserver.apache.org
>   [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http) [0]
>   [HttpSM::main_handler, EVENT_HOST_DB_LOOKUP]
>   [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http) [0]
>   [&HttpSM::state_hostdb_lookup, EVENT_HOST_DB_LOOKUP]
>   [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http_trans)
>   [HttpTransact::OSDNSLookup] This was attempt 1
>   [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http_seq)
>   [HttpTransact::OSDNSLookup] DNS Lookup successful
>   [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http_trans)
>   [OSDNSLookup] DNS lookup for O.S. successful IP: 140.211.11.131
>   [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http_trans) Next
>   action HttpTransact::HTTP_API_OS_DNS; HandleCacheOpenReadMiss
>   [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http) [0] State
>   Transition: DNS_LOOKUP -> API_OS_DNS
>   [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http_trans)
>   [HandleCacheOpenReadMiss] --- MISS
>   [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http_seq)
>   [HttpTransact::HandleCacheOpenReadMiss] Miss in cache
>   [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http_trans) Next
>   action DNS_LOOKUP; HttpTransact::PPDNSLookup
>   [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http) [0] State
>   Transition: API_OS_DNS -> DNS_LOOKUP
>   [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (dns)
>   [HttpTransact::HandleRequest] Skipping DNS lookup, provided by
>   plugin
>   [Dec 6 10:16:02.082] Server {3066604400} DEBUG: (http_trans)
>   [HttpTransact::PPDNSLookup] This was attempt 1
>   
> It maybe related to the following issues:
> https://issues.apache.org/jira/browse/TS-859
> https://issues.apache.org/jira/browse/TS-905
> 
> I have applied the fix for 859 to my copy.
> 
> I have also made the following change and it appears to fix the
> problem with the DNS lookup, the code was added to line 6413 in
> HttpSM.cc. I probably should
> added something to check that a parent has been specified also, if

Hah, yeah :)

> somebody could review and comment I would be really grateful.
> 
>       } else if (t_state.parent_result.r == PARENT_UNDEFINED &&
>       t_state.dns_info.lookup_success) {
>         Debug("dns", "[HttpTransact::HandleRequest] Skipping DNS
>         lookup, provided by plugin");
>         call_transact_and_set_next_state(NULL);
>         break;
> /* change start */
>       } else if (t_state.dns_info.looking_up ==
>       HttpTransact::ORIGIN_SERVER &&
>       t_state.http_config_param->no_dns_forward_to_parent){
>         Debug("dns", "[HttpTransact::HandleRequest] Skipping DNS
>         lookup, no_dns_forward_to_parent turned on");
>         t_state.dns_info.lookup_success = true;
>         call_transact_and_set_next_state(NULL);
>         break;
> /* change end */

(I hope someone with some actual mad skillz can take care of this part :)

> Regards,
> 
> Kevin.

So long,
i

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE