Slashdot Mirror


How Much Virtual Memory is Enough?

whitroth asks: "Ten years ago, Received Wisdom said that virtual memory should be, on the average, two to two-and-a-half times real memory. In these days, where 2G RAM is not unusual, and many times is not that uncommon, is this unreasonable? What's the sense of the community as to what is a reasonable size for swap these days?"

40 of 544 comments (clear)

  1. lots by emphatic · · Score: 5, Funny

    lots

  2. Not much, anymore... by FishWithAHammer · · Score: 5, Insightful

    Under Windows it seems it'll swap out whether the free RAM is needed or not, no matter what (there's a registry setting to change this though). Under Linux, you won't swap much anyway unless you need it.

    I run a Core Duo laptop with 1GB of RAM and have never swapped out in Linux, no matter what I was doing.

    --
    "You can either have software quality or you can have pointer arithmetic, but you cannot have both at the same time."
    1. Re:Not much, anymore... by Propaganda13 · · Score: 5, Informative

      Simple. Monitor your own resource usage and figure out what YOU require. Everyone has different hardware, programs, and habits.

    2. Re:Not much, anymore... by larry+bagina · · Score: 5, Informative

      system control panel -> advanced -> performance options -> advanced - > virtual memory.

      Set to no paging.

      --
      Do you even lift?

      These aren't the 'roids you're looking for.

    3. Re:Not much, anymore... by megaditto · · Score: 5, Informative

      To control how much 'it will swap' on Linux:
      #echo [0-100] > /proc/sys/vm/swappiness

      A better question is how much memory you can address. Could your 32 bit Windows system address over 2^36 bits of memory (64GB), for example? And could you allocate over 2GB to windows kernel?
      Could your 64-bit linux system address over 2^48 bits of memory?

      --
      Obama likes poor people so much, he wants to make more of them.
    4. Re:Not much, anymore... by LO0G · · Score: 4, Informative

      VM != VA. You're confusing the two.

      VA is Virtual Address space. For a 32bit processor, you have 32bits of virtual address space - each process can occupy no more than 3G of RAM (on XP, with the /3G switch (which can hurt other parts of the system because it reduces the memory that the kernel can use)).

      If you have more than one process, you have more than one virtual address space. So saying that each process can only address 3G of RAM doesn't matter - with 30 processes running, you could theoretically have 90G of VA allocated.

      What's important is VM.

      VM is vitual memory. VM is what backs the pages that are mapped into the VA.

      The maximum amount of VM you can have allocated on a machine is measured by the commitment limit on the machine, which is typically measured as "physical RAM + page file space". If overall VM always stays below physical RAM, you don't need a paging file. But if it EVER goes above it, you're toast if you don't have a paging file. All those pages from the boot process that normally would have been discarded to the paging file (or were allocated by daemons that started during boot but haven't done anything since then) stick in the craw of the memory manager taking up space that COULD be used for your application, but can't because you've not told the OS where to put them.

      That's why you have a paging file - it gives the OS a place to put the mouldy old pages that were allocated by apps that aren't actively doing things so your application can re-use the memory that those apps were using.

      Btw, it's my understanding that ALL modern virtual memory based operating systems have essentially the same VM architecture - Linux, Windows, whatever. They both use paging files for essentially the same things - discarding writable pages that are not in current use by applications (read-only pages can typically be loaded from the binary image).

    5. Re:Not much, anymore... by mathew7 · · Score: 4, Informative

      "One other (Linux) server has big processes (1Gig or more) and when they have to swap out, watch the machine fall apart while the process is swapped out - it takes a while to write 1 gig of ram into swap! Since the process is large, swap needs to be large.... Just hope that server needs to have 3 or 4 multi gig processes swapped out...."

      You seems to miss the idea of swap. All modern OSes combined with processors (from 386 in the x86 range) will swap 4KB pages. So if memory is needed, the last accessed page (4KB) in RAM will be swapped (and the algorithm continues until no more RAM is required). When one of the swapped 4KB pages is needed, it's retrieved from swap in free RAM (if no free RAM is available, it swaps out another page).
      I don't think it swaps out all of your application, and if it does, you should increase you RAM. The thing is that your app can try to access the "just swapped" page, which is a preformance killer. Swapping is done on page chunks, not app chunks.
      PS: the term pagefile probably comes from windows 95 because it contains "pages". All modern processors have MMU (http://en.wikipedia.org/wiki/Memory_management_un it), which segments the memory in 4-64KB of pages.

    6. Re:Not much, anymore... by paganizer · · Score: 5, Informative

      Here is The True Word from a MCSE of long standing on the subject of virtual memory and windows (please note that nearly every person who has worked with windows will have a different true word):
      All windows: defrag your drives first.
      Win98SE: if RAM is =/> than 256mb, make Min setting equal to the amount of RAM, Max set to 1.5 the amount of RAM.
      If less than 256mb, set min setting to 1.5 times amount of ram, max to 2.5 times or 512MB, whichever comes first.

      Winnt:
      if you have 2 drives (not two partitions, two drives) create swap files with min/max equal to the amount of physical memory in the system on 2 drives. This is a way to make WinNT scream when it comes to disk writes
      Otherwise, if RAM is less than 256mb, set Virtual memory, both min & max, to twice your amount of RAM; if you have => 256MB, set min & Max to 1.5 times the amount of RAM.

      Win2k: if you have less than or equal to 512MB, set min to 1.5 times RAM, max to 2 times RAM. if you have greater than 512mb, set swap min/max to 1.5 times RAM.
      If you ever get an "out of virtual memory" error, defrag and add 100mb to min/max.
      If you have =/> 2GB RAM, disable swap, unless you are running server, in which case 4GB is the magic number.
      The 2 drive swap method just doesn't seem to work as well on Win2k as it did on WinNT; no clue why, but i've tested it repeatedly.

      WinXP Pro: Luser. why are you running the Windows ME of the 21st century? at least you aren't running WinXP home, though. just follow the guidelines for win2k, since that is all WinXP pro is, win2k with add-on crap, no changes to kernel or underlying function.

      Win2003: No clue.

      Vista: Not only have no clue, but I promise you I never will.

      --
      Why, yes, I AM a Pagan Libertarian.
    7. Re:Not much, anymore... by Spackler · · Score: 4, Funny

      #echo [0-100] > /proc/sys/vm/swappiness

      I hope this is not your example of how Linux is ready for the mainstream.

  3. Depends by beavis88 · · Score: 4, Interesting

    My rule of thumb these days is 1.5x RAM, unless you're at 2GB, in which case I go with 2GB swap as well. This is for *gasp* Windows, though.

  4. If you have enough, none by bob+whoops · · Score: 4, Insightful

    Back when I had 512MB of memory, I had a 512MB swap partition, but I noticed that I never came close to using all of it.

    When I got my new machine with 1G, I never bothered to make one at all, and I've never had a problem with it. If I do ever find myself in a situation where I need some swap space, I could always just create a swap file. It's a lot more convinient because it wouldn't have to be a fixed size, doesn't take up space when I don't need it, and I have one less partition

    Especially if you have 2G or more, I don't see a real reason to use swap

    1. Re:If you have enough, none by MyDixieWrecked · · Score: 5, Interesting

      not creating a swap partition at all is a bad idea, imo...

      you never know when some runaway process is going to eat all yer RAM and need to use swap... no matter how much RAM you've got.

      I typically just make a 1 or 2 GB swap partition since I've got more than enough space to spare. I mean, back in the days when 128MB of RAM was considered a lot, and a 5GB drive was considered huge, no one would consider using 20% of their storage space for swap. Now, it's not unusual to have 300GB of storage, so what's 1% of that being used for swap?

      I've also got a serious collection of 2-6GB harddrives kicking around, now, so I've been using them for swap. It's really pointless to have a 4GB partition for data, so I just use the entire 6GB drive for swap on some machines.

      my primary server right now has a 4GB swap partition and 1.25GB of RAM... a piece of bad AJAX code that ran overnight wound up using all the RAM and had some seriously detrimental effects on the performance of the server. it took 25 minutes to ssh in in the morning and when I finally got in, I found that the load averages were at over 100 (I've NEVER see that before).

      my point is that even if you have a LOT of RAM, it's still handy to have some spillover available.

      --



      ...spike
      Ewwwwww, coconut...
    2. Re:If you have enough, none by edmudama · · Score: 5, Interesting

      If you've got a 300GB primary drive, it's foolish to use a 5GB drive for your swap. While you gain the benefit of having that drive separate from the primary (and potentially not contending for the bus), those drives are so far apart technology wise that you'd probably be better off with a swap partition on your most modern disk.

      That 2/5/6GB drive may have a 20MB/s sequential rate at OD and half that at ID. Modern drives more than double that sequential performance (or triple), which is what's critical when swapping in/out a large job. Many drives in that generation don't support UDMA either, and talk with PIO, meaning you get no data checksum on your transfers.

      You can span generations when you're using a cost reduced modern drive (fewer heads, same formats) but the drive that was stretching to make 5GB across 6/8 heads will be a real POS compared to modern drives performance wise.

      Thrashing is bad, but thrashing to a slow disk I'd think would be worse. It is even compounded since that 5GB drive is probably PATA, meaning you're going to have your swap drive and primary drive sharing a cable, which will basically nuke most of the savings of 2 disks since they'll be reselecting master/slave at almost every command.

      --
      More data, damnit!
    3. Re:If you have enough, none by gfxguy · · Score: 4, Insightful

      you never know when some runaway process is going to eat all yer RAM and need to use swap... no matter how much RAM you've got.

      Frankly, while I do use swap, in this case I'd rather have the process crash sooner rather than later.

      --
      Stupid sexy Flanders.
    4. Re:If you have enough, none by EvanED · · Score: 4, Insightful

      Well, again, that depends; if your usage patterns don't cause enough memory use to justify swapping, and you're just creating a swap partition for the emergency where some program decides to break, then it hardly matters if your swap drives are slow, because they are never accessed.

    5. Re:If you have enough, none by fuzz6y · · Score: 4, Interesting
      you never know when some runaway process is going to eat all yer RAM and need to use swap... no matter how much RAM you've got.
      You never know when some runaway process is going to eat all yer RAM and swap combined, no matter how much swapspace you've got.
      a piece of bad AJAX code that ran overnight wound up using all the RAM and had some seriously detrimental effects on the performance of the server
      too bad you had all that swapspace for it to run rabid across. if you'd had no swap at all, 1 of 2 things would have happened:
      1. the kernel kills the process because of a low memory condition
      2. an attempt to allocate memory fails. The application then handles this somehow. Since we've established that it's a lousy application, I'd guess it handles it by crashing.
      Either way, the Dude^W server abides.
      Naturally if you actually had that much physical RAM, the process would have still gone nuts, but your server wouldn't have had to thrash its disk for every process except the prodigal son, so the performance hit probably wouldn't have been noticeable.
      --
      If you're going to be elitist, it would help to be elite.
  5. I use this by Anonymous Coward · · Score: 5, Insightful

    2X physical memory for under 2G RAM
    2G swap for up to 8G RAM
    +1G swap for every 4G RAM beyond that

  6. More is better! by Millenniumman · · Score: 5, Funny

    I use 4x750 GB hard drives (RAID), purely for virtual memory. It increases the speed on the RAM preprocessing directive, but demodulates the core processing utility monitor. I find it to be a good setup, especially for running Naibed Linux.

    --
    Stupidity is like nuclear power, it can be used for good or evil. And you don't want to get any on you.
  7. Set it and forget it by StikyPad · · Score: 4, Insightful

    According to MS, it's 1.5 times the total RAM. I assume you're asking because you're trying to avoid a fragmented page file. While the benefits of an unfragmented page file are dubious at best (since it will be randomly accessing different parts of the page file), it's better to err on the side of caution: If you have 2GB of memory, you likely have an equally compensating-for-something hard drive, so you probably won't miss 3GB of space, or even 4. It's better to waste a little space than have Windows run out of Virtual Memory. Otherwise, just let it do its dynamic page file adjustment thing.

    If you're asking about creating a swap partition for Linux then 1.5X is also recommended. Just be generous, unless -- for some reason -- you've got 2GB of RAM and a 50 meg hard drive. Too much is always better than not enough.

  8. Don't forget disk cache by uler · · Score: 5, Insightful

    One of the real advantages of using swap isn't to avoid memory exhaustion at all; by moving infrequently accessed pages from memory you make more room for the disk cache, thereby possibly improving overall system performance by reducing hard drive reads.

  9. Pre-emptive swapping... by Junta · · Score: 5, Informative

    Linux has futzed with this a lot (and lets the user tweak VM behavior a lot, but /proc/sys/vm/swappiness goes a long way...), both linux and Windows will swap well ahead of not having free memory (for good reason). Just wanted to go into detail because I keep seeing people complain that they see swap used in linux or windows when they still have free memory, not realizing this isn't a bad thing generally.

    There are generally two strategies:
    -The common-sense one where you swap when you run out of memory. This makes a lot of practical sense on systems with limited write cycles (flash based swap, though you really never ever should do that anyway), and systems that want to spin down drives to conserve power for battery conservation. Performance wise (this may surprise people who haven't spent time thinking about it), this can often be bad. Avoiding swapping is generally only good on systems where resource utilization is carefully managed and you know it won't swap ever (the IO operations of unneeded can interfere with the productive activity of a constantly busy system). This is actually a vast minority of systems in the world (no matter how l33t one may think themselves, they most certainly don't have a usage pattern that would be impacted by the extraneous IO operations of occasional write to swap.

    -Pre-emptive swapping. When the IO subsystem is idle and the system can afford to copy memory to swap area, it does so (depending on criteria). Generally speaking it will select memory not accessed much and write it to disk, but leave the memory copy in place if the physical memory is not immediately needed. A fair amount of swap used in an apparently underutilized system is duplicated in physical memory and swap space. The benefit here is that if the process reads back that memory, it doesn't incur any penalty in reading it back despite it being also in swap (the system may make certain decisions on what is the best swap candidate and write to disk different data). The benefit of writing this stuff to swap even when not needed is clear when an application comes along that allocs more memory than the system has free in physical space. In the first strategy, this means the malloc blocks while data is written to disk, and the new application starting or needing a lot of data is severely impacted. In the pre-emptive swap case, system notices the condition, knows what memory it has a backup in swap of that hasn't been used lately, and can free that memory and satisfy the malloc pretty much instantly.

    To those who have 1GB of RAM or so it becomes less likely that the system will have to flush memory from physical RAM, but there is a balance to be struck between memory used directly invoked by applications, what the application memory access pattern is, and what ram you can use to buffer filesystem access. If your total application memory allocation is 75%, it still may make sense performance wise to only keep 50% of your physical memory dedicated to the applications, (the other bit relegated to swap), and 50% of the memory to buffer disk I/O.

    --
    XML is like violence. If it doesn't solve the problem, use more.
    1. Re:Pre-emptive swapping... by m0rph3us0 · · Score: 4, Informative

      It's a problem called free-list errosion. Windows will swap out apps to make room for buffer cache. So when WoW reads a 2GB file, all your programs end up swapped out to disk.

  10. Re:No swap at all by georgewilliamherbert · · Score: 4, Interesting
    If the server starts to swap, you've lost the battle. But randomly killing things or locking up is losing the war.

    It's fine to set off alerts and alarms if you're paging. You should set off alerts and alarms if your servers start paging. Randomly killing things instead? Insanity.

    You can never build reliable services for users/customers unless you can handle random or accidental error conditions gracefully. Swap space is a cheap and easy key way to do that.

  11. But more on topic... by Junta · · Score: 4, Insightful

    My strategy generally is to use a file for swap rather than a partition, even in linux. I figure that if memory has to be swapped in from disk, it's already crappy going to disk so the extra overhead doesn't matter much, and I have freedom to adjust it up or down depending on my needs. (This is a desktop/laptop circumnstance). I generally start at 512MB or so, increasing maybe if IO is faster on the drive. I view swap like a rumble strip on a road before a stop sign. With no swap, you don't realize a process leaked memory until it's too late, with swap, while it eats through your swap the performance will degrade and you'll see the end coming ahead of time, and may be able to head it off with a kill. It may be well an good your 4GB of ram is technically capable of handling the same load your 1GB RAM+1GB swap handled in the past, but having some noticable impact when things start going wroing is nice. I realize theoretically there are better approaches, but nothing gets in your face like poor performance and tons of disk accesses.

    On a production server or a problematic system where I want support and the OS likes to dump a core to swap, I'll ensure a generous swap partition is available (generally observed active swapx1.5+physical memory size). In this case a file-backed swap may depend on layers of the kernel that are in an invalid state, and a swap partition is more likely to be reliably writable. The only system I would even theoretically hibernate on is my laptop, and I only ever suspend to ram or shutdown completely, so I don't consider my laptop as needing a swap partition of any significant size.

    --
    XML is like violence. If it doesn't solve the problem, use more.
  12. Re:Depends... by Limecron · · Score: 4, Informative

    This is completely wrong.

    In Windows, your RAM is saved to a file called "hiberfil.sys" which is the exact size of your physical RAM. Your swap file stays exactly the way it is, otherwise you'd lose the data that was swapped to it.

    In Linux, it depends on what program you are using to suspend, but typically, it's a file in /tmp.

  13. Re:Rules of thumb are dumb by Feyr · · Score: 4, Interesting

    all this swapping talk is giving me nightmares.

    a few years ago, we had a customer with multiple colocated servers complaining that sometimes they crashed for no apparent reasons.
    after much debugging, we figured out one of their script was leaking memory. eventually consuming all ram (2.5G) + all swap (1-2g).

    now the real problem is this. those were LIVE processes so the system was constantly paging back and forth, using 90%-95% cpu just to swap the damned things in and out and starving the actual processes.
    linux 2.4, linux 2.6 (early 2.6). same deal. amazingly, the distro made a difference, redhat was pure hell, debian slightly better (though still not acceptable)
    freebsd was much smarter, it just killed the offending processes.it sure wasn't ideal, but at least the server was still serving its clients

    to this day, i never put more than 256m as swap even on servers with 4G of ram. that's where we had the least problems.

  14. Mac OS X swap by atomm1024 · · Score: 4, Informative

    On Mac OS X, swap is stored (by default) in files in the /var/vm directory on the boot hard drive, instead of on a separate partition. So there's no limit to how much is used, nor a predefined minimum amount of space used, the swap space expanding and contracting as needed. That seems reasonable.

    --
    Signature.
  15. BSDs like more by Just+Some+Guy · · Score: 4, Insightful
    According to FreeBSD's tuning(7) man page:
    The kernel's VM paging algorithms are tuned to perform best when there is at least 2x swap versus main memory. Configuring too little swap can lead to inefficiencies in the VM page scanning code as well as create issues later on if you add more memory to your machine.

    Disk is always far cheaper and more plentiful than memory. If you have four gigs of memory, what's wrong with carving eight gigs of swap out of your terrabyte RAID? If you have that much memory in the first place, then you're probably running large apps. Do you and them a favor and give them a little breathing room.

    --
    Dewey, what part of this looks like authorities should be involved?
  16. your next box needs swap by r00t · · Score: 4, Funny

    You have a GUI to run: 600 MB for firefox, 1800 MB for OpenOffice.org, 100 MB for X, 100 MB for desktop odds and ends, 300 MB for Evolution or Thunderbird, and 10 MB for old-style stuff running in the background.

    Total: 2910 MB

    Yep, you need a gigabyte of swap. OpenOffice.org was made 64-bit clean for a reason. If you plan ahead, not wanting to reallocate disk space in the next few years, you'll allow for this:

    2 GB for firefox, 5 GB for OpenOffice.org, 1/2 GB for X, 1/2 GB for desktop odds and ends, 1 GB for Evolution or Thunderbird, and 10 MB for old-style stuff running in the background

    That's 9.01 GB. You're exactly 7.01 GB short, so you'll be needing that swap space before you know it.

  17. Rule of thumb... by tachyonflow · · Score: 4, Insightful

    But... but... the rule of thumb says to have twice as much swap as RAM!

    It's a pet peeve of mine that so many system administrators appeal to "rules of thumb" about decisions such as this, instead of actually thinking it through. Sys admins pass around these nuggets of wisdom with unquestioning reverence, like they were handed down from some bearded UNIX guru sitting on a mountaintop. These rules either 1) happen to reflect reality, 2) do not reflect reality, or 3) reflected reality 20 years ago but nobody got around to issuing some sort of "revocation rule of thumb". :)

    My experience is that very little swap is needed these days, and the rule of thumb falls into category #3. Long gone are the days that the OS demanded swap space for all process memory.

    If I have a machine with 1GB of RAM, I'll usually give it 512MB of swap or so. As discussed elsewhere in this thread, a little bit of swap is good for pre-emptive swapping and for emergencies (to avoid the dreaded Linux "oom killer".) Also, if you're going to use hibernate, you'll want at least as much swap as real memory.

  18. Are you using tmpfs or not? by hpa · · Score: 5, Interesting

    One thing to consider is whether or not you're using tmpfs for /tmp. For performance, I recommend using tmpfs for /tmp, and basically treat the swap partition as your /tmp partition. It may seem counterintuitive, "why would it be faster than a filesystem when it's backed to disk anyway, and my filesystems caches just file if need be?" The answer is that tmpfs never needs to worry about consistency. On the kernel.org machines, we have seen /tmp-intensive tasks run 10-100 times faster with tmpfs than with a plain filesystem. The downside, of course, is that on a reboot, tmpfs is gone.

  19. Read (please!) by Anonymous Coward · · Score: 5, Informative

    Man, it's utterly depressing to see the same useless "rules-of-thumb" still in effect when the original question is asking if the rule-of-thumb is a good idea.

    1) Page space is not swap space. There's a small distinction that's generally lost (and generally ignored). Page space is used to move memory pages to and from disk. Swap space is technically to move entire processes out to disk. The difference is mainly based on when your OS was created (i.e., technological underpinnings) and no need to get into it now... but the difference is meaningful.

    2) Page space is not *free*. There's a misconception that if you have 500G of disk space then "how does it hurt" to put 8G of swap on 4G RAM. Depending on your OS, the size of the page table can grow remarkably depending on how much memory (RAM + VM) is allocated. This means that adding 2G of page space may not cost anything, but adding 2.5G may suddenly take up another chunk of real, non-pageable memory because the page table cannot itself be paged. This means that if your app is thrashing, then adding page space may make it worse.

    3) Even with lots of RAM, it's still often a good idea (depending on your usage) to have some page space. Modern OSes will still page out unused pages to use RAM for better stuff. I.e., if you have a huge file open in a graphics application, but are not actively using that application for a length of time (an hour, say) then the OS will page it to disk. This makes better use of your physical RAM. On some OSes the OS will use page space even if free RAM is available. It can then toggle a page out by flipping a bit in the page table and not have to do an expensive write.

    4) In some systems you can overcommit memory. Applications tend to request a lot more memory from the OS than they'll actually use. This is useful in many instances but it again depends on your usage. If you're running a single application that doesn't dynamically allocate memory then you can run pageless. If a new app requests memory that's not available then it will get a failure on malloc request. This can be desirable in some circumstances.

    5) There are benefits to running page space on a separate disk, but for the vast majority of home users, the difference is negligible. This applies to Windows and Linux. Once you start stressing the VM subsystem then a separate disk is highly desirable.

    6) You can create page files on Unix/Linux. It's not desirable generally because of the extra filesystem overhead and possibility of fragmentation. But hey, in a pinch it works.

    7) Why this 2x RAM rule? A lot of it comes from old VM subsystems that needed a "picture" of the entire memory space. This made the page-out algorithms easier to code. Newer algorithms don't require the 2X RAM.

    KL

  20. No...not really by Chas · · Score: 5, Informative

    There's no real hard and fast rule anymore. And setting it against a static value (like physical memory) is incredibly wasteful.

    It's a much better idea to set it interactively. Use the system without adjusting the Virtual Memory for a while. Then take a look at your usage and set your virtual memory against that usage.

    For instance.

    If you're in a Windows machine, let it run normally for a few days.
    Run everything the way you normally use it.
    Multiple apps, multiple instances, games out the ass, everything.

    Then open up the Task Manager and look at the Performance tab.
    Take a look at the Peak value under "Commit Charge".
    Set your virtual memory, min and max, at about 10% above that value to leave yourself a little headroom.
    Normally this will be enough to deal with your maximum swap requests.

    If, somehow, you begin bumping against virtual memory limits again AFTER that, bump it another 10%.

    If you still have problems, keep bumping it in 10% increments, and start looking for apps that are memory leaking.

    --


    Chas - The one, the only.
    THANK GOD!!!
  21. But really, who cares? by mcrbids · · Score: 4, Insightful

    My strategy generally is to use a file for swap rather than a partition, even in linux.

    What I find curious is that you have a strategy. On what relevant experience do you base this strategy? 1 GB of disk space costs less than $0.50. Set up 3 GB of VM if it makes you feel good. The latte you drink while you set it up costs more than the extra disk space!

    So go for it!!! Who cares what you do? Heck, give yourself 10x the RAM and see if it actually makes any difference!!! (it won't)

    This is sort of like asking: "Which goes faster: the yellow Pacer or the red Pacer?"!

    --
    I have no problem with your religion until you decide it's reason to deprive others of the truth.
    1. Re:But really, who cares? by Angostura · · Score: 4, Funny

      Are you aware of the ironic disconnect between the content of your posting (If you need to ask, you don't need to know) and the content of your .sig?

  22. Is swapping obsolete? (was:Rules of thumb are dumb by Jeremi · · Score: 4, Interesting
    To this day, i never put more than 256m as swap even on servers with 4G of ram. that's where we had the least problems.


    That raises the question: is swapping obsolete? Or to put it more explicitly, has the speed difference between modern CPUs and hard drives become so large, and RAM so cheap, that it's better to consider running out of RAM to be indicative of a software failure? That way you end up with a system where one or more processes may fail (or be terminated) but at least the machine remains usable and doesn't swap itself into non-responsiveness.


    In my experience, the answer is yes: with 2GB of RAM in my machine, I never need to swap, and in the few instances where swapping did occur, it was because of buggy software (memory leaks) and manually terminating the offending processes is what I needed to do resolve the memory shortage. So why not just have the OS do that automatically?


    Or to put it a third way, is there any situation where swapping is helpful, anymore?

    --


    I don't care if it's 90,000 hectares. That lake was not my doing.
  23. Listen to Mr Cray. by haeger · · Score: 5, Funny

    "Memory is like an orgasm. It's a lot better if you don't have to fake it."
                      -- Seymour Cray, on virtual memory.

    --
    You are not entitled to your opinion. You are entitled to your informed opinion. -- Harlan Ellison
  24. Re:OSX - 4 gigs RAM, 14 gigs swap?!? by ajcarr · · Score: 4, Informative

    The VM Size listed in Activity Monitor is not the size of the swapfiles. I'm running on a machine with 1 GB RAM, my VM size is 6.53 GB, but I only have 128 MB of swapfiles. You might find it interesting to intall MenuMeters http://www.ragingmenace.com/software/menumeters/ to keep track of what's going on.

  25. gig of RAM costs 50 times more than a Gig of HDD by da5idnetlimit.com · · Score: 4, Interesting

    And is 1000 times faster ?

    So, to answer the original question :
    Optimal amount of Swap ? 0 !

    Even my old PIII 1Ghz takes 2 gigs of ram. Newest system we have at the office takes 64 Gigs.

    => right now I consider the Linux systems @ work as having a problem if they use swap...

    Adding just a wee bit of RAM to your system and seeing swap disappear means your perfomance just exploded on this particular task...

    Best Regards,

    D.

    --
    It takes 40+ muscles to frown, but only four to extend your arm and bitchslap the motherfucker
  26. Re:gig of RAM costs 50 times more than a Gig of HD by mrball_cb · · Score: 5, Interesting

    We've found that 512 Megs of swap is more than enough for our 2 and 4 Gig machines. Why even have swap? Here is an example:

    1) On a system with zero swap, when apache gets slammed (say you get to the top of digg or slashdot), apache starts consuming lots of memory to handle new inbound requests. When it runs out, the machine grinds to a halt because it can't allocate more and requires a power cycle. (Setting a low max children really only helps if you are happy denying traffic to the people who are trying to see your site...it's best to plan for capacity and put quite a few servers load balanced).
    2) On a system with any appreciable swap (IMHO, more than 128 Megs, up to 512 Megs), if you're monitoring the system (watch -n 1 df -h, for example) and all of a sudden it starts using swap, the machine is on the edge of dying. This gives you an early warning that maximum machine performance/throughput is occurring. You can restart apache or shut it down or similar, you can do something to temporarily lower or remove load from that machine. This doesn't give you *much* time, but it gives you some.

    In our real world experience, at digg and slashdot loads you have about 10-15 seconds to stop apache once it starts swapping. After that, the performance degrades so bad that the machine becomes catatonic, the same as #1, requiring a power reset (obviously because virtual memory on HD is magnitudes slower than RAM, as numerous others have suggested). The key here is that you must realize that some swap is good for allowing unused programs to be swapped out, such as login terminals that just sit there. It's great for detecting problems, but if your heavy app is the one utilizing swap, your machine is about to crash anyway.