🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #19085

Re: Most efficient directory structure for news?

#19085
From: Matt Dillon
Date: Tue, 08 Jul 1997 00:00
57 lines
2731 bytes
:In article <000033C29F8E.NO_UCE@mauve.demon.co.uk>,
:Ian Stirling  <000033C29F8E.NO_UCE@mauve.demon.co.uk> wrote:
:....
:>
:> ....
:>: The probability of collision is non-zero.  (1 in 2400 if you assume
:>: 32 bit hash, 600K articles x 3 day retention.) This could mean that a
:>600K*3=21 bits (I think)
:>It's not 1 in 2400, it's a dead cert, due to birthday paradox.
:>
:>Basically, in any group of size sqrt(x) selected from x possible
:>states, you have a probability of .5 that there will be two x's of
:>the same value. In classic form, it's more likely than not you will
:>get 2 people with the same birthday in a group of 20 or over.
:>I did some sums, to generate pretty unique hashes (50 billion articles/day,
:>for 1000 years has 1 in a billion probability of any article clashing)
:>you need around 128 bits.

    It's not quite that bad, since a news system only retains the last 16
    days worth of message-id's, but 32 bits is definitely not enough.

    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

    Add'm together:

	(0 + 1 + 2 .. + 16M)      (16M/2)*16M + 16M/2
	--------------------   =  ------------------- = 29802
	       2^32                       2^32

    So, with a 32 bit hash there will be approximately 29802 collisions
    given a history retention of 16 million message-id's.

    This isn't perfect, because it does not take into account prior
    collisions in calculating later potentials, but it's close enough.  With
    a 64 bit hash, chances are no articles will collide.  Same with a 62 bit
    hash...  which is what Diablo uses.

    Now, I am not the best in the world when it comes to stats, so I
    might be wrong, but I think this is pretty close.

						-Matt


Technical Details
Message-ID: <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
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>

Show Full Headers
Complete Article Headers
Message-ID: <5pucvk$f8f$1@flea.best.net>
Subject: Re: Most efficient directory structure for news?
Date: Tue, 08 Jul 1997 00:00:00 +0000
From: dillon@flea.best.net (Matt Dillon)
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>
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: 255592942
Organization: Best Internet Communications, Inc. - 415 964 BEST
Newsgroups: news.software.nntp