🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
9 messages
9 total messages Started by Matt Dillon Tue, 04 Feb 1997 00:00
Patch to inn-1.5.1's nnrpd to mmap() the active file shared+ro
#14729
Author: Matt Dillon
Date: Tue, 04 Feb 1997 00:00
531 lines
14159 bytes
    This patch uses mmap() to map the active file shared + read-only.
    For newsreader machines with large (~ 1MByte) active files, this
    patch more then halves the per-nnrpd process memory usage.  It is
    roughly equivalent to the shared-active mods that have been
    floating around, but approaches the problem somewhat differently.

    I don't know which is better, or whether it even matters.  I do know
    that this patch allows our newsreader machine to support nearly twice
    as many nnrpd's as it would otherwise be able to... around 
    500 nnrpd processes on a 256 MByte pentium-pro 200 running FreeBSD.

    The patch has been reasonably well tested, and since it restricts
    itself to a read-only map, it ought to work on any machine that
    supports mmap().

					-Matt

diff -r -c nnrpd/commands.c nnrpd-matt/commands.c
*** nnrpd/commands.c	Tue Dec 17 06:40:40 1996
--- nnrpd-matt/commands.c	Mon Feb  3 21:59:33 1997
***************
*** 322,329 ****
  	    if (gp) {
  		Reply("%d list:\r\n", NNTP_LIST_FOLLOWS_VAL);
  		Printf("%s %ld %ld %c%s\r\n.\r\n",
! 		      gp->Name, (long)gp->High, (long)gp->Low,
! 		      gp->Flag, gp->Alias ? gp->Alias : "");
  		return;
  	    }
  	    wildarg = av[2];
--- 322,329 ----
  	    if (gp) {
  		Reply("%d list:\r\n", NNTP_LIST_FOLLOWS_VAL);
  		Printf("%s %ld %ld %c%s\r\n.\r\n",
! 		      GPNAME(gp), (long)GPHIGH(gp), (long)GPLOW(gp),
! 		      GPFLAG(gp), GPALIAS(gp) ? GPALIAS(gp) : "");
  		return;
  	    }
  	    wildarg = av[2];
***************
*** 528,535 ****
  		continue;
  	}
  	Printf("%s %ld %ld %c%s\r\n",
! 	    p, (long)gp->High, (long)gp->Low,
! 	    gp->Flag, gp->Alias ? gp->Alias : "");
      }
      QIOclose(qp);
      Printf(".\r\n");
--- 528,535 ----
  		continue;
  	}
  	Printf("%s %ld %ld %c%s\r\n",
! 	    p, (long)GPHIGH(gp), (long)GPLOW(gp),
! 	    GPFLAG(gp), GPALIAS(gp) ? GPALIAS(gp) : "");
      }
      QIOclose(qp);
      Printf(".\r\n");
diff -r -c nnrpd/group.c nnrpd-matt/group.c
*** nnrpd/group.c	Tue Dec 17 06:40:40 1996
--- nnrpd-matt/group.c	Mon Feb  3 22:32:25 1997
***************
*** 8,13 ****
--- 8,14 ----
  #include "clibrary.h"
  #include "nnrpd.h"
  #include "mydir.h"
+ #include <sys/mman.h>
  
  
  /*
***************
*** 20,28 ****
--- 21,32 ----
  #define GRP_BUCKET(j)	&GRPtable[j & (GRP_SIZE - 1)]
  
  typedef struct _GRPHASH {
+ #ifdef NOTDEF
      int		Size;
      int		Used;
      GROUPENTRY	**Groups;
+ #endif
+     GROUPENTRY	*First;
  } GRPHASH;
  
  
***************
*** 42,57 ****
      register char		*p;
      register unsigned int	j;
      register int		i;
!     register GROUPENTRY		**gpp;
      GRPHASH			*htp;
      char			c;
  
      /* SUPPRESS 6 *//* Over/underflow from plus expression */
      GRP_HASH(group, p, j);
      htp = GRP_BUCKET(j);
!     for (c = *group, gpp = htp->Groups, i = htp->Used; --i >= 0; gpp++)
! 	if (c == gpp[0]->Name[0] && EQ(group, gpp[0]->Name))
! 	    return gpp[0];
      return NULL;
  }
  
--- 46,62 ----
      register char		*p;
      register unsigned int	j;
      register int		i;
!     register GROUPENTRY		*gp;
      GRPHASH			*htp;
      char			c;
  
      /* SUPPRESS 6 *//* Over/underflow from plus expression */
      GRP_HASH(group, p, j);
      htp = GRP_BUCKET(j);
!     for (c = *group, gp = htp->First; gp; gp = gp->Next) {
!         if (c == GPNAME(gp)[0] && EQ(group, GPNAME(gp)))
!             return gp;
!     }
      return NULL;
  }
  
***************
*** 69,74 ****
--- 74,83 ----
      GRPbuckets = GRPsize / GRP_SIZE;
      if (GRPbuckets == 0)
  	GRPbuckets = 1;
+     for (i = 0; i < GRP_SIZE; ++i)
+ 	GRPtable[i].First = NULL;
+ 
+ #ifdef NOTDEF
      if (GRPtable[0].Groups)
  	for (i = GRP_SIZE, htp = GRPtable; --i >= 0; htp++)
  	    htp->Used = 0;
***************
*** 78,99 ****
  	    htp->Groups = NEW(GROUPENTRY*, htp->Size);
  	    htp->Used = 0;
  	}
  
      /* Now put all groups into the hash table. */
      for (i = GRPsize, gp = GRPentries; --i >= 0; gp++) {
  	/* SUPPRESS 6 *//* Over/underflow from plus expression */
! 	GRP_HASH(gp->Name, p, j);
  	htp = GRP_BUCKET(j);
  	if (htp->Used >= htp->Size) {
  	    htp->Size += GRPbuckets;
  	    RENEW(htp->Groups, GROUPENTRY*, htp->Size);
  	}
  	htp->Groups[htp->Used++] = gp;
      }
  
      /* Note that we don't sort the buckets. */
  }
  
  
  /*
  **  Read the active file into memory, sort it, and set the number of
--- 87,232 ----
  	    htp->Groups = NEW(GROUPENTRY*, htp->Size);
  	    htp->Used = 0;
  	}
+ #endif
  
      /* Now put all groups into the hash table. */
      for (i = GRPsize, gp = GRPentries; --i >= 0; gp++) {
  	/* SUPPRESS 6 *//* Over/underflow from plus expression */
! 	GRP_HASH(GPNAME(gp), p, j);
  	htp = GRP_BUCKET(j);
+ #ifdef NOTDEF
  	if (htp->Used >= htp->Size) {
  	    htp->Size += GRPbuckets;
  	    RENEW(htp->Groups, GROUPENTRY*, htp->Size);
  	}
  	htp->Groups[htp->Used++] = gp;
+ #endif
+ 	gp->Next = htp->First;
+ 	htp->First = gp;
+ 	
      }
  
      /* Note that we don't sort the buckets. */
  }
  
+ long XRSize = -1;
+ 
+ char *
+ XReadInFile(const char *fileName, struct stat *pst)
+ {
+     int fd;
+     char *ptr = NULL;
+     struct stat st;
+ 
+     if (pst == NULL)
+         pst = &st;
+ 
+     fd = open(fileName, O_RDONLY);
+     if (fd >= 0) {
+         if (fstat(fd, pst) == 0) {
+             ptr = (char *)mmap((caddr_t)NULL, pst->st_size + 1, PROT_READ, MAP_SHARED, fd, 0);
+             if (ptr != (char *)-1) {
+                 XRSize = pst->st_size + 1;
+                 close(fd);
+                 /* syslog(L_ERROR, "%s mapped %d", ClientHost, pst->st_size + 1);*/
+             } else {
+                 close(fd);
+                 return(ReadInFile(fileName, pst));
+             }
+         } else {
+             close(fd);
+         }
+     }
+     return(ptr);
+ }
+ 
+ void
+ XDISPOSE(char *active)
+ {
+     if (XRSize >= 0) {
+         munmap(active, XRSize);
+         XRSize = -1;
+     } else {
+         DISPOSE(active);
+     }
+ }
+ 
+ char *
+ GPNAME(GROUPENTRY *gp)
+ {
+     const char *p = strchr(gp->Ptr, ' ');
+     static char GPBuf[1024];
+ 
+     GPBuf[0] = 0;
+     if (p && p - gp->Ptr > 0 && p - gp->Ptr < sizeof(GPBuf) - 1) {
+         bcopy(gp->Ptr, GPBuf, p - gp->Ptr);
+         GPBuf[p - gp->Ptr] = 0;
+     }
+     return(GPBuf);
+ }
+ 
+ ARTNUM
+ GPHIGH(GROUPENTRY *gp)
+ {
+     const char *p = strchr(gp->Ptr, ' ');
+     long n = 0;
+     if (p)
+         n = strtol(p + 1, NULL, 10);
+     return(n);
+ }
+ 
+ ARTNUM
+ GPLOW(GROUPENTRY *gp)
+ {
+     const char *p = strchr(gp->Ptr, ' ');
+     long n = 0;
+     if (p) {
+         if ((p = strchr(p + 1, ' ')) != NULL)
+             n = strtol(p + 1, NULL, 10);
+     }
+     return(n);
+ }
+ 
+ 
+ char
+ GPFLAG(GROUPENTRY *gp)
+ {
+     const char *p = strchr(gp->Ptr, ' ');
+     char c = 'n';
+ 
+     if (p) {
+         if ((p = strchr(p + 1, ' ')) != NULL) {
+             if ((p = strchr(p + 1, ' ')) != NULL) {
+                 c = p[1];
+             }
+         }
+     }
+     return(c);
+ }
+ 
+ 
+ char *
+ GPALIAS(GROUPENTRY *gp)
+ {
+     const char *p = strchr(gp->Ptr, ' ');
+     static char GPBuf[1024];
+ 
+     GPBuf[0] = 0;
+ 
+     if (p) {
+         if ((p = strchr(p + 1, ' ')) != NULL) {
+             if ((p = strchr(p + 1, ' ')) != NULL) {
+                 if (p[0] == NF_FLAG_ALIAS &&
+                     p[1] != '\n' &&
+                     strlen(p + 1) < sizeof(GPBuf) - 1
+                 ) {
+                     strcpy(GPBuf, p + 1);
+                 }
+             }
+         }
+     }
+     return(GPBuf);
+ }
  
  /*
  **  Read the active file into memory, sort it, and set the number of
***************
*** 110,121 ****
  
      /* If re-scanning, free previous groups. */
      if (active != NULL) {
! 	DISPOSE(active);
  	DISPOSE(GRPentries);
      }
  
      /* Get the new file. */
!     active = ReadInFile(ACTIVE, (struct stat *)NULL);
      if (active == NULL) {
  	syslog(L_ERROR, "%s cant read %s %m", ClientHost, ACTIVE);
  	return FALSE;
--- 243,254 ----
  
      /* If re-scanning, free previous groups. */
      if (active != NULL) {
! 	XDISPOSE(active);
  	DISPOSE(GRPentries);
      }
  
      /* Get the new file. */
!     active = XReadInFile(ACTIVE, (struct stat *)NULL);
      if (active == NULL) {
  	syslog(L_ERROR, "%s cant read %s %m", ClientHost, ACTIVE);
  	return FALSE;
***************
*** 128,168 ****
      /* Fill in the group array. */
      GRPentries = NEW(GROUPENTRY, i);
      for (i = 0, gp = GRPentries, p = active; *p; i++, gp++, p = q + 1) {
  	gp->Name = p;
  	if ((p = strchr(p, ' ')) == NULL) {
  	    syslog(L_ERROR, "%s internal no_space1 \"%.20s...\"",
! 		ClientHost, gp->Name);
  	    return FALSE;
  	}
  	*p++ = '\0';
  
  	/* Get the high mark. */
  	if ((q = strchr(p, ' ')) == NULL) {
  	    syslog(L_ERROR, "%s internal no_space2 \"%.20s...\"",
! 		ClientHost, gp->Name);
  	    return FALSE;
  	}
  	*q++ = '\0';
  	gp->High = atol(p);
  
  	/* Get the low mark. */
  	if ((p = strchr(q, ' ')) == NULL) {
  	    syslog(L_ERROR, "%s internal no_space3 \"%.20s...\"",
! 		ClientHost, gp->Name);
  	    return FALSE;
  	}
  	*p++ = '\0';
  	gp->Low = atol(q);
  
  	/* Kill the newline. */
  	if ((q = strchr(p, '\n')) == NULL) {
  	    syslog(L_ERROR, "%s internal newline \"%.20s...\"",
! 		ClientHost, gp->Name);
  	    return FALSE;
  	}
  	*q = '\0';
  	gp->Flag = *p;
  	gp->Alias = gp->Flag == NF_FLAG_ALIAS ? p + 1 : NULL;
      }
  
      GRPsize = i;
--- 261,313 ----
      /* Fill in the group array. */
      GRPentries = NEW(GROUPENTRY, i);
      for (i = 0, gp = GRPentries, p = active; *p; i++, gp++, p = q + 1) {
+ 	gp->Ptr = p;
+ 
+ #ifdef NOTDEF
  	gp->Name = p;
+ #endif
  	if ((p = strchr(p, ' ')) == NULL) {
  	    syslog(L_ERROR, "%s internal no_space1 \"%.20s...\"",
! 		ClientHost, GPNAME(gp));
  	    return FALSE;
  	}
+ #ifdef NOTDEF
  	*p++ = '\0';
+ #endif
  
  	/* Get the high mark. */
  	if ((q = strchr(p, ' ')) == NULL) {
  	    syslog(L_ERROR, "%s internal no_space2 \"%.20s...\"",
! 		ClientHost, GPNAME(gp));
  	    return FALSE;
  	}
+ #ifdef NOTDEF
  	*q++ = '\0';
  	gp->High = atol(p);
+ #endif
  
  	/* Get the low mark. */
  	if ((p = strchr(q, ' ')) == NULL) {
  	    syslog(L_ERROR, "%s internal no_space3 \"%.20s...\"",
! 		ClientHost, GPNAME(gp));
  	    return FALSE;
  	}
+ #ifdef NOTDEF
  	*p++ = '\0';
  	gp->Low = atol(q);
+ #endif
  
  	/* Kill the newline. */
  	if ((q = strchr(p, '\n')) == NULL) {
  	    syslog(L_ERROR, "%s internal newline \"%.20s...\"",
! 		ClientHost, GPNAME(gp));
  	    return FALSE;
  	}
+ #ifdef NOTDEF
  	*q = '\0';
  	gp->Flag = *p;
  	gp->Alias = gp->Flag == NF_FLAG_ALIAS ? p + 1 : NULL;
+ #endif
      }
  
      GRPsize = i;
diff -r -c nnrpd/nnrpd.h nnrpd-matt/nnrpd.h
*** nnrpd/nnrpd.h	Tue Dec 17 06:40:40 1996
--- nnrpd-matt/nnrpd.h	Mon Feb  3 22:07:38 1997
***************
*** 49,59 ****
--- 49,63 ----
  **  A group entry.
  */
  typedef struct _GROUPENTRY {
+ #ifdef NOTDEF
      char	*Name;
      ARTNUM	High;
      ARTNUM	Low;
      char	Flag;
      char	*Alias;
+ #endif
+     char        *Ptr;   
+     struct _GROUPENTRY *Next;
  } GROUPENTRY;
  
  
***************
*** 142,144 ****
--- 146,155 ----
  #if	defined(VAR_VARARGS)
  extern void		Reply();
  #endif	/* defined(VAR_VARARGS) */
+ 
+ char *GPNAME(GROUPENTRY *gp);   
+ ARTNUM GPLOW(GROUPENTRY *gp);
+ ARTNUM GPHIGH(GROUPENTRY *gp);
+ char GPFLAG(GROUPENTRY *gp);
+ char *GPALIAS(GROUPENTRY *gp); 
+ 
diff -r -c nnrpd/post.c nnrpd-matt/post.c
*** nnrpd/post.c	Tue Dec 17 06:40:40 1996
--- nnrpd-matt/post.c	Mon Feb  3 22:00:04 1997
***************
*** 589,608 ****
  	    continue;
  	FoundOne = TRUE;
  	DDcheck(h, p);
! 	switch (gp->Flag) {
  	case NF_FLAG_OK:
  	    break;
  	case NF_FLAG_MODERATED:
  	    if (!approved) {
  		DISPOSE(groups);
  		DISPOSE(DDend(h));
! 		return MailArticle(gp->Name, article);
  	    }
  	    break;
  	case NF_FLAG_IGNORE:
  	case NF_FLAG_NOLOCAL:
  	    (void)sprintf(Error, "Postings to \"%s\" are not allowed here.",
! 		    gp->Name);
  	    break;
  	case NF_FLAG_EXCLUDED:
  	    /* Do NOT return an error. */
--- 589,608 ----
  	    continue;
  	FoundOne = TRUE;
  	DDcheck(h, p);
! 	switch (GPFLAG(gp)) {
  	case NF_FLAG_OK:
  	    break;
  	case NF_FLAG_MODERATED:
  	    if (!approved) {
  		DISPOSE(groups);
  		DISPOSE(DDend(h));
! 		return MailArticle(GPNAME(gp), article);
  	    }
  	    break;
  	case NF_FLAG_IGNORE:
  	case NF_FLAG_NOLOCAL:
  	    (void)sprintf(Error, "Postings to \"%s\" are not allowed here.",
! 		    GPNAME(gp));
  	    break;
  	case NF_FLAG_EXCLUDED:
  	    /* Do NOT return an error. */
***************
*** 610,616 ****
  	case NF_FLAG_ALIAS:
  	    (void)sprintf(Error,
  		    "The newsgroup \"%s\" has been renamed to \"%s\".\n",
! 		    p, gp->Alias);
  	    break;
  	}
          if (PERMspecified) {
--- 610,616 ----
  	case NF_FLAG_ALIAS:
  	    (void)sprintf(Error,
  		    "The newsgroup \"%s\" has been renamed to \"%s\".\n",
! 		    p, GPALIAS(gp));
  	    break;
  	}
          if (PERMspecified) {


Re: Patch to inn-1.5.1's nnrpd to mmap() the active file shared+ro
#14730
Author: Karl Denninger
Date: Tue, 04 Feb 1997 00:00
44 lines
2333 bytes
In article <5d6th6$b8h@flea.best.net>,
Matt Dillon <dillon@flea.best.net> wrote:
>    This patch uses mmap() to map the active file shared + read-only.
>    For newsreader machines with large (~ 1MByte) active files, this
>    patch more then halves the per-nnrpd process memory usage.  It is
>    roughly equivalent to the shared-active mods that have been
>    floating around, but approaches the problem somewhat differently.
>
>    I don't know which is better, or whether it even matters.  I do know
>    that this patch allows our newsreader machine to support nearly twice
>    as many nnrpd's as it would otherwise be able to... around 
>    500 nnrpd processes on a 256 MByte pentium-pro 200 running FreeBSD.
>
>    The patch has been reasonably well tested, and since it restricts
>    itself to a read-only map, it ought to work on any machine that
>    supports mmap().
>
>					-Matt

Heh INN people!

How about folding this into the default distribution if MMAP is defined?

This REALLY does work well, and it completely avoids the "crash and wedge"
problem that the shared-active patch has had from time to time.

With this one, perhaps I can get rid of one of my "watchdog" processes that
runs around trying to detect the wedge condition -- since it can't happen
any longer.

I like it.  A lot.

Thanks Matt.

--
-- 
Karl Denninger (karl@MCS.Net)| MCSNet - The Finest Internet Connectivity
http://www.mcs.net/~karl     | T1's from $600 monthly to FULL DS-3 Service
			     | 99 Analog numbers, 77 ISDN, Web servers $75/mo
Voice: [+1 312 803-MCS1 x219]| Email to "info@mcs.net" WWW: http://www.mcs.net/
Fax:   [+1 773 248-9865]     | 2 FULL DS-3 Internet links; 400Mbps B/W Internal

Re: Patch to inn-1.5.1's nnrpd to mmap() the active file shared+ro
#14767
Author: bill davidsen
Date: Wed, 05 Feb 1997 00:00
42 lines
2429 bytes
In article <5d8d56$2k0$1@Jupiter.Mcs.Net>, Karl Denninger <karl@MCS.COM> wrote:

| Heh INN people!
| 
| How about folding this into the default distribution if MMAP is defined?

How about MMAP_ACTIVE for reasons detailed below.

| This REALLY does work well, and it completely avoids the "crash and wedge"
| problem that the shared-active patch has had from time to time.
| 
| With this one, perhaps I can get rid of one of my "watchdog" processes that
| runs around trying to detect the wedge condition -- since it can't happen
| any longer.

I did something like this on inn1.4sec2 (or maybe earlier, jan-feb
95 timeframe). It worked well until I got to my machines which are
NFS slaves to serve readers without needing a lot of disk. MMAP on
an NFS mounted file didn't work well on AIX. It also failed
completely on another platform, don't remember if it was SCO, SunOS,
Linux, Dell/Intel SVR4 or whatever I was working on two years ago.

I intend to look at this in the near future (next few days), but I
have an additional problem with my machines, some run as NFS slaves
and may have a problem memory mapping a remote file. I know they
don't when I use shared active. For that reason I'd like to see a
separate option in the config, in case the stuff which now works
with MMAP and mapped active are not the same on some machines.

| I like it.  A lot.

I like the idea enough to make time to try it, I'll let you know
after that ;-) Before it goes in the main distribution I'd like to
see maybe a month of extra experience, but it certainly should go in
unless someone finds a major problem.
--
	-bill davidsen (davidsen@tmr.com)
"As a software development model, Anarchy does not scale well."
		-Dave Welch

Re: Patch to inn-1.5.1's nnrpd to mmap() the active file shared+ro
#14769
Author: Dan Swartzendruber
Date: Wed, 05 Feb 1997 00:00
24 lines
1561 bytes
In article <32f95bab.180976735@news.deltanet.com>, jsawa@deltanet.com wrote:

>I am curently using the patch on my NFS mounted reader machines and it works
>great! I do not run inn on those machines I just fire off nnrpd out of inetd. I
>have noticed that nnrpd only takes about half the memory it used to. I can get
>between 60%-80% more connections per machine with the patch.
>
>Kudos to Matt...

Amen!  I've noticed similar results on a machine I've been testing that
patch on for most of this week.  In a similar vein, I'm also testing a
patch for Linux 2.0.X for the ext2 filesystem to support the noatime
mount option.  This seems to have improved performance as well.  I've not
been in this code a lot, so it's possible my modification to the original
patch (designed for 1.2.13 kernel) isn't optimal.  If so, feel free to fix
it the "right way" after I post the patch...

-- 

Dan Swartzendruber


Re: Patch to inn-1.5.1's nnrpd to mmap() the active file shared+ro
#14778
Author: Matt Dillon
Date: Wed, 05 Feb 1997 00:00
38 lines
2382 bytes
:In article <32f95bab.180976735@news.deltanet.com>,
:John J. Sawa <jsawa@deltanet.com> wrote:
:>I am curently using the patch on my NFS mounted reader machines and it works
:>great! I do not run inn on those machines I just fire off nnrpd out of inetd. I
:>have noticed that nnrpd only takes about half the memory it used to. I can get
:>between 60%-80% more connections per machine with the patch.
:>
:>Kudos to Matt...
:>
:>John J. Sawa
:>jsawa@delta.net

    Thank you!  I should have posted this patch months ago but, silly me,
    I was assuming that it would be fixed in INN 1.5.

    Certainly many people are going to have different experiences with
    NFS-mounted news spools, as I believe another person mentioned in an
    earlier posting.  It will depend heavily on the OS the NFS client is
    operating under... caching is the key.  My worry with NFS is always
    more towards reliability... I've managed to crash many an operating system
    through heavily used NFS mounts.  News is probably safer then most,
    especially if it's a read-only mount, but our own newsreader machines
    use 16GB local spools and take a feed from our newsfeeds machine
    rather then attempting to use NFS.

    It ought to be possible to rewrite NNTP to use even less memory... 
    there is really no good reason why it uses so much.  I've contemplated
    rewriting nnrpd several times but have always balked because I hate
    INN's access methodology (active, newsgroups, spool topology, etc...)
    and didn't want to waste time building a new program around it.  I'm
    hoping to eventually get NNTP client capabilities built into
    Diablo (which I just released for Alpha), but that's a long way off.

					-Matt


Re: Patch to inn-1.5.1's nnrpd to mmap() the active file shared+ro
#14831
Author: John J. Sawa
Date: Thu, 06 Feb 1997 00:00
12 lines
965 bytes
I am curently using the patch on my NFS mounted reader machines and it works
great! I do not run inn on those machines I just fire off nnrpd out of inetd. I
have noticed that nnrpd only takes about half the memory it used to. I can get
between 60%-80% more connections per machine with the patch.

Kudos to Matt...

John J. Sawa
jsawa@delta.net

Not setting atime on files (was ... mmap() the active file)
#14835
Author: bill davidsen
Date: Fri, 07 Feb 1997 00:00
44 lines
3001 bytes
In article <dswartz-0502972349580001@accord.druber.com>,
Dan Swartzendruber <dswartz@druber.com> wrote:

| Amen!  I've noticed similar results on a machine I've been testing that
| patch on for most of this week.  In a similar vein, I'm also testing a
| patch for Linux 2.0.X for the ext2 filesystem to support the noatime
| mount option.  This seems to have improved performance as well.  I've not
| been in this code a lot, so it's possible my modification to the original
| patch (designed for 1.2.13 kernel) isn't optimal.  If so, feel free to fix
| it the "right way" after I post the patch...

I've expanded the newsgroups and directed followups there, since
I'm about to take a turn from news to general o/s design...

Synopsis: this is from a discussion of avoiding an update of the
accessed time for an inode, to prevent disk activity.

My feeling on this is that the "right" was to do this is to add an
option to the open() call which allows the files to be accessed
without updating the accessed time (atime). This means that programs
wishing to use the fopen() calls would have to switch to a sequence
of open() followed by fdopen(). This doesn't add any measurable
overhead, since the fopen() routine is going to do an open() system
call and put the information in a FILE descriptor anyway.

Programs which would want to do this are apps like news and backups,
for which any reduction in system overhead is a plus.

My feeling is that this is a good general capability, and doesn't
need to be restricted to use by root. However, if someone can
imaging a real security hole from its use, it could be restricted to
files owned by the opening process. Since that process could reset
the times if desired, this adds convenience and efficiency without
opening any holes. At least not any obvious to me on short notice.

Comments and thoughts?
-- 
bill davidsen (davidsen@tmr.com)
  Company policy prevents me from commenting on the performance of
this distributed database. However, the machines on which it runs
are called bottleneck and roadblock.

Re: Patch to inn-1.5.1's nnrpd to mmap() the active file shared+ro
#14850
Author: bill davidsen
Date: Fri, 07 Feb 1997 00:00
18 lines
1381 bytes
In article <32f95bab.180976735@news.deltanet.com>,
John J. Sawa <jsawa@deltanet.com> wrote:
| I am curently using the patch on my NFS mounted reader machines and
| it works great! I do not run inn on those machines I just fire off
| nnrpd out of inetd. I have noticed that nnrpd only takes about half
| the memory it used to. I can get between 60%-80% more connections per
| machine with the patch.

Sounds very good, what o/s do you run? I'm currently running on AIX,
SCO, Solaris and Linux...
-- 
bill davidsen (davidsen@tmr.com)
  Company policy prevents me from commenting on the performance of
this distributed database. However, the machines on which it runs
are called bottleneck and roadblock.

Re: Patch to inn-1.5.1's nnrpd to mmap() the active file shared+ro
#15412
Author: Robert A Heller
Date: Fri, 28 Feb 1997 00:00
52 lines
2947 bytes
What patch is this and where can I get it ?

In Article Re: Patch to inn-1.5.1's nnrpd to mmap() the active file shared+ro , Matt Dillon <dillon@flea.best.net> wrote:
:In article <32f95bab.180976735@news.deltanet.com>,
:John J. Sawa <jsawa@deltanet.com> wrote:
:>I am curently using the patch on my NFS mounted reader machines and it works
:>great! I do not run inn on those machines I just fire off nnrpd out of inetd. I
:>have noticed that nnrpd only takes about half the memory it used to. I can get
:>between 60%-80% more connections per machine with the patch.
:>
:>Kudos to Matt...
:>
:>John J. Sawa
:>jsawa@delta.net

    Thank you!  I should have posted this patch months ago but, silly me,
    I was assuming that it would be fixed in INN 1.5.

    Certainly many people are going to have different experiences with
    NFS-mounted news spools, as I believe another person mentioned in an
    earlier posting.  It will depend heavily on the OS the NFS client is
    operating under... caching is the key.  My worry with NFS is always
    more towards reliability... I've managed to crash many an operating system
    through heavily used NFS mounts.  News is probably safer then most,
    especially if it's a read-only mount, but our own newsreader machines
    use 16GB local spools and take a feed from our newsfeeds machine
    rather then attempting to use NFS.

    It ought to be possible to rewrite NNTP to use even less memory... 
    there is really no good reason why it uses so much.  I've contemplated
    rewriting nnrpd several times but have always balked because I hate
    INN's access methodology (active, newsgroups, spool topology, etc...)
    and didn't want to waste time building a new program around it.  I'm
    hoping to eventually get NNTP client capabilities built into
    Diablo (which I just released for Alpha), but that's a long way off.

					-Matt

--------------------------------------------------------
Name: Robert A Heller
E-mail: Robert A Heller <rah@mail.xl.ca>
Date: 02/28/97
Time: 16:13:16

This message was sent by Z-Mail Pro - from NetManage
NetManage - delivers Standards Based IntraNet Solutions
--------------------------------------------------------



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