🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #19105

Re: Most efficient directory structure for news?

#19105
From: Forrest J. Cavalier III
Date: Wed, 09 Jul 1997 00:00
64 lines
2703 bytes
(posted and mailed)

In article <5pucvk$f8f$1@flea.best.net>, dillon@flea.best.net wrote...
>
>    So, given (16 days x 1,000,000 message-id's/day) = 16M message-id's
>    and 2^32 slots (hash codes) to fit them in, how many collisions will 
>    there be ?
>
>    Approximate chance of collision:
>
>        message-id #1           0/2^32
>        message-id #2           1/2^32
>        message-id #3           2/2^32
>                .
>                .
>                .
>        message-id #16M         16M/2^32

----Probability should be (16M-1)/2^32

My nose for software bugs had to point out the "fence-post" error.

Not that it changes the result much.  :-)

My 1 in 2400 analysis was per message ID.

Using the 16M figures, my back of the envelope calculation
goes as so:

Density of filled hash space:
     16M
     ---- = probability a single insertion causes a collision.
     2^32

Or 1 in 268.  (The summation resulted in 29802/16M or 1 in 807,
lower by nature of initial insertions into "cleaner" hash space.)
But on day 17, you don't have a clean hash space, so you're stuck
with 1 in 268.


Anyway, the original poster wrote e-mail clarifying the
implentation.   16 bits are used to generate the directory name.
The actual file name is based on the group and article number,
not just the 16 bits left over.  This makes the name unique,
completely removing the collision problem.

But this discussion on collision rates is educational for other
applications, like history lookups, caches, etc.


BTW, with a 62 bit cache, 16M messages in hash space, there is
a 1 in 1.1E12 chance of collision.  At 600K articles per day,
that is equivalent to once every million days.

All of these assume uniform densities on the hash function, which
is not necessarily a good assumption.  Matt, have you ever seen/heard
of a collision in practice using 62 bits?

Forrest Cavalier, Mib Software, INN customization and consulting.



Technical Details
Message-ID: <5puvu1$gt4$1@news1.epix.net>
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: <5pn3ck$137s$1@node17.cwnet.frontiernet.net> <5pq0fa$rpv@stealth.eng.pyramid.com> <5pt6cs$l6l$1@news1.epix.net> <000033C29F8E.NO_UCE@mauve.demon.co.uk> <5pucvk$f8f$1@flea.best.net>

Show Full Headers
Complete Article Headers
Message-ID: <5puvu1$gt4$1@news1.epix.net>
Subject: Re: Most efficient directory structure for news?
Date: Wed, 09 Jul 1997 00:00:00 +0000
From: mibsoft@epix.net (Forrest J. Cavalier III)
References: <5pn3ck$137s$1@node17.cwnet.frontiernet.net> <5pq0fa$rpv@stealth.eng.pyramid.com> <5pt6cs$l6l$1@news1.epix.net> <000033C29F8E.NO_UCE@mauve.demon.co.uk> <5pucvk$f8f$1@flea.best.net>
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: 255647564
Organization: Mib Software
Newsgroups: news.software.nntp