From:	MERC::"uunet!VM1.NODAK.EDU!OWNER-ANU-NEWS"  3-MAR-1993 05:19:52.02
To:	Multiple recipients of list ANU-NEWS <ANU-NEWS@VM1.NoDak.EDU>
CC:	
Subj:	Re: ANU News 6.1 beta 6: RMS Performance Patches

In article <1993Mar2.185140.778@hnrc.tufts.edu>,
saul_sy@hnrc.tufts.edu (Saul Tannenbaum) writes:
>
> The patches (to NEWSFILES.C and NEWSDELETE.C) are posted in the reply to
> this message.

And here they are:

*** newsfiles.c;1
--- newsfiles.c;
**************
*** 22,27
  **    V6.1    15-Feb-1992     rankin@eql.caltech.edu
  **      - Optimizations to speed up startup, particularly for non-ANU-NEWS
  **        servers which may provide groups out of alphabetical order.
  **--
  */










--- 22,29 -----
  **    V6.1    15-Feb-1992     rankin@eql.caltech.edu
  **      - Optimizations to speed up startup, particularly for non-ANU-NEWS
  **        servers which may provide groups out of alphabetical order.
+ **    V6.1    2-Mar-1993      saul@hnrc.tufts.edu
+ **      - RMS optimizations
  **--
  */










**************
*** 69,74
    i->r = cc$rms_rab;
    i->r.rab$l_fab = &(i->f);

    if (sys$open(&(i->f)) & 1) {
      if (sys$connect(&(i->r)) & 1)
        return(i);
--- 71,80 -----
    i->r = cc$rms_rab;
    i->r.rab$l_fab = &(i->f);

+ /* ST 2/2/93 - turn on multibuffering and read ahead */
+     i -> r.rab$l_rop |= RAB$M_RAH;
+     i -> r.rab$b_mbf = 2;
+
    if (sys$open(&(i->f)) & 1) {
      if (sys$connect(&(i->r)) & 1)
        return(i);
**************
*** 123,128
    i->r = cc$rms_rab;
    i->r.rab$l_fab = &(i->f);

    sysprv();
    if (sys$create(&(i->f)) & 1) {
      if (sys$connect(&(i->r)) & 1) {
--- 129,138 -----
    i->r = cc$rms_rab;
    i->r.rab$l_fab = &(i->f);

+ /* ST 2/2/93 - turn on multibuffering and write behind */
+     i -> r.rab$l_rop |= RAB$M_WBH;
+     i -> r.rab$b_mbf = 2;
+
    sysprv();
    if (sys$create(&(i->f)) & 1) {
      if (sys$connect(&(i->r)) & 1) {
**************
*** 310,315
        }
      }
    else {
      kid_valid = 0;
      if (init_lock()) exit(1);
      kid_valid = 1;
--- 320,335 -----
        }
      }
    else {
+ /* ST 2/2/93 RMS Performance Patch */
+       int buff_count=0;
+       char *buff_count_ptr;
+       int item_performance = FALSE;
+       buff_count_ptr = getenv("ANU_NEWS_ITEMFILE_BUFFERCOUNT");
+       if (buff_count_ptr != NULL)
+       {
+           sscanf(buff_count_ptr,"%d",&buff_count);
+           item_performance = TRUE;
+       }
      kid_valid = 0;
      if (init_lock()) exit(1);
      kid_valid = 1;
**************
*** 319,324
      itmfab.fab$l_fna = ITM_FILENAME;
      itmfab.fab$b_fns = strlen(itmfab.fab$l_fna);
      itmfab.fab$l_fop = FAB$M_CIF;
      itmfab.fab$w_mrs = sizeof newsitm;
      itmfab.fab$b_org = FAB$C_IDX;
      itmfab.fab$b_rat = FAB$M_CR;
--- 339,352 -----
      itmfab.fab$l_fna = ITM_FILENAME;
      itmfab.fab$b_fns = strlen(itmfab.fab$l_fna);
      itmfab.fab$l_fop = FAB$M_CIF;
+
+       /* ST 2/2/93 if the buffer count logical was defined, turn on
+           a number of RMS performance features */
+     if (item_performance)
+     {
+       itmfab.fab$l_fop |= FAB$M_DFW; /* deferred write */
+       itmfab.fab$b_rtv = 255;        /* map the entire file */
+     }
      itmfab.fab$w_mrs = sizeof newsitm;
      itmfab.fab$b_org = FAB$C_IDX;
      itmfab.fab$b_rat = FAB$M_CR;
**************
*** 356,361
      itmrab.rab$l_rbf = (char *) &newsitm;
      itmrab.rab$w_rsz = sizeof newsitm;

      sysprv();
      if (!((status = sys$open(&itmfab)) & 1)) {
  #ifndef V58_UPGRADE_MANUAL
--- 384,393 -----
      itmrab.rab$l_rbf = (char *) &newsitm;
      itmrab.rab$w_rsz = sizeof newsitm;

+ /* ST 3/2/93  - use up to 127 buffers for the item file */
+     if (item_performance)
+       itmrab.rab$b_mbf = (buff_count <= 127) ? buff_count : 127;
+
      sysprv();
      if (!((status = sys$open(&itmfab)) & 1)) {
  #ifndef V58_UPGRADE_MANUAL
**************
*** 390,395
      nosysprv();

      /* open the index newsgroup descriptor file for full access */
      grpfab = cc$rms_fab;
      grpfab.fab$b_bks = 3;
      grpfab.fab$b_fac = FAB$M_GET | FAB$M_PUT | FAB$M_UPD | FAB$M_DEL ;
--- 422,439 -----
      nosysprv();

      /* open the index newsgroup descriptor file for full access */
+ /* ST 3/2/93 - RMS Performance Patches */
+ {
+       int buff_count=0;
+       char *buff_count_ptr;
+       int group_performance = FALSE;
+       buff_count_ptr = getenv("ANU_NEWS_GROUPFILE_BUFFERCOUNT");
+       if (buff_count_ptr != NULL)
+       {
+           sscanf(buff_count_ptr,"%d",&buff_count);
+           group_performance = TRUE;
+       }
+
      grpfab = cc$rms_fab;
      grpfab.fab$b_bks = 3;
      grpfab.fab$b_fac = FAB$M_GET | FAB$M_PUT | FAB$M_UPD | FAB$M_DEL ;
**************
*** 396,401
      grpfab.fab$l_fna = GRP_FILENAME;
      grpfab.fab$b_fns = strlen(grpfab.fab$l_fna);
      grpfab.fab$l_fop = FAB$M_CIF;
      grpfab.fab$w_mrs = sizeof newsgrp;
      grpfab.fab$b_org = FAB$C_IDX;
      grpfab.fab$b_rat = FAB$M_CR;
--- 440,453 -----
      grpfab.fab$l_fna = GRP_FILENAME;
      grpfab.fab$b_fns = strlen(grpfab.fab$l_fna);
      grpfab.fab$l_fop = FAB$M_CIF;
+
+       /* ST  3/2/93 if the buffer count logical was defined, turn on
+           a number of RMS performance features */
+     if (group_performance)
+     {
+       grpfab.fab$l_fop |= FAB$M_DFW; /* deferred write */
+       grpfab.fab$b_rtv = 255;        /* map the entire file */
+     }
      grpfab.fab$w_mrs = sizeof newsgrp;
      grpfab.fab$b_org = FAB$C_IDX;
      grpfab.fab$b_rat = FAB$M_CR;
**************
*** 428,433
      grprab.rab$w_usz = sizeof newsgrp;
      grprab.rab$l_rbf = (char *) &newsgrp;
      grprab.rab$w_rsz = sizeof newsgrp;

      sysprv();
      if (no_priv()) status = sys$open(&grpfab);
--- 480,490 -----
      grprab.rab$w_usz = sizeof newsgrp;
      grprab.rab$l_rbf = (char *) &newsgrp;
      grprab.rab$w_rsz = sizeof newsgrp;
+
+ /* ST 3/2/93 RMS Performance */
+     if (group_performance)
+       grprab.rab$b_mbf = (buff_count <= 127) ? buff_count : 127;
+ }

      sysprv();
      if (no_priv()) status = sys$open(&grpfab);








[End of patch to newsfiles.c]
*** newsdelete.c;1
--- newsdelete.c;
**************
*** 138,143
  open_hist_file()
  {
    FILE *fpw;

    if (nntp_client) return(0);
    if (hist_off) return(0);
--- 138,147 -----
  open_hist_file()
  {
    FILE *fpw;
+ /* ST 3/2/93 - RMS Performance Options for History file access */
+   int buff_count=0;
+   char *buff_count_ptr;
+   int hist_performance = FALSE;


    if (nntp_client) return(0);
**************
*** 139,144
  {
    FILE *fpw;

    if (nntp_client) return(0);
    if (hist_off) return(0);
    sysprv();
--- 143,149 -----
    char *buff_count_ptr;
    int hist_performance = FALSE;

+
    if (nntp_client) return(0);
    if (hist_off) return(0);
    sysprv();
**************
*** 158,163
    histfab.fab$b_fns = strlen(histfab.fab$l_fna);
    histfab.fab$b_shr = FAB$M_SHRDEL | FAB$M_SHRGET | FAB$M_SHRPUT | FAB$M_SHRUP
D;

    if (!(sys$open(&histfab) & 1)) {
      histfab.fab$b_bks = 4;
      histfab.fab$l_fop = FAB$M_CIF;
--- 163,178 -----
    histfab.fab$b_fns = strlen(histfab.fab$l_fna);
    histfab.fab$b_shr = FAB$M_SHRDEL | FAB$M_SHRGET | FAB$M_SHRPUT | FAB$M_SHRUP
D;

+ /* ST 3/2/93 RMS Performance Patches */
+   buff_count_ptr = getenv("ANU_NEWS_HISTORYFILE_BUFFERCOUNT");
+   if (buff_count_ptr != NULL)
+       {
+        sscanf(buff_count_ptr,"%d",&buff_count);
+        hist_performance = TRUE;
+        histfab.fab$l_fop |= FAB$M_DFW; /* deferred write */
+        histfab.fab$b_rtv = 255;       /* map the entire file */
+       }
+
    if (!(sys$open(&histfab) & 1)) {
      histfab.fab$b_bks = 4;
      histfab.fab$l_fop = FAB$M_CIF;
**************
*** 195,200
    histrab.rab$w_usz = sizeof newshist;
    histrab.rab$l_rbf = (char *) &newshist;
    histrab.rab$w_rsz = sizeof newshist;

    if (!((status = sys$connect(&histrab)) & 1)) {
      sys$close(&histfab);
--- 210,219 -----
    histrab.rab$w_usz = sizeof newshist;
    histrab.rab$l_rbf = (char *) &newshist;
    histrab.rab$w_rsz = sizeof newshist;
+
+ /* ST 3/2/93 RMS Performance Patches */
+     if (hist_performance)
+       itmrab.rab$b_mbf = (buff_count <= 127) ? buff_count : 127;

    if (!((status = sys$connect(&histrab)) & 1)) {
      sys$close(&histfab);
