cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: DNS cache size control

From: Sterling Hughes <sterling_at_bumblebury.com>
Date: Wed, 17 Apr 2002 17:13:54 -0400

> On Wed, 17 Apr 2002, Jacky Lam wrote:
>
> > Is it possible to add some control on DNS cache size? Especially, the
> > global one?
>
> No, there's no current limit. This is badness.
>
> They should probably be controlable per single-cache basis.
>

problem is there is really no easy way to keep track of memory size, as
Curl_resolv just keeps track of the pointer returned by
Curl_getaddrinfo(). Therefore, something that pruned based on "memory
limits" is a bit tricky to implement. Something like number of entries
would be much simpler to implement.

> > I use global size and run through 150 websites and fnd that the dns cache
> > size grow to more than 6M!!!
>
> That is of course totally unacceptable.
>

I'd be surprised it would grow that large, but... :)

> > There are two reasons:
> > i) Libcurl won't remove some old expired dns cache
>
> Right. Stupid, really.
>

I've added a patch to CVS which prunes old entries on each call to
Curl_resolv, this can certainly be optimized a bit (both in hash table
implementation, and the Curl_resolv function call), but it is a first
step to getting this fixed.

-Sterling
Received on 2002-04-17