TCS - Driving for Performance: SMARTDrive, Part 2

ReadMe.1st (11/97)
Driving for Performance: SMARTDrive, Part 2

by Ken Johnson
Tulsa Computer Society
From the November 1997 issue of the I/O Port Newsletter

by Kenneth E. Johnson Last month we starting looking at SMARTDrive, the DOS and Windows 3.1 disk cache. We'll continue on SMARTDrive this month.

A disk cache is an easy and effective way to improve the speed and performance of your PC. A disk cache works by creating an area of RAM temporarily to store data from the disk. When data is requested from the disk, the cache will read whole tracks of data at a time into RAM. Chances are that additional data requests will require data already in the cache, which can then be retrieved quickly from RAM instead of physically having to read the disk again. A good disk cache can make a slow hard disk seem fast, and a fast hard disk even faster.

SMARTDrive has been included with MS-DOS since version 5.0, and with Microsoft Windows since version 3.0. In MS-DOS 5.0 SMARTDrive was a traditional device driver (SMARTDRV.SYS) loaded in CONFIG.SYS. With MS-DOS 6.0 and Windows, SMARTDrive became an executable program loaded in AUTOEXEC.BAT.

There are several ways to monitor how efficient the SMARTDrive cache is. Typing in SMARTDRV at the command line will display information on the cache size and the disk caching status (Important note: if SMARTDrive isn't already running, this command will load it). You'll see the normal cache size, the cache size when Windows is running, the read and write cache status for each drive, and whether double buffering is being preformed on the drives (double buffering may be needed for SCSI, ESDI, and MCA drives).

Entering SMARTDRV /S on the command line displays additional information about SMARTDrive's status, including cache hits and misses. You can find the current cache "hit rate" by dividing the hits by the sum of hits and misses, then multiply by 100. For example, if SMARTDRV /S shows:
Room for 256 elements of 8,192 bytes each
There have been 967 cache hits
and 200 cache misses

The calculation would be (967/(967+200))*100, for a hit rate of 82% You'll want to have a hit rate between about 60% and 80%. Less than 60% means that the cache isn't very effective, so you should make the cache larger. Much more than 80% typically means that more RAM is allocated to SMARTDrive than is needed. That RAM probably can be better used by making it available to your programs.

In Windows 3.1, cache information is provided by SMARTMON.EXE, the Windows SMARTDrive Monitor. SMARTMON is part of the Windows 3.1 Resource Kit, and is included with MS-DOS 6.x. If you have MS-DOS 6.x, SMARTMON is in the \DOS subdirectory; if you've installed the Windows 3.1 Resource Kit, it will be in the \WINDOWS subdirectory.

When SMARTMON is running minimized, it will display the cache hit percentage. The percentage number turns red whenever disk write activity is taking place. When maximized, SMARTMON will show a bar graph with the cache hit percentages of recent disk activity. The bottom of the SMARTMON window shows a status line with the activity of the cache and the average hit ratio over the last 30 sampling intervals.

Another, albeit less known, performance benefit of SMARTDrive is the ability to reduce the DOS buffers. DOS uses its own read-write buffers to hold data when reading to and writing from the disk. Before accessing the disk, DOS checks the buffers to see if the data needed is already present. There are regular read-write buffers, and look-ahead buffers. With look-ahead buffers, DOS reads additional sectors when accessing the disk.

As you can see, DOS' buffers are like a small cache, but not as nearly as efficient as a disk cache. Each buffer is about 532 bytes, which doesn't hold much data. SMARTDrive's cache is usually between one and two megabytes, and the cache reads whole tracks (not sectors like look-ahead buffers). Unfortunately DOS looks through all its buffers before going to the disk cache, so you can speed up performance by reducing the number of buffers it has to search. With SMARTDrive, about 10 read-write buffers and no look-ahead buffers is usually sufficient (and is Microsoft's recommendation).

Buffers are specified in CONFIG.SYS. Change the setting to:

This gives you 10 read-write buffers and no look-ahead buffers. (Notice you also get some memory back by lowering the number of buffers.)

RAMDrive versus SMARTDrive

Both RAMDrive and SMARTDrive provide performance enhancements, and both can be used on your computer if you've got the memory. If you do, just remember not to use SMARTDrive to cache a RAM disk. The RAM drive is already in memory and as such runs at maximum speed. Caching it with SMARTDrive will actually slow your processing down.

But if you are limited in memory, are you better off with RAMDrive or SMARTDrive? Overall, the memory given to SMARTDrive gives better performance than the same memory given to RAMDrive. A disk cache speeds up ALL your input/output operations. The RAM disk provides the speed benefit only to temporary files or when you explicitly use it for storing specific files. The RAMDrive memory cannot be used for anything else. However, you can set up SMARTDrive to give back some memory to Windows and so improve the performance of all Windows applications.

You can set a general guideline if you look at the memory requirements of each driver. The best disk cache is about 2Mb, and a RAM drive needs at least 2Mb for DOS and Windows' temporary files. So if you have less than 4Mb of extended memory to spare, set up a SMARTDrive disk cache. More than 4Mb to spare, set up both a disk cache and a RAM drive.

Whither Windows 95?

Like RAMDrive, SMARTDrive appear to have "gone missing" in Windows 95. It isn't in \WINDOWS\COMMAND with the other DOS 7 commands, and if you installed WIN95 on an existing WIN31/DOS computer, RAMDRIVE.SYS and SMARTDRV.EXE are deleted from your \DOS directory. Yet if you look hard, you'll find both files in the \WINDOWS directory.

SMARTDRV.EXE is a 16-bit program replaced in WIN95 by VCACHE, a 32-bit protected mode driver that intelligently manages the disk cache. VCACHE takes up no conventional or upper memory, doesn't need to be explicitly loaded, and you don't have to specify the size of the cache. VCACHE dynamically resized itself based on available memory and read/write activity. So SMARTDrive is no longer necessary.

However, you can do some tweaking of VCACHE, if so moved. Right-click on My Computer, choose Properties, the Performance Tab, and the File System button. There are separate settings for the Hard Drive and the CD-ROM drives. Under Hard Drive, you can set the role of the machine and the read-ahead optimization. The roles correspond roughly to this: "Desktop Computer" is a standard PC that uses a smaller cache and provides more memory for applications. "Mobile or Docking System" assumes limited memory and the machine is running on battery, so the cache is larger (reducing the power drain of frequent hard disk accesses) and the cache is flushed frequently. "Network Server" means lots of RAM and lots of disk activity, so the cache is large and optimized for high amounts of disk access.

The CD-ROM tab specifies the cache settings for the CD-ROM drive. Set the cache based on RAM size and drive speed:

RAM SizeOptimize ForCache Size
8Mb or lessSingle-speed64K
8Mb to 12MbDouble-speed624K
12Mb or moreQuad-speed or higher1238K
Setting the maximum and minimum size of VCACHE's disk cache is also possible, by editing the SYSTEM.INI file in the \WINDOWS directory. Look for the [vcache] section (add it if not already there). For example, to set a minimum cache size of 1Mb (1024K) and a maximum size of 4Mb (4096K), add the following two lines:

However, remember that Windows 95 users generally don't have to deal with either a disk cache or RAM drive. Though you can load RAMDRIVE.SYS and configure the WIN95 VCACHE settings, most of us can leave the high performance driving to Windows 95 itself.


Kenneth E. Johnson is author of "The Lawyer's Guide to Creating Web Pages," published by the American Bar Association. He is Assistant Editor of the ABA's Network 2d newsletter, and Contributing Editor of Practical Windows and DOS World Magazines.

For more information on the Tulsa Computer Society click here

This page has been accessed times.
Tulsa Computer Society 09/08/97
Don Singleton, President