🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #21005

Re: A Study on INN history cache

#21005
From: coneill
Date: Wed, 27 Aug 1997 00:00
73 lines
4001 bytes
sysuh@news.kigam.re.kr (Sang-yong Suh) writes:
> I'm afraid that we are talking about different sujbect, because
> my answers to the above are completely different from you. :-(

Yes, I'm afraid I initally misunderstood your question.

> I have been running two in boxes with 1024K HISCACHESIZE, both having
> 20+ peers, and still I belive I'll have to increase it if I can afford
> the memory.

I still think you'd be better off implementing a better collision 
handling algorithm so that you get better temporal locality.  OTOH, you
may want to look at the new dbz code since you're already using 8mb for
cache on a 32bit machine, and the new dbz code pretty much eliminates
the need for history cache if you have the memory to mmap the .pag 
file.  Typical lookup time for me on a PPro200 is measured in tens
of microseconds.

> There are two types of hash collisions.  The first is that two different
> msg ids give same hash value.  The second type is collision of the two
> different hashes within the hash table produced by
> (hash_val % HISCASHSIZE).  If you keep the original msg id string,
> like your first announced history cache, I agree you, i.e., no need to
> use more than 512K HISCACHESIZE, and the existing dbzhash() is sufficient.
> Actually, the dbzhash() is named by you but not Jeff Garzik.
> 
> Due to my short writing skill, I wrote
> 
>     "Is Jeff Garzik's dbzhash() suffcient?",
> 
> hoping you to understand as
> 
>     "Is 32-bit dbzhash(), used in Jeff Garzik's history cache,
>      enough for the history cache? His cache does not store original
>      MessageID string in memory, and relies on the cache status
>      for the existence of the msg id."

I'm no longer using my original history cache code.  What I'm using 
now more closely resembles Jeff's code, but I'm also using a 48bit
md5 hash instead of the crc32.  See ftp://ftp.fnord.net/pub/cvs-inn/snapshots
for the current code.

> If two different msg ids give same hash value, we must not determine
> the existence of a msg id from the hash alone, and have to store the
> original string like yours and use strcmp().  However, if we are sure
> that the collision rarely occurs, say, one message per year, some people,
> like me, may prefer not to store the string in memory.  The risk is
> compensated by the better history performance.  May be some people
> prefer yours, because it has zero probability of error.

It also uses memory much less efficently and has memory leaks. :(

> Obviously, my test result showed that the current dbzhash() will
> errorneously refuse to receive an article once per 18K messages.
> The error rate may be one message per hour.
> To avoid this, we must purge cache rapidly, meaning we must
> use small caches.  How much small should it be?
> My intension is improving Jeff's idea.

I'm surprised that crc32 is colliding that often.  I suppose that is 
a problem :)

> I am now sure that our approaches are quite different.  I am trying to
> make the cache more perfect.  However, you have aother tool beyond
> the history cache.

You're trying to make the hash more perfect, I'm trying to increase
the hit rate on the cache.  I'd prefer that whatever solution we come to
not use GCCism's such as long long.  Anyone have any good modulus code
that isn't recursive?

Technical Details
Message-ID: <86203g84pv.fsf@blah.erols.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <5tu1mf$s4c@news.kigam.re.kr> <8667ss99qs.fsf@blah.erols.com> <5u0c2e$2gc@news.kigam.re.kr>

Show Full Headers
Complete Article Headers
Message-ID: <86203g84pv.fsf@blah.erols.com>
Subject: Re: A Study on INN history cache
Date: Wed, 27 Aug 1997 00:00:00 +0000
From: coneill@blah.erols.com
References: <5tu1mf$s4c@news.kigam.re.kr> <8667ss99qs.fsf@blah.erols.com> <5u0c2e$2gc@news.kigam.re.kr>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 268693721
Organization: Erol's Internet Services
X-Received-On: 27 Aug 1997 07:28:13 GMT
Newsgroups: news.software.nntp