🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
8 messages
8 total messages Started by brian moore Mon, 01 Sep 1997 00:00
YOUHAVE transaction and speeding up nocem's
#21148
Author: brian moore
Date: Mon, 01 Sep 1997 00:00
34 lines
2183 bytes
I played with c-nocem a bit, but found it rather annoying: it likes pausing
the server to process its mods to the history database, which of course
kills any connections trying to deliver articles and is generally annoying
to peers.

Now, since INN really doesn't want to give up its control of history, and
since I am too lazy to figure out record locking on dbz files (locking
individual hash chains while its updating), I thought of something truly
trivial that should work fine:

Hack c-nocem to open a channel to inn (as ctlinnd does) and use that
to pass the message ID's to cancel.  Keeping it internal to INN would
allow news to keep coming in, no long pauses while it waits for each
feed to close down, etc.

I don't know if the existing channel would handle multiple IDs as it
stands (I don't think it would), but it seems like allowing a stream of
message ID's to toast would speed up nocem processing immensely unless
I missed something obvious.

INN could just process them like it does a cancel then, marking it in the
dbz, but with no actual message to process (parse/save/output), just a stream
of 'YOUHAVE' transactions to mark things in the history.  The rm'ing of
the spool for anything that may have arrived can be handled outside
of inn of course, to let it process news.

Anything obvious I've missed (assuming the above is clear :))?

-- 
Brian Moore                      The opinions expressed above are my own, not
Sysadmin, C/Perl Hacker          necessarily my employers'.

Re: YOUHAVE transaction and speeding up nocem's
#21168
Author: Don Lewis
Date: Mon, 01 Sep 1997 00:00
50 lines
3144 bytes
In article <5ud3lb$grv$1@news.cmc.net>, brian moore <bem@news.cmc.net> wrote:
>I played with c-nocem a bit, but found it rather annoying: it likes pausing
>the server to process its mods to the history database, which of course
>kills any connections trying to deliver articles and is generally annoying
>to peers.

>Hack c-nocem to open a channel to inn (as ctlinnd does) and use that
>to pass the message ID's to cancel.  Keeping it internal to INN would
>allow news to keep coming in, no long pauses while it waits for each
>feed to close down, etc.

See NoCeM-On-Spool at ftp://ftp.mpcs.com/pub/newsadmin/nocem
The 0.92.3e version of it works like your description, but there are
some problems:
	I've found that on a busy server the channel isn't serviced
	often enough, causing processing of NoCeM messages to fall
	behind.  This doesn't help you refuse the articles before
	they arrive :-(  I saw backlogs of over 100 NoCeM messages
	before I hacked the code to only process the message-ID's for
	the groups that we receive.

	NoCeM message processing continues while the innd is paused
	or throttled.  This is probably not good, since expire or the
	administrator may be frobbing the history file.  The newer
	beta versions of this software try to avoid this problem but
	can't totally eliminated it, at the cost of even more overhead.

	This software attempts to work around a bug in the INN cancel
	code (the timestamp added to the history file is incorrect)
	by first doing an addhist with the desired timestamp, and then
	doing the cancel if addhist fails.  Unfortunately, there is
	a bug in innd.  If an addhist is attempted while the innd is
	paused or throttled, the check for an existing history file
	entry fails because innd doesn't open the history database
	first.  Innd then proceeds to add a new history file entry,
	possibly creating a duplicate entry and fooling the software
	into thinking it doesn't need to issue the cancel.

In the newer beta's, the software opens the history database, checks
for the history entries independently of innd, and removes the articles
by itself.  If it doesn't find the entry in the history database, it
uses the channel interface to get innd to add the history file entry.
This scheme still has some race conditions ...
-- 
Don "Truck" Lewis                                       TDK Semiconductor
Internet: Don.Lewis@tsc.tdk.com                         138 New Mohawk Road
Phone: +1 916 478-8284       FAX: +1 916 478-8251       Nevada City, CA  95959

Re: YOUHAVE transaction and speeding up nocem's
#21195
Author: Olaf Titz
Date: Tue, 02 Sep 1997 00:00
59 lines
3629 bytes

brian moore <bem@news.cmc.net> wrote:
> I played with c-nocem a bit, but found it rather annoying: it likes pausing
> the server to process its mods to the history database, which of course
> kills any connections trying to deliver articles and is generally annoying

This is annoying, but pausing the server should not kill any
connections. (Or do they time out at the client side?)

> since I am too lazy to figure out record locking on dbz files (locking
> individual hash chains while its updating), I thought of something truly

Record locking in dbz looks rather hard to me. First problem: the hash
chains are not explicitly there; when a slot is filled the next one
gets taken. For locking a chain you had to keep track of the
individual slots. Second problem: there are three modes in which the
history.pag file is handlesd, depending on compilation and run-time
flags: in small chunks (regular), all at once in memory (dbzincore)
and mapped (-DMMAP). A reliable locking mechanism has to work for all
of them.

In any case, it would be necessary to flock() the history text file in
addition to the hash file. Unfortunately, you can't get away with this
alone because of the second problem mentioned above.

> Hack c-nocem to open a channel to inn (as ctlinnd does) and use that
> to pass the message ID's to cancel.  Keeping it internal to INN would
>...
> I don't know if the existing channel would handle multiple IDs as it
> stands (I don't think it would), but it seems like allowing a stream of
> message ID's to toast would speed up nocem processing immensely unless

ncmspool works like this. It feeds the server "ctlinnd cancel"
commands. This would be the best way to do it in theory, but the
overhead for every single article to be cancelled seems a bit high for
my taste. You have to open up a new socket, send a command, wait for
response for each single cancel. These are datagram sockets, meaning
that (a) they can't be used for batches of cancels because of maximum
datagram size, (b) you need at least to wait for response on every
command. (And (c) the implementation in libinn makes a new socket for
every command, but I think this isn't strictly necessary.)

To get batch cancel processing into the server, which would
undoubtedly be a bit cleaner than the fastcancel program, the server
should have a special channel where it can be feeded commands in bulk
without much overhead. (Like a command channel operating on a stream
socket, perhaps even without acknowledgements of the individual
commands, which are not needed here.) I.e. some major hackery on innd
itself.

olaf
-- 
___        Olaf.Titz@inka.de or @{stud,informatik}.uni-karlsruhe.de       ____
__ o           <URL:http://www.inka.de/~bigred/>     <IRC:praetorius>
__/<_              >> Just as long as the wheels keep on turning round
_)>(_)______________ I will live for the groove 'til the sun goes down << ____

Re: YOUHAVE transaction and speeding up nocem's
#21247
Author: brian moore
Date: Wed, 03 Sep 1997 00:00
53 lines
3422 bytes
In article <5ui1ir$cqv$1@bigred.inka.de>,
	olaf@bigred.inka.de (Olaf Titz) writes:
> This is annoying, but pausing the server should not kill any
> connections. (Or do they time out at the client side?)

Well, when you start getting 500k nocem's that toast tens of thousands of
articles, they take a while to process. :(

> In any case, it would be necessary to flock() the history text file in
> addition to the hash file. Unfortunately, you can't get away with this
> alone because of the second problem mentioned above.

Good, then I won't do it... :).  One of the reasons I like client/server
models is that most of the time you don't even need to worry about locks
with one server acting as the main controller of data.

> ncmspool works like this. It feeds the server "ctlinnd cancel"
> commands. This would be the best way to do it in theory, but the
> overhead for every single article to be cancelled seems a bit high for
> my taste. You have to open up a new socket, send a command, wait for
> response for each single cancel. These are datagram sockets, meaning
> that (a) they can't be used for batches of cancels because of maximum
> datagram size, (b) you need at least to wait for response on every
> command. (And (c) the implementation in libinn makes a new socket for
> every command, but I think this isn't strictly necessary.)

Hrrm.... well, I played a bit and it seems to work fine: basically,
I call ICCopen() to open the socket, then for every call to do_one,
I instead call ICCcancel().  (Oh, and I commented out the pause code in
c-nocem itself.).  It does end up messing up the site (listed as '?')
in the logs instead of being '[NoCeM]', but seems to work fine.  It
probably isn't as fast as the pause/fastcancel/go method, but it doesn't
pause the server when processing huge nocem's either. :)

> To get batch cancel processing into the server, which would
> undoubtedly be a bit cleaner than the fastcancel program, the server
> should have a special channel where it can be feeded commands in bulk
> without much overhead. (Like a command channel operating on a stream
> socket, perhaps even without acknowledgements of the individual
> commands, which are not needed here.) I.e. some major hackery on innd
> itself.

That would be ideal.  libinn does handle most of the grunt work of
calling INN functions, though.  For now, this is fast enough.  Does
ncmspool really call ctlinnd?  Forking tens of thousands of times to
process a nocem is not on my list of fun things.

-- 
Brian Moore                      The opinions expressed above are my own, not
Sysadmin, C/Perl Hacker          necessarily my employers'.

Re: YOUHAVE transaction and speeding up nocem's
#21250
Author: Don Lewis
Date: Wed, 03 Sep 1997 00:00
46 lines
2648 bytes

In article <5uic5l$1ba$1@news.cmc.net>, brian moore <bem@news.cmc.net> wrote:
>In article <5ui1ir$cqv$1@bigred.inka.de>,

>Does
>ncmspool really call ctlinnd?

Nope, it uses the interface in libinn.a.

>Hrrm.... well, I played a bit and it seems to work fine: basically,
>I call ICCopen() to open the socket, then for every call to do_one,
>I instead call ICCcancel().  (Oh, and I commented out the pause code in
>c-nocem itself.).  It does end up messing up the site (listed as '?')
>in the logs instead of being '[NoCeM]', but seems to work fine.

Beware of this comment in the released version of ncmspool:

       /* now actually cancel the article. 2 steps:
          1. add history entry
          2. if 1 fails then generate a cancel
             (can't just cancel in #1 since bug in INN generates
              a history record with a date from the 1980s)
       */                                 

I think if you've installed the INN cancel timestamp patch you
should be able to avoid this problem, but you could corrupt the
history file by telling innd to do the cancel while innd is paused
by expire so that it can frob the history file, or throttled because 
innd ran out of space while writing history.

If you have not installed this patch and you use the ncmpspool algorithm,
you'll stumble across the innd bug that causes it to always add an entry
to this history file while innd is paused or throttled no matter if the
entry exists or not, and you won't know to remove the article.

The latest beta of ncmspool attempts to avoid the latter problem by
checking the state of innd, but there's still a race condition.  It
also does a dbz lookup and unlinks the file independently of innd,
causing a couple of other race conditions.
-- 
Don "Truck" Lewis                                       TDK Semiconductor
Internet: Don.Lewis@tsc.tdk.com                         138 New Mohawk Road
Phone: +1 916 478-8284       FAX: +1 916 478-8251       Nevada City, CA  95959

Re: YOUHAVE transaction and speeding up nocem's
#21550
Author: Charles Ball
Date: Mon, 15 Sep 1997 00:00
46 lines
2832 bytes
Olaf Titz (olaf@bigred.inka.de) wrote:

: brian moore <bem@news.cmc.net> wrote:
: > I played with c-nocem a bit, but found it rather annoying: it likes pausing
: > the server to process its mods to the history database, which of course
: > kills any connections trying to deliver articles and is generally annoying

: This is annoying, but pausing the server should not kill any
: connections. (Or do they time out at the client side?)

: > since I am too lazy to figure out record locking on dbz files (locking
: > individual hash chains while its updating), I thought of something truly

: Record locking in dbz looks rather hard to me. First problem: the hash
: chains are not explicitly there; when a slot is filled the next one
: gets taken. For locking a chain you had to keep track of the
: individual slots. Second problem: there are three modes in which the
: history.pag file is handlesd, depending on compilation and run-time
: flags: in small chunks (regular), all at once in memory (dbzincore)
: and mapped (-DMMAP). A reliable locking mechanism has to work for all
: of them.

: In any case, it would be necessary to flock() the history text file in
: addition to the hash file. Unfortunately, you can't get away with this
: alone because of the second problem mentioned above.

Has anyone tried using db version 2 (http://www.sleepycat.com/db) to
replace dbz?  While this would have the disadvantage of storing hashes
in the hashfile, it offers advantages like shared rw support,
optional shared memory pools (cache), data-level transaction logs
with crash-recovery mechanisms, record level locking, etc.  Db v2
should be a drop in replacement using the included dbm() replacement
library, but the semester started while I was trying to do so and I'm
busy elsewhere for awhile.  If the expanded history storage utilization
is a problem, with [considerably?] more work it should be possible to
drop the flat history file altogether and just eliminate the whole business
of routine history rebuilds.  If the hashed key performance is anything
like we've seen with b-tree keyed databases, this should be a viable
mechanism for both history and active.

Charles Ball
Information Technology
Boston University

Re: YOUHAVE transaction and speeding up nocem's
#21565
Author: brian moore
Date: Tue, 16 Sep 1997 00:00
25 lines
1822 bytes
In article <5vm919$nj9$1@araga.funcom.com>,
	tl@funcom.com (Torbjorn Lindgren) writes:
> 
> Also noteworthy is that db v2 has a different licensing agreement than
> older db's...

Not very different.  If you take the BSD copyright and change 'REGENTS'
to 'Sleepy Cat Software', and 'Harvard University', include the original
and the two new ones you get the same license as BSD.

In short, Harvard and Sleepy Cat have added their copyrights that have
identical "restrictions" as the Berkeley copyright (in short, don't
claim you wrote it: you didn't -- the word restrictions is in quotes above
since I don't think that requiring acknowledgement is a restriction).

Without getting into the Copyleft vs BSD-Copyright argument, I can see
no problems in using the DB-2 code as far as copyright issues go.  Sleepy
Cat didn't make changes to the license as far as I can tell.

-- 
Brian Moore                      The opinions expressed above are my own, not
Sysadmin, C/Perl Hacker          necessarily my employers'.

Re: YOUHAVE transaction and speeding up nocem's
#21599
Author: Torbjorn Lindgren
Date: Tue, 16 Sep 1997 00:00
47 lines
2547 bytes
Charles Ball <cball@bu.edu> wrote:
>Olaf Titz (olaf@bigred.inka.de) wrote:
>: In any case, it would be necessary to flock() the history text file in
>: addition to the hash file. Unfortunately, you can't get away with this
>: alone because of the second problem mentioned above.
>
>Has anyone tried using db version 2 (http://www.sleepycat.com/db) to
>replace dbz?  While this would have the disadvantage of storing hashes
>in the hashfile, it offers advantages like shared rw support,
>optional shared memory pools (cache), data-level transaction logs
>with crash-recovery mechanisms, record level locking, etc.  Db v2
>should be a drop in replacement using the included dbm() replacement
>library, but the semester started while I was trying to do so and I'm
>busy elsewhere for awhile.


I don't think you get record locking and stuff like that using the
legacy interfaces...

It shouldn't be that hard to convert to the native db 2 interface, and
it's likely to give much better performance.


Another note for anyone interrested in actually doing this: 

If the posts is really *small*, it's likely that btree is actually
faster than the hash access method. (With 16-byte key and 0 byte data
btree was 2-3 times as fast, depending on the pagesize
selected. Depending on page-size the bottlenecks seemed to be either
to small pagesize, or to many hashes per page).

Depending on the data-size this might or might not be the case, but I
thought I should mention it so people actually benchmark the two
relevant access methods instead of just assuming that hash is of
course the best alternative.

Also noteworthy is that db v2 has a different licensing agreement than
older db's...


-- 
Torbj�rn Lindgren
E-mail: tl@funcom.com
If Santa ever DID deliver presents on Christmas Eve, he's dead now.

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads