🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #19240

Re: Most efficient directory structure for news?

#19240
From: D. J. Bernstein
Date: Sun, 13 Jul 1997 00:00
37 lines
2306 bytes
Mark Wedel <mark@stealth.eng.pyramid.com> wrote:
> Basically, we generate a 32 bit hash code from the message id,

Why not use expire time as the hash?

Have one file for all the articles expiring this hour, one file for all
the articles expiring next hour, and so on. Every hour, remove the
appropriate file. (As I recall, Bill Russell proposed this years ago.)

30 days, one directory per day, 24 files per directory. Use the TAI day
number as the directory name, and the TAI hour number as the filename.
(Today is day 10055.) Articles outside the 30-day range are rare and can
be handled separately.

Store a newsgroup as a single file with basic information followed by a
series of 16-byte pointers, one pointer per article, showing day number,
hour number, article position within the article file, article length in
bytes, article number in the newsgroup, etc. Or use longer pointers and
store NOV information. Periodically check for large newsgroups and
rewrite them to eliminate pointers to expired articles.

The newsgroup filenames can be compressed versions of the group names,
hashed into a bunch of directories for fast access.

To support lookups by Message-ID, keep a big hash table of pointers.

The database has to be cleaned and rebuilt after a crash. You could keep
a single crashproof log of article MD5 checksums and pointers, and use
that to recover all non-garbage articles. These days, however, I suspect
that recovering the entire database from other sites is more efficient
overall than keeping any sort of crashproof database on a local disk.

---Dan
Let your users manage their own mailing lists. http://pobox.com/~djb/qmail.html

Technical Details
Message-ID: <1997Jul1304.21.21.18009@koobera.math.uic.edu>
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>

Show Full Headers
Complete Article Headers
Message-ID: <1997Jul1304.21.21.18009@koobera.math.uic.edu>
Subject: Re: Most efficient directory structure for news?
Date: Sun, 13 Jul 1997 00:00:00 +0000
From: djb@koobera.math.uic.edu (D. J. Bernstein)
References: <5pn3ck$137s$1@node17.cwnet.frontiernet.net> <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
X-Deja-AN: 256537345
Organization: IR
Newsgroups: news.software.nntp