Question about performance impact based on location of swap file

Discussion in 'Operating Systems' started by Cyber Akuma, Sep 8, 2019.

  1. Cyber Akuma

    Cyber Akuma Limp Gawd

    Messages:
    384
    Joined:
    Jan 3, 2009
    So, I have a rather convoluted Frankenstein setup. My original system setup had two SSDs in RAID0 as the OS drive (I know I know...), since I had 32GB of ram the default Swap and Hibernation file sizes took up a lot of space on those SSDs, so I disabled hibernate and manually set the swap file to have a max size of 8GB since in my tests even when I intentionally overloaded the system with as many tasks as I would ever do at once it never hit even 6GB of usage.... granted this was when I first built it years ago.

    Few years later I was having issues, and assuming it was the SSD, imaged the OS to a spare 5400RPM HDD I had of the same size as the array at the time..... on top of the massive impact to performance this caused, I was getting out of memory errors. Windows REALLY loves to use Swap even if you have tons of RAM free.... so due to both the performance impact and how I had low free space left, I got a cheap 128GB SSD and tossed my swap file on there, with no size limits anymore.

    Anyway, much later I finally confirmed my SSDs were fine, so I imaged the HDD back to the SSD array. But now I am wondering what to do with the Swap file. The SSDs in RAID0 are using up the only two SATA6Gb ports on my motherboard, so the SSD that's housing the swap (and some other app's temp folders) is running off of only SATA3Gb.

    Would the fact that the OS drive (that also holds all my apps and games) is constantly reading and writing and running several programs at once while the Swap SSD is only housing the Swap file and other temp files make any difference in swap performance in making it a better candidate to have my Swap file on? Or would the impact of the Swap file also being on the same SSD as a heavily used make it more beneficial to put the Swap file on a different drive, even if that drive is using Sata 3Gb instead of Sata 6Gb?

    Or would any difference in Swap performance if I go either route be so negligible that it does not matter?
     
  2. SvenBent

    SvenBent 2[H]4U

    Messages:
    3,044
    Joined:
    Sep 13, 2008
    Windows REALLY loves to use Swap even if you have tons of RAM free
    Yeah that is to be anticipated unless you think memory work like in the DOS/win3.11 days. the OS use the pagefile to speed up your system.

    You pagefile location impact on speed depends on you system. if you have "enough" RAM in it the pagefile is only used for memory clean so the speed of the pagefile has negligible performance impact
    If you run out of swap file and actually start to swap out pages due to lack of RAM. then the impact of the swap file speed will be a lot bigger.


    in short. if you have enough ram. don't worry about the pagefile. just let windows take care of it on a drive with enough space.


    To get closer to the answer to you question I have to correct another mistake you seem to be living on.
    There is no either OR in regards to where to place the pagefile.
    Your Pagefile is faster when you put it across multiple drives. It will work "kinda" like a raid0 for the OS.
     
    Last edited: Sep 9, 2019
  3. Dead Parrot

    Dead Parrot 2[H]4U

    Messages:
    2,488
    Joined:
    Mar 4, 2013
    Since the 2 SSDs in the raid 0 setup are several years older then the 128G drive, might be worth doing some benchmarks of the raid 0 array vs the single 128 on the faster sata port. Some type of live CD with the testing software would avoid OS loading issues. Might turn out that the 128 is faster then the 2 older drives even allowing for the raid setup.

    2nd the thought that windows really wants a pagefile.

    Another thing to check is setting your windows temp folder to a non-OS drive. Sometimes it helps, sometimes not. Can also be useful if the OS drive is short of space.
     
  4. B00nie

    B00nie [H]ardness Supreme

    Messages:
    7,910
    Joined:
    Nov 1, 2012
    Slap in a larger NVME PCI-E SSD and call it a day. It will most likely solve both your space problems and be faster than sata in raid-0.
     
  5. primetime

    primetime [H]ardness Supreme

    Messages:
    5,867
    Joined:
    Aug 17, 2005
    So windows default is already set up correctly with no changes needed?....I figure the windows devs have to get it rights some of the time:)
     
  6. SvenBent

    SvenBent 2[H]4U

    Messages:
    3,044
    Joined:
    Sep 13, 2008
    Pretty much. With the exception of using multiple driver.

    The issue is people keep thinking of pagefile as a "im out of RAM" solution, and that memory works like in DOS where its either in use or free.
    The truth is more more complex than that.
     
  7. SvenBent

    SvenBent 2[H]4U

    Messages:
    3,044
    Joined:
    Sep 13, 2008
    As stated above, that benchmark is irrelevant. If you want maximum pagefile speed you place it on both. This is not an either/or choice
     
  8. Dead Parrot

    Dead Parrot 2[H]4U

    Messages:
    2,488
    Joined:
    Mar 4, 2013
    My thought on the benchmark is it is very possible that newer 128 SSD will be faster as a single drive on the faster connector then the many years older paired drives in a raid 0 setup. In that case, likely to have better over all performance with the single 128 as the primary OS drive. Could still use the two older drives for additional pagefile and temp usage.
     
  9. primetime

    primetime [H]ardness Supreme

    Messages:
    5,867
    Joined:
    Aug 17, 2005
    Capture.PNG Mine defaults to putting the entire page file on my system drive and pretty much matches the amount of Ram in my setup 16GB. Now if it was indeed better i would have thought it would have at least used the Samsung SSD or both. If it really helped, who knows cause i could never tell one way or the other any benefit with games or tasks. Part of me thinks it could help telling it to use the samsung drive. I use the samsung as a down loads folder just because why not?
     
  10. KarsusTG

    KarsusTG 2[H]4U

    Messages:
    2,991
    Joined:
    Aug 27, 2010
    Honestly, if you are only using 6 of 32GB of ram, unless you are using some really old legacy apps, you can safely check no paging file and be just fine.
     
  11. primetime

    primetime [H]ardness Supreme

    Messages:
    5,867
    Joined:
    Aug 17, 2005
    And then a year down the road your trying to figure out why a new purchase of an older game you just bought CTD's on start up.....No thanks;)
     
  12. SvenBent

    SvenBent 2[H]4U

    Messages:
    3,044
    Joined:
    Sep 13, 2008
    No this is a very bad tip, you need the page fiel to optimize you ram.
    Please dont spread this kind of "Tweak" if you dont know how windows handles memory.
    if you dont know the diffrence between privat memory and commit size than just dont do ANY advise on memory or related "tweaking"
     
    B00nie and primetime like this.
  13. SvenBent

    SvenBent 2[H]4U

    Messages:
    3,044
    Joined:
    Sep 13, 2008
    Not just that. But even before you hit CTD issues you are left with a shrinking disk cache and thereby a risk of slower I/O performance because people giving bad advise based and made up reasoning
     
  14. primetime

    primetime [H]ardness Supreme

    Messages:
    5,867
    Joined:
    Aug 17, 2005
    Regarding the rapid mode or Ram Cache type of software.....of course its a cheat but i also kinda feel if you made it big enough cause you have what ever amount of ram it could help in SOME situations and make worse in others. If i had a full 64GB of ram or if what ever file would not to big for the cache size i wounder if it would help. Something tells me its better to just invest in bigger/faster M2 drives
     
  15. SvenBent

    SvenBent 2[H]4U

    Messages:
    3,044
    Joined:
    Sep 13, 2008
    Windows already Does it. There is no need for another layer of ram cached to storage.

    The only diffrence is when a software ask for uncached read/writes. Windows does correclt not cache it,. but rapid mode does.

    So benchmarks like Crystaldiskmar and AS SDD that used uncached read/writes (because they want to measure the actualy storage units speed) under w ndows cache you get uncached writes. but in rapid mode its cached
    Normal usage is cached read/writes anyway so that measure diffrence is not present.

    then add in the issues of security/safety when you are ignored uncached flag and read/writes. that is a safety concern.

    so in the end. no real world performance gain but a risk of data corruption with some software that relies in uncached read/writes


    Rapid mode actually hurt performance because its not as optimal as the windows cache.
    do anykind of wall timer measurement on a heave I/o operation ( not a syntethic benchmark). and you'll see using rapid mode is slower than not using it
     
    Last edited: Sep 11, 2019
  16. SvenBent

    SvenBent 2[H]4U

    Messages:
    3,044
    Joined:
    Sep 13, 2008
    Do the reason why we want a pagefile no matter what, is because with the page file, Is with a 2GB process that only really uses 1GB, we can copy the unused 1GB part out to the page file.
    and use the 1GB free space in physical ram to increase the disk cache if needed.

    The pagefile cleans up and ensures optimal use of our ram.
    Without pagefile all kinds of "junk" data is taking up space, reducing diskcache etc etc
     
    Last edited: Sep 11, 2019
  17. Cyber Akuma

    Cyber Akuma Limp Gawd

    Messages:
    384
    Joined:
    Jan 3, 2009
    Right, many many places have commented on about how having no pagefile for Windows is a BAD idea because of how it works.

    I mean, I already explained how I was running out of memory even with RAM free due to a small pagefile.

    I was just asking if the location of the pagefile between my two options would make any noticeable difference, and if so which option would be better.
     
  18. KarsusTG

    KarsusTG 2[H]4U

    Messages:
    2,991
    Joined:
    Aug 27, 2010
    I understand it quite well thank you. It's just not a problem we actually deal with on computers where the bulk of your ram is never used. I have turned off the page file of my systems since xp-64 and only ever encountered a problem once. And that was from a game that had to be installed from a dos prompt... The OP is clearly not pushing VM's or working in a production environment...

    This is how that page file is used guys. It's not some mysterious boogy monster that is chasing newbies out of the noc at night. The truth is it's the rare bird indeed that is actually using > half of 32gb of your ram with any regularity anyway, at least on a non production computer. So unless you are going a year + without rebooting your computer you will never see an actual performance difference. Since that will never happen on a non-server pc running windows it's just a non issue.

    Honestly the OP should either disable it or just use a decent USB3.x thumb drive and put it on that. Both are perfectly viable options in his scenario.

    Edit: stupid auto correct

    Also, here is a good reference to get started.

    Users frequently ask "how big should I make the pagefile?" There is no single answer to this question because it depends on the amount of installed RAM and on how much virtual memory that workload requires. If there is no other information available, the typical recommendation of 1.5 times the installed RAM is a good starting point. On server systems, you typically want to have sufficient RAM so that there is never a shortage and so that the pagefile is basically not used. On these systems, it may serve no useful purpose to maintain a really large pagefile. On the other hand, if disk space is plentiful, maintaining a large pagefile (for example, 1.5 times the installed RAM) does not cause a problem, and this also eliminates the need to worry over how large to make it.

    That is straight from Microsoft guys, though not super recent as it's windows 7 era, but it has not changed in windows 10. It's talking about servers because until recently it was pretty rare to have more than 8gb of ram in a pc...
     
    Last edited: Sep 11, 2019
    Kardonxt likes this.
  19. SvenBent

    SvenBent 2[H]4U

    Messages:
    3,044
    Joined:
    Sep 13, 2008

    Even though you are not "using" you page file due to running out of ram for processes . you are still using it to keep the Data in RAM optimally alligned
    What you see in E.g. Taskmanger is only process usage not total usage of ram.
    There is no performance reason to disable the pagefile. at best it make no difference at worst it cause CTD.

    Full disclores I will say I did remove the pagefile from my file server. but that was because I did not want to keep the storage drives awake all the time. and i didn want the Writes to my SSD the OS was on.
    It had nothing to do with performance. and i took that performance hit to diskcache since the I/o bottleneck here was going to be the 1gb connection anyway
     
    primetime likes this.
  20. KarsusTG

    KarsusTG 2[H]4U

    Messages:
    2,991
    Joined:
    Aug 27, 2010

    But that is flatly untrue. Having a page file on a slow drive can have a considerable and noticeable difference in things like games with lots of load screens. Going with out a page file has a near 0% performance loss that cannot even be recognized by a normal person. Even then, trying to chase it with synthetic benchmarks it is difficult to detect because the difference is usually so small that it falls in the margin of error for the bench...

    If you don't believe me, just install Windows and World of Warcraft (just as an example) on a computer with a 5400rpm hard drive and 32gb of ram. Play with the page file on, then turn it off and reboot. Its a dramatically different experience. But you are right, if you are not doing things with lots of load screens and other memory intensive work it doesn't really matter if you have a page file or where it is.

    As far as I am aware, the only thing windows 10 NEEDS a page file for is crash dumps, but if you have turned your page file off and left crash dumps turned on, it creates a .dmp page file instead. If you turn off BOTH (Which I do not recommend) the only thing you lose is the dump data.

    Where you get into the crashes is when you start to actually run out of memory, run out of hard drive space (because windows assumes it can grow it's page file, even if it cannot,) or you have a bad stick of ram. You can see why that is here, under system committed memory. As you can see, the OP said his page files never got above 6gb even pushing his system in every way he ever really would. That means he was not even crossing the 50% memory threshold... He is well within any reasonable margin of error to do this.

    And lets be honest here. The OP is running his OS on sata ssd's in raid 0. Stability is not a core concern...



    OP, you were not running out of RAM, you were running out of disk space that was being used as ram because windows ASSUMES, but never checks, that it can just expand that page file all the way to 3x your ram size, which was not true in this case. It's not the same thing as running out of ram. Just read through that microsoft link I placed above in this post. Currently, with no page file I have 6 chrome browser tabs open, a 4gb linux vm running, VS code running, am actively compiling a large program for a class I am taking, and have an eve online game running. My current memory usage is just at 12gb... You would have to be doing something crazy to be burning 32 gigs of ram... Even pushing 3-4 vm's and running solidworks I rarely cross 22gb...

    You already purchased an extra 128gb ssd for this express purpose, your maximum theoretical page file size is ~96gb, though you will never see that much used, so just put it there and call it a day if you don't want to worry about it. Just don't put it on that 5400rpm drive if you can avoid it. The last thing you want is the latency from waiting on that drive to spin back up if the system needs something it stored in a page file on that drive after it has spun down which WILL happen at default power settings.

    Ok, enough keyboard warrior, I gotta get back to work hehe.
     
  21. Darth Ender

    Darth Ender Limp Gawd

    Messages:
    383
    Joined:
    Oct 11, 2018
    i dont use swap in linux or windows. Not since having 32GB of ram and not since moving on to 64GB . Absolutely no issues in the years I've been doing it. Both on computers that have uptimes that hit the year mark and on my main development / gaming machine.

    Swap is a necessary evil to deal with a lack of ram when you can't add anymore ram. So add more ram until you dont need it is step 1.
     
  22. Cyber Akuma

    Cyber Akuma Limp Gawd

    Messages:
    384
    Joined:
    Jan 3, 2009
    Yes I know, I am well aware the out of memory errors were due to the swap file hitting the size limit I already had on it. As I said, I could see that I had gigs of actual RAM free, but was still getting those errors because the Swap file had gotten full and Windows was insisting on using it.

    Should have clarified that when I said I was "Out of memory" that was just the error I was getting, and that I meant the swap file was full, not that all of my actual memory was used up.

    Yeah, I had actually read that originally when I was first setting up this system back in 2012. Issue was that back then I had 500GB of SSD space.... and 32 Gigs of ram. So windows by default ate up 64GB of that already (32GB for Swap and 32GB for Hibernate), quite a large chunk out of that 500GB at the time, which is why I had disabled hibernate and tried to manually test what swap file size I would need. I mean.... it did work for about 5 years fine until I started needing to open many many apps and browser tabs at once...

    But yeah, after that incident I set it back to "auto", just on a different physical drive.

    Oh don't worry, that drive is physically not even in this system anymore. So nice to finally be back on SSD after being on that thing for like 2-3 years.

    Thanks
     
  23. SvenBent

    SvenBent 2[H]4U

    Messages:
    3,044
    Joined:
    Sep 13, 2008
    It's you statements please provide evidence to back it up.

    I did ran a series of articles called tweakbuster, going over these kind of myths
    I'll show you my results when you show me yours. But until you put up evidence of your claim that there is a sifference, I'll consider it the usuall undocumented myth.
     
    Last edited: Sep 11, 2019
  24. SvenBent

    SvenBent 2[H]4U

    Messages:
    3,044
    Joined:
    Sep 13, 2008
    Again you are wasting your ram with junk data not having a pagefile even though you think you "have enough"
    it like people just dont understand that windows have a dynamic disk cache and think only processes takes up memory.

    Pagefile makes you RAM more effective even when you "Have enough"
     
  25. primetime

    primetime [H]ardness Supreme

    Messages:
    5,867
    Joined:
    Aug 17, 2005
    went ahead and uninstalled all the disk cashing apps and set the page file to auto use the backup ssd as well on mine. No really way to test what way is faster but your explanation seem reasonable. Moved all the temp folders to the Samsung ssd as well so all tweaks are complete lol.
     
  26. Darth Ender

    Darth Ender Limp Gawd

    Messages:
    383
    Joined:
    Oct 11, 2018
    Swapping disk cache to disk is stupid.

    Disk cache will consume ram that's able to be consumed and swapping in memory applications to swap just to have some more disk cache is also stupid, unless you leave all your programs open regardless of when and if you ever use them again. If you run what you use, having any of those swapped results in time wasted.

    So no, I will treat swap like the extra ram overflow it is and be fine with it because my storage is not old slow spinning disks when those arguments may have been valid
     
  27. DeaconFrost

    DeaconFrost [H]ardForum Junkie

    Messages:
    11,050
    Joined:
    Sep 6, 2007
    I don't remember the last time this was even a debate. 10 years ago? It has to be at least that long since I bothered configuring or even caring about the swap file. Just let the OS handle it.
     
  28. Chuklr

    Chuklr Gawd

    Messages:
    737
    Joined:
    Nov 1, 2009
    This thread is like the "Return of Black Viper". :ROFLMAO:
     
    DeaconFrost likes this.
  29. DeaconFrost

    DeaconFrost [H]ardForum Junkie

    Messages:
    11,050
    Joined:
    Sep 6, 2007
    Ah, the good 'ol QuackViper days, where disabling services that weren't running somehow gave you performance boosts!
     
  30. B00nie

    B00nie [H]ardness Supreme

    Messages:
    7,910
    Joined:
    Nov 1, 2012
    If swap would cause noticeable performance degradation I would understand all this discussion - but it doesn't. And there is zero need to worry about writes to SSD, multiple tests have proven that they are capable of handling years worth of writes. By the time a modern SSD starts to degrade the computer itself is outdated.
     
  31. ManofGod

    ManofGod [H]ardForum Junkie

    Messages:
    10,794
    Joined:
    Oct 4, 2007
    Back then, they did help but, this was the Windows XP days. After all, poor memory management, less ram overall then newer systems and only a 32 bit OS had it's effect.
     
  32. bigdogchris

    bigdogchris [H]ard as it Gets

    Messages:
    17,885
    Joined:
    Feb 19, 2008
    PageFile/Swap are many small IO so the fastest drive possible is the best option.