🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #5487

Re: How to do a better USENET file system

#5487
From: Mark Delany
Date: Sun, 03 Mar 1996 00:00
116 lines
5371 bytes
brad@clarinet.com (Brad Templeton) writes:

>What you do is just use a circular buffer.  Allocate a fixed amount of
>space for each of the classes of news, and as articles come in, stream
>them out to the 5 circular buffers.  After it loops around, it starts
>replacing old articles with new ones in the same class.

Yup.

>This actually might work efficiently in the regular filesys too, as long
>as you have contiguous buffer areas, and I will agree that in the real
>filesys, you could even have the advantage of deciding to shrink or grow
>a circular buffer file.

Or symlink one off to another spindle or three if news gets a bit
tight.

>becomes pretty good too, particularly if you have fewer than 5 classes
>or have the different blocks on different spindles.

How an article is placed in a class could easily be rule-based, much
as expire is now.

>Reading is OK, but not super efficient.  It is hard to say if you can
>optimize for reading these days, since very few people read articles
>contiguously in newsgroups.  Instead you see 100 articles and you pick 5.

Yes, reading is a tricky problem. At least we have overview to help
out here.

The other "proximity" read advantage you want to try and get is for
systems sending a significant number of relatively full feeds.
Multiple reads of the same article for each downstream site is a
significant amount of read I/O but that problem may best be handling
by a sweep-nntp (discussed in another thread here recently). But you
probably know about this problem already I imagine.

>(Note the classes need not be per newsgoup, you could do things like
>"big articles into the short class", "alt group big articles into the
>very short class" etc.)

Yup. A class is just were an article ends, based on some external
ruleset such as expire.ctl

>THe big downside -- cancels do not save disk space, unless you decide to

As someone else said. You don't need to save space. A class always
takes X amount of disk space. You buy an 8G disk and split into 4 x 2G
classes (or some such). You're not going to use the disk for anything
else, so you may as well use it all from day one. Your "expire times"
simply get shorter as the classes wrap around more quickly. All that
you need to do is time stamp the point at which you wrap and the
difference between two stamps gives you the current expire time of a
given class.

If a class was defined as either a file system file or a raw-disk,
then those who favour a raw disk for performance could do so. It's
just an open() as far as the news writing code is concerned, with a
defined class size.

class1	/dev/raw/d1	8G	alt.*
class2	/dev/d2		1G	comp.*
class3	/mnt/campus/d4	5G	campus.*
class4	/dev/null	0G	*

Oh, and in terms of fetching an article, questions arise as to whether
it's over-written. This turns out to be pretty triv to detect in a
non-locking manner if the news writing s/w uses a cycle-count that
increments everytime it wraps a class. If the current cycle-count and
next write offset are externally visible to readers, then reading goes
something like this: (assuming class, offset, size and cycle-written)
are available from an external location, such as a history or overview
db):

/* get article info */
	read(history, {class, article_offset, article_size, article_cycle});

lab1:	/* Check to see if the article has definitely been overwritten */

	if (current_cycle > (article_cycle + 1)) article_has_expired;
	if ((current_cycle == (article_cycle +1) &&
		(next_write_offset > article_offset)) article_has_expired;

/* Article hasn't been over-written yet but it may be between now and .. */

	cache_open(class);
	seek(class, article_offset);
	read(class, article_size);

/* .. now, so we'd better check again */

	if (current_cycle > (article_cycle + 1)) article_has_expired;
	if ((current_cycle == (article_cycle +1) &&
		(next_write_offset > article_offset)) article_has_expired;
	}

/* Still not over-written, what we read *must* be ok */

	article_is_good;

The writer has to be careful about update order of cycle_count and
next_write_offset (and indeed there are questions of atomicity with
these two values at the point at which cycle_count increments but
tricks are possible, eg stashing the lot in the first word or two of
the class file).

Alternatively, the cycle count can be emedded in the header of each
article - this approach lends itself to fixed-length article sizes in
the class (and the complications of wildly varying article size,
multiple segments and stuff, but that does have some merit too in
terms of robustness).


Regards.

Technical Details
Message-ID: <4hbkjk$2cj@bushwire.mira.net.au>
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: <Dn4HrC.KIx@twwells.com> <DnM84I.B9w@clarinet.com> <4h8gvp$ss7@bushwire.mira.net.au> <4h9put$5jd@the-fly.zip.com.au> <DnoG2v.67M@clarinet.com>

Show Full Headers
Complete Article Headers
Message-ID: <4hbkjk$2cj@bushwire.mira.net.au>
Subject: Re: How to do a better USENET file system
Date: Sun, 03 Mar 1996 00:00:00 +0000
From: Mark Delany <markd@mira.net.au>
References: <Dn4HrC.KIx@twwells.com> <DnM84I.B9w@clarinet.com> <4h8gvp$ss7@bushwire.mira.net.au> <4h9put$5jd@the-fly.zip.com.au> <DnoG2v.67M@clarinet.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: 141891139
Distribution: inet
Organization: Werple Internet, Melbourne
Newsgroups: news.software.nntp