curl-library
Re: DNS cache size control
Date: Fri, 19 Apr 2002 10:38:01 +0800
On Thursday 18 April 2002 05:13, Sterling Hughes wrote:
> > 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.
>
I have checked the CVS and look for your patch. It seems that your patch
hasn't take care about the pointer referencing to DNS cache (e.g.
conn->hostaddr) before you remove it. Will there be a problem?
Jacky
Received on 2002-04-19