🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #92714

Re: High and low water marks vs active file

#92714
From: Russ Allbery
Date: Sat, 02 May 2026 02:44
141 lines
8286 bytes
InterLinked <nntp@phreaknet.org> writes:
> On 5/1/2026 5:14 PM, Russ Allbery wrote:

>> Well, I'm not sure I agree with the distinction you're making here,
>> since the active file *is* a database. INN has a whole bunch of
>> databases, some of which it stores as text files, but just because the
>> format is a text file doesn't make it a database. INN definitely uses
>> the active file like a database (hence the zero-padding).

> Sorry, to be clear, I meant database in the sense of something like
> SQLite or MySQL, not using a text file under direct control of the
> program as a store.

So, this is tricky. My installation of INN doesn't use any databases in
the sense of SQLite or MySQL. The spool is in CNFS, the overview is in
tradindexed, and the history file is in hisv6, all of which are under the
direct control of the program. But those are all binary structured file
formats with capabilities that make some specific types of queries fast.

A database is essentially just an abstraction over really good
implementations of a bunch of complex data structures. This is sort of
what I'm getting at in the overall discussion. Writing your own bespoke
data structures is a good idea if your needs are extremely simple or
extremely complicated (and specific to you), but there's a whole middle
space where the thousands of hours someone else has put into a generic,
highly-tuned implementation of those algorithms is probably better.

People will definitely disagree over where those points are. And obviously
writing your own bespoke stuff is fun, and to a large extent netnews is
just a hobby at this point, so I'm all in favor of people having fun.

> Makes sense - I'm assuming the new mechanism is a database of each
> article, effectively, so you can just select the articles of interest?

For ovsqlite, yes. For tradindexed, which is the backend I wrote many
years ago, there's still a .overview file as before (although it has a
different name), but alongside it there is a binary index that records
some additional metadata (arrival time, for instance) and the offset and
length in the data file for each article. That allows something similar.
There's also another file that stores information about each group in a
hash table that's written to disk.

(You can see all the details in storage/tradindexed in the INN source
tree. It should be pretty well-commented.)

It's all very "I was in my 20s and was having a great deal of fun writing
data structures for a real-world problem." :)

> Thanks, this is helpful perspective. I think I still need to sleep on
> this a bit but hearing about your experience here is really valuable.

> Honestly, I was really set on just using flat files before but there are
> some compelling reasons you've brought up. Maybe I'll abstract things in
> a way such that I can start with flat files and add a DB (SQLite or
> other) backend option later that could be used instead. I was trying to
> avoid that complexity but it might be worth it.

I do want to say that by all means, do whatever makes you the most happy
and feel free to ignore advice for what's the most maintainable or the
least effort or whatever! Really at this point in netnews's history I
think the most important thing is that people are having fun.

> If going the database route, I'm assuming you would just recommend
> SQLite for everything? I would guess a regular RDBMS like MariaDB would
> be overkill (and possibly cause issues if the server weren't local).

SQLite is by far the easiest to use because it's just a library that
stores its stuff in files on disk, which has lots of really nice
properties and makes it very easy to set up and maintain (not entirely
trivial, but easy). But it is going to be slow. I suspect that an actual
database server that is properly tuned will be faster than SQLite. You may
not care. No one has cared enough for INN to write such a backend.

>>> <group>/<article number> for article naming

>> The last is often not used these days because it has a lot of poor
>> performance properties.

> You mean one file per article in the spool?
> From the documentation, I thought the "tradspool" method in INN was the
> most common deployment.

Right. It probably is still the most common deployment, and it has a lot
of nice advantages, particularly for small servers. It's very human
comprehensible without special tools, which is nice.

However, tradspool is extremely hard on file systems and disks, so for a
really large server it tends to be slow. It also forces a rather expensive
expire process (deleting lots of articles is a lot of file system
operations!) if you want to expire articles.

For a news server that requires mininmum maintenance and can mostly just
be ignored, I would recommend CNFS. That's what I use personally. You lose
some control and visibility and it's a bad choice if you never want
articles to expire, but it has the huge advantage that you'll never run
out of disk space (the worst thing that happens is that things expire a
bit faster), there's no expensive expire process, and it's really fast and
light on resources.

> Yes, I skipped these since they're global and not "one entry per group"-
> are there any others of those that I missed?

No, I think you got them all.

> Is the "LIST MODERATORS" file all that is involved in moderation? I
> didn't think there was any moderator info explicitly associated with
> each group.

It's rather irrelevant these days, although it does let the client mail a
submission to a moderated group directly, which in theory would actually
be better in these days of spam filtering, DMARC, and similar problems
with the email relay system. Not that any clients do this. :)

> Some files already use tab, which I don't *think* is allowed in any of
> the metadata to date? If it is, maybe a non-ASCII character like field
> separator would work.

Tab is probably the best choice. Newsgroup descriptions should really be
treated as full UTF-8 these days except for reserved characters, not that
all software has been updated to do that.

> Adding a field is something to think about. It would be a problem for
> databases too, though there are various migration tools for extending
> schemas, at least, and I'll grant that's one area where databases win
> over plain text files. But regardless of the underlying format, I'd
> prefer to invest enough time in the design up front to hopefully not
> need any changes later. Since NNTP has been stable for quite a long time
> now, I think that's realistic, unless there are new extensions in the
> future which add more metadata - and I do have a few extensions in mind
> for later but none would modify the group metadata.

Yeah, this is one of those classic design trade-offs. I pretty much always
build extensibility into everything I do these days because I've been
burned too many times, but you're not wrong about the unlikelihood of
major NNTP changes.

-- 
Russ Allbery (eagle@eyrie.org)             <https://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <https://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Technical Details
Message-ID: <87340ay1gl.fsf@hope.eyrie.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.eyrie.org!.POSTED!not-for-mail
References: <10t0m5h$1177o$1@dont-email.me> <877bpo570b.fsf@hope.eyrie.org> <10t12o5$14bjd$1@dont-email.me> <87se8bxc5x.fsf@hope.eyrie.org> <10t32uf$1mio9$1@dont-email.me> <87zf2ix26q.fsf@hope.eyrie.org> <10t3gha$1qe2v$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.eyrie.org!.POSTED!not-for-mail
From: Russ Allbery <eagle@eyrie.org>
Newsgroups: news.software.nntp
Subject: Re: High and low water marks vs active file
Date: Fri, 01 May 2026 19:44:42 -0700
Organization: The Eyrie
Message-ID: <87340ay1gl.fsf@hope.eyrie.org>
References: <10t0m5h$1177o$1@dont-email.me> <877bpo570b.fsf@hope.eyrie.org>
	<10t12o5$14bjd$1@dont-email.me> <87se8bxc5x.fsf@hope.eyrie.org>
	<10t32uf$1mio9$1@dont-email.me> <87zf2ix26q.fsf@hope.eyrie.org>
	<10t3gha$1qe2v$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: hope.eyrie.org;
	logging-data="3739"; mail-complaints-to="news@eyrie.org"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:oowTHFUXPXJoXGxEq76Gu24HedM=