Best Use of RAMdisk?

Discussion in 'Memory and Storage' started by spittledip, Jan 28, 2010.

  1. spittledip

    spittledip Diamond Member

    Joined:
    Apr 23, 2005
    Messages:
    4,483
    Likes Received:
    0
    I am running XP and have 8 gigs of RAM, 5 of which is being used for RAMdisk. I have a 4 gig Pagefile on the RAMdisk, which leaves me with a gig left for other stuff. I was thinking of putting Firefox cache on there... but was wondering what other options would be good.

    What suggestions do people ahve for using RAMdisk? Is using 4 gigs of it for a pagefile a good idea? Just looking for people's opinions on what will bring about the best performance.

    thanks
     
  2. her209

    her209 No Lifer

    Joined:
    Oct 11, 2000
    Messages:
    56,361
    Likes Received:
    0
    Why would you do this? You're paging pages of memory back into memory (Ramdisk). Its self-defeating.

    To answer your original question, I use to do PAR2 recovery, RAR file extraction, etc.
     
  3. spittledip

    spittledip Diamond Member

    Joined:
    Apr 23, 2005
    Messages:
    4,483
    Likes Received:
    0
    I figure that however XP uses the pagefile with the RAM (seems like people disagree about how it is used in XP), it would improve performance to keep all "swapping" on the RAM rather than on the hard drive. Not really sure though, that is why I ask.

    Thanks for the input.. I think I will do some RAR extracts to see how it works :D
     
  4. spittledip

    spittledip Diamond Member

    Joined:
    Apr 23, 2005
    Messages:
    4,483
    Likes Received:
    0
    I just installed FF on it and redirected the cache to it- much snappier now.

    Any more ideas for using RAMdisk are welcomed.
     
    #4 spittledip, Jan 28, 2010
    Last edited: Jan 28, 2010
  5. jjmIII

    jjmIII Diamond Member

    Joined:
    Mar 13, 2001
    Messages:
    8,385
    Likes Received:
    0
    You could use less for that pagefile since XP itself has 3gb.. shouldn't really need that much.
     
  6. poohbear

    poohbear Platinum Member

    Joined:
    Mar 11, 2003
    Messages:
    2,259
    Likes Received:
    1
    best advice would be to stop using XP. its 9 years old man, its memory management subsystem is archaic. back then comps had 128mb of ram total. woot.
     
  7. Blain

    Blain Lifer

    Joined:
    Oct 9, 1999
    Messages:
    23,636
    Likes Received:
    1
    With that much system memory, what applications are you running that would even need to hit the page file?
     
  8. her209

    her209 No Lifer

    Joined:
    Oct 11, 2000
    Messages:
    56,361
    Likes Received:
    0
    There's nothing wrong with Windows XP memory management.
     
  9. Emulex

    Emulex Diamond Member

    Joined:
    Jan 28, 2001
    Messages:
    9,759
    Likes Received:
    0
    other than the 2/2gb memory split? limited kernel memory?

    xp-64 is really 2003 in disguide; so i don't count that as XP.

    32bit is more of a hinderance these days
     
  10. spittledip

    spittledip Diamond Member

    Joined:
    Apr 23, 2005
    Messages:
    4,483
    Likes Received:
    0
    OK, as much as I appreciate people arguing about how well XP manages memory, I would prefer other suggestions for the use RAMdisk.

    So I could shrink the pagefile and use more of the RAMdisk for other stuff.. was wondering about that. Will do that.
     
  11. NoQuarter

    NoQuarter Golden Member

    Joined:
    Jan 1, 2001
    Messages:
    1,004
    Likes Received:
    0
    At 8GB of ram on XP you would never need to touch a pagefile unless some app has a memory leak anyway.

    Your best bet would be to disable the page file entirely (or rather reduce it to the minimum size, ~16MB, just for app compatibility, and disable kernel paging). This would prevent Windows from proactively paging out memory, while keeping more of your ram available. Putting a large page file on ramdisk is only causing paging to happen that wouldn't if it weren't for the ramdisk to begin with, but there shouldn't be any performance penalty or benefit either method since virtual memory access is seamless.

    Cache files on ramdisk isn't a bad idea, but I've never had any other ideas for ramdisk use since loading apps on there always involves front-loading them off the HD anyway.
     
  12. Engineer

    Engineer Elite Member

    Joined:
    Oct 9, 1999
    Messages:
    37,893
    Likes Received:
    2
    OT: I know how to change the size of the page file, but how do you disable kernel paging?

    Edit: [HKEY_LOCAL_MACHINE \System \CurrentControlSet \Control \Session Manager \Memory Management]
    DisablePagingExecutive = 1 (1 = Force to RAM, 0 = Allow to page, Default = 0)

    This must be it. I wonder if it still works on Windows 7? I might just do that.

    As for the OP, I don't have an issue with running the ramdisk on XP, especially if it's 32 bit XP. The ramdisk can take advantage of the ram that 32bit XP cannot use (above 4GB). As for the page file in ram, not sure about that one.
     
    #12 Engineer, Jan 29, 2010
    Last edited: Jan 29, 2010
  13. Nothinman

    Nothinman Elite Member

    Joined:
    Sep 14, 2001
    Messages:
    30,672
    Likes Received:
    0
    Which makes no sense since they share the same kernel. The version in 2003 may be slightly newer but it's still mostly the same code.

    Only because MS made it so. A proper 32-bit OS with real PAE support would be fine for most people.

    The best suggestion is to upgrade to 64-bit Vista or Win7 and ditch the RAMdisk idea completely.

    None of those are good ideas. Just leave the pagefile system managed, it'll create a smallish one on bootup and only grow it if it starts to fill up. And disabling kernel paging won't help anything, the only stuff that would be eligible for paging would be the unused stuff like serial drivers and forcing them to stay in memory is pointless. And the kernel code is so small that you're only talking a few megs anyway.

    The pagefile is only 1 part of the equation when dealing with paging and removing it makes the kernel make worse decisions, not better.
     
  14. NoQuarter

    NoQuarter Golden Member

    Joined:
    Jan 1, 2001
    Messages:
    1,004
    Likes Received:
    0
    Well it makes the kernel not able to make any decisions at all lol :)


    From what I remember about XP's memory management, it's very proactive about paging, and would page out as much as it could including the important parts of the kernel just based on inactivity rather than necessity of RAM. So if you spent a long time in a game, exiting the game would cause a lot of disk thrashing as it pulled everything back out of the page file even though the game never demanded the RAM that would cause it to need paging.

    I know in Linux you can very specifically set the behavior of the paging to determine how proactive it is. The advantage of proactive paging is the RAM is ready to use right when you need it, the disadvantage of proactive paging is things you may still want in RAM get pushed out by the whim of the OS because it decided it was inactive too long. I prefer non-proactive paging because have more RAM than all my apps will need (so none of them should be paged out proactively because I have nothing else I plan on loading, even if I haven't alt-tabbed to it in an hour).


    But at 8GB an XP system shouldn't even have to make decisions about paging.. it can easily keep every part of the kernel (as you said those parts are small) and all running apps in ram without paging anything unless you're running some monster apps.


    I know Vista and Win 7 have a much smarter memory management system worked out so I wouldn't bother in those OS's.


    Also using the RAMdisk for page file may be a workaround for the default 2GB user mode app limit since Windows uses PAE to redirect memory to the virtual ram (page file), and should give the app access to more memory through that. But I doubt OP has a >2GB app..
     
    #14 NoQuarter, Jan 29, 2010
    Last edited by a moderator: Jan 29, 2010
  15. Nothinman

    Nothinman Elite Member

    Joined:
    Sep 14, 2001
    Messages:
    30,672
    Likes Received:
    0
    No, it doesn't. All I/O is done via paging and the kernel can still evict unmodified pages from memory, which it does with or without a pagefile. All you've done is restrict it's ability to put modified pages into the pagefile, paging to normal files, binaries, shared libraries, etc will still happen.

    No, the whole thing is based on LRU lists and while it may proactively put some modified pages into the pagefile that haven't been used in a long time it's not evicting them from memory until necessary and that's generally a good thing. It's not like XP is looking to keep memory free for no good reason.

    A bit. You can change /proc/sys/vm/swappiness if you want, but that's directly related to the swap space usage and not paging in general.

    You'd be right if it worked like that.

    Exactly, so in the best case scenario none of your tweaks do anything.

    The core memory management is virtually the same, but they also include userland portions in SuperFetch that watch usage and preload things they think you might want to use soon.

    Not at all, where you put the pagefile has absolutely zero affect on the VM layout of the kernel or any userland processes. The only workaround for the 2G per-process VM limit is to boot with /3GB and make sure any binaries that need more VM are marked LargeAddressAware.

    And PAE has nothing to do with the pagefile or the VM layout. All it does is add another level to the pagetables so that the kernel can address >32-bits of physical memory. Virtual memory is unaffected.

    You really should get a copy of Inside Windows or Understanding the Linux kernel and read the chapters on memory management. The details of the implementations differ, but the core ideas about virtual memory are the same.
     
  16. NoQuarter

    NoQuarter Golden Member

    Joined:
    Jan 1, 2001
    Messages:
    1,004
    Likes Received:
    0
    Oh, I guess I was confused, I know the location of the pagefile doesn't matter from the VM perspective, but I thought it used some sort of address translation that was PAE or fundamentally similar to PAE to effectively change which pagetable the app is addressing (and the new pagetable happens to be the VM) which also allowed an app beyond 2GB in spite of the arbitrary restriction (1 2GB pagetable for usermode and 1 2GB pagetable for the OS?).

    Also I was under the impression that XP basically operated under a swappiness around 80 while Vista and Win7 are more in the ball park of 60 or so, as far as their behavior goes (I know there isn't a swappiness setting for Win.. just comparing)
     
    #16 NoQuarter, Jan 29, 2010
    Last edited by a moderator: Jan 29, 2010
  17. Ben90

    Ben90 Platinum Member

    Joined:
    Jun 14, 2009
    Messages:
    2,866
    Likes Received:
    0
    lolol, its so sad but completely true... A few years back when I was rocking xp-64 I went on this "optimization spree" only to find out that performance either stayed the same or went down when doing this kinda stuff
     
  18. Nothinman

    Nothinman Elite Member

    Joined:
    Sep 14, 2001
    Messages:
    30,672
    Likes Received:
    0
    The page tables are a structure used by the OS to track physical->virtual mappings. The only thing PAE does is add another level to expand the physical addresses from 32-bit up to whatever the OS and CPU support. The virtual addresses seen and used by processes are still only 32-bit and are completely unrelated to pagefile activity.

    Despite what many of the docs written by MS interns say, the pagefile and virtual memory aren't the same thing. The kernel uses virtual memory to facilitate usage of the pagefile, but that's it.

    IMO XP seems to favor the filesystem cache a little too much causing it to generate more I/O than necessary when moving files around and such which makes it seem worse than it is. However, portions of that I/O will also be from non-pagefile sources like runnings binaries, shared libraries, etc.

    I wouldn't call it sad, it just means that the MS engineers actually know more than most people give them credit for. Memory management tuning is a difficult thing to get right because no two workloads are exactly alike. But even so, the engineers at MS generally know more than about the subject than Windows' users and the defaults set by those engineers are usually good enough.
     
  19. Engineer

    Engineer Elite Member

    Joined:
    Oct 9, 1999
    Messages:
    37,893
    Likes Received:
    2
    Not to get OT here (as this thread is about ramdisk), but how would you guys optimize the system and pagefile usage to keep writes down to an SSD (which has limited lifetime cell writes of about 10,000 per cell)? Or should I say the hell with it and buy a new SSD in a few years after I wear this one out, lol?

    The ramdisk could be used to cache temporary files from IE, Firefox and the Windows TEMP and TMP folders. No reason to move the pagefile there as it would be removing memory from the main pool just to place a pagefile there to swap memory to/from. Sort of self defeating in an OS that can take advantage of ALL of the memory natively.
     
  20. Blain

    Blain Lifer

    Joined:
    Oct 9, 1999
    Messages:
    23,636
    Likes Received:
    1
    As much as we'd like to give you more suggestions about RAMdisk usage, we would prefer that you tell us what applications you're running on your 8GB XP 64-bit machine that would even tap the page file/RAMdisk.
     
  21. Nothinman

    Nothinman Elite Member

    Joined:
    Sep 14, 2001
    Messages:
    30,672
    Likes Received:
    0
    Well, chances are good that you'll be considering a new SSD in a few years regardless. But it's pretty difficult to keep Windows from periodically writing to the system drive. Profiles, registry, temp files, etc will touch that volume at some point regardless of what you do. Sadly, you can't just mount the partition read-only like you can with Linux.

    Putting the pagefile on a RAMdisk is a pretty bad idea, however it's a slightly less bad idea when you're using 32-bit Windows since you can't just let the OS do it's thing with all of your memory. But even so, I'd probably say it's not really worth it, just put it on a decent normal disk and don't worry about it. Those kind of optimizations don't have anywhere near the kind of net effect that people think or want.
     
  22. spittledip

    spittledip Diamond Member

    Joined:
    Apr 23, 2005
    Messages:
    4,483
    Likes Received:
    0
    i am running 32 bit XP, not 64. I got the extra RAM specifically for a RAMdisk for now. I will be upgrading to 7 eventually on this same machine. So, 5 gigs of the RAM are available for the RAMdisk (capped at 3.25, choosing to use just 3 gigs for the OS). So, any talk of using all the RAM for the system is not relevant.

    edit-

    Will also be getting an SSD around the same time I get W7... when prices are reasonable.
     
  23. spittledip

    spittledip Diamond Member

    Joined:
    Apr 23, 2005
    Messages:
    4,483
    Likes Received:
    0
    To reduce disk usage I put the temp folders (both user and system) on the ramdrive and dropped the pagefile to 2 gigs. The machine seems generally snappier. I continue to look for other ideas if anyone has any.
     
  24. Blain

    Blain Lifer

    Joined:
    Oct 9, 1999
    Messages:
    23,636
    Likes Received:
    1
    We're all out.
     
  25. ozkoe

    ozkoe Junior Member

    Joined:
    Jun 19, 2010
    Messages:
    1
    Likes Received:
    0
    you have to first sit back and understand ramdisk just as much as you would understand your pet that you love more than your girlfriend. the best way to set up ramdisk realyl depends on how much memory and hard drive space you have, what kind of hard drive interfaces you have, and speed differences to read and write.. im not about to write up a ramdisk bible, but heres my setup and i love it<3
    win2k3 server x86 desktop
    2.9ghz quad core athlon x4
    6gb ddr2 memory
    500gb sata hdd

    2 gigs dedicated to ramdisk (R:\ with just two directories; R:\TEMP, and R:\FF_CACHE.
    search on how to set a cache directory on firefox via about:config, and point it to R:\FF_CACHE, and right click my computer, select properties, advanced tab, Click "Environment Variables" button, and set any %TEMP% or %TMP% variable to R:\TEMP.
    i then disable virtual memory/pagefile, why would you use ramdisk for virtual memory? correct me if im wrong but wouldnt the performance degrade a bit due to re-routing to the same medium? you probably dont notice because ram is fast.
    i also use fat32 not ntfs =]
    (somebody please buy me a super fast ssd + 2tb sata drive =/)