Thread View: news.software.nntp
3 messages
3 total messages
Started by Mike Bird
Fri, 15 Mar 1996 00:00
NNTPSEND pre-sort patch (UNOFF4)
Author: Mike Bird
Date: Fri, 15 Mar 1996 00:00
Date: Fri, 15 Mar 1996 00:00
106 lines
3820 bytes
3820 bytes
Here is the inn1.4unoff4 version of the nntpsend pre-sort patch.
This patch enables '-b' to pre-sort the outgoing batch.
A pre-sorted batch is much more efficient if the destination
host has a single spool spindle (and may be faster for small
numbers of spindles) because it reduces directory thrashing.
--Mike
-------------------------------------
--- nntpsend.unoff4 Wed Mar 13 16:14:13 1996
+++ nntpsend Thu Mar 14 23:18:54 1996
@@ -2,7 +2,7 @@
## $Revision: 1.8 $
## Send news via NNTP by running several innxmit processes in the background.
## Usage:
-## nntpsend [-p][-r][-s size][-S][-t timeout][-T limit][host fqdn]...
+## nntpsend [-p][-r][-s size][-S][-t timeout][-T limit][-b][host fqdn]...
## -p Run innxmit with -p to prune batch files
## -r innxmit, don't requeue on unexpected error code
## -s size limit the .nntp file to size bytes
@@ -11,6 +11,7 @@
## -t timeout innxmit timeout to make connection (def: 180)
## -T limit innxmit connection transmit time limit (def: forever)
## -P portnum port number to use
+## -b sort batch (for single spindle destinations)
## host fqdn send to host and qualified domain (def: nntpsend.ctl)
## If no "host fqdn" pairs appear on the command line, then ${CTLFILE}
## file is read.
@@ -28,6 +29,7 @@
R_FLAG=
S_FLAG=
C_FLAG=
+B_FLAG=
TRUNC_SIZE=
T_FLAG=
TIMELIMIT=
@@ -52,6 +54,9 @@
X-c)
C_FLAG="-c"
;;
+ X-b)
+ B_FLAG="-b"
+ ;;
X-s)
if [ -z "$2" ] ; then
echo "${PROGNAME}: option requires an argument -- s" 1>&2
@@ -152,7 +157,7 @@
echo "${PROGNAME}: [${PARENTPID}] start"
## Set up environment.
-export BATCH PROGNAME PARENTPID INNFLAGS
+export BATCH PROGNAME PARENTPID INNFLAGS B_FLAG
## Loop over all sites.
cat ${INPUT} | while read SITE HOST MAXSIZE FLAGS; do
@@ -173,6 +178,7 @@
R_PARAM=
S_PARAM=
C_PARAM=
+ B_PARAM=
PP_PARAM=
TIMEOUT_PARAM=
TIMELIMIT_PARAM=
@@ -192,6 +198,9 @@
X-c)
C_PARAM="-c"
;;
+ X-b)
+ B_PARAM="-b"
+ ;;
X-p)
P_PARAM="-p"
;;
@@ -284,7 +293,7 @@
fi
## Start sending this site in the background.
- export SITE HOST LOCKS BATCHFILE PROGNAME PARENTPID SIZE TMPDIR
+ export SITE HOST LOCKS BATCHFILE PROGNAME PARENTPID SIZE TMPDIR B_PARAM
sh -c '
BATCHFILE=${SITE}.nntp
LOCK=${LOCKS}/LOCK.${SITE}
@@ -305,8 +314,12 @@
test -n "${SIZE}" && shrinkfile -s${SIZE} -v ${BATCHFILE}
if [ -s ${BATCHFILE} ] ; then
echo "${PROGNAME}: [${PARENTPID}:$$] begin ${SITE} `date`"
+ if [ -n "${B_FLAG}${B_PARAM}" ] ; then
+ echo "${PROGNAME}: [${PARENTPID}:$$] sort -r ${BATCHFILE} -o ${BATCHFILE}"
+ sort -r ${BATCHFILE} -o ${BATCHFILE}
+ fi
echo "${PROGNAME}: [${PARENTPID}:$$] innxmit ${INNFLAGS} ${HOST} ${BATCH}/${BATCHFILE}"
- eval innxmit ${INNFLAGS} ${HOST} ${BATCH}/${BATCHFILE}
+ innxmit ${INNFLAGS} ${HOST} ${BATCH}/${BATCHFILE}
echo "${PROGNAME}: [${PARENTPID}:$$] end ${SITE} `date`"
else
rm -f ${BATCHFILE}
----------------------------------------------------------
Mike Bird Tel: 209-742-5000 FAX: 209-966-3177
President POP: 209-742-5333 NOC: 209-742-9979
Iron Mtn Systems http://www.ims.mariposa.ca.us/
Re: NNTPSEND pre-sort patch (UNOFF4)
Author: Rahul Dhesi
Date: Sat, 16 Mar 1996 00:00
Date: Sat, 16 Mar 1996 00:00
51 lines
2012 bytes
2012 bytes
I normally do a 'batched sort', as that lets you maintain some idea of
chronological order and do FIFO truncation of long batch files. Below
is my 'bsort' perl script. Just plug it in anywhere you would pipe
through 'sort'.
== begin perl code ==
#! /local/bin/perl
# Sort input, or argument file(s), in $LIMIT-line pieces.
# This is useful when processing batches of outgoing News. Sorting
# filenames makes directory access more efficient.
# Also useful to speed up commands like
# find . -type f -mtime +3 -print | bsort | xargs rm -f
# when cleaning up filled News spools.
# At the same time, too much sorting causes loss of information about
# the order in which articles were queued, making it harder to shorten
# a very long batch file by skipping the older articles.
# Compromise: sort in $LIMIT-line pieces. Default is below, but
# may be overridden with a command-line arg, e.g.,
# 'bsort 10000' to sort in 1000-line pieces.
# Rahul Dhesi <dhesi@rahul.net>
# hostmaster & postmaster
# a2i communications network operations
$LIMIT = shift || 2000;
$count = 0;
while (<>) {
push(@list, $_);
if ($count++ > $LIMIT) {
@out = sort @list;
@list= ();
print @out;
$count = 0;
}
}
if (@list > 0) {
@out = sort @list;
print @out;
}
== end perl code ==
--
Rahul Dhesi <dhesi@rahul.net>
"please ignore Dhesi" -- Mark Crispin <mrc@CAC.Washington.EDU>
Re: NNTPSEND pre-sort patch (UNOFF4)
Author: Jerry Aguirre
Date: Mon, 18 Mar 1996 00:00
Date: Mon, 18 Mar 1996 00:00
40 lines
2565 bytes
2565 bytes
In article <4ib76t$gqb@news.ims.mariposa.ca.us> mgb@ims.mariposa.ca.us (Mike Bird) writes: > >Here is the inn1.4unoff4 version of the nntpsend pre-sort patch. > >This patch enables '-b' to pre-sort the outgoing batch. Sorting the entire batch is overkill and prone to problems. When a site gets behind the queue can grow to many megabytes. With the suggested patch the entire batch file gets sorted every time nntpsend starts a new innxmit. This happens more often than you may think as the suggested parameters cause innxmit to time out after every half hour, rewrite the queue file, and exit. What I have done is to sort just the site.work file. This sorts the new articles being appended to the queue. This combined with a longer "-T" option results in 90% of the benifit of sorting the entire queue with a lot less overhead. It also doesn't need "sort -r" to avoid giving unreasonable priority to "alt.*". (If the suggested patch were to become standard we could expect to see the propigation of the "vmsnet" hierarchy greatly improved! :-) Consider also that sorting the entire queue requires enough space on /var/tmp to hold it. There have been enough reports of the sort of expire.rm failing to indicate that not every site always has this amount of space. The example time out of 30 minutes is one that I disagree with. For a site with a large backlog it results in significant IO as the batch file gets copied and recopied. It also creats dead time between the end of a run and the next crontab run of nntpsend. By example if you only ran nntpsend every 30 minutes it would start one that would finish just AFTER the next nntpsend run. Then you would have 30 minutes of idle time. I increased my time to at least an hour minus a few minutes. That minimizes both the copying and the dead time. Innxmit has just enough time to clean up and then a few minutes later the next nntpsend run starts a new one. (-T3400 or -T7100)
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