Article View: news.software.nntp
Article #12777Re: History DB Performance
From: Joe Greco
Date: Thu, 28 Nov 1996 00:00
Date: Thu, 28 Nov 1996 00:00
83 lines
4325 bytes
4325 bytes
In article <yy3sp5ucy18.fsf@velo.pp.vix.com>, James Brister <brister@vix.com> wrote: >Ok. I'll chime in..... The history.pag file is a series of hash tables of >indexes into the history text file. The indexes are looked up by hashing >the message-id. Each index has some number of its upper bits reserved (the >`tag' bits) for comparing against a portion of the hashed value. If the >tags bits dont match the hash value, then the match failed and the next >index in the same hash-table bucket can be checked. If the tags do match, >then the entire message id in the history text file must be checked >(because multiple message-ids can hash to the same value). If the history >file gets big enough then there is no space left for tag bits and every >lookup has to go to the text file to verify the message-id. Excellent explanation, I will clarify a bit more because I've done some work in this area.. In an ideal situation, there should be enough tag bits to "almost" uniquely encode every active message-ID. You will always access the history text file at least once for a valid match, because the tag bits will match but the real entry must be checked to verify. You may not need to access the history text file at all for an invalid match (ideal situation!), because the tag bits will not match. In both cases, if there are tag collisions because the tag space is too small, and the hash table bucket is sufficiently dense, you end up with additional accesses to the history text file to determine mismatches. For those of us who have 64-bit history index values, that problem is a long way off. :-) % head -1 /usr/local/news/history.dir dbz 3 2003591 9 C 536870912 536870911 34 8 7 6 5 4 3 2 1 0 I have 536,870,912 possible tag values available to me. Do the math and I believe that the likelihood of tag collisions is a few per YEAR :-) For those folks who have 32-bit history index values, that problem is a lot closer to home. :-( % head -1 /usr/local/news/history.dir dbz 3 3173683 9 C 8 7 28 4 0 1 2 3 You might have 4, 8 (in this case), 16, maybe 32 possible tag values available... ecccch. DBZ reported lots of tag collisions via history text file accesses back before I did the 64 bit thing. That directly translates into much more disk activity. Why? Simple. If you are verifying a valid match (and your feeds are not incredibly far behind), you will be trying to access part of the history (maybe last 5MB) that was recently written, and more importantly, is probably in core because other people have been offering articles in that same locality. But if you have to resolve a collision due to not having enough tag-ID's to (fairly) uniquely identify the message-ID, you will incur a disk access because the offset you are looking for is someplace random within the history text file. Doing collision resolution lookups is real poison. :-( If you REALLY have RAM to spare, yes, it may be OK to somehow force the entire history database to be resident in memory, but as for me, I would rather make the indexing process more efficient and simply minimize the need for accesses to the text file. My history text file is > 200MB, and the history.pag is only 45MB. Besides, a server that is accepting mostly current feeds will mainly be attempting to access pages within the last few megabytes of the history text file. Those should generally be cached by UNIX anyways, so I am not sure if you would see much benefit from sticking 190MB of mostly unused data in RAM. Just some thoughts, ... JG
Technical Details
Message-ID:
<57k8ea$28m@earth.alpha.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-mailReferences:
<56turt$5vb$1@newsfeed.dreamscape.com> <57j2n6$kpn@news.cic.net> <57jguk$bvm@newshub.atmnet.net> <yy3sp5ucy18.fsf@velo.pp.vix.com>Show Full Headers
Complete Article Headers
Message-ID: <57k8ea$28m@earth.alpha.net> Subject: Re: History DB Performance Date: Thu, 28 Nov 1996 00:00:00 +0000 From: jgreco@ns.sol.net (Joe Greco) References: <56turt$5vb$1@newsfeed.dreamscape.com> <57j2n6$kpn@news.cic.net> <57jguk$bvm@newshub.atmnet.net> <yy3sp5ucy18.fsf@velo.pp.vix.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 X-Deja-AN: 201242543 Distribution: inet Sender: joegreco@earth.execpc.com Organization: sol.net Network Services - Milwaukee, WI Newsgroups: news.software.nntp