🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #19035

Re: Most efficient directory structure for news?

#19035
From: Mark Wedel
Date: Sun, 06 Jul 1997 00:00
75 lines
4078 bytes
In article <5pn3ck$137s$1@node17.cwnet.frontiernet.net>,
Dan Foster <dsf@node6.frontiernet.net> wrote:
>If you had the chance to dump the one-article-per-file and 
>one-group-per-directory structure, and could use any type of structure...
>what would the most efficient one be?
>
>
>Just mulling things over because it seems that while a simple hash (like
>../56/78 for <blah>/12345678 will help in the short term, I want to do it
>right for a long term approach, and have a lot of flexibility as to how
>I want to do it, exactly.

 I actually put an overall hash scheme in for news storage.  Basically,
we generate a 32 bit hash code from the message id, and store it based
on that.  the 32 bit is actually overkill, so I am only use 16 of those
bits for the directorys (xx/xx/article) storage.  This gives 65536
directories for all the news.

 I based the number of directories on the number of articles I generally
store - on average, there should be less than 100 articles per directory.
And I certainly don't have the problem with control or misc.jobs having
a huge number of files in them.

 For storage, it works pretty good (I have 23 2 GB drives individual
mounted, and usage on all of them are about equal.)  traffic on all the 
drives is also pretty good.

 To actually run in this configuration also required some other changes
(expire also needs to spit out the hashed paths in addition to just the
normal articles for expireover).  nnrpd also needs to rely on the overview
data to find the actual article path.

 A side benefit of this storage method is no linking need to be done
for crosspost - the article is stored once, and since the article has
the same message id for all crossposted groups, it resolves properly.

 Now for the downside:

 Recovery of the files is much more difficult - since the articles are not
stored in any group basis, it is not possible to regen a history or overview
data from the article spool (history regen I don't consider a big thing,
since it would probably tape so long, it would be worth restoring it
from backup tape and just get duplicate news for a day or so.)

 renumber also doesn't work as expected.  I actually just renumber the
low values, and I get those from looking at the history file after an
expire.  That seems to work OK.  It would be possible in this configuration
for several articles to have the same message number - I am not sure how
that is handled, but that should also only be a problem in a system crash.

 If article doesn't make it into the overview database, it will not be
shown as available.  I have actually put debugging messages into nnrpd
when that happens, and it is pretty uncommon.

 The other disadvantage in that caching by the OS is pretty poor - since
articles are not going to be written to the same directories, that hurt
writes time (but if you are getting multiple unsorted feeds, you may
get the same result.)  But also when people read news, there is no
locality to specific directories - things would hop here and there.

 In terms of write performance, I am thinking of making some improvements -
have innd write the files into a standard directory (so the OS will always
have the directory info in memory) and write some helper process that then
moves the files out of that directory to where the belong (could probably
be done with some entry in the newsfeeds line..)


 
-- 

-- Mark Wedel
mark@pyramid.com

Technical Details
Message-ID: <5pq0fa$rpv@stealth.eng.pyramid.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: <5pn3ck$137s$1@node17.cwnet.frontiernet.net>

Show Full Headers
Complete Article Headers
Message-ID: <5pq0fa$rpv@stealth.eng.pyramid.com>
Subject: Re: Most efficient directory structure for news?
Date: Sun, 06 Jul 1997 00:00:00 +0000
From: mark@stealth.eng.pyramid.com (Mark Wedel)
References: <5pn3ck$137s$1@node17.cwnet.frontiernet.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: 255409464
Organization: Pyramid Technology Corporation
Newsgroups: news.software.nntp