🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: demon.ip.developers
Article #79

Re: Newshistory checking

#79
From: Terrance Richard Boyes
Date: Sun, 18 Jul 1999 00:00
52 lines
3289 bytes
Terrance Richard Boyes <tez@pierrot.co.uk> wrote:

> Yep, there's a HASH1 and HASH2 value, though there seem to be
> some problems if both of those overflow (collisions). I couldn't
      ^
      speed

> find my refs to how to understand the numbers behind a hashing
> algorithm. Any good books ?

NB when I refer to 32K, 256K as the HASH values I'm using the
nearest primes above and below that value!

> However with a bit of experimentation I upped both the HASH values
> from ~32K to ~256K, on 32K unique msgids this has dropped the
> collisions from ~5000 to ~700.

Damn, that should have been 128K, at 256K it's 150 collisions,
at 512K it's 50. The default 32K values are good for up to
about 8K articles in the history. 

As far as building the HASH table(s) goes the "size" of the
table (HASH 32K, 512K etc...) makes very little difference in
speed, and using 2 HASHes is only a little slower than one.
However using 2 does result in less collisions.

Speed wise having more than a handful of collisions on a
newshistory of that size is bad news, each one results
in a (table) scan of the history file.

I can see a few ways to help alleviate the collision speed
problem, though they all need more RAM usage (so DOS users
may have problems ?).

I tried extending the idea of using multiple HASH's, to 4,
it was slower than 2 large ones, and no more efficient
at eliminating dupes.

Or using some pseudo-randomising algorithm as Jes suggested ?

Or HASHing the lhs and rhs of the Message-ID: ?

Or storing the overflow in a btree, this could of course 
eat memory rapidly if there are a lot of collisions, OTOH
in a case like that the multiple history scans would be
a speed killer...

Maybe storing a file offset for every collision ?

-- 
<URL:http://www.pierrot.co.uk/>                                  Team AMIGA
What UNIVERSE is this, please??
Technical Details
Message-ID: <19990718.155600.9E9801DE.1Vaa@pierrot.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <19990713.200500.0AA80202.PEaa@pierrot.co.uk> <19990714.210035.0AA80202.TCaa@pierrot.co.uk> <E114k4m-0000SW-00@jes.noc.nl.demon.net> <19990716.193917.0AA80202.XVaa@pierrot.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bb05,75d5f9974c0fd91a
X-Google-Attributes: gid10bb05,public
From: tez@pierrot.co.uk (Terrance Richard Boyes)
Subject: Re: Newshistory checking
Date: 1999/07/18
Message-ID: <19990718.155600.9E9801DE.1Vaa@pierrot.co.uk>
X-Deja-AN: 502408402
X-PGP-Fingerprint: 20 66 0F E8 85 64 9C 2C  6F 82 6F 19 6C 2F 6A 1D
X-Cancel-Lock: TEZT:903f7556d02f6a18e8e1eb2caebf40f3 20e6b4c8aaba36cf03bab105480c6ec1
X-PGP-Keyfile: <URL:http://www.pierrot.co.uk/pgpauth/>
References: <19990713.200500.0AA80202.PEaa@pierrot.co.uk>   <19990714.210035.0AA80202.TCaa@pierrot.co.uk> <E114k4m-0000SW-00@jes.noc.nl.demon.net> <19990716.193917.0AA80202.XVaa@pierrot.co.uk>
X-PGP-Auth: pub   512/3A14C4B9 1999/04/22 Tez Boyes <tez@pierrot.co.uk> iQBVAwUBN5IHJUXush46FMS5AQE4ugIAtTAkFuJ0AeeIpRLpeanSvk5j9pj0EWpt /A45K7lcTx06WrPCe0pPqudUq4OdwftzrZrfrxGImSVLiKcIRclDHQ== =4Ux0
X-NaMLServ: $VER: v0.9b <tez@pierrot.co.uk>
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!finch-post-10.mail.demon.net!pierrot.demon.co.uk!pierrot.co.uk!tez@pierrot.co.uk
X-Trace: mail2news.demon.co.uk 932313379 mail2news:3906 mail2news mail2news.demon.co.uk
Organization: ECL.Net
User-Agent: tin/pre-1.4-980618 (AMIGA)
X-Lan-Trace: news.pierrot.lan 19990718.155600 news:1Vaa IDENT tez@pierrot.demon.co.uk
Newsgroups: demon.ip.developers