Article View: news.software.nntp
Article #6378cyclic news file system - two interesting quirks
From: Mark Delany
Date: Sun, 07 Apr 1996 00:00
Date: Sun, 07 Apr 1996 00:00
125 lines
5875 bytes
5875 bytes
I've finally got a stand-alone cyclic news file system kicking and have
been feeding it a reasonable sized feed for a little while so I
thought it time to post about a few residual quirks to get some
feedback.
[-- Recall from "How to do a better USENET file system" the idea of a
cyclic file to store article and NOV data. This has the potential
to substantially reduce I/O load for a whole stack of reasons:
serial I/O to the disk, no UFS to fight, no expire, etc. --]
There are two "aberrations" that come from the implementation I'm
running.
1. Premature 'expire' of low volume NOV entries
--------------------------------------------
This one is pretty straightforward actually and is really only a
prelude to the second, and far more serious "aberration".
Assume the simple case of a cyclic file that has just two newsgroups
being written to it. Group A is a high volume group while Group B is a
low volume group. If the article arrival order is B1, A1...A10, then
the file would look like this:
Next write position---+
|
v
.-----------------------------------------------------.
| Art | Nov | Art| Nov | Art | Art | NOV | |
| B1 | B1 | A1 | A1-9| A2-8 | A9-10 | A10 | |
.-----------------------------------------------------.
Note that a NOV disk block typically fits lots of NOV entries.
When article B2 arrives the article data is written at the next write
position. The NOV entry however is written into the same NOV disk
block as the last NOV entry for the same group, thus:
Next write position---------------------------+
Article written here-+ |
+--NOV written here | |
v v v
.-----------------------------------------------------.
| Art | Nov | Art| Nov | Art | Art | NOV | Art |
| B1 | B1,B2 | A1 | A1-9| A2-8 | A9-10 | A10 | B2 |
.-----------------------------------------------------.
At this point articles A11-13 arrive, the file wraps and old data is
over-written, thus:
+---------Next write position
|
v
.-----------------------------------------------------.
| Art | Nov | Art| Nov | Art | Art | NOV | Art |
| A11-13| A11-13| A1 | A1-9| A2-8 | A9-10 | A10 | B2 |
.-----------------------------------------------------.
Note that Art-B1, NOV-B1 *and* NOV-B2 have been over-written.
The is OK for B1 as it has been there for a full cycle and the NOV
entry disappears at about the same time as the article.
This is not Ok for B2 as it has only just arrived, yet it is almost
immediately 'expired' as the NOV entry has been overwritten. In other
words, low-volume groups get unfairly penalized with this scheme.
My current solution is to introduce a "proximity" factor which says
that a new NOV entries must be written within a certain distance of
the article (say, within 10% of file size).
This solution wastes a bit of NOV space for low-volume groups as they
typically wont fill, but that's a small price to pay methinks.
2. Lost of lowest valid article number
-----------------------------------
The second and most serious problem is that it is hard to track the
lowest article number for each group (lownum). Since articles are
perpetually being over-written by new articles, it is apparent that
the lownum value needs to increase all the time to reflect these
'expired' articles.
Returning to this situation:
Next write position---------------------------+
v
.-----------------------------------------------------.
| Art | Nov | Art| Nov | Art | Art | NOV | Art |
| B1 | B1,B2 | A1 | A1-9| A2-8 | A9-10 | A10 | B2 |
.-----------------------------------------------------.
When the next article comes along and overwrites Art-B1, how do I know
that newsgroup B now has a lownum value of 2 for the purposes of
keeping the active file accurate?
I cannot think of a good way of determining what is about to be
over-written without pre-reading it first. Pre-reads of course
introduce a *lot* of extra read I/O (albeit with limited head
movement) that I definitely want to avoid. Pre-reading also has some
nasty implications wrt re-decoding "Newsgroups" headers - ugh.
One possibility is to compute lownum on the fly as it's only needed in
response to certain NNTP commands, but that is a fairly I/O heavy
activity as it requires a read of all NOV data per newsgroup. Even
though NOV data is grouped on disk, it's still at least one disk I/O
per group, and likely more.
I don't know for sure, but in practice does lownum really need to be
accurate for all NNTP commands or only a subset?
If lownum only needs to be accurate when the NOV data is also
required, then that's easy. On the other hand, if it has to be
accurate for most, or all group related NNTP commands then I'm *very*
interested in ideas on how to efficiently determine lownum in a cycle
news file system as it's pretty much the only unresolved aspect of the
implementation (that I know of).
Regards.
Technical Details
Message-ID:
<4k78u1$lbu@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-mailShow Full Headers
Complete Article Headers
Message-ID: <4k78u1$lbu@bushwire.mira.net.au> Subject: cyclic news file system - two interesting quirks Date: Sun, 07 Apr 1996 00:00:00 +0000 From: Mark Delany <markd@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 X-Deja-AN: 146171368 Organization: Werple Internet, Melbourne Newsgroups: news.software.nntp