Article View: news.software.nntp
Article #41505Re: NoCeM & INN2.3
From: Forrest J. Cavalier III
Date: Fri, 12 Nov 1999 00:00
Date: Fri, 12 Nov 1999 00:00
126 lines
4972 bytes
4972 bytes
In article <yl66zlnugn.fsf@windlord.stanford.edu>, rra@stanford.edu wrote...
>
>greg andruk <gerglery@usa.net> writes:
>
>> The possiblities I'm thinking about are being able to pull the database
>> writes out of innd without all the pain that currently entails. With
>> that pesky detail out of the way, all sorts of interesting opportunities
>> for innd hackage open up.
>
>Precisely. :) Any API will obviously be designed with some eye to thread
>safeness as well. (A thread-safe header parsing library that doesn't use
>the ugly globals that INN currently uses to parse headers is the other
>thing that's going through my mind.)
I don't INN hack much anymore for a number of reasons. This code described
below was developed for something else. (It's c++, so that is a barrier to
placing it into INN anyway...)
I always get shot down whenever I suggest anything of the sort, (hi
marc) but if there is any possibility that ISC, or another sponsor (or
even cosource.com project) would attract paying interest, then I have
time to work on major fixes to INN. Lots of ideas, but I have no
need to work on INN as a hobby.
Russ, let me know if you want the code.
Forrest.
CLibmibMsgProc
General purpose RFC-822 message header handling class.
Features:
Very fast lookup of message headers, based on a hash table.
Very low initialization and reinitialization overhead.
Efficient in processing one article, or many. (INN expireover
needs to init a table.)
No need to load entire message if just the headers are needed.
Limited number of buffer copies. Returns pointers to message
headers in place.
Segmented message buffer holds body.
Does not make multiple reallocs of a single larger and
larger block as message is read in. Instead the message
is stored in multiple (smaller) segments.
Parcelled memory management: handles many small allocations
and housekeeping with one single malloc(),free()
Measured Performance:
I don't run a news spool at the moment, and the hardware I have
is a bit dated, but it tests very well. I tested against
1500 messages..
From disk: creates INN style overview at 150 messages a second of
wall clock time. (Measured CPU user+system ~ 4 seconds, so
disk was definitely slowing things.)
From memory (or disk cache): not tested extensively, but seems
to be over 1500 messages a second, including the fwrites of
the overview data to a file (which probably slows things down quite
a bit.)
Example use:
long cbSize;
msgproc.Begin();
do {
char *pBuf = msgproc.BufPrep(&cbSize);
if (cbSize > 4096) { /* Don't do a lot of disk transfer, because
often headers will completely appear in
first bit of file.
*/
cbSize = 4096;
}
cbSize = read(fileno(f),pBuf,cbSize);
if (cbSize > 0) {
msgproc.BufCommit(cbSize);
}
if (msgproc.HasAllHeaders()) {
break; /* Don't need to read more */
}
} while (cbSize > 0);
fclose(f);
if (!msgproc.HasAllHeaders()) {
fprintf(stderr,"Message is only headers\n");
}
/* Generate overview */
printf("%s\t",pszName);
int ind = 0;
while(schema[ind]) {
int cnt;
if (ind > 0) {
printf("\t");
}
ptr = msgproc.pchHeaderByName(schema[ind],&end,&cnt);
if (ptr) {
if (cnt != 1) {
fprintf(stderr,"%s Multiple %s headers\n",pszName,schema[ind]);
}
ptr += counttowh(ptr);
ptr += countbl(ptr);
while(ptr < end) { /* collapse multi-line headers */
fwrite(ptr,1,counttoeol(ptr),stdout);
ptr += countln(ptr);
}
}
ind++;
}
printf("\n");
Technical Details
Message-ID:
<JbYW3.117$q6.27117@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-mailReferences:
<3819A774.9C57FDCA@boerde.de> <7vei02$1n3@bigred.inka.de> <ylu2n8cokb.fsf@windlord.stanford.edu> <7vhcis$oq9@bigred.inka.de> <yl7lk3llie.fsf@windlord.stanford.edu> <7vicf1$1dh$1@inn.do.mms.mt.nec.co.jp> <ylg0yppcjo.fsf@windlord.stanford.edu> <87yachwck5.fsf@slip-32-100-243-27.ma.us.prserv.net> <ylyachnwki.fsf@windlord.stanford.edu> <87u2n5wa1n.fsf@slip-32-100-243-27.ma.us.prserv.net> <yl66zlnugn.fsf@windlord.stanford.edu>Show Full Headers
Complete Article Headers
Message-ID: <JbYW3.117$q6.27117@news1.epix.net> Subject: Re: NoCeM & INN2.3 Date: Fri, 12 Nov 1999 00:00:00 +0000 From: mibsoft@mibsoftware.com (Forrest J. Cavalier III) References: <3819A774.9C57FDCA@boerde.de> <7vei02$1n3@bigred.inka.de> <ylu2n8cokb.fsf@windlord.stanford.edu> <7vhcis$oq9@bigred.inka.de> <yl7lk3llie.fsf@windlord.stanford.edu> <7vicf1$1dh$1@inn.do.mms.mt.nec.co.jp> <ylg0yppcjo.fsf@windlord.stanford.edu> <87yachwck5.fsf@slip-32-100-243-27.ma.us.prserv.net> <ylyachnwki.fsf@windlord.stanford.edu> <87u2n5wa1n.fsf@slip-32-100-243-27.ma.us.prserv.net> <yl66zlnugn.fsf@windlord.stanford.edu> 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: 547820718 Content-Type: Text/Plain; charset=US-ASCII X-Complaints-To: abuse@epix.net X-Trace: news1.epix.net 942428009 209.74.53.68 (Fri, 12 Nov 1999 12:33:29 EST) Organization: Mib Software MIME-Version: 1.0 NNTP-Posting-Date: Fri, 12 Nov 1999 12:33:29 EST Newsgroups: news.software.nntp