What's the best setting for virtual memory?

Discussion in 'other software & services' started by sweater, Oct 25, 2006.

Thread Status:
Not open for further replies.
  1. pvsurfer

    pvsurfer Registered Member

    Joined:
    Sep 1, 2004
    Posts:
    1,618
    Location:
    USA
    Yes, and I also believe allowing Windows to manage the pagefile (with different Min/Max settings) is definitely not the best way to go, for two reasons:

    1. Whenever paging is required, Windows needs a finite amount of time (no matter how short) to build the file 'on-the-fly' to the required size. If the page-file is a fixed size, Windows doesn't have to take the time to build it.

    2. There can be little question that a variable page-file size will result in more frequent page-file fragmentation. For the most part, that issue is avoided by setting it to a fixed size.
     
  2. Howard Kaikow

    Howard Kaikow Registered Member

    Joined:
    Apr 10, 2005
    Posts:
    2,802
    Use the PagefileUsageMonitor from http://www.standards.com/index.html?PageFileUsageMonitor to find out how much page file you typically use.

    Say, that happens to be 48MB.
    Then set your page file size to a min of, say, 64MB and a max of 768MB.
    In effect, this means that the fixed 64MB portion would be be used most of the time, and there might be infrequent fragmentation if a larger size is needed at some point.

    Depends on what apps you use.

    And you sghould hve a good defragger. such as Perfect Disk, to defrag the drive when a lot of defragging does occur.

    Over time, you may need to admust the pagefile min up or down. You could run the PagefileUsageMonitor to track usage.
     
  3. Howard Kaikow

    Howard Kaikow Registered Member

    Joined:
    Apr 10, 2005
    Posts:
    2,802
    Not if you choose the appropriate minimum.
     
  4. zarzenz

    zarzenz Registered Member

    Joined:
    May 19, 2002
    Posts:
    502
    Location:
    UK
    Hi Howard,

    I downloaded the monitor... great little program and works really well.

    On first run it gave a page file size of just 21MB and then after opening quite a few apps it went to 97MB so it looks like I'm not going to need so much allocation after all.

    So useful to be able to check the actual size... many thanks for this gem of a utility.
     
  5. ThunderZ

    ThunderZ Registered Member

    Joined:
    May 1, 2006
    Posts:
    2,459
    Location:
    North central Ohio, U.S.A.
    Now for a question concerning a situation with plenty of memory. 4 gigs, 3.5 recognized on a Win 2k machine. If I am understanding all this correctly I should be able to run with a 0 swap file. Gave it a try and of course got the windows warning on restart, it then set a 20 MB file. Should I manualy set it to 20 just to avoid the warning? Or.........? :rolleyes:
     
  6. NGRhodes

    NGRhodes Registered Member

    Joined:
    Jun 23, 2003
    Posts:
    2,381
    Location:
    West Yorkshire, UK
    WinXP does a great job of managing PF size. Just let it do its thing.

    You want your pagefile on the most active partition of your least active drive.
    This is a really simple rule, your pagefile near the most activity on a drive to reduce head seeking (paging writes lots of small bits of data at a time, seek rate is far more important that transfer rate, especially as a page file is NOT sequential storage like a mpg movie file for example), and on the least active drive (if possible) so that (obviously) there is more time to use the pagefile.
    This advice is on the MS site somewhere, I can try and dig a reference out, the logic is sound though.

    You can also run a pagefile on each drive - WinXP will use the pagefile on the least active drive automatically (and I think this changes with time as well). You could then monitor the pagefile activity and see which one is being used more. You can leave both on if you have the space. I never noticed (to my human eye) any performance difference between running 3 swap files and one on my server (3 * 7200rpm drives all on primary masters thanks to extra ide controllers).

    Thunderz, even with large amounts of ram, win nt (4/2k/xp etc) will still swap out pages from ram to disc (when these pages are not required) to allow an optimum file cache size - this gives a better performance than leaving everything in ram (eg those unused services) at the exspense of file cache, which aims to improve the slowest part of a computer. Yes its a juggling act, but without a pagefile, you will find you file cache shrink the more ram you use for paging, and drive performance (which is the most noticable thing to a human) will gradually drop (as we approach the extreme).
     
  7. Howard Kaikow

    Howard Kaikow Registered Member

    Joined:
    Apr 10, 2005
    Posts:
    2,802
    If you have only 1 drive, set the range to, say, X-Y, where X is a value, rounded up, determined by using http://www.standards.com/index.html?PageFileUsageMonitor
    and Y is some value you can live with.

    If you have more than 1 drive, put a fixed size page file on 1 drive and a variable length on another, as I described elsewhere in this thread/
     
  8. Howard Kaikow

    Howard Kaikow Registered Member

    Joined:
    Apr 10, 2005
    Posts:
    2,802
    Set the minimum large enough to avoid fragmentation.

    Pagefile belongs on a PHYSICAL drive other than the PHYSICAL drive on which the OS lives.
     
  9. NGRhodes

    NGRhodes Registered Member

    Joined:
    Jun 23, 2003
    Posts:
    2,381
    Location:
    West Yorkshire, UK
    Im sorry but that is not always the case. It can be a lot of the time but not always, that why I stated using the least active drive.

    We have a graphics workstation which has 2 drives, one has OS on and the other is used for (the storage of and) coverting movie files, the OS drive would by far the best option.

    I have a similar siuation on our web servers as well. Once the OS is loaded and IIS, the OS drive sees little activit, but the drive with all our websites and images (it hosts 20 websites approx) sees a huge proportion of the activity, obivously we put the pagefile on the OS drive due to the high activity other the other drive.
     
  10. charincol

    charincol Registered Member

    Joined:
    Nov 10, 2005
    Posts:
    113
    That would be fine if the OP's computer was set up like yours (a server of some kind) but it's not.

    There is reasoning behind 2GB of "virtual memory" even if your pagefile is only maxing out at something like 100-150MB. XP does not allow (or is not supposed to allow) direct memory access to programs. Instead it allocates memory from the pool of your "virtual memory". It has a "virtual memory address" space that is usually larger than your physical ram combined with pagefile size. So giving it at least a combined "virtual memory" total of 2GB if you can afford it will allow XP the ability to give your programs the memory space they ask for. Just because they're given the space does not necessarily mean they will use all of it. So if you only have 512MB RAM and your pagefile is only set at 512MB, XP might not assign the space programs might ask for as quickly. It's just one more thing that can be done to minimize a performance hit.
     
    Last edited: Oct 28, 2006
  11. charincol

    charincol Registered Member

    Joined:
    Nov 10, 2005
    Posts:
    113
    The best would be to set one that size or even smaller. The smallest size allowed is 2MB.
     
  12. aigle

    aigle Registered Member

    Joined:
    Dec 14, 2005
    Posts:
    11,164
    Location:
    UK / Pakistan

    @ charnicol

    To me these two statements contradict or I can,t understand at least.
     
  13. sweater

    sweater Registered Member

    Joined:
    Jun 24, 2005
    Posts:
    1,678
    Location:
    Philippines, the Political Dynasty Capital of the
    Me too...I am confused with those conflicting different ideas and knowledge on who should I follow. :oops: :rolleyes: :'(

    Anyway, all them are "bright"...and gives me some "enlightenment" bout virtual memory. :D ;) :D

    As of now I just use one advise of those "bright men"... setting my initial and maximum into 1024..and as of now I haven't received noticed yet that I am low on vm. I think it works fine...:D (if only there's a way to use and apply all of the advices just to achieve multiple layer of correct settings in order to get the best thing like multiple anti-spyware scanners..then I'll surely would do it). :cautious:

    :cool:
     
  14. charincol

    charincol Registered Member

    Joined:
    Nov 10, 2005
    Posts:
    113
    Since ThunderZ has the same amount of RAM as the "virtual memory" address space, he is in a totally different situation than someone with 512MB RAM, and only needs a tiny pagefile to satisfy Windows "need" for one.
     
  15. aigle

    aigle Registered Member

    Joined:
    Dec 14, 2005
    Posts:
    11,164
    Location:
    UK / Pakistan
    So can you sum up some general rules here in simple words or general figures like 256 MB ram needs so much page file( min and max), 512 this much, 1 GB, 2 Gb and 4 GB, That will be useful.
    Thanks
     
  16. zarzenz

    zarzenz Registered Member

    Joined:
    May 19, 2002
    Posts:
    502
    Location:
    UK
    Well going by the advice offered by charincol, a system like mine with 512MB RAM would need to have the page file set at 1536MB to get to the 2GB size that XP likes to have... regardless of the actual page file usage... and this is where it gets confusing because using Howard Kaikow's page file monitor I very rarely see a page file over 24MB under normal operating conditions.

    I understand what charincol is saying about Windows liking this 2Gb combined size between RAM and HDD, but it's the first time I've ever come across this idea.

    Over the years this subject has been very confused and open to various interpretations, based on I guess how people see things differently.

    But I am willing to give this 1536MB over to the HDD for a few days as a test.

    I never get any low memory warnings so I am not expecting any noticeable difference on my system. Unless I do... which will be great.
     
  17. charincol

    charincol Registered Member

    Joined:
    Nov 10, 2005
    Posts:
    113
    Here's a quick rundown:
    RAM...............PAGEFILE

    256MB............1792MB
    384MB............1664MB
    512MB............1536MB
    768MB............1280MB
    1GB(1024MB)...1024MB
    1.5GB.............512MB
    2GB or more.....20MB or smaller just to keep Windows from whining

    I have read for years (and Windows defaults) to using 1.5 (or 2) x RAM for your pagefile size. So someone with ony 128MB of RAM should only need 192MB pagefile and someone with 2GB RAM should need a 3GB pagefile size? Nothing about that theory makes sense and there is no definitive reasoning behind it. As far as I can tell, it's an arbitrary number someone pulled out of their backside most likely from MS to keep people from optimizing what they have so MS can keep getting them to upgrade for more performance. When have they ever been forthright about the inner workings of Windows?

    Then I came across articles here and there that talked about how Windows XP manages "virtual memory" pretty well if you set it up right. It can map up to 4GB of memory address space. But it really only needs about half in order to run efficiently under most circumstances. Which is where the idea of the 2GB "sweetspot" comes from. If you only set it with say 1GB of actual usable "virtual memory" (say you have 512MB RAM and a pagefile of 512MB), then you may be causing it to work a little more in order to find contiguous "mapped" address space for all your programs.

    Let me give you an example:
    512MB RAM + 512MB Pagefile
    1GB mapped space translated into 50MB chunks numbered 1 - 20. (Windows actually maps memory in 4KB chunks.)

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

    When Windows starts up, it requests a certain amount of "mapped" memory, say 5 chunks (250MB). XP gives it chunks 1-5 "mapped" to RAM. Then program "A" starts and requests 4 chunks (200MB), so XP gives it 8-11. So far, XP has mapped all the chunks to actual RAM because only 450MB has been requested so far. Program "B" starts and requests 6 chunks (300MB), so XP gives it 15-20. Now XP, is starting to use the pagefile to "map" it's address space to.

    -/..XP..\------/.."A"..\------------/........"B".......\
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

    Program "C" starts, and requests another 4 chunks (200MB), but there is no contiguous address space left for it because only chunks 6,7 and 11, 12, 13 are available, so XP has to start juggling or splitting stuff around to make it fit. (The above is not definitive, just broken down to easily explain the basic working of memory in Windows.)

    Don't get me wrong, you're not going to see the difference that a faster CPU and more RAM will make, but why make Windows work harder when it's not neccesary.

    I am not an expert on this, this is just my suggestion based on what makes sense to me. If you try this and it makes absolutly no difference, what have you lost? (I hardly think anyone here is going to be offended from trying a new configuration.) If you do see a difference, than good for you.
     
  18. NGRhodes

    NGRhodes Registered Member

    Joined:
    Jun 23, 2003
    Posts:
    2,381
    Location:
    West Yorkshire, UK
    Firstly XP has 4 gig of addressable memory space.
    http://support.microsoft.com/kb/555223

    2 GB of address space is for each processes and the other 2 GB is shared between all processes and the operating system.

    Next, you totally ommited that nt has a memory based file cache and XP will adjust the amount of ram used for file caching and program memory dynamically, depending on various factors, so you cant use the simple maths you've used.

    http://www.microsoft.com/technet/prodtechnol/windows2000serv/maintain/optimize/wperfch7.mspx

    Further down the page it explains how the file cache works (its based on 2k, but very little has changed for xp).

    Eg if you start doing a LOT of file operations its more efficient to swap out a lot of ram pages to disc to grow the file cache (if there is little program activity).

    Obviously this is an extreme, but explains why you always need your pagefile to be atleast as big as your physical ram.
     
  19. charincol

    charincol Registered Member

    Joined:
    Nov 10, 2005
    Posts:
    113
    UMMM, I think I said, "[Windows] can map up to 4GB of memory address space." Apparently, you skipped over that.


    HELLO! I think I CLEARLY explained that the example I gave was just for illustration and not totally or technically accurate! You're being rather uptight to not accept an explanation designed to oversimplify concepts. Technically, I would be wrong to say that stepping on the accelerator makes a car go, but isn't that oversimplifying how a car runs?

    You're first article is talking about the way that XP uses 2GB of mapped memory space for one purpose, and 2GB more for another. However, it does not state when, and under what circumstances it does this and how to optimize your system for it. So, this article is basically useless for those less technical. (Why I was trying to oversimplify.) And, didn't I mention a 2GB "sweetspot" in an earlier post?

    You're second article was talking specifically about Win 2000 Server, which is the wrong configuration for a home computer that only serves itself.
     
  20. NGRhodes

    NGRhodes Registered Member

    Joined:
    Jun 23, 2003
    Posts:
    2,381
    Location:
    West Yorkshire, UK
    Thats inacurate you can address more than 4 gb of virtual memory (actually its max page file size + 4gb approx), the 4gb refers to how much RAM XP can address, most XP systems will be able to use somewhere between 3 and 3.5 GB or RAM but there is not such a limit to how much virtual memory can be addressed.

    Thats upto 2gb per process and 2gb for the OS at the same time, not 2gb one at a time, which can add up to a whole lot more than 2gb.

    Also, can you explain/show benchmarks to 2gb being a performance benifit, why will performance drop if the addressable memory is more or less ?

    If the system isn't paging to disk much, then reducing the pagefile can't possibly have much effect!

    Memory Management between 2k pro/server and xp/2003 is essentially the same, but the reason I gave that link was to show how much ram can be taken up by the system cache (regaurdless of which OS, check for yourself on task manager) - and because nearly all (I cant remember the exact figures for xp, I think its 80%) of your ram could be used by the cache, you could run out of addressable memory unless you have enough space to page 80% of your ram.

    NT can go two ways if you have limited ram, that is as more apps are used, reduce the cache size and disc performance or page out to disc, and it is preferential to page out to disc as disc based operations are extremly slow. By having a very limited size page file you are actually reducing the potential peformance when the OS is under disc load when ram is being heavily used.

    Anyhow the point is I was showing you why this 2gb sweet spot of yours is a bad/flawed idea and showing you why.

    Try running default settings, settings based on different recommendations, and see if there is any performance difference, in most cases you will find none.

    Oh heres MS's advice on pagefiles (that I mentioned earlier in the thread and lost the link to): http://support.microsoft.com/default.aspx?scid=kb;en-us;197379 and for xp http://support.microsoft.com/kb/314482/

    The reason for "least-used hard drive" should be obvious.
    The reason for "most-used partition" is that it minimizes seek distances.
    Making it a fixed size is unnecesary, too, as long as the initial or default size is big enough.
     
    Last edited: Oct 31, 2006
  21. zcv

    zcv Registered Member

    Joined:
    Dec 11, 2002
    Posts:
    355
    How would a dual boot installation be set up?

    Two XP's

    One on C drive with OS partition C and data partition E.

    The other on D drive with OS partition D and data partition G.
     
  22. charincol

    charincol Registered Member

    Joined:
    Nov 10, 2005
    Posts:
    113
    nickr, are you arguing for aurgument's sake? or do you have a point? (other than saying I'm wrong for oversimplifying, which I already claimed I'd done before you said it, cause I knew someone would come along way too concerned with correcting my oversimplication, that they would totally miss the whole point) cause you've totally missed mine.

    Who really gives a rat's rear end how technical XP's management of virtual memory is? (other than you?) All that anyone is wanting to know is how they should set it up their pagefile. Sure, you've cited the definitive source on "EXACTLY" how the virtual memory works, but what good is it to anyone here without knowing how to apply it to an individual situation, which you've not done.

    The quote(s) below are from MS.
    "Additionally, it is optimal to create the second paging file so that it exists on its own partition, with no data or operating-system-specific files." Interesting that I've been doing this for years ever before I read this (except for the "second" part).

    P.S. You're totally wrong on your interpretation of the sentence, "By design, Windows uses the paging file on the less frequently accessed partition over the paging file on the more heavily accessed boot partition." to mean that it should reside on the most heavily-used partition. The word "over" is this case means "in preference to".
     
    Last edited: Nov 1, 2006
  23. charincol

    charincol Registered Member

    Joined:
    Nov 10, 2005
    Posts:
    113
    Put C's pagefile on your D partition since that's closest to the spindle and it will not be in use when booted into your C partition. Put D's pagefile onto partition C for same reason.

    If you backup your OS partitions to images, then put C's pagefile on G and D's pagefile on E to minimize backup image size (unless the pagefile is automatically omitted from the image - you may have to test it).

    I dual boot 2 XP's, but they reside in different partitions on the same drive. So I only have 1 pagefile set up on a second drive that each one uses.
     
  24. zcv

    zcv Registered Member

    Joined:
    Dec 11, 2002
    Posts:
    355
    Thanks chairncol, that's what I was thinking of doing.
     
  25. Get

    Get Guest

    In the "old days" I've read a lot about the "pagefile-issue", before falling asleep using http://www.dougknox.com/xp/utils/xp_pagefilemon.htm , having a LOT of programs running, having say 120 as max-> using 250 as initial size to be on the very safe side and using my RAM (1024) + 12 =1036 as maximum size and haven't got any problems whatsoever with it.
     
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.