![]() |
Adrian Wong's "VCACHE"; The Final Word |
A disk cache (also called Virtual Cache or just simply vcache in Win95/98) is important for improving hard disk performance. This is because the disk cache caches or stores data from the hard disk in the much faster RAM so that if a program requires that piece of data, it can just access the disk cache for it, instead of loading from the hard disk. The disk cache can also read ahead by copying more data than what the program asked for in the assumption that the following consecutive data segment will be needed next. These are some of the methods employed by the disk cache to improve your hard disk's performance.
By default, Win95 grabs most of the unused RAM at bootup to use as disk cache. Then, it is supposed to release the RAM used for the dynamic disk cache when a program requires it. This is a rather fine idea as the unused RAM is better utilized as a disk cache rather than just left there. However, the problem with Win95's newfound affinity for disk cache is that it refuses to free up the RAM when you run a memory intensive program. Instead of releasing the RAM it grabbed at bootup for the program to use, it releases some and forces the program to use the swapfile for the rest of its memory requirement instead.
Naturally, this degrades performance as the program now has to use the much slower swapfile, instead of the RAM. Also, it was found that increasing disk cache had diminishing gains. That means that increasing your disk cache from 32MB to 64MB of RAM won't boost overall hard disk performance as much as an increase from 4MB to 8MB of RAM. On the other hand, many programs' performance are degraded when deprived of RAM by the disk cache and forced to run using the swapfile. Hence, it is now important for us to control how much RAM is allocated to the disk cache so that there is a balance between hard disk and program performance.
=====================
Optimizing VCache's ChunkSize
What's ChunkSize?
As you know, Win98's VCache disk cache is important for improving hard disk performance. This is because the disk cache caches or stores data from the hard disk in the much faster RAM so that if a program requires that piece of data, it can just access the disk cache for it, instead of loading from the hard disk. The disk cache can also read ahead by copying more data than what the program asked for in the assumption that the following consecutive data segment will be needed next. These are some of the methods employed by the disk cache to improve your hard disk's performance. More information on optimizing the disk cache can be found in the Disk Cache Optimization article.
But what exactly is chunksize and what has it got to do with the disk cache? Well, to organize the data stored in the cache, the RAM used for the cache is divided into smaller units, just like hard disk space. Each of these units or chunks of cache are now like containers in which Win98 can store cached data. The size of each chunk is the chunksize of the disk cache. Like the dimensions of a container, it limits the amount of data that each chunk can store. So, the smaller the chunksize, the less data can be stored in each but there will be consequently more chunks per MB of cache. But what's the significance of this fact?
How Can ChunkSize Affect The Disk Cache?
If the chunksize is set to a small value, each chunk as noted above will be able to store less data but there will be many more chunks per MB of the disk cache. The disk cache can then make more efficient use of each chunk. Instead of flushing data from a single large chunk of cache just to store a small dataset, the disk cache can now flush a few small chunks that is just large enough to cache that dataset. In short, there will be less wasted cache space. However, due to the larger number of chunks being managed, there will be a larger overhead for all cache transactions.
On the other hand, the chunksize can be increased so that there will be fewer chunks (for a given cache size) to manage. This will lower the overhead of the cache but because there are fewer chunks per MB of cache, the disk cache will have to store data in larger and less efficient chunks.
=================================
Scroll down until you see the line [vcache]. Usually, there will be
nothing under this line. To adjust the vcache settings, you can add the
following lines below the [vcache] line :-
MinFileCache=xxxx
MaxFileCache=yyyy
ChunkSize=zzzz
where xxxx is the minimum size of the vcache in kilobytes (KB)
yyyy is the maximum size of the vcache in kilobytes (KB)
zzzz is the chunksize of the vcache in bytes
Save any changes that you've made to the system.ini file, close Notepad and reboot the system. The changes will only take effect after you reboot the system.
Naturally, we will only touch on chunksize settings. Details on the other settings can be found in the Disk Cache Optimization article.
=======================================
What Are The Optimal Values?
So, what's the optimal chunksize for the disk cache? What chunksize value would be a good balance between increasing overhead and cache efficiency? From the e-mails I keep receiving, this is a question that has been bothering many people. The default value set by Microsoft is 512 bytes. But unlike the other settings for the vcache, there is no rule of the thumb yet on the optimal value for a chunksize.
I could be wrong but as far as I know, no one has ever done any extensive testing of the various chunksizes in order to determine the performance difference between different chunksizes. My attempts to elicit information on chunksize from Microsoft has so far gotten me nothing at all. But the extremely poor Internet connection that I'm stuck with now is to be blamed for this, more than anything else.
In any case, I finally decided to test 11 different chunksizes - 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096 and 8192 bytes. That should cover just about all the bases, I hope. Now, let's see what I actually did to test the effect of the various chunksizes.
============================
Conclusion
If you compare the Winstone and WinBench results, you'll notice that there was mostly little change, irrespective of whether the chunksize was extremely small (8 bytes) or extremely large (8KB). Most notably, whenever there was a noticeable performance difference between the best and the poorest scorers (with the exception of the Sound Forge 4.0 test), the chunksize of 512 bytes was always the top scorer. The chunksize of 256 bytes, on the other hand, has the dubious honour of garnering the lowest score more often than any other chunksize (6 out of a total of 10 tests).
Looking at the games' benchmark scores, I can only conclude that it has minimal, if not negligible. The most "significant" gain from tweaking the chunksize was a tiny 1 fps gain in Turok, where the average framerate was already over 100 fps. So, there's absolutely no use in tweaking the chunksize for a boost in framerates.
It appears that whatever improvement in efficiency that a small chunksize gains and the extra overhead associated with it are so insignificant that they hardly make a ripple in the benchmark scores. The same goes for the large chunksize and its lower overhead. None of the other chunksizes offered a significant improvement over the default chunksize of 512 bytes. Many actually scored worse than it. So, based on the results, I can only recommend that you leave the chunksize at the default 512 bytes.
In our relentless quest to squeeze out that extra drop of performance, it's inevitable that we will meet with failures as well as sweet successes. Unfortunately, the vcache's chunksize is one optimization avenue that promised a lot but didn't deliver as we have hoped. Now, let us turn away from this dead-end and look for other more promising optimization opportunities.
Adrian Wong
http://epsilon.silicon.net.my/adrian/