🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #7340

Re: expire performance enhancement (fastrm times)

#7340
From: Joe Greco
Date: Tue, 07 May 1996 00:00
112 lines
4343 bytes
In news.software.nntp article <4m9mj9$dqv@stealth.eng.pyramid.com>, mwedel@stealth.eng.pyramid.com (Mark Wedel) wrote:
:In article <4m8bmq$sqa@olivea.ATC.Olivetti.Com>,
:Jerry Aguirre <jerry@strobe.ATC.Olivetti.Com> wrote:
:>
:>Note that expire's processing of the history file is only a small part
:>of the total news.daily time.  There is still the time for fastrm,
:>expireover, and log processing.  Still, every little bit helps.
:
: One thing I did to speed up expire time was to run a couple of the fastrm
:and expireover in parallel.

Yeah, I've been meaning to incorporate the expireover too..  :-)

I wrote a hacky sh script (ecccch) that "works for me", but doesn't do the
expireover.  Perhaps what we need to do is to rewrite this in C, and
instead of creating tons of temp files, directly forks off fastrm and
expireover and feeds them the appropriate data on stdin..

The following works for me:

#! /bin/sh -
##
## expirerm - parallelize removing a set of files
##
## XXX bad bad, hard codes hierarchies in here :-(  need a .cfg file
##
## Remove articles listed by expire -z.
## Remove all files specified in the input file.

# Temporary directory for shuffling schtuff.
temp=/var/tmp

# List all the "secondary" spool disks here.
#
# This gets Really Ugly because it is not easy to automatically determine,
# for example, that "alt" is on one disk and "alt.binaries" is on another.
# It gets dealt with by repetitive pruning of the list of files to expire,
# in order specified by "hierlist", so make sure deep hierarchies such as
# "alt.binaries" come before "alt".
#
hierlists="news0 news1 news2 news5 news4"
hiers_on_news0="ncar/|rec/|talk/"
hiers_on_news1="bionet/|comp/|junk/|relcom/|sci/|uk/"
hiers_on_news2="milw/|news/|sol/|uwm/|wi/"
hiers_on_news4="alt/"
hiers_on_news5="alt/binaries/"

##  =()<. @<_PATH_SHELLVARS>@>()=
. /usr/local/news/innshellvars

MAIL="${MAILCMD} -s 'Problem removing expired files' ${NEWSMASTER}"

#RMPROC="xargs rm"
RMPROC="fastrm -e -s ${SPOOL}"

# Split our input up into per-disk files.
rm -f ${temp}/expire.rm.$$ ${temp}/expire.new.$$
cat $1 > ${temp}/expire.rm.$$

for hl in ${hierlists} ; do
    rm -f ${temp}/expire.rm.${hl}.$$
    eval hiers=\$hiers_on_${hl}
    ${EGREP} "${hiers}" \
                < ${temp}/expire.rm.$$ \
                > ${temp}/expire.rm.${hl}.$$ \
    && ${EGREP} -v "${hiers}" \
                < ${temp}/expire.rm.$$ \
                > ${temp}/expire.new.$$ \
    && mv ${temp}/expire.new.$$ ${temp}/expire.rm.$$ \
    || echo "Had a problem with creating ${temp}/expire.rm.${hl}.$$"
done

# Move the "default" list to an appropriately named file, and add it
# to the list of file lists that we are about to remove.

mv ${temp}/expire.rm.$$ ${temp}/expire.rm.default.$$
hierlists="default ${hierlists}"

# Now we have a pile of per-disk files and an expire.rm with misc. stuff
# that wasn't explicitly mentioned in the hierarchy lists.
#
# Kick it off!

for hl in ${hierlists} ; do
    eval "cd ${SPOOL} \
	&& ${RMPROC} < ${temp}/expire.rm.${hl}.$$ \
	&& rm -f ${temp}/expire.rm.${hl}.$$ &"
done

wait

# Check that all went OK.

for hl in ${hierlists} ; do
    if [ -f ${temp}/expire.rm.${hl}.$$ ] ; then
	echo "Expire had problems removing articles under ${hl} on `hostname`"\
	    | eval ${MAIL}
	exit 1
    fi
done

mv $1 ${MOST_LOGS}/expire.list
exit 0

... Joe

-------------------------------------------------------------------------------
Joe Greco - Systems Administrator			      jgreco@ns.sol.net
Solaria Public Access UNIX - Milwaukee, WI			   414/546-7968

Technical Details
Message-ID: <4mnlrg$h59@brasil.moneng.mei.com>
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
References: <Dqp091.7q3@twwells.com> <4m8bmq$sqa@olivea.ATC.Olivetti.Com> <4m9mj9$dqv@stealth.eng.pyramid.com>

Show Full Headers
Complete Article Headers
Message-ID: <4mnlrg$h59@brasil.moneng.mei.com>
Subject: Re: expire performance enhancement (fastrm times)
Date: Tue, 07 May 1996 00:00:00 +0000
From: jgreco@brasil.moneng.mei.com (Joe Greco)
References: <Dqp091.7q3@twwells.com> <4m8bmq$sqa@olivea.ATC.Olivetti.Com> <4m9mj9$dqv@stealth.eng.pyramid.com>
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: 153498057
Distribution: inet
Organization: Marquette Electronics, Inc. - Milwaukee, WI.
Newsgroups: news.software.nntp