Swap file size with large RAM sizes

Copie

n00b
Joined
Jul 7, 2009
Messages
11
I've never managed to find a sensible answer to the question of "how large should your swap file be" despite looking every 6 months for what seems the last 10 years.

In the good old days it was recommended that your swap file should be 1.5x your RAM size. But with RAM becoming cheaper and even the lowest end workstations having multiple gigabytes of RAM has this 1.5 ratio now changed?

I have many servers at work with 32Gb of RAM and we tend to use a 32Gb swap file, this is just about doable with a 73Gb OS drive, but we've are just about to order our newest server which has 144Gb of RAM (Dell R710). If we stick to the 1x RAM ratio we burn a whole 146Gb drive just for swap, and if we go by 1.5x RAM we need a 300Gb OS drive.

What are peoples own ratios of swap to RAM?
 
Uhm, a 300GB drive shouldn't be that expensive if you can afford 144GBs of ram, or better yet use a SSD. But personally I don't use a swap file, because ram is so cheap I find it better just to buy more ram than I need than force the system to use slow hard drives as backup ram. That's just me though, some people here hate the idea of no swap file though and say it causes instabilities, I've not seen that running with no swap file for at least 2 years now, though.
 
Last edited:
It's a fair point but why have such a large swap if it's not actually needed?
 
Well, I assume you mean on the server, well if you absolutely don't need it, then don't have a swap file. But on a server you probably want the extra security, because you may not need it now but at some point in the future the server may be really loaded and will run out of memory and crash. On a server, especially if it's mission critical stuff, a little slowness is acceptable to keep the system stable at all times. On home systems that's not that important an issue, especially if you're like me and over-buy on ram and know your memory usage patterns.

Also some lame programs, i.e. custom server apps potentially, will abort if there is no swap file, or possibly crash. Like I said, not an issue on home systems if you know what you're doing, but I wouldn't risk it with a server.

edit - Maybe you mean 'why have such a large swap if a smaller one will suffice' - in which case I'd say, set the swap large and see how much you use at peak, then adjust the swap down so there's still a comfortable margin but it's not using so much space, but again you're taking risks that are unnecessary, just set it to 1:1 or 1:1.5, monitoring ram usage to see if that's enough if not set it larger.
 
Last edited:
Is there a reason you're setting the pagefile to a static size and not just letting Windows manage it?
 
I'm lead to believe that a static page file is better for performance as there is less disk thrashing due to resizing.

Although if the page file is on a dedicated disk thats less of an issue.

We tend to leave our page files on the OS drive though.
 
Well, Microsoft generally recommends to leave it up to Windows to decide and I've seen little evidence to prove that doing otherwise does anything but decrease performance (except perhaps in specialized environments). The last thread I saw about this was about disabling it entirely (awful idea IMO from the evidence I've seen and what MS and others suggest). It went multiple pages but I've seen no solid testing evidence that tinkering with it helps (besides moving it to a different drive).

That said here's a MS article on establishing proper page file sizes for Win XP / server 2003 with lots of RAM if you want to tweak away:

http://support.microsoft.com/kb/889654

This might be helpful too (I got it from the XP Myths page here:

http://home.comcast.net/~SupportCD/XPMyths.html#Optimization )

http://support.microsoft.com/default.aspx?scid=kb;en-us;555223
 
Last edited:
I'm lead to believe that a static page file is better for performance as there is less disk thrashing due to resizing.

Although if the page file is on a dedicated disk thats less of an issue.

We tend to leave our page files on the OS drive though.
I don't know what OS you are running but from what I understand, constant resizing of the page file stopped with XP/2003. Vista uses 1.3x ram for the page file, Windows 7 (guessing 2008R2) uses 1x. The OS sets the page file and there's no reason to not be happy with that unless it tells you you have low virtual memory. The only modification to the page file I can see be resonable is to set a static size, of whatever the OS sets it at (on XP) On Vista/7, maybe move the page file to a less used drived/partition. That's about it. Microsoft knows more about the page file than anyone here does so why mess with it.
 
I was always to the understanding that some programs need a swapfile. No ?
 
I've seen many pages about what to do about the pagefile, many of them conflicting with what another page says to do about it. I don't know which to believe, so after I got 8GB memory, I decided to arrive at my own conclusions. I set it to a static, very small size (64MB). This way, programs that check for the existence of a pagefile get nothing to bitch about. If windows ends up needing more virtual memory, it will pop up that bitchy little message. That was 6 months ago. Windows has not bitched about virtual memory yet, ergo, it works for me.

Do whatever works for you.
 
I was always to the understanding that some programs need a swapfile. No ?

Yes. I was running 8 gigs without a swap file and noticed one of my 3d modeling program (Maya) would stutter like crazy when I would rotate the model around in space. Turned swap file back on (2 gigs) and the stuttering would stop. I'm running 12 gigs now on an i7 rig and would love to turn it off, but for the sake of maya and for less problems of other unseen programs, it wouldn't hurt use a little page swapping.
 
You cannot say that some applications require a pagefile. Maybe if it was possible to write directly to it, but that isn't possible.
 
You cannot say that some applications require a pagefile.

Why not? I suppose, techincally, I haven't seen any that require one, they just pop up annoying warning boxes on every startup of the program if you don't have one. I have seen some versions of photoshop do this. I have seen one or two other programs do it as well, but I can't recall which ones they were off the top of my head.
 
Because the pagefile is internal to the memory manager. Applications cannot access it.

The warning is just a way to tell the user he might run out of memory sooner than he would with one configured.
 
in vista/win7 and i think xp also, windows will increase the size of the swap file to accommodate it's needs. regardless of what static number you set it, windows will size it as needed. i don't think there is any performance gain by setting it static but i have been doing it for so long that i just keep doing it. there was a article a read back in the win98 days that was very useful and i think it's still informative, just not the info about optimizing. http://www.adriansrojakpot.com/Speed_Demonz/Swapfile_Optimization/Swapfile_Optimization_01.htm
 
Turned mine off with 12gigs, no problems. I would probably leave 30gigs for your server environment just in case. But you should really analyze peak usage.
 
, this is just about doable with a 73Gb OS drive, but we've are just about to order our newest server which has 144Gb of RAM (Dell R710).

HDs are absolutely dirt cheap so a 300GB OS drive should not be an issue. And, I believe that if this is a mission critical server with a decent modern OS, just leave it alone.
 
Here we go again...

The million other threads on this topic ended with a consensus of "Leave it alone!"

No matter how much RAM you have, some apps rely on the swap file no matter what.
 
I am running windows servers 2003/2008 for the past 5 years without the windows paging file. I turn it off on both home and work computers. Again, I am running like this for the past 5 years. The first thing that I do after installing windows is turning off the paging file. I have never encountered a situation where some application dysfunctions because of lacking paging file. In fact, it is a pure nonsense that applications need a paging file because the applications cannot know whether the memory they use comes from the paging file or the RAM.

As an extremely heavy memory user, I often hit the installed RAM limit. On windows 2008 this results in applications refusing to start/load and applications become nonresponsive. The situation immediately corrects after reducing the number of open applications. Usually I have around 30 windows/applications open at any time.

On the contrary, I find that it is really sucks to have a paging file turned on. The problem with having a paging file is that windows does not utilize the memory correctly. No matter how much RAM you have, windows will always act in its retarded way and utilize the paging file even if you have 10GBs RAM left unallocated. Microsoft windows sucks in endless ways and this is one of them. The OS should never use the paging file until there is any free RAM left.

It is a pure biased myth that windows should not run without the paging file.

I recommend to anyone how knows what RAM is to turn off the paging file on computers with 2GB+ of RAM.

Yesterday I have completed the order of my new build that will have 12GB of RAM. Hopefully I will post a build log for your viewing pleasure.
 
No matter how much RAM you have, some apps rely on the swap file no matter what.

No they don't. As said, applications cannot access it. Therefore they cannot rely on it (unless you run of out memory of course, but even then only the memory manager accesses it).
 
I personally just put a 512MB pagefile on each physical hard-drive. It can potentially help with multi-tasking, and with disk sizes that they are these days, you're not gonna miss the room. Windows will only put the absolutely non-performance critical data on the page-file, so having it on won't hurt anything. And you get the peace on mind of not having to worry is some badly coded app is going to crash because you turned it off.
 
I personally just put a 512MB pagefile on each physical hard-drive. It can potentially help with multi-tasking, and with disk sizes that they are these days, you're not gonna miss the room. Windows will only put the absolutely non-performance critical data on the page-file, so having it on won't hurt anything. And you get the peace on mind of not having to worry is some badly coded app is going to crash because you turned it off.

You are wrong. Windows will utilize that 512MB extensively, even if all the RAM is left free. Turn off the paging file and you will see how your hard drive gets a break.
 
You are wrong. Windows will utilize that 512MB extensively, even if all the RAM is left free. Turn off the paging file and you will see how your hard drive gets a break.

That is not what I experience. Mine is hardly ever used.
 
You are wrong. Windows will utilize that 512MB extensively, even if all the RAM is left free. Turn off the paging file and you will see how your hard drive gets a break.

With my setup as stated before, using Everest Ultimate, each of my 512MB page file only has 35MBs of used space. Windows reports page file as physical + virtual together in task manager.




 
With my setup as stated before, using Everest Ultimate, each of my 512MB page file only has 35MBs of used space. Windows reports page file as physical + virtual together in task manager.





It is not important what the used space of the paging file is. The problem is with the frequency the paging file is been accessed. Windows accesses the paging file much more often than it should. Pay attention to the HDD activity light, why is it active every time you perform some operation even if the process doesn’t need to access the hard drive for data. Now, switch off the paging file and see that windows can do the same operations as before, but without a single access to the HDD.
Every useless access to the HDD slows down the system tremendously even if the access is for a few KBs.
I can’t give you an exact scenario how to replicate this, but you should pay a good attention to the HDD activity light. After turning the paging file off you will be surprised how much less the light flashes.
The bottom line is that probably not everyone is picky as me and not everyone cares to have few HDD accesses, but for me it’s a very important.
 
Since switching to Windows 7, the only time my drive light goes on is when i first boot up and prefetch loads everything, or i open a program. There's no thrashing resulting from page file. While i did have that problem with Vista when i was still on 2GB, it's now gone. I still believe that even with large amounts of ram, a small page file will not degrade performance any.
 
Since switching to Windows 7, the only time my drive light goes on is when i first boot up and prefetch loads everything, or i open a program. There's no thrashing resulting from page file. While i did have that problem with Vista when i was still on 2GB, it's now gone. I still believe that even with large amounts of ram, a small page file will not degrade performance any.
I don't have much experience with windows 7, but it is possible that paging file is used differently on win 7. Microsoft did some major upgrade to the Win 7 memory system.
 
Uhm, a 300GB drive shouldn't be that expensive if you can afford 144GBs of ram, or better yet use a SSD. But personally I don't use a swap file, because ram is so cheap I find it better just to buy more ram than I need than force the system to use slow hard drives as backup ram. That's just me though, some people here hate the idea of no swap file though and say it causes instabilities, I've not seen that running with no swap file for at least 2 years now, though.

The last time I tried running with no swap file I did have problems. There are a small number of apps that need a swap file. For instance Company of Heroes requires a 1024 MB swap file. It is why I keep my swap file at 1100 MB. Why it wants it I don't know.
 
If you have tons of ram and you had some crazy app that required it, couldn't you create a ram drive and put your swap there? Best of both worlds. You get the performance of no swap with the safety of having a swap.

I have no experience or evidence to back this up, just a thought...
 
If you have tons of ram and you had some crazy app that required it, couldn't you create a ram drive and put your swap there? Best of both worlds. You get the performance of no swap with the safety of having a swap.

I have no experience or evidence to back this up, just a thought...

how does it affect overall system performance? lets say you have 8GB of ddr2 800mhz, and you know games wont use all 8GB would it be worth using like a 4GB swap file on the Ram or would the ram having to do that extra load slow down gaming perf. thats trying to access the ram for gaming but stuff is trying to use the swap file at the ame time ect...
 
how does it affect overall system performance? lets say you have 8GB of ddr2 800mhz, and you know games wont use all 8GB would it be worth using like a 4GB swap file on the Ram or would the ram having to do that extra load slow down gaming perf. thats trying to access the ram for gaming but stuff is trying to use the swap file at the ame time ect...

If you are not using all of your RAM, you "should" have very little swap file activity anyway. However, a swap file on a RAM drive cannot be as fast as simply using the memory.
 
(didnt read everyone else's responses)

use the search function, this has been covered time and time and time again

bottom line is

leave it alone.....
 
(didnt read everyone else's responses)

use the search function, this has been covered time and time and time again

bottom line is

leave it alone.....

I said the same thing a few posts up and got chewed out over it. Good luck. :D
 
I do believe it was world in conflict (could be wrong) but one game i tried to install refused with no swap file, so stupid

i turn it off on anything over 8gb myself, if nothing else it saves 12gb of waste space on the ssd raid array
 
Back
Top