Windows swap file - how large?

Squidmaster

Member
Jul 26, 2004
192
0
0
I'm putting together a new system within the next week or so, and I'd like to optimize my swap file. What is the best configuration for a system with 4GB memory (3.5ish in XP)? Is it worth making a drive partition for this purpose or should I just let it reside with my OS/programs partition?

Thanks!
 

nerp

Diamond Member
Dec 31, 2005
9,867
105
106
The best configuration is no configuration. Leave at auto.

Put the swap file on the fastest drive. Don't create a special partition for it.

Any mucking about will reduce performance.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
I'm putting together a new system within the next week or so, and I'd like to optimize my swap file.

That's pretty much an oxymoron, you can do a few things to make pagefile usage interfere with the system less but that's about it. And with as much memory as you have you won't be touching the pagefile much at all so anything you do will be pretty much imperceivable.
 

Squidmaster

Member
Jul 26, 2004
192
0
0
Good to know. Thanks! I've read about some people actually turning it off (when paired with 8GB RAM). Does the swap file get used sometimes when it isn't actually needed or something, or is that a meaningless maneuver?
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
In Windows it's almost never a good idea to try to turn the pagefile off and I say try because I've seen Windows create a small temporary one when there isn't one present so it can take some work to really make it go away for no gain at all.
 

VinDSL

Diamond Member
Apr 11, 2006
4,869
1
81
www.lenon.com
Originally posted by: Nothinman
In Windows it's almost never a good idea to try to turn the pagefile off...

Agreed, but probably for different reasons... ;)

I ran this machine (I'm typing on) without a pagefile (off 'n on) for almost a year, for varying lengths of time, and never could NOT tell a difference one way or the other, so...

I just decided to leave it on!

I figure, if the pagefile was all THAT critical, Microsoft wouldn't allow you to tinker with it, enable, disable, et cetera.

Maybe in the old days it made a difference in performance, but... you couldn't prove it by me!

My suggestion to the OP is, just 'leave it alone'... unless you're bored or something.

In the end, he'll come to the same conclusion! :)
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
I figure, if the pagefile was all THAT critical, Microsoft wouldn't allow you to tinker with it, enable, disable, et cetera.

It's probably just a bug that you can disable it completely in some cases in when not running in PE because it doesn't always work and if you do get it to work sometimes it'll still bootup and say "There's no pagefile, I've created a temporary one for you until you get around to creating a proper one.".
 

Scotteq

Diamond Member
Apr 10, 2008
5,276
5
0
Originally posted by: Squidmaster
Good to know. Thanks! I've read about some people actually turning it off (when paired with 8GB RAM). Does the swap file get used sometimes when it isn't actually needed or something, or is that a meaningless maneuver?

Running 8GB/Vistax64 here, and I pretty firmly feel that the better course of action is to turn the page file down to some minimal level (512MB in my case) rather than eliminate it entirely. Some prograns do still look for it, and get fussy when it's not there. And if for whatever reason, the computer decides to use the now-nonexistant page file, it will generally crash your computer on the spot.


It seems to be fashionable to shut it off completely - possibly stemming at least in part from a (poor IMO) article at Tom's about running Vista with 8GB - in a quest for the best possible performance.



 

Squidmaster

Member
Jul 26, 2004
192
0
0
Ah, I didn't read that article. I was just curious about that anyway. Thanks for your input. It's certainly nice to not have to worry about this element. :)
 

EarthwormJim

Diamond Member
Oct 15, 2003
3,239
0
76
Originally posted by: Scotteq
Originally posted by: Squidmaster
Good to know. Thanks! I've read about some people actually turning it off (when paired with 8GB RAM). Does the swap file get used sometimes when it isn't actually needed or something, or is that a meaningless maneuver?

Running 8GB/Vistax64 here, and I pretty firmly feel that the better course of action is to turn the page file down to some minimal level (512MB in my case) rather than eliminate it entirely. Some prograns do still look for it, and get fussy when it's not there. And if for whatever reason, the computer decides to use the now-nonexistant page file, it will generally crash your computer on the spot.


It seems to be fashionable to shut it off completely - possibly stemming at least in part from a (poor IMO) article at Tom's about running Vista with 8GB - in a quest for the best possible performance.

Why would you turn it down that low? You really shouldn't mess with the size of the pagefile unless you're moving it to a different drive. And even then you shouldn't make it arbitrarily small.
 

Tweakin

Platinum Member
Feb 7, 2000
2,532
0
71
I believe MS recommends 2.5 times the available memory for optimal performance...which is why it is constantly resizing in XP. I normally set it to manual and use that recommendation...can't say I've ever noticed an improvement though...
 

lopri

Elite Member
Jul 27, 2002
13,329
709
126
But wouldn't the swap files expanding/shrinking will cause less than ideal disk performance over time? (fragmentation) I usually set a large enough swap files in fixed size.
 

WildHorse

Diamond Member
Jun 29, 2003
5,006
0
0
I've found that a swap file of 2046 MB (same for both min & max) works real well on my Windows XP SP2 computers.
 

Continuity28

Golden Member
Jul 2, 2005
1,653
0
76
Originally posted by: Tweakin
I believe MS recommends 2.5 times the available memory for optimal performance...which is why it is constantly resizing in XP. I normally set it to manual and use that recommendation...can't say I've ever noticed an improvement though...

It only works for certain memory sizes.

I guarantee, for someone with 4GB of system memory (on a 64-bit OS obviously), for example, 10GB of page file is extremely overkill and far from ideal. That's just a waste of disk space.

Dynamic resizing can have a performance impact, but to make the page file static, you'll need to make sure you're using a safe amount which won't be small enough to impact performance also.

The location on the hard drive matters as well. The outside of the drive platters are the fastest, and Windows detects one such area as the beginning of the drive. The reason people recommend partitions isn't because they think it will go faster than non-partitioning, but because it helps ensure the page file will stay on the fastest part of the hard drive regardless of reinstalling and such. For example, if you place a blank hard drive in your PC, and move the page file to this drive, it will likely go to the beginning of the drive. All is well. There are two issues, however. First, if you reinstall and now have other data on that drive, Windows may not place the page file in that same position, it may place it near the end of the drive, in the slower areas. Secondly, if your drive is NTFS, the MFT area might be close to the beginning of the drive, and Windows will place the page file in 2 fragments, sandwiching this MFT area. Depending on what's being paged, this can have consequences.

What I do, after determining which drive I want to handle my page file (which is currently unpartitioned), is make the first partition on the beginning of the drive - as FAT32. Why FAT32? Because the NTFS MFT space and overhead is very wasteful when a partition is only going to contain one darn file. FAT32 would perform better in such a scenario. So let's say I want a 4GB page file (which is still pretty high, but this is an example), I'll then make a slightly bigger than 4GB FAT32 partition, and the rest of the drive is partitioned as NTFS and used as usual. No matter how many times you reinstall, or move the drive, you can always be sure your page file is on the fastest part of the drive, and in one fragment.

All that said, the performance difference is not very great, which is why most people should just leave it at default.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
I believe MS recommends 2.5 times the available memory for optimal performance...which is why it is constantly resizing in XP. I normally set it to manual and use that recommendation...can't say I've ever noticed an improvement though...

The pagefile is never "constantly resizing", it grows if necessary but only ever shrinks on a reboot.

I've found that a swap file of 2046 MB (same for both min & max) works real well on my Windows XP SP2 computers.

Which is completely arbitrary. System managed is fine for 99% of the cases and in the other cases the size depends on the workload you're putting on the machine.

The location on the hard drive matters as well. The outside of the drive platters are the fastest,

Actually it matters very little. Pagefile access is pretty much completely random so seek time dominates performance, raw throughput means almost nothing with regards to the pagefile.

The reason people recommend partitions isn't because they think it will go faster than non-partitioning, but because it helps ensure the page file will stay on the fastest part of the hard drive regardless of reinstalling and such.

And those people are wrong, the impact of seeking between partitions hurts performance more than keeping the pagefile at the beginning of the drive will ever help.

Secondly, if your drive is NTFS, the MFT area might be close to the beginning of the drive, and Windows will place the page file in 2 fragments, sandwiching this MFT area. Depending on what's being paged, this can have consequences.

I believe the MFT is always offset a certain amount from the beginning of the volume so that will probably never happen and even so you're always seeking into the MFT so putting the pagefile near it would help performance more than hurt.

What I do, after determining which drive I want to handle my page file (which is currently unpartitioned), is make the first partition on the beginning of the drive - as FAT32. Why FAT32? Because the NTFS MFT space and overhead is very wasteful when a partition is only going to contain one darn file. FAT32 would perform better in such a scenario. So let's say I want a 4GB page file (which is still pretty high, but this is an example), I'll then make a slightly bigger than 4GB FAT32 partition, and the rest of the drive is partitioned as NTFS and used as usual. No matter how many times you reinstall, or move the drive, you can always be sure your page file is on the fastest part of the drive, and in one fragment.

And all of that is pretty much wasted effort. The extra partition seeking during pagefile access is going to undo any performance benefits that you might have and the time spent implementing it is very likely much larger than any amount that you might've saved from any performance increases even if it did help.
 

Continuity28

Golden Member
Jul 2, 2005
1,653
0
76
Originally posted by: Nothinman
And those people are wrong, the impact of seeking between partitions hurts performance more than keeping the pagefile at the beginning of the drive will ever help.

I believe the MFT is always offset a certain amount from the beginning of the volume so that will probably never happen and even so you're always seeking into the MFT so putting the pagefile near it would help performance more than hurt.

And all of that is pretty much wasted effort. The extra partition seeking during pagefile access is going to undo any performance benefits that you might have and the time spent implementing it is very likely much larger than any amount that you might've saved from any performance increases even if it did help.

Partition seeking? You misread what I wrote. It's a separate drive. The only other data on this drive are files I don't access often, like video files. The page file competes with nothing on that drive, so there is no partition seeking.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Partition seeking? You misread what I wrote. It's a separate drive. The only other data on this drive are files I don't access often, like video files. The page file competes with nothing on that drive, so there is no partition seeking.

You didn't originally specify what else is on that drive and even so it's a largely pointless optimization. If memory is low enough that you're using the pagefile then you're also paging to/from other places on other disks because the pagefile is only one of the VM backing stores used by the kernel.
 

soonerproud

Golden Member
Jun 30, 2007
1,874
0
0
As others have said it is best to leave the PF alone, especially on Vista. Out of all my experiments with the pagefile I have not found one thing that will improve performance. Almost all the tweaks people use today can and in most cases will hurt performance.

The only tweak that might give a very slight performance boost is to set the page file to a fixed size. The only reason this may very slightly boost performance is that it kills one less process (Automatic PF service) that will interfere with windows performance due to it having a high priority. If you do decide to set a fixed pagefile, at least set it to something reasonable like 2048.
 

vaca232

Junior Member
May 13, 2006
19
0
0
I have my pagefile set to 4GB on my C drive, and have a 2GB pagefile on a separate physical disk. I've heard not to move the pagefile from the Windows partition, and there's no point to have multiple pagefiles on different partitions of a single psychical disk.
 

F1shF4t

Golden Member
Oct 18, 2005
1,583
1
71
I have same amount as my ram pagefile set on C drive and then set very small ones (300 meg in size) on other drives just so you can't format them.
 

lopri

Elite Member
Jul 27, 2002
13,329
709
126
Here is what I do. If someone could comment on this I'd appreciate it.

1. Install Windows.
2. Remove Swapfile. (size=0 or near 0)
3. Reboot and defrag.
4. Set the Swapfile at 8GB 'fixed'. (physical RAM is also 8GB)
5. Reboot.

Let's suppose the time wasted is zero. ;)
 

Auric

Diamond Member
Oct 11, 1999
9,591
2
71
Having the pagefile on its own volume on an independent drive is beneficial not only to ensure it remains at a fast portion and contiguous, but also because the cluster sizes can be optimized. Windows pages in 4KB but media storage, for instance, benefits from 64KB clusters. Sure, anything but occasional paging is ideally precluded but given both hardware and software limitations, if not cost, it is not always possible to have 'nuff RAM.
 

flexy

Diamond Member
Sep 28, 2001
8,464
155
106
>>>
The location on the hard drive matters as well. The outside of the drive platters are the fastest, and Windows detects one such area as the beginning of the drive.
>>>

thats a fallacy. There is now question that the outside of an HD is fastest, but picture a typical system, say, Vista with 50GB of OS data.

If the PF is all the way at the begining of the HD the HD ehad has to access the PF, and, in the worst case, "jump" over the chunk of 50GB of data to go all the way to the outside of the HD, to the PF.

Even worse, say you have a typical, ONE drive/partition system with OS and apps/games...say 400GB.

Now...having your PF all the way at sector 0, you play a game which resides at the last 80% of the HD. Again....HD head must physically go all the way to the outside, jumping over 400Gb of data, to access the pagefile.

The most intelligent solution is to have the pagefile in the MIDDLE, to make the average distance to access the pagefile smallest. Thats also a reason why recent commercial defraggers usually do NOT place the pagefie all the way outside, but right in the middle.

I also THINK that importance of pagefile with 4GB or even 8GB+ systems is way too overrated....ever since i have my Vista with 4GB i didnt notice any significant pagefile accesses as i had with XP and 1GB ram, trying to play games etc. with way high memory requirements.

PF performance, defragmentation and playcement etc..etc..would only play a role if the PF is in fact constantly accessed in a system already very much on its limits...but then this is rather a sign to QUICKLY get out and get another stick of memory..and not try to tweak where's no point in tweaking.

Or in other words: if a system is actually negatively affected by constant PF accesses its adviced to uprade ram and not to seek a solution to the problem with the placement of the pagefile.



IMHO.

 

flexy

Diamond Member
Sep 28, 2001
8,464
155
106
Originally posted by: Auric
Having the pagefile on its own volume on an independent drive is beneficial not only to ensure it remains at a fast portion and contiguous, but also because the cluster sizes can be optimized. Windows pages in 4KB but media storage, for instance, benefits from 64KB clusters. Sure, anything but occasional paging is ideally precluded but given both hardware and software limitations, if not cost, it is not always possible to have 'nuff RAM.

this is interesting. recently i heard that Vista (OS partition) wouldnt even boot if clusters are changed from default 4k to say, 16k or 32k.

But an interesting solution would be to make a mini paritition which only contains BCD boot data, keep at 4k clusters and let Vista boot from this. And then the actual OS resides on the next partition, this can have 16k, 32k or even 64k cluster size. The pagefile could also stay on this mini boot-partition, since 4k cluster site.

But i am too lazy to tweak around with this now.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Let's suppose the time wasted is zero.

Except that supposition is clearly wrong since steps 2-5 take a good amount of time that's otherwise unnecessary.