Article View: news.software.nntp
Article #17579INN inews speedup (includes patch)
From: Nick Andrew
Date: Tue, 06 May 1997 00:00
Date: Tue, 06 May 1997 00:00
160 lines
5661 bytes
5661 bytes
I needed to do some work on NN recently (since it was last compiled a
few library revisions back, and I wasn't sure if I was on the latest
code). So I did ...
... Anyway I did some system call traces to check it out, and I also
traced the inews program, which does the news posting part (handing
the article off to the news server using the NNTP protocol).
It was interesting to note in the trace then that the inews program
actually issues a 'LIST' command to the server, and the server returns
the list of all active newsgroups plus high and low article numbers,
and the inews program saves this list to a file and rereads the file
before issuing the 'POST' command to send the article to the server.
The time taken to get a list of articles from the server was much longer
than the time to actually post the article. So I dug into the inews
source to find out why and it turned out that inews read the list of
groups to verify the newsgroups in the Newsgroups and Followup-To
headers of the article. After doing some tests it also became evident
that the remote newsserver does the same checks (and a lot quicker)
so inews wasn't gaining any reliability by performing additional checks
and was just wasting time (IMHO anyway).
So I hacked inews to add an optional flag '-C' which prevents the
newsgroup check. I then did some timing tests.
Posting time varies a lot (depending on exactly what the news server is
doing at the time of the posting, but anyway I posted 4 articles with
and without the flag. Times follow:
1st 2nd 3rd 4th
With flag 7.70s 0.67s 0.81s 0.56s
Without flag 32.93s 28.46s 26.58s 43.81s
I think the results speak for themselves.
The diff to frontends/inews.c follows:
Nick.
-----------------------------------------------------------------------------
*** inews.c.original Wed Dec 18 01:40:40 1996
--- inews.c Tue May 6 16:04:55 1997
***************
*** 1177,1182 ****
--- 1177,1183 ----
char SpoolMessage[NNTP_STRLEN + 2];
BOOL DoSignature;
BOOL AddOrg;
+ BOOL CheckNewsgroups;
SIZE_T Length;
/* Find out who we are. */
***************
*** 1190,1203 ****
Dump = FALSE;
DoSignature = TRUE;
AddOrg = TRUE;
(void)umask(NEWSUMASK);
/* Parse JCL. */
! while ((i = getopt(ac, av, "DNAVWORShx:a:c:d:e:f:n:r:t:F:o:w:")) != EOF)
switch (i) {
default:
Usage();
/* NOTREACHED */
case 'D':
case 'N':
Dump = TRUE;
--- 1191,1208 ----
Dump = FALSE;
DoSignature = TRUE;
AddOrg = TRUE;
+ CheckNewsgroups = TRUE;
(void)umask(NEWSUMASK);
/* Parse JCL. */
! while ((i = getopt(ac, av, "CDNAVWORShx:a:c:d:e:f:n:r:t:F:o:w:")) != EOF)
switch (i) {
default:
Usage();
/* NOTREACHED */
+ case 'C':
+ CheckNewsgroups = FALSE;
+ break;
case 'D':
case 'N':
Dump = TRUE;
***************
*** 1331,1356 ****
QuitServer(1);
}
! /* Check the newsgroups. */
! if ((F = CAlistopen(FromServer, ToServer, (char *)NULL)) == NULL) {
! if (NNTPsendpassword((char *)NULL, FromServer, ToServer) >= 0)
! F = CAlistopen(FromServer, ToServer, (char *)NULL);
! }
! if (F != NULL) {
! if (!ValidNewsgroups(HDR(_newsgroups), F, article)) {
! CAclose();
! QuitServer(1);
! }
! if ((p = HDR(_followupto)) != NULL
! && !EQ(p, "poster")
! && !ValidNewsgroups(p, F, (char *)NULL)) {
CAclose();
- QuitServer(1);
}
! CAclose();
}
- else if (!Spooling)
- PerrorExit(TRUE, "Can't get list of newsgroups");
if (Dump) {
/* Write the headers and a blank line. */
--- 1336,1364 ----
QuitServer(1);
}
! if (CheckNewsgroups) {
! /* Check the newsgroups. */
! if ((F = CAlistopen(FromServer, ToServer, (char *)NULL)) == NULL) {
! if (NNTPsendpassword((char *)NULL, FromServer, ToServer) >= 0)
! F = CAlistopen(FromServer, ToServer, (char *)NULL);
! }
!
! if (F != NULL) {
! if (!ValidNewsgroups(HDR(_newsgroups), F, article)) {
! CAclose();
! QuitServer(1);
! }
! if ((p = HDR(_followupto)) != NULL
! && !EQ(p, "poster")
! && !ValidNewsgroups(p, F, (char *)NULL)) {
! CAclose();
! QuitServer(1);
! }
CAclose();
}
! else if (!Spooling)
! PerrorExit(TRUE, "Can't get list of newsgroups");
}
if (Dump) {
/* Write the headers and a blank line. */
-----------------------------------------------------------------------------
Nick.
--
Kralizec Internet Data: +61-2-9837-1183, 9837-1868
Zeta Microcomputer Software Fax: +61-2-9233-6545 Voice: 9837-1397
P.O. Box 177, Riverstone NSW 2765 http://www.zeta.org.au/
--
Kralizec / Zeta Microcomputer Software Fax: +61-2-9233-6545 Voice: 9837-1397
P.O. Box 177, Riverstone NSW 2765 http://www.kralizec.net.au/
Technical Details
Message-ID:
<5kmrtn$tse$1@gidora.kralizec.net.au>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-mailShow Full Headers
Complete Article Headers
Message-ID: <5kmrtn$tse$1@gidora.kralizec.net.au> Subject: INN inews speedup (includes patch) Date: Tue, 06 May 1997 00:00:00 +0000 From: nick@zeta.org.au (Nick Andrew) 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: 239688449 Organization: Kralizec Internet, http://www.zeta.org.au/ Newsgroups: news.software.nntp Summary: INNs inews 'LIST's all newsgroups, possibly unnecessarily