[comp.os.os2.misc] Disk buffering

weiss@theory.lcs.mit.edu (Paul G. Weiss) (04/30/91)

Can anyone explain the difference between the various forms of
disk buffering available under OS/2?  In particular, what is the
difference between:

    (a) The BUFFERS parameter in CONFIG.SYS?
    (b) The DISKCACHE parameter in CONFIG.SYS?
    (c) The /c switch in installing HPFS?

How do these affect operation of

    (a) A FAT fixed disk filesystem
    (b) A HPFS fixed disk filesystem
    (c) A floppy disk filesystem

Also, what if anything does all this have to do with machines that are
advertising as having a disk controller with a built-in cache.

Thanks to all disk buffering mavens.

-Paul

ejp@bohra.cpg.oz.au (Esmond Pitt) (05/01/91)

In article <WEISS.91Apr29221914@toucan.lcs.mit.edu> weiss@theory.lcs.mit.edu (Paul G. Weiss) writes:
> Can anyone explain the difference between the various forms of
> disk buffering available under OS/2?  In particular, what is the
> difference between:
>
>     (a) The BUFFERS parameter in CONFIG.SYS?

These are used when doing disk reads & writes of blocks that do not
occupy an entire sector.

>     (b) The DISKCACHE parameter in CONFIG.SYS?

I believe this applies to the FAT file system.

>     (c) The /c switch in installing HPFS?

Applies to HPFS only; must be used in assocation with a RUN=CACHE
statement.

I have:

	IFS=C:\OS\HPFS.IFS /C:256 /AUTOCHECK:F
	RUN=C:\OS2\CACHE.EXE /LAZY:ON

See the description of BUFFERS, DISKCACHE, IFS and CACHE in the online
command reference.

>
> How do these affect operation of
>
>     (a) A FAT fixed disk filesystem
>     (b) A HPFS fixed disk filesystem

Make them faster, as appropriate.

>     (c) A floppy disk filesystem

No effect.

> Also, what if anything does all this have to do with machines that are
> advertising as having a disk controller with a built-in cache.

Nothing. If the disk controller has a large built-in cache you should
not need much in the way of software caching as per DISKCACHE and
HPFS /C:


-- 
Esmond Pitt, Computer Power Group
ejp@bohra.cpg.oz

d88-pfo@dront.nada.kth.se (Peter Forsberg) (05/02/91)

In article <WEISS.91Apr29221914@toucan.lcs.mit.edu> weiss@theory.lcs.mit.edu (Paul G. Weiss) writes:

   Can anyone explain the difference between the various forms of
   disk buffering available under OS/2?  In particular, what is the
   difference between:

       (a) The BUFFERS parameter in CONFIG.SYS?
       (b) The DISKCACHE parameter in CONFIG.SYS?
       (c) The /c switch in installing HPFS?

   How do these affect operation of

       (a) A FAT fixed disk filesystem
       (b) A HPFS fixed disk filesystem
       (c) A floppy disk filesystem

   Also, what if anything does all this have to do with machines that are
   advertising as having a disk controller with a built-in cache.

   Thanks to all disk buffering mavens.

   -Paul

I believe that this extract from IBM Advisor might answer most of your
questions concerning disk buffering and performance issues:

<begin extract>
 
 ByMarkChapman
 (From IBM Advisor, Vol.1 #1, 1990)
 
 There are several simple steps that can be taken to obtain the maximum performance 
 from the base OS/2 V1.2 or 1.3 operating system: 

 1) Unless the Dual Boot feature (which allows you to boot from DOS or OS/2 
 interchangeably) is required, always format your disk using the High Performance File 
 System (HPFS). HPFS replaces the traditional DOS-OS/2 File Allocation Table (FAT) 
 method of storing data on the drive with a newer, more sophisticated method.  HPFS is 
 affected to a much smaller degree by the number or size of files, and file fragmentation 
 is nearly eliminated.  There isn't room in this column to describe HPFS in detail, but 
 benchmarks show a 30-300% improvement in disk performance versus a FAT partition.  
 (For more information on the specifics of HPFS, please refer to the article "Design 
 Goals and Implementation of the new High Performance File System", by Ray Duncan, in 
 the IBM Personal Systems Technical Solutions, Issue 2, 1990.) 

 2) If Dual Boot is required, consider partitioning your bootable C: partition as FAT, and 
 either a second (D:) partition on the physical C: drive or a second physical drive, with 
 HPFS.  At least some of your program and data files will be able to take advantage of 
 HPFS.  (In fact, even DOS programs running in the DOS compatibility box can run from 
 an HPFS driveDDsomething DOS itself can't do!) 

 3) If using a FAT partition, try to limit the number of files in any subdirectory to under 
 200 (less if possible). You are much better off having many directories with few files in 
 them (as long as it makes sense from a usability standpoint).  Because directory 
 listings are read sequentially, the last file on the list (which is actually the first, as 
 directories are read backwards) takes much longer to find than the first.  And several 
 levels of directories will be faster than having all directories off the root. 

 4) Increase the BUFFERS= statement in CONFIG.SYS to 50 buffers, from the default of 
 30.  Benchmarks show a significant performance increase going to 50 buffers, but no 
 benefit beyond 50.  This performance boost comes at a penalty of only 10K of RAM.  
 Cheap at the price. 

 5) If you have the RAM, the best thing you can do is increase the size of the OS/2 
 cache.  On a FAT system, the DISKCACHE= statement in CONFIG.SYS should be 
 increased from the default of 128K, to 256K.  No advantage is gained by going beyond 
 256K. 

 On an OS/2 1.2 HPFS system, the applicable CONFIG.SYS statement is: IFS=C:\OS2
 \HPFS.IFS /C:xxxx.  The default HPFS cache size is 64K (/C:64).  There is a dramatic 
 performance improvement going from 64K to 256K, a slightly smaller increase going 
 from 256K to 512K, a slightly smaller gain going to 1MB, and a smaller, but still 
 significant, improvement going to 1.5MB.  Beyond 1.5MB performance actually 
 DEGRADES, as it takes so long to read the huge cache that all gains by having the data 
 ready to go are negated.  The closer to 1.5MB you can get (memory permitting) the 
 better your performance. 

 For OS/2 1.3, the default cache has changed from 64K to 20% of installed RAM, however 
 this default also can be overridden with the /C:xxxx parameter above. You may wish to 
 experiment to determine the best cache size for your operation. 

 If you have a system with both FAT and HPFS partitions, you will need to set up both 
 types of cache (DISKCACHE and CACHE) in CONFIG.SYS. 

 CAVEAT:   Never allocate so much memory to caching that there is insufficient memory 
 left for application use.  Lack of memory will cause disk swapping, which will more than 
 offset any gains made by caching. 

 6) On an OS/2 1.2 HPFS system, you may wish to enable "lazy writing". Caching 
 normally buffers the data coming from the (slow) disk drive to the (fast) memory.  Lazy 
 writing also allows buffering from memory back to the disk.  This allows the system to 
 wait until the disk drive is not in use, rather than writing immediately and possibly 
 having to wait for another job to finish using the fixed disk.  To use lazy write, add the 
 following statement to CONFIG.SYS: RUN=C:\OS2\CACHE /LAZY:ON 

 In 1.3 Lazy writing is the default.  To disable it, use the preceding statement to to turn 
 /LAZY:OFF. 

 There are other parameters you may wish to use, which determine the length of time to 
 wait before writing to the disk.  If you do not wish to set the parameters, defaults will 
 be supplied by the system.  For more information on lazy writes, refer to the online 
 Command Reference. 

 Note:   Because data is not immediately written to disk, you run a small risk of losing 
 updated information if the power drops before the file is written back to disk.  For this 
 reason, always run SHUTDOWN before powering off your system. 

 7) Another change that can produce a performance boost in memory-constrained 
 systems, is enabling OS/2 to swap the DOS box to disk when not active (ie, when in the 
 background). Normally, under OS/2 1.2, the 500-520K of RAM that is available to DOS 
 programs is not available for OS/2 application use.  But by adding a parameter to the 
 MEMMAN= statement in CONFIG.SYS this memory can be freed up for OS/2 use.  Simply 
 change MEMMAN=SWAP,MOVE to MEMMAN=SWAP,MOVE,SWAPDOS.  In an 
 environment where 512K-or-so of RAM will reduce or eliminate swapping, overall system 
 performance will improve .  SWAPDOS will have no ill effect on the DOS box.  Should 
 you wish to disable SWAPDOS, simply change it to NOSWAPDOS. 

 In OS/2 1.3 SWAPDOS is the default.  It may be similarly disabled. 

 In summary, there is no one ideal system for everyone, however most users would 
 benefit from an all-HPFS system, with a 1.5MB cache and 50 buffers, with lazy writes 
 and SWAPDOS enabled. 

<end extract>

Sorry about the long lines, the text was cut directly from an on-line document
that I have.

-- Peter A Forsberg
   Royal Inst. of Technology, Stockholm, Sweden.
   IBM Sweden.
--
_______________________________________________________________________________
Peter Forsberg 		      Royal Institute of Technology, Stockholm, Sweden.
Internet: d88-pfo@nada.kth.se
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

d88-pfo@dront.nada.kth.se (Peter Forsberg) (05/02/91)

In article <1991May1.021720.20381@bohra.cpg.oz.au> ejp@bohra.cpg.oz.au (Esmond Pitt) writes:

  [Text deleted]

   >     (c) The /c switch in installing HPFS?

   Applies to HPFS only; must be used in assocation with a RUN=CACHE
   statement.

   I have:

	   IFS=C:\OS\HPFS.IFS /C:256 /AUTOCHECK:F
	   RUN=C:\OS2\CACHE.EXE /LAZY:ON

Nope! I admit that when you read the on-line doc's you may think that you 
need the run statement. It should be enough though to have the options in
the IFS statement, i.e.
   IFS=c:\OS2\HPFS.IFS /C:256 /AUTOCHECK:F /LAZY:ON
Note also that LAZY:ON is the default for OS/2 1.3.
The CACHE.EXE program is meant to be run if you like to change any of
the cacheing parameters, and it may indeed be run at any time, not just
in config.sys.

   [More text deleted]

   -- 
   Esmond Pitt, Computer Power Group
   ejp@bohra.cpg.oz

-- Peter A Forsberg
   Royal Inst. of Technology, Stockholm, Sweden.
   IBM Sweden.
--
_______________________________________________________________________________
Peter Forsberg 		      Royal Institute of Technology, Stockholm, Sweden.
Internet: d88-pfo@nada.kth.se
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~