Virtual Memory Optimization Guide!

Discussion in 'Reviews & Articles' started by Dashken, Oct 29, 2004.

  1. Dashken

    Dashken Administrator!

    Even today, virtual memory is still very important component of the operating system. No matter how much memory you have, there is always a need for virtual memory. Therefore, its performance is of great importance. Optimizing the virtual memory system will greatly improve the performance of the computer.

    Today, we will take an in-depth look at virtual memory, what it really is and how to optimize it! In this edition, we will also take a thorough look at the differences between swapfile and paging file as well as making a contiguous paging file. Come and check out the definitive Swapfile Optimization Guide!

    Here are the updates:-
    • Added discussion on differences between swapfile and paging file.
    • Corrected all references to the virtual memory file as paging file, instead of swapfile.

    [​IMG]

    Link : Virtual Memory Optimization Guide Rev. 4.0!
     
    Last edited by a moderator: Nov 2, 2004
  2. News Writer

    News Writer News Writer

    The guide has just been updated! :wave:

    Even today, virtual memory is still very important component of the operating system. No matter how much memory you have, there is always a need for virtual memory. Therefore, its performance is of great importance. Optimizing the virtual memory system will greatly improve the performance of the computer.

    Today, we will take an in-depth look at virtual memory, what it really is and how to optimize it! In this edition, we will also take a thorough look at moving paging file to the outer tracks as well as the pros and cons of making a very large paging file. Come and check out the definitive Virtual Memory Optimization Guide!

    Here are the updates:-
    • A thorough look at moving paging file to the outer tracks.
    • The pros and cons of making a very large paging file.

    [​IMG]

    Link : Virtual Memory Optimization Guide Rev. 4.0!
     
  3. Viper007Bond

    Viper007Bond Newbie

    I just use CachemanXP to manage my virtual memory and recover RAM. :thumb:

    I'll read the guide anyway though as I bet it's still really helpful. :cool:
     
  4. SmartDrv

    SmartDrv Newbie

    Viper: Programs like that hinder things more than help. Windows will automatically manage the size of the cache if more memory is needed by applications. All you are doing is making the cache less effective.

    Regarding the article:

    What benchmarking have you actually done to show that your optimizations have any effect on the performance of the system? Many of the optimizations in this article seem to revolve around the assumption that a fragmented page file reduces performance. It also seems to stress that a dynamic page file reduces performance.

    While some of the people on arstechnica (specificially in the NT Mojo subforum) can educate you way better than I can (such as in threads like this) a couple points worth mentioning are:

    The page file is not read sequentially or completely but rather in chunks of up to 64K each. The chance of a single read requiring an extra seek are minimal. In fact the performance degradation due to fragmentation is overhyped in general.

    Setting a good sized mininum on a page file isn't a bad idea. But there is no need to limit the maximum. Should the page file grow to meet demand and than shrink again, the original allocated portion will still be in a single chunk (again it probably doesn't matter much). Although your program may have run a bit slower, you avoided an "Out of virtual memory" condition which would be far worse.
     
  5. Viper007Bond

    Viper007Bond Newbie

    Hmm...

    *uninstalls it and reads the guide*
     
  6. Adrian Wong

    Adrian Wong Da Boss Staff Member

    Hello SmartDrv! :wave:

    Actually, this is still a work in progress. Right now, only part 2 of the guide has been posted. If my calculations are right, the complete guide will consist of about 39-40 pages.

    So, there is actually a LOT more to virtual memory optimization than just defragmenting the paging file. It just happens that you are only reading the first two parts of the guide. ;)

    Yes, the new paging file system reads in chunks. But I don't think it's 64K. The last time I checked Microsoft's Knowledge Base, it was 4K chunks. So, performance degradation is not as severe as in the swapfile days. I think I mentioned this in the guide.

    However, that does not mean that defragmenting the paging file won't improve its performance. Defragmenting the paging file keeps the paging file together. This reduces head seeks. And if you move the paging file to the outer tracks, that ensures maximum transfer rates from the paging file. All of it, not just some parts.

    As for the maximum page file size, if you read the guide again, you will see that I recommend creating a semi-permanent paging file. In fact, I also mentioned that there is no way to create a true permanent paging file. Windows XP automatically extends the paging file if there is a need for more virtual memory. :mrgreen:
     
  7. T8000

    T8000 Newbie

    Why does this happen?

    As shown on the image, my swapfile is split up in 2 halves, even while it has its own partition and there is nothing in between of it.

    I formatted the partition and recreated it, but it always splits up.

    Why does this happen?
     

    Attached Files:

  8. SmartDrv

    SmartDrv Newbie

    Thanks for the quick response. I hope I didn't come off as being too negative but as I'm sure you understand there are a lot of "tweak" sites around that offer information that either does nothing or that actually hinders performance (i.e. most of those sites that tell you to edit low level memory management parameters)

    While I don't see anything in your guide that would hinder performance, I do suggest a section about how changing what physical drive the page file is on is more important to overall performance than how fragmented it is. I imagine your next section will probably go over that mentioning things like how it's best to keep the page file on "fast but less busy" drives and how spanning the page file over multiple physical disks is good in some cases (i.e. SCSI) but bad in others (i.e. over 2 drives on the same IDE channel)

    And as I suggest, if you need some more information, check out some of the past threads on the forum I posted. I'm not affiliated with the owners and am not trying to advertise that forum for them, however, there are a lot of smart people (Network Admins, Developers, Engineers, etc) mixed in the crowd. Some like DriverGuru seem to know so much about lower level functions of operating systems that it can make your head spin.

    I look forward to your next update!
     
  9. Adrian Wong

    Adrian Wong Da Boss Staff Member

    Hello T8000, as mentioned in the guide, Windows XP does not necessarily create a contiguous paging file. Even then, I agree. It's odd that it didn't create a contiguous paging file in an empty partition.

    Don't worry though. You can easily defragment the paging file using Diskeeper or a similar utility.
     
  10. Viper007Bond

    Viper007Bond Newbie

    Wow, that's a good idea.

    I'm going to try to make mine use like 2 MB of space all of the time though as I should never have to use all of my GB of RAM... right?
     
  11. Adrian Wong

    Adrian Wong Da Boss Staff Member

    Hello SmartDrv!

    Not a problem. If there's a mistake with my guide, I would like to know about it so that I can improve it. No one's perfect. ;)

    ROTFL! You certainly can read my mind! :haha:

    Actually, I posted a list of methods I will cover in this revision of the guide in the last page of the guide, as well as page 4. There should be two more parts to this guide! :shifty: :mrgreen:
     
  12. T8000

    T8000 Newbie

    Pagefile

    You need a page file to run Windows, since a lot of applications expect one. Even if you have more free RAM than total pagefile when running them, some applications cannot run without the page file.

    If you have a lot of RAM, using the same size for the pagefile as for the RAM should be OK.

    Since todays Harddisks are rather large, I just use a small NTFS partition. Do remember that pagefiles do not like being on partitions with less than 15% free space, so to prevent annoying error messages, make sure to make 15% more space than you plan to use for your pagefile.

    I think having a slightly too large pagefile does not have any performance disadvantages over a small one, so you should not try to save a few 100 MB to see how small you can go.
     
  13. Chai

    Chai Administrator Staff Member

    I used to run 384MB of pagefiles only! Obviously it wasn't enough, but Windows will kindly warn you about running low on space allocated for pagefiles. I don't see any potential hazard if you allocated very little space. I wanted to force Windows to use more of my RAM doing this! Obviously that doesn't work! :mrgreen:
     
  14. Adrian Wong

    Adrian Wong Da Boss Staff Member

    There are other ways of doing that. :mrgreen:

    I think that will be covered in Part 4. :think:
     
  15. Clear Virtual Memory On Shutdown

    Hello!
    The guide was very helpful and I can't wait to part 4.,

    I have a question regarding an option in XP AntiSpy that called Clean page file on shutdown.,

    I wonder if it'll change the postition of permanent pagefile from the outer HD space to the inner?

    Thank you,
    -Noam
     
  16. Adrian Wong

    Adrian Wong Da Boss Staff Member

    We are posting the third part tonight. :thumb:

    Actually, that option is only for security purpose. If you use it, Windows XP may not recreate the paging file in the original position. Therefore, it may end up split into two or worse.
     
  17. Dashken

    Dashken Administrator!

    The guide has just been updated! :wave:

    Even today, virtual memory is still very important component of the operating system. No matter how much memory you have, there is always a need for virtual memory. Therefore, its performance is of great importance. Optimizing the virtual memory system will greatly improve the performance of the computer.

    Today, we will take an in-depth look at virtual memory, what it really is and how to optimize it! In this edition, we will also take a thorough look at moving the paging file to a different partition as well as the pros and cons of moving it to a different hard disk. Come and check out the definitive Virtual Memory Optimization Guide!

    Here are the updates:-
    • A thorough look at moving the paging file to a different partition.
    • The pros and cons of moving the paging file to a different hard disk.

    [​IMG]

    Link : Virtual Memory Optimization Guide Rev. 4.0!
     
  18. Viper007Bond

    Viper007Bond Newbie

    Ooo, goody! :D :thumb:
     
  19. Scarceas

    Scarceas Newbie

    localization

    I realize the guide is not complete, but I was wondering if in part 4 (or
    maybe I missed it) you might discuss data localization and virtual memory
    performance.

    I've read two different arguments on this, and they are somewhat conflicting.

    On the one hand is the argument you already provided, regarding a fragmented vs contiguous page file:
    http://www.rojakpot.com/default.aspx?location=3&var1=143&var2=0

    On the other hand, some have asserted that under Windows XP the paging file,
    when left to its default behavior, will store it's pages in close proximity
    to other data on the physical disk. So if you're in your "my documents" a
    lot, the paging file would store itself near that physical location. The
    theory here is that the seeks are much shorter.

    I'd like to know how important locality is, and how it fits into the
    definitive virtual memory guide.
     
  20. Adrian Wong

    Adrian Wong Da Boss Staff Member

    Hello Scarceas,

    Actually, no. I don't think there will be any discussion of data locality and virtual memory. That's because I don't think Windows XP even bothers about data locality when it comes to creating virtual memory.

    AFAIK, Windows XP simply uses the nearest available clusters for the dynamic paging file. In fact, Microsoft states that if you create multiple paging files, Windows XP will favour the partition that is LEAST active. That goes totally against what you claim others are asserting.

    If you are interested, read this - http://support.microsoft.com/default.aspx?scid=kb;en-us;314482

    In any case, it doesn't make sense for Windows XP to create the paging file based on spatial locality to work files like your documents. Once opened, Windows keeps the working copy in the Temp folder, not your paging file.

    Incidentally, can you give us the link to the sources that mention this spatial data locality feature of the Windows XP paging file?

    Thanks!
     

Share This Page