How should I configure virtual memory settings?
Hi everyone. Leo Notenboom here for askleo.om.
Let's get right to this question.
I have a Windows machine to which I added a second hard drive.
The new, larger drive is now the primary.
What do you recommend for a swap file?
The three times Ram
rule of thumb doesn't make much sense to me.
It should be bigger with less Ram, not more.
It's currently set to the same as my Ram
size as its minimum and twice as much as a maximum size on the C drive.
What size should I set it to?
Should it be on a different partition, and should I give it its own partition?
I'll be doing a lot of scanning and Photoshop if that affects the answer.
It's my understanding that a fixed size
reduces fragmentation, or at least makes defragmentation easier.
I've also seen suggestions for making the swap file an entire partition.
I have Partition Magic.
Would putting it onto the second drive improve read write speeds?
The second drive will be for backing up data files and not in constant use.
So you're asking some great questions and providing the right kind
of information to be able to address some of the topics that you're raising.
I've written about virtual memory a time or two already, but what I want to do
in this article is go over what is essentially what is so much voodoo to many
people and talk about what it is, why it is when it gets used,
and based on your situation, whatever specific that might be,
make a recommendation on exactly where to go.
So let's start with some terminology.
Swap file, paging file, virtual memory.
What the heck?
Very technically, and I do mean very technically.
They have different meanings.
However, for the purposes of this
discussion, we're just treating them all as the same.
All they really are is disk space used instead of Ram.
Now, Ram and disk are very different.
So what that means is that when your
system runs low on Ram, when programs are trying to use more Ram
than perhaps your system has available at that time,
Windows will take something that's in Ram and write it to disk,
making that Ram available for whatever this upcoming need turned out to be.
When it's time to come back, when that Ram that it just wrote to disk
is needed again, well then it might have to move something else out of Ram and read
that virtual copy of Ram from the disk back into real Ram.
Now that's a gross oversimplification, but the important point is that when
the system is in this situation where it is needing to use disk space as if it were
Ram, by writing to it and reading from it, the disk gets really busy and it's
a performance hit because your disk is slower than your Ram.
That's why Ram exists, right?
Ram is very, very fast, and the process of writing some of it
to disk and then reading it back in later when needed.
That's slow.
So that's the very first thing that I would focus on when trying to understand
what you should set your Paging file your virtual memory settings to.
Virtual memory is a performance bottleneck
only if your system has used up all available Ram.
Ram matters most.
So if you find yourself in that situation
frequently, then I actually have two recommendations.
Either add Ram to your system if you can.
If your system has the hardware capability of having you add more Ram to it,
that by far will be your biggest performance improvement because you'll be
able to continue doing what you were doing without necessarily needing to hit
the disk because of paging it'll all stay in Ram because you've got enough.
The other option,
try not to do as much at the same time when you're running five or six programs
or you've got a couple of dozen browser tabs open.
All of those require some amount of Ram to run.
That's the kind of stuff that can add up.
And if your machine doesn't have a lot of Ram, or if you're running a lot
of different things at the same time, then that too can push you into this
situation where all of a sudden your system as a whole requires more Ram than
it actually has and Windows has to start swapping to and from the disk.
So add more Ram if you can use less Ram.
If you can't add more Ram by running fewer programs.
Let's have a look on my demonstration system.
Here exactly what it means to potentially not have enough Ram or where to even look.
So I'm going to go ahead and close
the browser here because I don't really need it right now.
Right click on the Start menu and click on Task Manager.
Task Manager is a useful tool for this kind of thing.
I'm making it a little bit bigger
on purpose, but whatever works for you is fine.
If, by the way, you run into Task Manager and it looks like this,
especially when you've got nothing running, make sure that you click on more
details, because that's where all the good stuff is.
Then where we want to look at is performance.
And here you can see memory.
So what we're looking at,
that top graph is showing how much Ram is currently in use by the system.
So you can see this machine has 4GB of Ram available and it's using about 1.6. Why
the available 1.2 doesn't add up to the 1.6 to be four.
That's a topic for another discussion.
Simply because Windows Memory Management
is so much voodoo here, you can see it actually says committed to 3.5gb.
So you know that it's got some amount of knowledge that there's 4GB available.
If there's one takeaway, I will say as kind of an aside here,
Windows Memory Management is so much voodoo, it really is a lot of magic.
Numbers don't add up.
Things don't necessarily behave the way
you think, especially when you're looking at reports like this.
That's not a bad thing.
Windows memory management is incredibly
complex, and it's complex because it's really trying to do the best job I
possibly can as providing the optimal experience in terms of memory usage.
So don't let the fact that things don't necessarily add up matter too much.
Don't let that worry you.
Do take a look at what your system is using.
Like in this case I'm using One 6GB,
and more importantly, what's available One 2GB here of actual free Ram.
If I fire up Chrome again, this time I'm going to minimize Chrome.
And you can see that in fact it actually uses now a little bit more
Ram, we've got less than a gigabyte available.
Depending on what you're doing, obviously, your numbers will be different.
Depending on how much Ram is in your system, your numbers will be different.
Depending on how many programs you're
running simultaneously, your numbers will be different.
This is a fairly stripped down machine, both in terms of Ram available,
but also in terms of what I have installed, I'm not running that much.
It's one of my cleaner example, virtual machines for Windows Eleven.
But that's where you look.
If you suddenly see the available memory get small or zero.
And by small I mean if you see it like
bumping up here against the very top of the in use.
A rule of thumb might be that of the actual memory installed.
4gb.
In this case, if you're starting to see it bump up to be less than a quarter of that,
or less than an 8th of that be available as free memory.
You're running into a potential Paging
situation as soon as you run something else.
So that's just something to be aware
of in terms of memory usage and how Windows does it.
So let's go change some virtual memory settings, or at least look at them.
I'm right clicking on Start.
We'll click on System
and then in system somewhere is this Advanced Systems Settings?
Click on that here.
You'll see that in the Advanced tab, in case that's not the default tab.
When yours comes up, you'll see something here called
Performance in which there is this virtual memory.
We'll click on Settings.
Once again we have to go into a different tab.
It comes up with visual effects.
Feel free to play with those or not.
We'll hit Advanced and down here is the virtual memory setting.
Now, total Paging file size for all drives right now is 704 megabytes.
If we want to change that, we would first turn off automatically
managing the page file size for all drives.
And then if we had multiple drives we
could select each drive individually and give it if we wanted to, a custom size.
Or you could say no paging file.
I'll talk about that here in a moment.
But for the most part, letting Windows automatically manage
the paging file for you is my general recommendation.
It is absolutely possible to run without virtual memory.
You can turn off the paging files.
In fact, on my primary machine, the one that the companion article
for this video has screenshots from, you'll see that it has a lot of Ram.
It has 64GB of Ram, of which I tend to use maybe 16 or 20GB at most.
It doesn't need a paging file.
If I'm in a situation where that system is Paging, something is very wrong because
I've used 64GB of Ram and there's nothing that I do that will.
So if you're in a situation where you have
an excess of Ram, we've got more than enough Ram to deal with.
Whatever it is you deal with on a day
to day basis, feel free to turn off the paging file.
You save yourself a little bit of disk space.
You might save yourself a little bit of speed, although I don't think it's
really that big a deal when Windows isn't using an existing page file.
Now to your question about whether or not
if you're going to have a paging file, do you want it on a separate drive or not?
The answer is yes and no.
It's important that we distinguish between drives and partitions.
It is counterproductive to put the paging
file on a partition that is on the same physical hard disk as your system.
So, for example, if you've got a traditional spinning
platter magnetic hard drive and you create a partition specifically for the paging
file, you've made things worse because the disk head now is going to have to do
a lot more movement to get to and from the paging file as your system runs.
If you're running with an SSD, honestly,
there's no point in doing that simply because it takes the same amount.
There's no advantage to having a separate partition on the same SSD.
Now, having on a separate physical drive is another story.
For example, if you have a C drive and a D drive and C
has your system and it's got the programs that you're running,
putting the Paging file onto your D drive instead can in fact increase performance.
Because rather than having the disk a single disk competing and moving all
over the place to read and write the Paging file while it's still trying
to do whatever it is you're asking to do, you're spreading the load.
You're spreading the load across two
different hard drives with independent access mechanisms, which is great.
That's a performance improvement.
If you've got two SSDs, performance improvement,
probably not that great, but there actually still will be a very small one.
But the bottom line is that not on the same hard drive,
but as long as you can put it on a separate physical device, then yeah,
moving the paging file can in fact be a net positive.
You cannot and I don't think Windows will even let you move the.
Paging file to an external drive, because that just doesn't make any sense.
If you accidentally remove the external
drive, bad things will happen and it's going to be way slower just because
the external drive is probably going to be on an interface that is significantly
slower than the interface used by internal drives.
Finally, you asked about defragging the paging file.
It's weird. There used to be a utility that Microsoft
provided that would allow you to defrag the.
Paging file. It's no longer available.
It doesn't work in Windows ten or eleven, and honestly, there really isn't that much
of a need to there are two reasons for that.
Defragging kind of assumes that files are accessed linearly.
In other words, you're reading a file
from beginning to end, you're writing a file from beginning to end.
The paging file isn't really accessed that way.
It's accessed pretty randomly.
What that means, though, is that the optimization that puts all
the pieces in order doesn't really help that much.
There's really no huge gains to be had by defragging the
paging file.
There are third party utilities out there that can probably force the issue.
That's fine, but you're not going to get a lot out of it.
If I wanted to defrag my paging file, the way I would do it today would be
to use one of my backup programs, either Macrium Reflect or EaseUS Todo.
Take a system image of this hard drive and then restore it.
Because since backup programs typically
work file by file, when it restores files, they tend to be restored continuously.
In other words, they're defragged right from the start, including the
paging file.
But like I said, it's way not worth it.
I don't recommend taking the time to do it because you're going to waste more time
doing it than you'll actually save for any perceived speed improvement.
So I hope that helps.
I hope that helps you understand a little
bit more about paging files and what you may or may not want to use.
Set them to.
In summary, if you can make sure you have
enough Ram that way, you never have to worry about it.
If you do have to worry about it,
I tend to recommend letting Windows do the work and do the worrying for you.
And the only time moving the paging file
actually helps is if you were to put it on a second internal drive for updates.
For related links, for comments and more, visit AskLeo.com/3062.
I'm Leo Notenboom and this is Ask Leo.com. Thanks for watching.