From owner-freebsd-questions@FreeBSD.ORG Sat Aug 6 14:31:23 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A528F16A41F for ; Sat, 6 Aug 2005 14:31:23 +0000 (GMT) (envelope-from materribile@yahoo.com) Received: from web33513.mail.mud.yahoo.com (web33513.mail.mud.yahoo.com [68.142.206.162]) by mx1.FreeBSD.org (Postfix) with SMTP id 4355B43D55 for ; Sat, 6 Aug 2005 14:31:23 +0000 (GMT) (envelope-from materribile@yahoo.com) Received: (qmail 61684 invoked by uid 60001); 6 Aug 2005 14:31:22 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=tzGtZYfz9mmJSzRRaU9qv96nXT998J31Z8gK+fewY1Kep14+nhHa6picT65l0MG7R04jbpnjmfx2+v1lJBiarAg1xi0o3Gh2WLelU40Sey7P+LGRVDFXgIoO4T/YWma9nxFfd+J4tBVdDo8gzwXIe0i+8r2Szw8LN4iCEf/l4SU= ; Message-ID: <20050806143122.61682.qmail@web33513.mail.mud.yahoo.com> Received: from [24.228.74.10] by web33513.mail.mud.yahoo.com via HTTP; Sat, 06 Aug 2005 07:31:22 PDT Date: Sat, 6 Aug 2005 07:31:22 -0700 (PDT) From: Mark Terribile To: freebsd-questions@freebsd.org In-Reply-To: <20050806120035.A483816A420@hub.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: DNS caching: Squid, BIND or anything else? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Aug 2005 14:31:23 -0000 > +++ B. Bonev [05-08-05 12:02 +0300]: > | > My question is what's the difference between Squid DNS caching and > | BIND > | > and other programs that cache DNS requests? > | > | BIND is a DNS server. It will reply to DNS queries from others. Squid > | DNS won't reply to others DNS queries. > | > | I want just DNS caching. Is Squid is enough for that task? > > I think you are misunderstanding something. Can you please tell us what > exactly you are trying to achieve? As per my understanding, if you are > looking for DNS caching, you can't use squid. You need DNS caching > server, which can be BIND (comes in base system). It's been about four years since I had the hood open on squid, so I'll hazard a guess based on my work on another web cache (that didn't reach the market due to some bad corporate strategy). BIND will provide DNS caching as a service to other programs; that's its job. If squid or any other program NOT in the DNS business does DNS caching, it's to improve its own performance. How? Well, for one thing, going out to BIND requires messaging to another process. That slows things down. For another, the basic name-server library interface is blocking. If you want to use a few threads, running non-blocking and moving fast, you have to send those messages out yourself. (Why not use threads? If you're handling over a thousand requests per second, any backlog on DNS could put thousands of lookups on hold; that's thousands of threads and you're tying up megabytes instead of the tens or hundreds of bytes that a lookup-in- progress record would take. You could also be tying up a socket and file descriptor for each, which is a greater cost on a cache. Ask someone about the time to shut down the tcp FDs that the web uses.) If you're going to go to that much trouble, you might as well cache the results; you'll be getting back the expiration time information anyway. On the other side, the DNS system can deal with many kinds of records. Squid only cares about those that it needs to resolve web page lookups. And it doesn't want to cache any that it doesn't need, because that takes valuable main memory. What's more, if a web page isn't needed in a while, squid >could< drop the records from the cache, even if they haven't expired. BIND might be forced to do that, too (I don't know) but it could also keep them on disk for a while. Squid has another job to worry about. So if squid does DNS caching, it's almost certainly doing it for its own benefit, and not paying the price of being a generic DNS server. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com