Thread View: news.software.nntp
2 messages
2 total messages
Started by Nick Andrew
Tue, 06 May 1997 00:00
INN inews speedup (includes patch)
Author: 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/
Re: INN inews speedup (includes patch)
Author: Michael Hucka
Date: Wed, 14 May 1997 00:00
Date: Wed, 14 May 1997 00:00
9 lines
910 bytes
910 bytes
Awesome. Thanks for posting this. -- Mike Hucka hucka@umich.edu http://www.eecs.umich.edu/~hucka University PhD to be, computational models of human visual processing (AI Lab) of UNIX systems administrator & programmer/analyst (EECS DCO) Michigan
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