Article View: news.software.nntp
Article #14795Re: Redesign spool and history database
From: Brad Templeton
Date: Thu, 06 Feb 1997 00:00
Date: Thu, 06 Feb 1997 00:00
77 lines
3913 bytes
3913 bytes
Some time last year I designed a new underlying news system which is much more efficient than this, and in which expire takes effectively no time, other than a pass over the history file to find articles that need to expire early and nop them out. And I'm told that some brave soul is actually integrating it into INN, but so far has only done a feed hub with it, no reading. The design is close to perfect, in that it is hard to imagine how it could be faster for taking a feed and expiring, though possibly one could design some clever clustering algorithms for reading. In a nutshell: You allocate N chunks of fixed sized disk blocks. These can be in the FS, or raw disk partitions. Turns out the FS isn't as bad as you think and has some advantages. Each of the N chunks represents an "expire class", so you might put highly valuable articles in a large chunks, and alt.binaries in another pool. As articles come in, you simple write them out to their chunk using a circular pointer. As new articles come in, the overwrite old articles. Receiving and storing an article consists of calculating the expire class, then a seek and a write. Done several at a time, it can be a seek and one big long block write that outputs 100 articles at a time. You work at the raw speed of disk. You log to the history file and log file the block ID and seek address and length of the article, as well as supposed article number information. The slight hard part -- you also update, in batches for efficiency, overview files, adding a block ID and seek address to the overview information. Feeding tools take the seek address and length, and just seek and block read. You can't get more efficient than that. Reading tools pretend to use the article number, but really just take the seek address and length from the overview or history, and seek and read. There *is* no expire. Disk is fully utilized at all times, too, there is no "free list." You might define a special expire class that has a real expire which compacts the block, but I am not sure why. You do need to run a simple expire which scans the history file, finds articles with explicit expire dates, and, if past them, nops out their entries in the overview files. No space is saved but the ability to run your disk at full utilization with no thrashing should make up for this. Cancel is just an overview nop. All articles have their ID stored at the front, so that when you read an article, you check for this ID to see if it's been overwritten (expired), and return null if it has been. Extra Credit: Write some simple routines to fetch articles by numbers for people who want to manually browse the spool. Not hard, just open overview, find article number, get seek address and block, go there and output. Anyway, I hear this is coming, and my predictions are it should be an order of magnitude faster than INN and in fact I don't know if you could make something any faster, other than through clever work on how overviews are efficiently written -- and given directories so you can seek into them etc. -- Brad Templeton, publisher, ClariNet Communications Corp. info@clari.net The net's #1 E-Newspaper (1,400,000 paid sbscrbrs.) http://www.clari.net/brad/
Technical Details
Message-ID:
<5ddfma$aq0@fugue.clari.net>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-mailReferences:
<5dd8dn$ml7@news1.epix.net>Show Full Headers
Complete Article Headers
Message-ID: <5ddfma$aq0@fugue.clari.net> Subject: Re: Redesign spool and history database Date: Thu, 06 Feb 1997 00:00:00 +0000 From: brad@clari.net (Brad Templeton) References: <5dd8dn$ml7@news1.epix.net> 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: 214927440 Organization: ClariNet Communications Corp. Newsgroups: news.software.nntp