🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
25 messages
25 total messages Started by T. William Wells Tue, 30 Apr 1996 00:00
expire performance enhancement
#7060
Author: T. William Wells
Date: Tue, 30 Apr 1996 00:00
17 lines
1269 bytes
Ever notice how it seems to take *forever* to run through the
history file? Well, last night, I was hacking on expire and noted
that it has a hash table for newsgroups. However, there are only
128 buckets in the table. I set it to 2048 and cut the processing
time to what looks to be about half of the original. I didn't
experiment to see what the best size would be.

BTW, the hack I added: a flag X in expire.ctl that says that if
an article matches that line then the article gets expired in
_all_ the groups it's cross-posted to. This is a space-saver for
when someone cross-posts between binaries and non-binaries; it's
especially useful if you use -l.  That it also zaps small posts
cross-posted into the binaries groups doesn't bother me in the
slightest....

Re: expire performance enhancement
#7105
Author: Mike Bird
Date: Wed, 01 May 1996 00:00
27 lines
1657 bytes
A great idea.  Care to post the patch?

bill@twwells.com (T. William Wells) wrote:

>Ever notice how it seems to take *forever* to run through the
>history file? Well, last night, I was hacking on expire and noted
>that it has a hash table for newsgroups. However, there are only
>128 buckets in the table. I set it to 2048 and cut the processing
>time to what looks to be about half of the original. I didn't
>experiment to see what the best size would be.

>BTW, the hack I added: a flag X in expire.ctl that says that if
>an article matches that line then the article gets expired in
>_all_ the groups it's cross-posted to. This is a space-saver for
>when someone cross-posts between binaries and non-binaries; it's
>especially useful if you use -l.  That it also zaps small posts
>cross-posted into the binaries groups doesn't bother me in the
>slightest....

----------------------------------------------------------
 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: expire performance enhancement
#7113
Author: Michael Handler
Date: Wed, 01 May 1996 00:00
36 lines
2246 bytes
In <4m6tue$5rp@sunrise.gv.ssi1.com>,
Don Lewis <gdonl@gv.ssi1.com> wrote:

> And if you keep the *.answers groups longer than discussion groups,
> it expires the FAQ articles from the *.answers groups a lot sooner
> if they are crossposted to their respective discussion groups :-(

I think that Bill's patch (which I'd really like to see for myself,
BTW) only works on lines in expire.ctl which explicitly specify the
flag.  F'rinstance, I'd put the 'X' flag on my alt.test*,
alt.binaries*, and alt.sex.pictures* lines, but probably not anywhere
else.

I was thinking about this very problem last week. What if someone
posts a megabinary to alt.foo.group and alt.binaries.pictures.fetish,
in that order? I have alt.binaries.* on its own drive and partition
(like so many people these days), and I'm running crosspost (from
unoff4); INN will actually store the articles in the spool dir for the
first directory mentioned, and just create sym/hard links for the
crosspost. Which means that the only thing that gets expired for this
article in my one day alt.binaries.* expire is the symlink to the
article in the alt.foo.group spool, and a large binary sits in my
non-binaries spool for three days or more. :(

I was thinking of patching INN and crosspost to process rules for
where it should actually put the article and where it should just
symlink it to, based on what newsgroups were in the header, but Bill's
solution seems much more elegant. Thanks!

-- 
Michael Handler <handler@netaxs.com>                 Email: support@netaxs.com
Net Access System Administration                           Voice: 215-576-8669


Re: expire performance enhancement
#7121
Author: Mike Bird
Date: Wed, 01 May 1996 00:00
27 lines
1657 bytes
A great idea.  Care to post the patch?

bill@twwells.com (T. William Wells) wrote:

>Ever notice how it seems to take *forever* to run through the
>history file? Well, last night, I was hacking on expire and noted
>that it has a hash table for newsgroups. However, there are only
>128 buckets in the table. I set it to 2048 and cut the processing
>time to what looks to be about half of the original. I didn't
>experiment to see what the best size would be.

>BTW, the hack I added: a flag X in expire.ctl that says that if
>an article matches that line then the article gets expired in
>_all_ the groups it's cross-posted to. This is a space-saver for
>when someone cross-posts between binaries and non-binaries; it's
>especially useful if you use -l.  That it also zaps small posts
>cross-posted into the binaries groups doesn't bother me in the
>slightest....

----------------------------------------------------------
 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: expire performance enhancement
#7128
Author: Don Lewis
Date: Wed, 01 May 1996 00:00
19 lines
1477 bytes
In article <Dqp091.7q3@twwells.com>, T. William Wells <bill@twwells.com> wrote:
>BTW, the hack I added: a flag X in expire.ctl that says that if
>an article matches that line then the article gets expired in
>_all_ the groups it's cross-posted to. This is a space-saver for
>when someone cross-posts between binaries and non-binaries; it's
>especially useful if you use -l.  That it also zaps small posts
>cross-posted into the binaries groups doesn't bother me in the
>slightest....

And if you keep the *.answers groups longer than discussion groups,
it expires the FAQ articles from the *.answers groups a lot sooner
if they are crossposted to their respective discussion groups :-(
-- 
Don "Truck" Lewis                                       Silicon Systems
Internet: gdonl@gv.ssi1.com                             138 New Mohawk Road
Phone: +1 916 478-8284       FAX: +1 916 478-8251       Nevada City, CA  95959

Re: expire performance enhancement
#7134
Author: Jerry Aguirre
Date: Wed, 01 May 1996 00:00
39 lines
2133 bytes
In article <Dqp091.7q3@twwells.com> bill@twwells.com (T. William Wells) writes:
>
>Ever notice how it seems to take *forever* to run through the
>history file? Well, last night, I was hacking on expire and noted
>that it has a hash table for newsgroups. However, there are only
>128 buckets in the table. I set it to 2048 and cut the processing
>time to what looks to be about half of the original. I didn't
>experiment to see what the best size would be.

I have verified this.  Unfortunatly this is on my "test" system to the
history file is only about 3 meg. and doesn't give it a very long run.
Here are the timings (two runs each) I got for various hash sizes:

#define NGH_SIZE        128
7.6u 1.5s 0:16 55% 0+612k 9+0io 4pf+0w
7.2u 1.4s 0:16 51% 0+612k 1+0io 0pf+0w

#define NGH_SIZE        512
6.5u 1.5s 0:15 50% 0+624k 2+0io 0pf+0w
6.5u 1.7s 0:10 82% 0+624k 0+0io 0pf+0w

#define NGH_SIZE        2048
6.1u 1.7s 0:08 90% 0+656k 0+0io 0pf+0w
6.1u 1.1s 0:07 93% 0+656k 0+0io 0pf+0w

#define NGH_SIZE        8192
6.1u 1.7s 0:08 90% 0+812k 0+0io 0pf+0w
6.0u 1.8s 0:09 84% 0+804k 0+0io 0pf+0w

The hash of 2048 seems about optimal for my 4K active entries.  A
site with a larger active file might want to use a larger value.
Personally I plan to use the 8192 value to allow for growth.

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.

Re: expire performance enhancement
#7169
Author: T. William Wells
Date: Thu, 02 May 1996 00:00
330 lines
10533 bytes
In article <4m6tue$5rp@sunrise.gv.ssi1.com>,
Don Lewis <gdonl@gv.ssi1.com> wrote:
: In article <Dqp091.7q3@twwells.com>, T. William Wells <bill@twwells.com> wrote:
: >BTW, the hack I added: a flag X in expire.ctl that says that if
: >an article matches that line then the article gets expired in
: >_all_ the groups it's cross-posted to. This is a space-saver for
: >when someone cross-posts between binaries and non-binaries; it's
: >especially useful if you use -l.  That it also zaps small posts
: >cross-posted into the binaries groups doesn't bother me in the
: >slightest....
:
: And if you keep the *.answers groups longer than discussion groups,
: it expires the FAQ articles from the *.answers groups a lot sooner
: if they are crossposted to their respective discussion groups :-(

It's a tool; if you use it incorrectly, you cut off your fingers.

Since I had three people ask me, I decided to post the patch.
The first hunk is for the hash table size change; everything else
is for the X flag. NB: this really is a hack; it relies on a
global variable to communicate the results back from one of the
functions....

*** src.arc/expire/expire.c     Fri Jan 12 13:48:02 1996
--- src/expire/expire.c Mon Apr 29 23:26:58 1996
***************
*** 26,32 ****
  */
  #define NGH_HASH(Name, p, j)    \
	for (p = Name, j = 0; *p; ) j = (j << 5) + j + *p++
! #define NGH_SIZE      128
  #define NGH_BUCKET(j) &NGHtable[j & (NGH_SIZE - 1)]

  typedef struct _BUFFER {
--- 26,32 ----
  */
  #define NGH_HASH(Name, p, j)    \
	for (p = Name, j = 0; *p; ) j = (j << 5) + j + *p++
! #define NGH_SIZE        2048
  #define NGH_BUCKET(j)   &NGHtable[j & (NGH_SIZE - 1)]

  typedef struct _BUFFER {
***************
*** 44,49 ****
--- 44,50 ----
      time_t              Keep;
      time_t              Default;
      time_t              Purge;
+     int                 Xpost;
  } NEWSGROUP;

  typedef struct _NGHASH {
***************
*** 78,83 ****
--- 79,85 ----
  STATIC long             EXPsaved;
  STATIC NEWSGROUP        *Groups;
  STATIC NEWSGROUP        EXPdefault;
+ STATIC NEWSGROUP        *EXPfound;
  STATIC NGHASH           NGHtable[NGH_SIZE];
  STATIC STRING           EXPreason;
  STATIC time_t           EXPremember;
***************
*** 314,323 ****
  **  Set the expiration fields for all groups that match this pattern.
  */
  STATIC void
! EXPmatch(p, v, mod)
      register char     *p;
      register NEWSGROUP        *v;
      register char     mod;
  {
      register NEWSGROUP        *ngp;
      register int      i;
--- 316,326 ----
  **  Set the expiration fields for all groups that match this pattern.
  */
  STATIC void
! EXPmatch(p, v, mod, xpost)
      register char       *p;
      register NEWSGROUP  *v;
      register char       mod;
+     register int        xpost;
  {
      register NEWSGROUP  *ngp;
      register int        i;
***************
*** 334,339 ****
--- 337,343 ----
		ngp->Keep      = v->Keep;
		ngp->Default   = v->Default;
		ngp->Purge     = v->Purge;
+               ngp->Xpost     = xpost;
		if (EXPverbose > 4) {
		    (void)printf("%s", ngp->Name);
		    (void)printf(" %13.13s", ctime(&v->Keep) + 3);
***************
*** 358,363 ****
--- 362,368 ----
      register int        k;
      register char       mod;
      NEWSGROUP           v;
+     int                 xpost;
      BOOL                SawDefault;
      char                buff[BUFSIZ];
      char                *fields[6];
***************
*** 412,417 ****
--- 417,423 ----
	    (void)fprintf(stderr, "Line %d bad modflag\n", i);
	    return FALSE;
	}
+       xpost = strchr(fields[1], 'X') != NULL;
	if (!EXPgetnum(i, fields[2], &v.Keep,    "keep")
	 || !EXPgetnum(i, fields[3], &v.Default, "default")
	 || !EXPgetnum(i, fields[4], &v.Purge,   "purge"))
***************
*** 449,455 ****
	    return FALSE;
	}
	for (k = 0; k < j; k++)
!           EXPmatch(patterns[k], &v, mod);
      }
      DISPOSE(patterns);

--- 455,461 ----
	    return FALSE;
	}
	for (k = 0; k < j; k++)
!           EXPmatch(patterns[k], &v, mod, xpost);
      }
      DISPOSE(patterns);

***************
*** 527,532 ****
--- 533,540 ----
      *p = '\0';
      if ((ngp = NGfind(Entry)) == NULL)
	ngp = EXPnotfound(Entry);
+     EXPfound = ngp;
+
      *p = '/';

      if (EXPverbose > 2) {
***************
*** 604,622 ****
  **  Do the work of expiring one line.
  */
  STATIC BOOL
! EXPdoline(out, line, length, arts)
      FILE              *out;
      char              *line;
      int                       length;
      char              **arts;
  {
      static char               IGNORING[] = "Ignoring bad line, \"%.20s...\"\n";
      static long               Offset;
      static BUFFER     New;
      register char     *p;
      register char     *q;
-     register char     *first;
      register int      i;
      int                       count;
      char              *fields[4];
      time_t            Arrived;
--- 612,632 ----
  **  Do the work of expiring one line.
  */
  STATIC BOOL
! EXPdoline(out, line, length, arts, flags)
      FILE                *out;
      char                *line;
      int                 length;
      char                **arts;
+     int                 *flags;
  {
      static char         IGNORING[] = "Ignoring bad line, \"%.20s...\"\n";
      static long         Offset;
      static BUFFER       New;
      register char       *p;
      register char       *q;
      register int        i;
+     int                 xflag;
+     int                 keep;
      int                 count;
      char                *fields[4];
      time_t              Arrived;
***************
*** 703,744 ****
	    New.Size = length;
	    RENEW(New.Data, char, New.Size);
	}

!       /* The "first" variable tells us if we haven't saved the first
!        * article yet.  This only matters if we're doing link-saving. */
!       first = EXPlinks && count > 1 ? arts[0] : (char *)NULL;
!
!       /* Loop over all file entries, see if we should keep each one. */
	for (size = -1, q = New.Data, i = 0; i < count; i++) {
	    p = arts[i];
!           if (*p == '\0')
!               /* Shouldn't happen. */
!               continue;
!           if (EXPkeepit(p, when, Expires)) {
		if (EXPverbose > 1)
		    (void)printf("keep %s\n", p);
-               if (first != NULL) {
-                   /* Keeping one and haven't kept the first; so save it. */
-                   if (i > 0)
-                       q += strlen(strcpy(q, first));
-                   first = NULL;
-               }
		if (q > New.Data)
		    *q++ = ' ';
		q += strlen(strcpy(q, p));
!               continue;
!           }
!
!           /* Don't delete the file if preserving symbolic links to it. */
!           if (EXPlinks && i == 0 && count > 1)
!               continue;
	    EXPremove(arts[i], &size);
	}
!
!       /* If saving links and didn't have to save the leader, delete it. */
!       if (EXPlinks && first != NULL)
!           EXPremove(first, &size);
!
	if (q == New.Data) {
	    if (EXPsizing && size > 0)
		EXPsaved += size;
--- 713,758 ----
	    New.Size = length;
	    RENEW(New.Data, char, New.Size);
	}
+       /* First, make a pass over the articles to see which should be
+          expired. */

!       xflag = 0;
!       keep = 0;
!       for (i = 1; i < count; i++) {
!           if (flags[i] = EXPkeepit(arts[i], when, Expires)) {
!               keep = 1;
!           } else if (EXPfound->Xpost) {
!               xflag = 1;
!               break;
!           }
!       }
!       if (!xflag && count > 0) {
!           if (!(flags[0] = EXPkeepit(arts[0], when, Expires))) {
!               if (EXPfound->Xpost) {
!                   xflag = 1;
!               }
!           }
!       }
!       if (xflag) {
!           for (i = 0; i < count; i++) {
!               flags[i] = 0;
!           }
!       } else if (keep && EXPlinks) {
!           flags[0] = 1;
!       }
!       /* Loop over all file entries, get rid of those we don't want. */
	for (size = -1, q = New.Data, i = 0; i < count; i++) {
	    p = arts[i];
!           if (flags[0]) {
		if (EXPverbose > 1)
		    (void)printf("keep %s\n", p);
		if (q > New.Data)
		    *q++ = ' ';
		q += strlen(strcpy(q, p));
!           } else {
		EXPremove(arts[i], &size);
	    }
!       }
	if (q == New.Data) {
	    if (EXPsizing && size > 0)
		EXPsaved += size;
***************
*** 873,878 ****
--- 887,893 ----
      FILE                *F;
      char                *active;
      char                **arts;
+     int                 *flags;
      STRING              History;
      STRING              HistoryText;
      STRING              HistoryPath;
***************
*** 1055,1060 ****
--- 1070,1076 ----

      /* Main processing loop. */
      arts = NEW(char*, nGroups);
+     flags = NEW(int, nGroups);
      if ((qp = QIOopen(HistoryText, QIO_BUFFER)) == NULL) {
	(void)fprintf(stderr, "Can't open history file, %s\n",
		strerror(errno));
***************
*** 1062,1068 ****
      }
      for (Bad = FALSE, line = 1, Paused = FALSE; ; line++) {
	if ((p = QIOread(qp)) != NULL) {
!           if (!EXPdoline(out, p, QIOlength(qp), arts)) {
		Bad = TRUE;
		if (errno == ENOSPC) {
		    (void)unlink(NHistory);
--- 1078,1084 ----
      }
      for (Bad = FALSE, line = 1, Paused = FALSE; ; line++) {
	if ((p = QIOread(qp)) != NULL) {
!           if (!EXPdoline(out, p, QIOlength(qp), arts, flags)) {
		Bad = TRUE;
		if (errno == ENOSPC) {
		    (void)unlink(NHistory);
***************
*** 1101,1106 ****
--- 1117,1123 ----
      }
      QIOclose(qp);
      DISPOSE(arts);
+     DISPOSE(flags);

      if (Writing) {
	/* Close the output files. */



Re: expire performance enhancement (fastrm times)
#7181
Author: Mark Wedel
Date: Thu, 02 May 1996 00:00
34 lines
2028 bytes
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.

 One our main news server, there are 6 2 gig drives devoted for articles,
with anothe drive for overview (drives aren't striped, so there are 6
filesystems, news, news2, news3, ...)

 I made some changes to expirerm to split up the expire list based on
hierarchy and which drive those are stored on.  So, I have one split
for bit, comp, rec (on news2), another one for alt (on news3+), and another
for just everything else (on news.).  Then I run 3 fastrm processes and the
expireover all at the same time.  This greatly reduces expire time - this
works nicely since each one is using a different disk.

 I could probably tune this a little better (as well as better mix storing
binaries and discussion groups on the same drive for better performance),
but so far, I haven't hit performance issues on this.

 Having multiple cpus certainly helps in the above scenario in that I still
don't need to worry about cpu limitations (system actually has 7 cpus.)


-- 
 --Mark

Re: expire performance enhancement
#7182
Author: Andrew A. Vasilyev
Date: Thu, 02 May 1996 00:00
16 lines
1148 bytes
Jerry Aguirre (jerry@strobe.ATC.Olivetti.Com) wrote:
> The hash of 2048 seems about optimal for my 4K active entries.  A
> site with a larger active file might want to use a larger value.
> Personally I plan to use the 8192 value to allow for growth.

> 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.

  Well, and what about increasing NGH_SIZE in innd/ng.c and
  GRP_SIZE in nnrpd/group.c?
______
	ANDY

Re: expire performance enhancement
#7183
Author: T. William Wells
Date: Thu, 02 May 1996 00:00
15 lines
1028 bytes
In article <slrn4oevnk.ou7.handler@unix3.netaxs.com>,
Michael Handler <handler@netaxs.com> wrote:
: I think that Bill's patch (which I'd really like to see for myself,

I posted it.

: BTW) only works on lines in expire.ctl which explicitly specify the
: flag.  F'rinstance, I'd put the 'X' flag on my alt.test*,
: alt.binaries*, and alt.sex.pictures* lines, but probably not anywhere
: else.

That's correct.

Re: expire performance enhancement
#7184
Author: T. William Wells
Date: Thu, 02 May 1996 00:00
43 lines
2421 bytes
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.

I do expire at two different times. With the news.daily run, I do
a regular expire. Whenever disk space is low, I do a "fast
expire".

The fast expire starts with expire run with the options to not
recreate the history file. This lets me get to deleting files as
quickly as possible. In that case, the time spent in expire is
important -- it determines how long it'll be from the time I
detect the low space condition to the time I start deleting files.

A couple of notes on this. First, by only recreating the history
files once a day, I don't have the problem with multiple deleted
history files hanging around and causing the file system my lib
directory is on filling up.

Second, it's nothing as simple as just expire and fastrm. The
actual procedure is more like:

	expire and don't recreate the history files
	sort the resulting file of deletes
	save this sorted file for the next run of the fast expire
	comm this file against the previous set of deletes
	send the comm'ed output into fastrm

The reason for this is that, as I don't recreate the history
file, each time I do an expire run, already deleted files go into
the output; thus the system would spend lots of time trying to
delete files already deleted.

BTW, I have another trick in my arsenal for speeding up expires.
The last step is actually more complex. I split the comm'ed
output into multiple files, one for each news spindle and run a
fastrm on each of the files. That way, all the spindles get
things deleted off them ASAP.

Re: expire performance enhancement
#7197
Author: Robin Chen
Date: Fri, 03 May 1996 00:00
50 lines
2670 bytes
T. William Wells (bill@twwells.com) wrote:
: Ever notice how it seems to take *forever* to run through the
: history file? Well, last night, I was hacking on expire and noted
: that it has a hash table for newsgroups. However, there are only
: 128 buckets in the table. I set it to 2048 and cut the processing
: time to what looks to be about half of the original. I didn't
: experiment to see what the best size would be.
: 
: BTW, the hack I added: a flag X in expire.ctl that says that if
: an article matches that line then the article gets expired in
: _all_ the groups it's cross-posted to. This is a space-saver for
: when someone cross-posts between binaries and non-binaries; it's
: especially useful if you use -l.  That it also zaps small posts
: cross-posted into the binaries groups doesn't bother me in the
: slightest....


Hello,

	Your implementation of the X flag is a really great idea. I've
always wanted to limit the crossposting of the binaries newsgroups as I
have them set on a faster expire time than others.  Having them
crossposting to newsgroups that stays around defeats the limit on expire
time set for binaries.  Great job!

	However, here's the problem.  I tried to put in your patch to
Unoff4 and could not get it to go through, so I decided to patch it
manually.  Using a diff on the patch file I later made, I found it was
some problem with the spacing. Probably because of different tab setting. 
Anyway, it compiled without problem, but when I expired, I got one extra
line that I don't see before. 

	Bad entry, ""

Is this normal, or did I mess up on the manual patching?

	Another question I have is my expire time from the expire.log used
to says it's in the 6 minutes range.  After increasing the NGH_SIZE, it is
still in the 6 minutes range.  Should I increase it to higher number, or
does it only work for larger amount of articles? 

	I'm running on dx4-100 with 24M ram.  Expire 4 times a day with
about 40k to 60k files unlinked in each run using news.daily delayrm 
expireover, with norotate flag for 3 of the expires.


Robin

Re: expire performance enhancement
#7213
Author: Rich Salz
Date: Fri, 03 May 1996 00:00
8 lines
766 bytes
The NGH_HASH should definitely be increased.

While I have a few quibbles with the implementation, I definitely like
the idea of the X flag for expire.ctl.  Nice idea.
	/r$

Re: expire performance enhancement
#7222
Author: Dougal Campbell
Date: Fri, 03 May 1996 00:00
23 lines
1644 bytes
Robin Chen (robinche@mail.vividnet.com) proclaimed:
[....]
> 	However, here's the problem.  I tried to put in your patch to
> Unoff4 and could not get it to go through, so I decided to patch it
> manually.  Using a diff on the patch file I later made, I found it was
> some problem with the spacing. Probably because of different tab setting. 
[....]

I recently ran across something similar with another patch. I had saved
the patch (emailed a copy to myself, actually), and the tabs were
converted to spaces.  Shortly after I requested a more direct copy of
the patch from the author, I thought to check the man page for patch,
and found that it had a '-l' option that will munge whitespace.  Worked
like a charm!

--
Dougal Campbell      | "Quick to judge, quick to anger. |      Rush
System Administrator |  Slow to understand.             |  "Witch Hunt"
interQuest / Hsv, AL |  Ignorance and predjudice        | Moving Pictures
dougal@iquest.com    |  And fear go hand in hand."      |      1981

Re: expire performance enhancement
#7254
Author: Evan Champion
Date: Sun, 05 May 1996 00:00
21 lines
1287 bytes
bill@twwells.com (T. William Wells) wrote:

>Ever notice how it seems to take *forever* to run through the
>history file? Well, last night, I was hacking on expire and noted
>that it has a hash table for newsgroups. However, there are only
>128 buckets in the table. I set it to 2048 and cut the processing
>time to what looks to be about half of the original. I didn't
>experiment to see what the best size would be.

This has sort of gotten me thinking about what other hard-coded
constants are set in inn that are really too low/too high for modern
hardware and news volumes.  Has anyone poked around at other areas
where (safe) performance improvements may be made in terms of
increasing/reducing constants?

Evan



Re: expire performance enhancement
#7258
Author: Alan Brown
Date: Sun, 05 May 1996 00:00
29 lines
1932 bytes
In article <4m8bmq$sqa@olivea.atc.olivetti.com>,
Jerry Aguirre <jerry@strobe.ATC.Olivetti.Com> wrote:

>The hash of 2048 seems about optimal for my 4K active entries.  A
>site with a larger active file might want to use a larger value.
>Personally I plan to use the 8192 value to allow for growth.

ANy easy way to make this dynamic at runtime? Many sites are well over 
10k entries and by the time 16k rolls around this will probably have been 
forgotten again.

>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.

I find that processing of the history file is the most cpu intensive
of all the things done. Over the last few days it's taken as long as 6 
hours and as little as 1 hour as things settle to cope with my having moved
newslibs/logs onto their own 2Gb scsi drive. (Overviews get a 760Mb to 
themselves too)

AB
-- 
"But you can't say they have arrived to classify your nervous lies
 What's right, what's not, what may not be. Don't try your tricky tests on me
 For I won't live in fear my friend - that every day could be my end"

Re: expire performance enhancement
#7259
Author: Simon Lyall
Date: Sun, 05 May 1996 00:00
30 lines
1652 bytes
Don Lewis (gdonl@gv.ssi1.com) wrote:
>In article <Dqp091.7q3@twwells.com>, T. William Wells <bill@twwells.com> wrote:
>>BTW, the hack I added: a flag X in expire.ctl that says that if
>>an article matches that line then the article gets expired in
>>_all_ the groups it's cross-posted to. This is a space-saver for
>>when someone cross-posts between binaries and non-binaries; it's
>>especially useful if you use -l.  That it also zaps small posts
>>cross-posted into the binaries groups doesn't bother me in the
>>slightest....

>And if you keep the *.answers groups longer than discussion groups,
>it expires the FAQ articles from the *.answers groups a lot sooner
>if they are crossposted to their respective discussion groups :-(

I would assume the patch still acts one the last match in the expire.ctl ?

So something like:

*:A:2:4:10
*binaries*:X:1:2:2
*.answers:M:1:14:29

would solve this problem.

--
Simon J. Lyall.  |  Busy  |  Email - simon@darkmere.gen.nz
"Inside me Im Screaming, Nobody pays any attention. " | MT.

Re: expire performance enhancement
#7262
Author: -dsr-
Date: Sun, 05 May 1996 00:00
23 lines
1460 bytes
In article <4mdrdc$jp6@cancer.vividnet.com>,
	robinche@mail.vividnet.com (Robin Chen) writes:
>
>	Another question I have is my expire time from the expire.log used
>to says it's in the 6 minutes range.  After increasing the NGH_SIZE, it is
>still in the 6 minutes range.  Should I increase it to higher number, or
>does it only work for larger amount of articles? 

Well, six minutes is just a perfectly peachy amount of time to spend
on an expire. It's the three and four hour expires which will benefit
from this, IMH(and as-yet untested)O.

-dsr-

-- 
D.S. Ritter --                     Spectra.Net Communications (607) 798-7300 
dan@spectra.net                  Network Systems Architect - UNIX curmudgeon
[INTX]  sysadmin, news, postmaster, Co-moderator of alt.humor.best-of-usenet 
 "Why would you enter a command if you don't first know its consequences?" 


Re: expire performance enhancement
#7266
Author: Mark Delany
Date: Sun, 05 May 1996 00:00
29 lines
1685 bytes
evanc@synapse.net (Evan Champion) writes:

>>that it has a hash table for newsgroups. However, there are only
>>128 buckets in the table. I set it to 2048 and cut the processing

>This has sort of gotten me thinking about what other hard-coded
>constants are set in inn that are really too low/too high for modern
>hardware and news volumes.  Has anyone poked around at other areas
>where (safe) performance improvements may be made in terms of
>increasing/reducing constants?

I guess the general answer is that tuning most/all of those limits
will improve CPU performance. Nothing wrong with that, but how many
news servers have a CP problem?

Having said that, it is interesting to note the Rich Salz did go to
some trouble to keep CP usage down to a minimum, what with all those
first character checks before embarking on a strcmp() and so on, so
maybe we don't have a CP problem because of tuning.

I would expect that upping the size of the various hash tables would
be a painless thing to do, so maybe someone could ramp them up and see
if they notice any difference?


Regards.

Re: expire performance enhancement
#7337
Author: Evan Champion
Date: Tue, 07 May 1996 00:00
24 lines
1404 bytes
Mark Delany <markd@mira.net.au> wrote:

>I guess the general answer is that tuning most/all of those limits
>will improve CPU performance. Nothing wrong with that, but how many
>news servers have a CP problem?

I certainly don't.  The question, however, is where does increasing
certain constants derive a tangible performance improvement
irrespective of what happens to the CPU load which is not really an
issue for most of us.

>I would expect that upping the size of the various hash tables would
>be a painless thing to do, so maybe someone could ramp them up and see
>if they notice any difference?

That's more or less what I was thinking.  Unfortunately I don't have a
backup news server that I could play around with but I know some
people out there do.

Evan


Re: expire performance enhancement (fastrm times)
#7340
Author: 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

Re: expire performance enhancement
#7430
Author: Piers Cawley
Date: Thu, 09 May 1996 00:00
16 lines
1146 bytes
In article <4mdcp9$8a1@paperboy.osf.org>,
	rsalz@osf.org (Rich Salz) writes:
>The NGH_HASH should definitely be increased.

Hmm... if expire will benefit from upping NGH_SIZE to 2048 would innd
benefit from bumping NGH_SIZE to something larger than 512?

-- 
   Piers Cawley - Systems Sheriff on the Frontier Internet Service
	    Purveyors of fine connections to the Internet
	  0D 02 A0 20 54 E0 60 02   2B 77 F8 D1 8B EB 3F 36
     finger pdcawley@mercury.ftech.net for PGP key and Geek Code


Re: expire performance enhancement
#7576
Author: T. William Wells
Date: Tue, 14 May 1996 00:00
45 lines
2431 bytes
In article <4n8oib$4hc@news.ims.mariposa.ca.us>,
Mike Bird <mgb@ims.mariposa.ca.us> wrote:
: A patch was posted here a couple of weeks ago to implement an X flag
: in expire.ctl to signify that an article should be removed from all
: cross-posts when it expires in the flagged group.
:
: The patch seems to have two problems:
:
: (1) A minor typo causes postings of an article to be removed based on
: the expiration of the first posting only.

Oops!  For those using the original patch, see the second line of
the for loop that is supposed to recreate the entry; change the
flags[0] to flags[i].

The effect of this error: the entire entry is expired if and only
if the first newsgroup gets expired. If you're not using expire -l
this is a big lose; the first article goes away and they all go
away.  If you're using -l, this has a lesser effect; an article
doesn't get expired from any newsgroup until it gets expired from
all of them. Unless there's an X flag floating around; in that
case, they all get expired when the first one does.

: (2) Removal of some "shouldn't happen" (but apparently necessary) code
: results in lots of "Bad Entry" messages during subsequent expires.  We
: haven't figured out the exact circumstances under which this occurs.

Weird. I never see them.

: (This patch is smaller than the original because it is
: closer to the original logic of expire.)

I prefer my logic, as it's a whole lot clearer and also separates
out the decision about what to keep from the construction of the
new history entry.

: closer to the original logic of expire.)  (We originally used the
: P=Poison flag but have changed to X for compatibility with the
: previous patch.)

*Chuckle*. I like your P name *much* better than my X (for X-post)
name.

Re: expire performance enhancement
#7593
Author: Mike Bird
Date: Tue, 14 May 1996 00:00
215 lines
6769 bytes
A patch was posted here a couple of weeks ago to implement an X flag
in expire.ctl to signify that an article should be removed from all
cross-posts when it expires in the flagged group.

The patch seems to have two problems:

(1) A minor typo causes postings of an article to be removed based on
the expiration of the first posting only.

(2) Removal of some "shouldn't happen" (but apparently necessary) code
results in lots of "Bad Entry" messages during subsequent expires.  We
haven't figured out the exact circumstances under which this occurs.

The following patch has been in use for a week and does the same job.
We haven't noticed any problems.  Remove the previous patch before
applying this.  (This patch is smaller than the original because it is
closer to the original logic of expire.)  (We originally used the
P=Poison flag but have changed to X for compatibility with the
previous patch.)

NOTE: To clean bad entries from the previous patch use something like:

  awk <history >history.n -F '\t' 'NF!=3 || /\t.*\t.*\// {print}'

- then follow the directions for makehistory -r in news-recovery(8).

Your mileage may vary.  Caveat emptor.  ...

======================================== 
--- expire.c.SAFE	Sat Apr 27 17:40:54 1996
+++ expire.c	Mon May  6 07:58:33 1996
@@ -26,7 +26,7 @@
 */
 #define NGH_HASH(Name, p, j)    \
 	for (p = Name, j = 0; *p; ) j = (j << 5) + j + *p++
-#define NGH_SIZE	128
+#define NGH_SIZE	2048
 #define NGH_BUCKET(j)	&NGHtable[j & (NGH_SIZE - 1)]
 
 typedef struct _BUFFER {
@@ -44,6 +44,8 @@
     time_t		Keep;
     time_t		Default;
     time_t		Purge;
+    /* X flag => remove entire article when it expires in this group
*/
+    BOOL                Poison;
 } NEWSGROUP;
 
 typedef struct _NGHASH {
@@ -97,6 +99,8 @@
 
 extern double		atof();
 
+enum KRP {Keep, Remove, Poison};
+
 
 
 /*
@@ -334,6 +338,7 @@
 		ngp->Keep      = v->Keep;
 		ngp->Default   = v->Default;
 		ngp->Purge     = v->Purge;
+		ngp->Poison    = v->Poison;
 		if (EXPverbose > 4) {
 		    (void)printf("%s", ngp->Name);
 		    (void)printf(" %13.13s", ctime(&v->Keep) + 3);
@@ -412,6 +417,7 @@
 	    (void)fprintf(stderr, "Line %d bad modflag\n", i);
 	    return FALSE;
 	}
+	v.Poison = (strchr(fields[1], 'X') != NULL);
 	if (!EXPgetnum(i, fields[2], &v.Keep,    "keep")
 	 || !EXPgetnum(i, fields[3], &v.Default, "default")
 	 || !EXPgetnum(i, fields[4], &v.Purge,   "purge"))
@@ -440,6 +446,7 @@
 	    EXPdefault.Keep    = v.Keep;
 	    EXPdefault.Default = v.Default;
 	    EXPdefault.Purge   = v.Purge;
+	    EXPdefault.Poison  = v.Poison;
 	    SawDefault = TRUE;
 	}
 
@@ -510,7 +517,7 @@
 /*
 **  Should we keep the specified article?
 */
-STATIC BOOL
+STATIC enum KRP
 EXPkeepit(Entry, when, Expires)
     char		*Entry;
     time_t		when;
@@ -522,7 +529,7 @@
     if ((p = strchr(Entry, '/')) == NULL) {
 	(void)fflush(stdout);
 	(void)fprintf(stderr, "Bad entry, \"%s\"\n", Entry);
-	return TRUE;
+	return Keep;
     }
     *p = '\0';
     if ((ngp = NGfind(Entry)) == NULL)
@@ -549,12 +556,17 @@
     }
 
     /* If no expiration, make sure it wasn't posted before the
default. */
-    if (Expires == 0)
-	return when >= ngp->Default;
+    if (Expires == 0) {
+	if (when >= ngp->Default)
+	    return Keep;
 
     /* Make sure it's not posted before the purge cut-off and
      * that it's not due to expire. */
-    return when >= ngp->Purge && (Expires >= Now || when >=
ngp->Keep);
+    } else {
+        if (when >= ngp->Purge && (Expires >= Now || when >=
ngp->Keep))
+	    return Keep;
+    }
+    return ngp->Poison ? Poison : Remove;
 }
 
 
@@ -604,11 +616,12 @@
 **  Do the work of expiring one line.
 */
 STATIC BOOL
-EXPdoline(out, line, length, arts)
+EXPdoline(out, line, length, arts, krps)
     FILE		*out;
     char		*line;
     int			length;
     char		**arts;
+    enum KRP            *krps;
 {
     static char		IGNORING[] = "Ignoring bad line, \"%.20s...\"\n";
     static long		Offset;
@@ -628,6 +641,7 @@
     datum		key;
     datum		value;
     char 		date[20];
+    BOOL                poisoned;
 
     /* Split up the major fields. */
     i = EXPsplit(line, HIS_FIELDSEP, fields, SIZEOF(fields));
@@ -704,6 +718,14 @@
 	    RENEW(New.Data, char, New.Size);
 	}
 
+	/* First check all postings */
+
+	poisoned = FALSE;
+	for (i = 0; i < count; ++i) {
+	  if ((krps[i] = EXPkeepit(arts[i], when, Expires)) == Poison)
+	      poisoned = TRUE;
+	}
+
 	/* The "first" variable tells us if we haven't saved the first
 	 * article yet.  This only matters if we're doing link-saving.
*/
 	first = EXPlinks && count > 1 ? arts[0] : (char *)NULL;
@@ -714,7 +736,7 @@
 	    if (*p == '\0')
 		/* Shouldn't happen. */
 		continue;
-	    if (EXPkeepit(p, when, Expires)) {
+	    if (!poisoned && krps[i] == Keep) {
 		if (EXPverbose > 1)
 		    (void)printf("keep %s\n", p);
 		if (first != NULL) {
@@ -873,6 +895,7 @@
     FILE		*F;
     char		*active;
     char		**arts;
+    enum KRP            *krps;
     STRING		History;
     STRING		HistoryText;
     STRING		HistoryPath;
@@ -1055,6 +1078,7 @@
 
     /* Main processing loop. */
     arts = NEW(char*, nGroups);
+    krps = NEW(enum KRP, nGroups);
     if ((qp = QIOopen(HistoryText, QIO_BUFFER)) == NULL) {
 	(void)fprintf(stderr, "Can't open history file, %s\n",
 		strerror(errno));
@@ -1062,7 +1086,7 @@
     }
     for (Bad = FALSE, line = 1, Paused = FALSE; ; line++) {
 	if ((p = QIOread(qp)) != NULL) {
-	    if (!EXPdoline(out, p, QIOlength(qp), arts)) {
+	    if (!EXPdoline(out, p, QIOlength(qp), arts, krps)) {
 		Bad = TRUE;
 		if (errno == ENOSPC) {
 		    (void)unlink(NHistory);
@@ -1100,6 +1124,7 @@
 	Paused = TRUE;
     }
     QIOclose(qp);
+    DISPOSE(krps);
     DISPOSE(arts);
 
     if (Writing) {


----------------------------------------------------------
 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/


Expire patch fixes "Bad Entry" messages
#7941
Author: Mike Bird
Date: Fri, 24 May 1996 00:00
60 lines
2674 bytes
[Posted to news.software.nntp]

05/13 I posted a patch here containing a fix for the poison pill
expire but it didn't fix "Bad Entry" messages.  This new patch works
with my version of poison pill and will probably fix bill@twwells.com
version too.

The EXPsplit function previously could not report a count of zero
postings for a history "cancel" entry.  This was covered in the
original expire code by a "shouldn't happen" test.  bill@twwells.com
left out the "shouldn't happen" code in his version and I moved the
EXPkeepit call out of the area protected by the test.  Although some
more "shouldn't happen" tests would fix the problem, it seems more
elegant to allow EXPsplit to report zero when that is the case.

The danger of this fix is that there may be other code that relies on
EXPsplit returning one when no fields are present - but I can't find
any and it seems to work OK.

INND writes "cancel" entries with an empty third field.  Expire seems
to convert these to "remembered" entries with only two fields.  This
seems to work but I don't understand why there are two formats -
perhaps for debugging or historical reasons.  (This conversion means
that running one expire shortly after another may not encounter any
cancels in their original format - which is why I originally thought
the bug was fixed when it wasn't.)

An alternative patch might be to have INND write two-field
"remembered" entries for cancels.

--Mike

--- expire.c.SAFE	Thu May 23 04:59:59 1996
+++ expire.c	Thu May 23 05:15:05 1996
@@ -252,6 +252,15 @@
 {
     register int	i;
 
+    if (!p)
+      return 0;
+
+    while (*p == sep)
+      ++p;
+
+    if (!*p)
+      return 0;
+
     for (i = 1, *argv++ = p; *p; )
 	if (*p++ == sep) {
 	    if (++i == count)


----------------------------------------------------------
 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/


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