cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: DNS cache size control

From: Jacky Lam <sylam_at_emsoftltd.com>
Date: Wed, 17 Apr 2002 22:51:02 +0800

>
> > ii) Libcurl will alloc 9000bytes to hold dns answer. However,
> > normally, it just use 500-600bytes. (on Linux with gethostbyname_r).
>
> When I wrote that function once upon the time, I used a set limit since I
> thought it wasn't worth it trying different sizes (and some platforms
can't
> do that trick). Now, with the data being kept around for potentionly a
long
> while, it has of course changed the requirements of that function...
>
> That 500-600 bytes is also a question about how many IP addresses that the
> single name resolves to, right?

    Actually, I am thinking that instead of storing whole structure, why
don't we just cache up only the resolved addresses? Or, even, just top three
addresses. This really saves a lot of space.
>
> > I solve the second problem by using an adaptive buffer size which reduce
> > the dns cache size to 1/10 of the original.
>
> Sounds clever and good. Does it make a good fix for others to see too?

    The patch is simple and easy to make for others to work. But I am busy
for my school work this week. If you don't mind, I will tidy up the patch
and send to you next week.

Jacky
Received on 2002-04-17