🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #92888

Re: inn scalability improvements

#92888
From: InterLinked
Date: Tue, 23 Jun 2026 22:14
86 lines
6036 bytes
On 5/9/2026 7:26 PM, Kevin Bowling wrote:
> Hi,
> 
> I've been looking at inn as I run it:  tradspool/ovsqlite on FreeBSD+ZFS 
> with unlimited retention and trying to fix some scaling issues.
> 
> ovsqlite: Add direct reader mode for nnrpd with WAL
> https://github.com/InterNetNews/inn/pull/338
> 
> expireover: Add bloom filter for fast history existence checks
> https://github.com/InterNetNews/inn/pull/339
> 
> expire: skip per-article SMretrieve via cancel tombstone log
> https://github.com/InterNetNews/inn/pull/340
> 
> The first two have been running on csiph.com for a few days without 
> issue.  I haven't yet deployed the last one yet but will publish results 
> in the PR when I do.
> 
> The general theme of all three is to reduce random or sync I/O.  In the 
> case of expireover and expire, the general problem is somewhat similar 
> but the root cause and fix are fairly different.
> 
> expireover checks history for every article and this turns into a very 
> slow and random serial I/O for every article in the history DB.  The new 
> option is to use a bloom filter with a configurable false positive rate, 
> chosen for some acceptable RAM vs accuracy tradeoff by the admin and 
> their spool size.  The bloom filter is created with a much more 
> efficient streaming read of the entire history file.  In the case of a 
> false positive (bloom claims article in history, but expire removed it), 
> it gets cleaned up on the next expireover run (entropy introduced by 
> hash churn make this probabilistic reality).  On my system this is a 
> 1100x improvement, 2 weeks down to 18 minutes.
> 
> expire is a bit more involved.  We don't want the same bloom tradeoff, 
> exactness trades a bit of RAM (pending deletes) for totally eliminating 
> unnecessary disk I/O for verification.  If we keep a tombstone log of 
> articles expireover deletes, and any cancels, and we trust the state of 
> the spool, we can eliminate all speculative work and only deal with the 
> actual history cleanup needed.  On my system this will net a 2800x 
> improvement, 2 days down to sub minute.

I've been thinking about this recently as part of some of other work I 
have been doing and so in the past few days, have had a renewed interest 
in your optimizations.

A week or two ago, I was trying to figure out how to suck articles in a 
manner that preserves their ordering across all groups in which an 
article appears. In the end, I think there is really only one solution. 
Save all the message IDs + date header + Xref header for the articles 
you want to suck, sort them by Xref header with a fallback to Date, and 
then suck the articles in that order. (This is quite a bit slower than 
just going group by group, since you need to change the GROUP quite 
often, though I suspect faster (and nicer) to the server being sucked 
from than requesting by Message ID.) This won't work if there are a lot 
of articles being sucked by a wimpy machine, but fortunately I'm not 
operating at the scale.

I've been doing this in two passes, first saving the Message-IDs to a 
file and then sucking those, so that operations can be resumed and are 
idempotent. I check if an article was already in history to avoid asking 
for it again. I was surprised that even with a few hundred thousand 
articles, when resuming a partial suck, just weeding out all the 
duplicates would take many minutes, due to all the history traversals. 
Naturally, this made me think of using a Bloom filter (and I was 
reminded of the optimization you did here and its encouraging results) 
and indeed, that did speed that up quite a bit. I chose to retain 
accuracy in that case, so if the bloom filter answers yes, I check 
history anyways to confirm, but if there are a lot of negative matches 
then it goes much faster.

Although I added a Bloom filter for just this one operation, I'm now 
toying with the concept of having one in the background to use for all 
operations. For example, for IHAVE/CHECK/TAKETHIS, at the moment I check 
history to see if the Message-ID is present. I don't see why I can't 
just create a Bloom filter at startup, adding new articles to it as 
received, and recreating the filter on expire operations, and in the 
case of accepting an article we don't have, then a history scan is no 
longer necessary, even with a small Bloom filter (somewhat mediocre 
false positive rate).

As I understand it, only recently with your change does INN use Bloom 
filters at all, but I'm curious if you have any thoughts about adopting 
them for other purposes like this (either in INN, or news software in 
general). I'm thinking a lot of history related operations could benefit 
from them, but maybe there is something too good to be true here...
Technical Details
Message-ID: <111f0g2$2jdd3$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <10tofqn$edc$1@csiph.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: InterLinked <nntp@phreaknet.org>
Newsgroups: news.software.nntp
Subject: Re: inn scalability improvements
Date: Tue, 23 Jun 2026 18:14:24 -0400
Organization: A noiseless patient Spider
Lines: 86
Message-ID: <111f0g2$2jdd3$1@dont-email.me>
References: <10tofqn$edc$1@csiph.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 23 Jun 2026 22:14:27 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2733475"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18Antq73+cv4QhBD7IFdNx1P8DsC755S64="; posting-host="cef29f8637650f3d6360d19da3afc39a"
Cancel-Lock: sha1:ANlhHtzCyH0GGFvgODdE3hkyn60= sha256:uwi40v920geIeHzqAaQ/AJnG2/HF1vL676ljgAZeTAs=
	sha1:Eg0jqitObh5HXc9ltA9sKqmGT6Q=
X-Mailer: MailNews/52.9.9224a1
Content-Language: en-US
In-Reply-To: <10tofqn$edc$1@csiph.com>