Squid_ The Definitive Guide - Duane Wessels [186]
Squid writes a warning into cache.log if you have too few dnsserver child processes. If all helper processes are busy, Squid queues up new lookups. If the queue grows too large, Squid emits an error message and exits. Thus, too many child processes are better than too few.
You can use the dns entry in the cache manager menu to see dnsserver utilization information. Requests are always sent to the first idle process, so you can see if some processes never receive any DNS lookup requests. In that case you may want to lower the dns_children value.
Why doesn't Squid just create and destroy child processes as necessary? The primary reason is that the creation of a child process, via fork( ), is a relatively "heavy" operation. It may introduce significant delays for active HTTP requests. A Squid process typically consumes a lot of memory. In some cases, fork( ) may fail due to lack of available memory or swap space. Rather than try to fix all these issues with the external DNS implementation, Squid can read and write DNS messages internally.
Syntax
dns_children number
Default
dns_children 5
Example
dns_children 16
Related
cache_dns_program
Name
dns_retransmit_interval
Synopsis
This directive is meaningful only when you use the internal DNS implementation (the default).
This directive is the initial retransmission interval for unacknowledged DNS queries. Each time Squid retransmits a DNS query, it's sent to the next DNS server in the list. If none of the servers answer, Squid starts at the top of the list again and doubles the retransmit interval.
Syntax
dns_retransmit_interval time-specification
Default
dns_retransmit_interval 5 seconds
Example
dns_retransmit_interval 10 seconds
Related
dns_timeout
Name
dns_timeout
Synopsis
This directive is meaningful only when you use the internal DNS implementation (the default).
This directive is the total amount of time that Squid waits for a DNS answer. If the timeout occurs, Squid returns an error message to the user.
Syntax
dns_timeout time-specification
Default
dns_timeout 5 minutes
Example
dns_timeout 2 minutes
Related
dns_retransmit_interval
Name
dns_defnames
Synopsis
This directive is meaningful only with the —disable-internal-dns option.
By default, Squid's dnsserver program doesn't attempt to expand single-word hostnames (such as www) into fully qualified domain names. If your users are accustomed to using single-word hostnames, you may want to enable this directive.
Syntax
dns_defnames on|off
Default
dns_defnames off
Example
dns_defnames on
Related
append_domain
Name
dns_nameservers
Synopsis
By default, Squid sends DNS queries to the name servers listed in the /etc/resolv.conf file. If you want Squid to use a different set of name servers, you can specify them with this directive. Of course, you can also just change your resolv.conf file.
Syntax
dns_nameservers ip-address ...
Default
No default
Example
dns_nameservers 127.0.0.1 192.168.0.1
Name
hosts_file
Synopsis
When you use the internal DNS implementation (the default), Squid always uses the DNS name servers to resolve names and addresses. The external dnsserver program, on the other hand, may check a local database—the hosts file—before querying the DNS. With this directive, you can make Squid preload the contents of a hosts file into its IP and FQDN caches.
Squid rereads the hosts file when you send it the reconfigure signal (squid -k reconfigure).
If you configure the append_domain directive, it's appended to any single-component names in the hosts file.
Syntax
hosts_file pathname
Default
No default
Example
hosts_file /usr/local/squid/etc/hosts