Jump to content

Read ahead and behind optimisation - I want to increase it


esecallum

Recommended Posts

Waiting 5 seconds won't make it safe as files can be held in memory and not flushed to disk for extended periods of time. You need to execute a file cache flush (there are free utilities that serve this purpose) or shut down your computer (Windows flushes the file cache before shutting down... obviously) to be sure. There might be other ways to trigger it, but those are two options at least. I don't believe the safely remove hardware system will flush the file cache; it will just tell you the drive isn't safe to be removed until it has.

Queue

Link to comment
Share on other sites


...

The registry setting is ----

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem]

"ReadAheadThreshold"=hex:00,00,16,00

-----------

This is the best setting for my machine, maybe to high for you. 16 = 1024

just change "00 00 01 00" to "00 00 16 00"

other settings are ---

64 = 4096

32 = 2048

16 = 1024 ------ this is my best setting

8 = 512

4 = 264

2 = 128

1 = 64

...

You are using two different number bases here...

The registry key is using hexadecimal, where your list is decimal.

To find the correct value to enter into the registry use:

64 = 40 (0x40)

32 = 20 (0x20)

16 = 10 (0x10)

08 = 08 (0x08)

04 = 04 (0x04)

02 = 02 (0x02)

01 = 01 (0x01)

However, has anyone actually confirmed that values above 512MiB (08) do anything?

For some reason, the value for the above-mentioned key was 00 00 00 ff on my 98SE system.

I changed it to 00 00 08 00 since I only have 256 MB RAM and will see the result.

The value "00 00 00 ff" is the one listed on MDGx's tweaks page (http://www.mdgx.com/newtip18.htm)

I cannot understand how this is a valid value since it does not correlate with the standard values...

Another factor with performance is the Write Behind (writeback) Cache.

By default, this is enabled on internal, non-removable drives only (basically PATA/SATA/SCSI drives).

To enable writeback caching on all drives:

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem]

"DriveWriteBehind"=hex:ff,ff,ff,03

...

DriveWriteBehind is a drive bitmap. Each bit represents a drive letter.

Bit 0 is A:, Bit 1 is B:... Bit 25 is Z:.

Set a bit to 1 to enable, or 0 to disable.

Remember that the byte order is reversed in the registry, so the number above is 0x03ffffff.

Actually the default value is "fc ff ff 03" which enabled on drives C: through Z: so it would appear that every drive except A: and B: are enabled...

However, if you tick the "Disable write-behind caching for all drives" option (00 00 00 00) under Hardware Properties, Performance, File System, File System Properties, Troubleshooting, apply it, and then untick and apply again, the registry value changes to "ff ff ff ff" that includes A: and B:!!!

This must be a bug?

Waiting 5 seconds won't make it safe as files can be held in memory and not flushed to disk for extended periods of time. You need to execute a file cache flush (there are free utilities that serve this purpose) or shut down your computer (Windows flushes the file cache before shutting down... obviously) to be sure. There might be other ways to trigger it, but those are two options at least. I don't believe the safely remove hardware system will flush the file cache; it will just tell you the drive isn't safe to be removed until it has.

Queue

Using any available safely remove hardware option will always flush the write cache. It only gives a message if the volume is locked by an application.

The maximum write delay is determined by the three values:

BufferIdleTimeout, BufferAgeTimeout, and VolumeIdleTimeout

These are also in

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem]

But are normally not present and use the default values.

Anyone know what their default values are?

My understanding was that Windows will write stale cache pages within 5000ms.

Link to comment
Share on other sites

Thanks whatever420!

And I did not even notice that the low three bytes of the ReadAheadThreshold value are the actual maximum number of bytes for the read ahead cache.

Although it's dynamic as I understand it.

The high byte must be some kind of flag maybe?

Since MDGx's tweak page uses 0xff000000, or 4080MiB... I think not... Therefore it must be a flag of some sort... Or a typo?

Link to comment
Share on other sites

My suggestion:

  1. grab DiskMark9x from CrystalDewWorld.
  2. select a partition (the smallest non-system available is preferable, but any will do).
  3. perform the DiskMark9x test, always on the same partition, varying the ReadAheadThreshold setting.

This procedure ought to help find out which values have an effect, and which do not.

I'd do it myself instead of suggesting it, if I hadn't already too many chestnuts in my plate to chew (BTW, why must it always be chestnuts? I'd much rather have hazelnuts or cashewnuts instead... :D)

Link to comment
Share on other sites

You are using two different number bases here...

The registry key is using hexadecimal, where your list is decimal.

yep...

"ReadAheadThreshold"=hex:00,00,16,00

isn't 1024 kb..

rahur9.gif

it's 1408 kb...

i am confused now.

what are the values to enter in the registry for ReadAheadThreshold?

for :-

16 k

32 k

64 k

128 k

512 k

1024 k

are the figures to be intered in the registry supposed to be hex, binary or decimal?

Link to comment
Share on other sites

what are the values to enter in the registry for ReadAheadThreshold?

----------------------------------------------------------------

REGEDIT4

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem]

\\ 16 KB

"ReadAheadThreshold"=hex:00,40,00,00

\\ 32 KB

"ReadAheadThreshold"=hex:00,80,00,00

\\ 64 KB

"ReadAheadThreshold"=hex:00,00,01,00

\\ 96 KB

"ReadAheadThreshold"=hex:00,80,01,00

\\ 128 KB

"ReadAheadThreshold"=hex:00,00,02,00

\\ 256 KB

"ReadAheadThreshold"=hex:00,00,04,00

\\ 512 KB

"ReadAheadThreshold"=hex:00,00,08,00

\\ 1024 KB

"ReadAheadThreshold"=hex:00,00,10,00

\\ 2048 KB

"ReadAheadThreshold"=hex:00,00,20,00

\\ 4096 KB

"ReadAheadThreshold"=hex:00,00,40,00

\\ 6144 KB

"ReadAheadThreshold"=hex:00,00,60,00

\\ 8192 KB

"ReadAheadThreshold"=hex:00,00,80,00

\\ 10240 KB

"ReadAheadThreshold"=hex:00,00,A0,00

\\ 12288 KB

"ReadAheadThreshold"=hex:00,00,C0,00

\\ 14336 KB

"ReadAheadThreshold"=hex:00,00,E0,00

\\ 16384 KB

"ReadAheadThreshold"=hex:00,00,00,01

\\ 32768 KB

"ReadAheadThreshold"=hex:00,00,00,02

\\ 65536 KB

"ReadAheadThreshold"=hex:00,00,00,04

\\ 131072 KB

"ReadAheadThreshold"=hex:00,00,00,08

\\

\\

----------------------------------------------------------------

Edited by whatever420
Link to comment
Share on other sites

Highly unlikely, since that value was present on my system since... dunno... forever. Someone mentioned the same value earlier as being recommanded on MDGx's tweaks page so I think there's more to it.

Ever since I've changed it from 00 00 00 FF to 00 00 08 00, the only noticeable change has been quickly running out of space on drive C. This is odd, especially considering that I previously had swap file disabled through ConservativeSwapFileUsage=1 in sytem.ini > [386Enh] and now I see the swap file increasing in size over 1 GiB at times, leaving me with a few kB of free space. :(

Link to comment
Share on other sites

00 00 00 FF to 00 00 08 00, the only noticeable change has been quickly running out of space on drive C. This is odd, especially considering that I previously had swap file disabled through ConservativeSwapFileUsage=1 in sytem.ini > [386Enh] and now I see the swap file increasing in size over 1 GiB at times, leaving me with a few kB of free space. :(

That does not disable swap file usage, it only tells system to use ram first if possible. Disabling swapfile is not recommended. According to the Cacheman wizard, a large readahead buffer is 256 kb and is optimal for faster loading of individual programs. If you do a lot of multitasking, then leaving it at the default of 64 kb is optimal. This version of Cacheman also has settings for Windows 98 with over 512 MB of ram so even with ram to burn, it does not appear to them that setting a very large readahead buffer is the prudent thing to do.

I do not have Cacheman running in the background, but try as I might, I could not get the Mdgx setting of hex = 00 00 00 ff copied and converted into a reg file to merge with my registry even though it said it did. I think that is because I have Cachemen optimizations selected in the files system properties of the performance tab when right clicking on my computer.

Edited by ldb
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...