Swap File Tweaking

MERRICKMERRICK In the studio or on a stage
edited October 2003 in Science & Tech
Originally I published this here:
http://www.prosoundreview.com/forum/showthread.php?s=&threadid=143

But I'd like to also share it with Short-Media :wave:

If you have your swap file in the default C:\Windows location, this dose not apply. But If you are tweaking your DAW here's some tips:

If you have another fixed hard drive besides the drive where your O/S (presumably C:\Windows) is resident that IS NOT an audio/video writing drive, let's say for example a drive for backup, samples, whatever, then you should put your swap file on it. If you are setting up the drive for the first time, make the first (outermost partition which is the fastest physical access) reserved for your swap file. A good rule is 2x your ram. So a 512MB Ram system should have a 1.1GB FIXED swap file formated with 32k clusters. You'll see a good boost since now as your drives write data they can simultaneously read from the swap. If you can't set up the drive fresh, it still pays to put the swap file on it anyway.

Note:
Having a separate partition for swap file set up on a slower hard drive would still be faster than having it on a faster hard drive that contains the O/S (presumably C:\Windows).

Having the swap file on a different partition than the O/S (presumably C:\Windows), but still on the same physical drive does not increase performance:cry:

Okay so what's all this about two swap files:confused:

By default at setup Windows puts the swap file in C:\Windows. If you change the swap file location at that point then the original, unused swap file in C:\Windows "sticks behind". No damage to the system but another file that the O/S has to "read around". If you add that new drive later and decide to create a swap file on it, the old swap file and it's resident data just lays there like a dead log and you can't delete it from Windows Gui :mad:

To remove the old swap file ONLY after you have successfully installed the new swap file:

Reboot into pure dos (hit f8 and choose command prompt only) and type:
C:\>Deltree /y C:\Windows\386.swp
hit enter and reboot

Props to ageek, nightshade737 and Axcel216 for some of this info that I gleaned from their posts/articles.

:thumbsup:

Comments

  • SpinnerSpinner Birmingham, UK
    edited September 2003
    Cool stuff dude, I've added this information to the 'Tweaks and Tricks Thread'.:thumbsup:
  • Straight_ManStraight_Man Geeky, in my own way Naples, FL Icrontian
    edited September 2003
    Let me talk about cause and effect a minute, and this applies to MANY things as well as swap because it ties to inner way HDs are partitioned.

    Symantec has a thing called the Windows Optimization wizard. It bench reads drives, looking for the fastest Primary partition in the system. Why does it concentrate on Primaries??? Beacuse every read\write from a large secondary (could be drive D) involves not one, but four totally seperate seeks (first two are fast, and only position data gets read, third is a direcctory read positioning, fourth is to beginning of file).

    Drive has actually this structure as far as Widnows is concerned when secondary logical partitions are in use (your Drive D if you have one HD and it has one logical partition):

    Primary part, after a Primary part table and the drive core data (which would get too long to get into, the data is partly in what is technically the boot sector). Windows uses a chain of position pointers to get to files under normal use, first seek is to find out the start point of data are in primary or true secondary in quick order after that if the secondary exists. Second seek, if we are reading from drive D in this scenario, is to find start point of the beginning of a small data table in the secondary partition that is a map of where the logical drives exist and where they start and end.

    Ok, now lets talk more pedestrian things.

    Most of us know about directories, which are slightly more complex than most folks know, and the swap file IS a file of a special name and attribute set that has to follow base directory and file rules.

    Lets take 98SE in part for MERRICK here, as DAW is typically 98 or SE based. The drive has doen the first two seeks and does a third.

    Let's say you need a file-- the secondary logical has a full directory set and is a drive like a primary except it is encapsulated in a secondary Partition. The access to file from this point on, once the directory in the logical has been found, is same as the Primary. Read begin point of directory, hunt through directory for begin point of swap file by name, Read to point in file that has a contents index (this is extra for a swap only), read contents you want.

    But swaps are used actively by Windows normally, they are active read\write. For that reason alone they should be both fixed and near outer edge of drive so seeks are faster (movement of head time, latency to start and stop head are factored in here) and are the fastest possible so the swap write time is minimized and drive can move on to other things.

    Near outer edge of drive is a gimmee, lets look at why fixed. Have you ever watched the display of SpeedDisk as it optimizes a swap file??? The file is typically fragmented, so fragmented that the head of the HD is moving back and forth tracing through a dynamicly Windows run swap file-- next logical part of swap not only could be but more often WAS before th last part at least once inteh swap due to the ways DOS works with files (it indirectly feeds next open block position when asked for a file start place, and that block can be bigger or smaller than the size needed and older data that was not changed, say from a pended by windows process that is sleeping in the swap file due to RAM constraints forcing it to be taken out of active true RAM to make room for something that is active now and the new block (logically LATER in swap) can be physically before the older one.

    This irony means that two things can happen with a big dynamic swap file:

    First, it can be fragmented so much that the fastest way to fix a widnwos thta is fubarred is NOT to reload but simply to unhide your swap in DOS mode, wipe it, and reboot so Widnwos recreates the swap).

    Second, it can get so badly fragmented that DOS underlayers loose track of its last-written parts-- there are limits to how many parts of a file can be kept track of, in both DOS and Windows.

    Third, because the swap is typically written in chunks determined by Windows, the end of the file in a very RAM strapped and full drive Widnwos box can overwrite the end-of partition marker due to limits in how Windows and DOS interact in re swap. For 95 and 98, erasing the swap and running Norton Disk Docotr fixed many machines that less knowledgeable folks reloaded. The most common problem I found working with Windows that was locked, other than same-name DLLs used by apps overwritign core system DLLs, was swpa file problems.

    I started doing this:

    Defragged drive, if need be in Safe mode. Shut down box. Stuck extra RAM in box to 96 MB or more. In msconfig, unchecked all but core Windows needed things. Rebooted. Told Windows NOT to use a swap file. Overrode Windows's yelling and shouting about how this was bad. Rebooted(let Widnwos do it). Told Windows to use a fixed swap file of 2X RAM. Let Windows reboot, or helped it to if needed after HD light went out with a reset button push.

    Waited sometime 10X normal time for Windows to establish a new fixed locationa nd file size file on HD, much large than normally was established at boot. Boxes I did this to came back on average, HALF as often as boxes with soft problems came back. In many cases, customers also bought the RAM I stuck in as the box then ran faster also in part due to the RAM.

    THEN I discovered the Windows Optimization Wizard in Norton Systemworks could do this for me and in many cases without the RAM upgrade needed nor the peculiar order. It benched,chose a place, set up the swap file changes as DYN_keys which were written to the registry on reboot and a single new fixed file for swap built, and have used it ever since for that reason. It also did one other thing I liked, it set up an immediately-after-boot run of Speeddisk, which can optimize swap files, and that fixed the issue of the swap file being tuned on a fragged drive and starting out in pieces. Unless the drive was really fragged and full,the Optimization Wizard worked only about 90% of the time. Wiping swap let the wizard run if it had hung in about 90% of the remaining cases, and the other 10% were almost always hard errors on HD.

    John(this is a summary of about a year's study).
  • GobblesGobbles Ventura California
    edited September 2003
    *knocks on wood before making this statement* I run windows xp on c:, I have a D: which is a contains mine and my wifes users (my docs) folders, an e: which contains all of our legally ripped audio :p , and F: which is a 2 gig swap partition. C is a drive on its own and the rest are a divided 40 gig drive. Thus far the system seems ok.

    Gob
  • MediaManMediaMan Powered by loose parts.
    edited October 2003
    Swap file size and placement has been discussed many times. There are some true statetments that always apply:

    1) The outter part of the drive is faster since it data due to the fact that a point on the drive travels a greater distance than a point nearer to the center. Therefore it is safe to assume that the swap file placed nearer to C: would benefit from the greater speed.

    2) It is a given that swap file min and max should be set to the same number. This retards the defragmentation process of Windows continually resizing the swap file as needed.

    3) Swap files were originally put in place to offset the lack of ram in a sytem. At one time 8 or 16 MB was considered a lot of ram but programs needed more and RAM was expensive. The swap file did the job of ram but on a much slower level. Since RAM has become comparativiely dirt cheap the swap file is not as important any more.

    4) It is debatable that, in a system of 256 MB and definitely 512 or greater RAM what size the swap file should be. The old rule of 2.5 x ram isn't a rule that is set in stone. Swap file size should be though of as how hungry your programs are and if those programs, like photoshop, have their own scratch disk options.

    Swap file size is a variable of necessity of user and software.

    5) We often bench a drive based on optimum conditions. EG: fully defragmented, just after a reboot, etc. This may lead us to believe that one configuration is better than the other. Remember to keep in mind that a better result would be benchmarks done over a period of time...a month for example...in order to gauge a better result.

    6) Swap files should always be on the faster part of a drive or on the fastest drive. They should also be fixed in their own primary partition at best or the logical drive next to C: (the outter most part of the drive)

    Both of the previous comments are great. As usual, especially with mine, take the best of each and blend it for what you feel works best for you. We can get you pushed in a better direction but the fine tuning is that of a combination of usage, components and software. When it comes to squeaking out the extra points there is no hard and fast rule.
Sign In or Register to comment.