Slashdot Mirror


How Big Should My Swap Partition Be?

For the last 10 years, I have been asking people more knowledgeable than I, "How big should my swap be?" and the answer has always been "Just set it to twice your RAM and forget about it." In the old days, it wasn't much to think about — 128 megs of RAM means 256 megs of swap. Now that I have 4 gigs of RAM in my laptop, I find myself wondering, "Is 8 gigs of swap really necessary?" How much swap does the average desktop user really need? Does the whole "twice your RAM" rule still apply? If so, for how much longer will it likely apply? Or will it always apply? Or have I been consistently misinformed over the last 10 years?

900 comments

  1. What Has Changed? by eldavojohn · · Score: 5, Informative

    'Is 8 gigs of swap really necessary?'

    With a 750GB hard drive selling under $100, what has changed?

    Yeah, your 256MB of space was trivial when you had a 30GB hard drive ... and 8GB of space is still trivial with a 750GB hard drive.

    That said, I'll forward you some common information on paging.

    Linux and other Unix-like operating systems use the term "swap" to describe both the act of moving memory pages between RAM and disk, and the region of a disk the pages are stored on. It is common to use a whole partition of a hard disk for swapping. However, with the 2.6 Linux kernel, swap files are just as fast as swap partitions, although Red Hat recommends using a swap partition. The administrative flexibility of swap files outweighs that of partitions; since modern high capacity hard drives can remap physical sectors, no partition is guaranteed to be contiguous.

    I'm no expert but the short answer to this is to look at your swap partition as your extended virtual memory. By saying that your swap partition should be 2x your main memory is like saying that you will never use 3x of what your main memory is (in this case 12GB). While that rule of thumb is a good one, there may in fact be applications today in the graphics and processing world that require insane amounts of memory. While Firefox is probably never going to reach that critical mass (nor will most average programs) it's probable that a few years from now it will be common place. I know it's insane to think of but 'ought to be enough for anybody' is not the phrase you want to throw around in the digital information world.

    It's those days when I'm playing Warcraft through wine, listening to streaming radio through Amarok, have 20 windows open behind it, idling a LAMP server for my development projects, running a vent client, some form of news aggregater, pidgin & an e-mail client hooked up to several POP3/IMAP accounts that I am happy I erred on the side of a whole ton of swap space.

    --
    My work here is dung.
    1. Re:What Has Changed? by Zosden · · Score: 2, Funny

      Old memes
      640k is enough...
      in Soviet Russia drive partitions you.

    2. Re:What Has Changed? by meringuoid · · Score: 5, Interesting
      Yeah, your 256MB of space was trivial when you had a 30GB hard drive ... and 8GB of space is still trivial with a 750GB hard drive.

      I have an Eee 901. It has 1GiB of RAM and 20GB of disk space. A swap partition on the 'twice your RAM' rule would be far from trivial.

      I decided to be bold and installed Hardy with no swap partition. It seems to work just fine so far; Firefox greys out for a few seconds sometimes while loading pages, which might have to do with my reckless configuration, but on the whole it's pretty snappy.

      As for my desktop PC, it has 4GiB of RAM. I followed the traditional rule when I installed on that. I don't think that swap partition has ever even been used.

      --
      Real Daleks don't climb stairs - they level the building.
    3. Re:What Has Changed? by whoever57 · · Score: 1, Interesting

      With a 750GB [newegg.com] hard drive selling under $100, what has changed?

      The relative speeds of disks and memory have changed.

      I am thinking of reducing the amount of swap on my primary compute server -- the reason is simple: if the machine starts using appreciable amounts of swap, it becomes so slow, it is unusable. So, really, by reducing the swap, what I do is get the OOM killer to take action and kill some processes sooner. I may have an unusual situation that when my machine is out of memory, the cause is almost certainly due to a proces that I want killed anyway.

      --
      The real "Libtards" are the Libertarians!
    4. Re:What Has Changed? by srothroc · · Score: 3, Informative

      Just some stupid math, but if you figure that you had a 40 GB HD when you had 128 MB RAM, you'd need 256 MB for swap space; that's about .006% of your hard drive. Windows installs were also correspondingly smaller at that time.

      Now, if you suppose that someone has 4 GB RAM and a 750 GB drive, they'd be using 8 GB for swap space, which represents about .011% of their hard drive... and Windows installs, games, and applications are much bigger.

      HOWEVER, if you look at smaller drive sizes, which are still common in the modern day -- I know plenty of people who just use 120 GB or 200 GB drives; not everyone likes all their eggs in one basket.

      8 GB swap on a 120 GB drive represents about .07% of the drive. On a 200 GB drive, it represents about .04% of the drive. Still and order of magnitude larger than was required back when "swap space should be double your amount of RAM" was a standard rule of thumb.

      Just some thoughts.

    5. Re:What Has Changed? by Anonymous Coward · · Score: 0

      It really all depends on your usage and what you need. I have four gigs of RAM and my swap partition is only 1 gig is size. Despite the fact that my swap space is 1/4 of my physical RAM, my swap space has never been anywhere even close to approaching full. It hardly ever gets touched even when I'm running a virtual machine in VirtualBox. Also, in the rare circumstance when something is swapped out to disk, I've never seen the usage go above several megs.

      What I did to figure this out was started with the 2x rule of thumb and then monitored my swap space from time to time. Eventually I had an enough RAM and used so little swap space, I re-evaluated the amount I needed and the next time I installed, I reduced the swap partition size.

      I should probably also note, that I close programs when I'm not using them. I close Firefox when I'm not surfing. I turn off the VirtualBox services when I'm not running a virtual machine. The only programs I tend to leave running, other than UI and systems programs, are Pidgin and Amarok. My server applications are on a tower I use for server like apps such as my LAMP stack and file shares. That box has significantly less horsepower and only has 1 gig of ram and it's swap partition is also 1 gig in size and it hardly ever gets used.

    6. Re:What Has Changed? by Zekasu · · Score: 1

      While Firefox is probably never going to reach that critical mass (nor will most average programs) it's probable that a few years from now it will be common place.

      I only think that part about Firefox is applicable to Firefox 3, if you know what I mean.

      Also, I rarely am able to exceed 4GB total memory use, even with WoW and some other things up at the same time. To be honest, I run out of CPU cycles before I run out of memory.

    7. Re:What Has Changed? by Sensible+Clod · · Score: 1

      Since I installed Fedora 9 on my 3GB RAM and 850 GB RAID5 machine, I have zero swap and no issues so far. I very rarely use anything with huge memory requirements. I think the best answer to this question is: It depends on how much you use. Especially the largest thing(s) you use.

      --

      The difference between spam and poop is that you don't have to dig through septic tanks looking for real food. -- Me
    8. Re:What Has Changed? by RiotingPacifist · · Score: 3, Interesting

      consider using a swap file for your setup id recommend 256mb of swap, with 1.25gb of ram (apart from when i left wireshark running for toolong) ive not seen it creep above ~100mb for long.

      --
      IranAir Flight 655 never forget!
    9. Re:What Has Changed? by FooBarWidget · · Score: 1

      "With a 750GB [newegg.com] hard drive selling under $100, what has changed?"

      The coming of laptops. My laptop from 2007 only has an 80 GB hard drive. I'm a Linux user so the hard drive is partitioned with 10 GB for / and 42 GB for /home. I need Windows for games, so 23 GB for Windows, which proved to be barely enough for the few games that I'm playing (Starcraft, Portal, some MMORPGs). However, I don't want to reboot to Windows every time I want to test a website in Internet Explorer or every time I need to write Windows software, so I installed XP within VMWare, and the VMWare image resides in my home partition. This takes 20 GB of disk space. This only leaves about 20 precious GB. I download a lot of anime so 20 GB is really very little.

      I have 2 GB of RAM. Reserving 4 GB swap would be an utter waste of disk space that I could use for more useful things.

    10. Re:What Has Changed? by RiotingPacifist · · Score: 3, Informative

      i assume you dont hibernate, thats the only reason i have 1x my ram in swap. Although using something like "hibernate" instead of ubuntu's tool will happily compress it so i could really get away with about 60-70%

      --
      IranAir Flight 655 never forget!
    11. Re:What Has Changed? by cytg.net · · Score: 5, Insightful

      The real question is; is that 750GB drive really 20 times faster than the older 30GB one?

    12. Re:What Has Changed? by Gewalt · · Score: 1

      Since I hate 'just taking smart peoples word for it' I have been actively testing this myself for years. On windows, some drivers crash if they can't load themselves directly into swap/page. So, I give windows an 8mb swap file. It's happy. On Linux, I don't use a swap file at all. It's happy.
       
      Yes, I'm serious. I don't use pagefiles, the very concept makes no sense, and certainly does not improve performance.

      --
      Modding Trolls +1 inciteful since 1999
    13. Re:What Has Changed? by ArsonSmith · · Score: 1

      All that sounds nice, but I still go by the fact that 1G of swap is more than you should ever use. Maybe not more than you need (640k is all you should ever need...)

      I say it's all you should ever use because if you are using more then you need to upgrade RAM. Period. Anyone that tells you different is grasping at antiquated ideas of expensive memory and getting around buying more RAM by using swap. Even vendors like to request large amounts of swap space. I still never allocate more than 1G up front. Go ahead and try to get a technical reason for adding more swap. They'll give you something like, "Because the engineers say so." That usually shuts people up, but talk to those Engineers and they'll either tell you they say nothing of the sort or that they do it because they always have.

      If you do get into a situation where your monitoring notifies you that your memory is nearly full (make sure your monitoring uses the +-buffers portion of the free commands output) and you are running low on swap you can always create a temporary swapfile to hold you off until your new RAM upgrade comes in. If you are planning to work from swap then you are putting extra load on your hard drives and IO subsystem and killing your overall performance.

      The rule for swap:

      1G swap partition. If it's used regularly upgrade RAM.

      --
      Paying taxes to buy civilization is like paying a hooker to buy love.
    14. Re:What Has Changed? by setagllib · · Score: 4, Funny

      I hate it when that happens. A helpful popup told me I ran out of CPU cycles just a few days ago, and I had to order a whole bunch online. Cost thousands! Still waiting for them to arrive.

      --
      Sam ty sig.
    15. Re:What Has Changed? by sqlrob · · Score: 0

      Windows should have a swap file that is the size of RAM. If there's a system crash, the memory dump is written there and written to the dump file after the next boot.

    16. Re:What Has Changed? by -noefordeg- · · Score: 1

      But that was a rather slow and cheap disk. The cheapest disks we use here are 146GB 15000RPM disks in raid or mirror.
      You don't "spend" 32GB of a raid for swap for a server with 16GB of memory. We set the swap to 2GB. I just checked top on one of the computers and it listed "81956k used" of the swap.

    17. Re:What Has Changed? by ArsonSmith · · Score: 1

      Most of your percentages are off by 2 orders of magnitude.

      --
      Paying taxes to buy civilization is like paying a hooker to buy love.
    18. Re:What Has Changed? by Gewalt · · Score: 4, Insightful

      Why would I want that? If Windows crashes, I want it to restart and quickly, not waste my time dumping memory.

      --
      Modding Trolls +1 inciteful since 1999
    19. Re:What Has Changed? by orzetto · · Score: 5, Informative

      I have an Eee 901 [...] I decided to be bold and installed Hardy with no swap partition.

      There are better reasons than boldness for not using swap on an Eee. They use solid-state drives (except some 1000-series models and the 904), which are faster than mechanical devices but can be rewritten fewer times. To make sure your drives last longer, do the following:

      1. Mount partitions with noatime, or relatime if you are using one of the very rare programs that use atime (mutt is the only one I know of);
      2. No swap partition, which would predictably have many more writes than the rest of the disk;
      3. Mount /tmp on tmpfs so that temporary files do not wear the disk.

      Sure, without swap and with tmpfs you will have less memory available, but I have an Eee 900A and I bought it as a presentation machine, possibly for some occasional work while travelling, not as a workhorse.

      --
      Victims of 9/11: <3000. Traffic in the US: >30,000/y
    20. Re:What Has Changed? by TurboNed · · Score: 1, Insightful

      But the question arises - how many people actually are going to make use of that memory dump? Considering that even most power users of Windows don't know what to do with a memory dump file, discarding it completely is the efficient and useful thing to do in most cases.

    21. Re:What Has Changed? by kyz · · Score: 4, Insightful

      Swap space does improve performance. I have a lot of services loaded, ready for someone to use them, but they are rarely used. FTP server, file server, music server, web server, and so on. Most people have at least one little-used process running.

      With no swap, these never-running programs actively consume RAM and reduce the amount of RAM available to running programs and even disk cache.

      With swap, these sleepy daemons are paged out and not loaded again unless someone needs them. I get my RAM back for something I'm doing now.

      Yes, I could pare down my system so it doesn't load things unless absolutely needed, but why should I have to do that manually when I could just leave them running and have them consume zero RAM?

      As to "how big should swap be?", I prefer the Mac OS X solution - all free space on your drive is swap. Nothing is reserved, and you can make swap go away by completely filling your drive (but you wouldn't do that, would you?)

      --
      Does my bum look big in this?
    22. Re:What Has Changed? by the+unbeliever · · Score: 3, Insightful

      Some people actually want to debug something and find out *why* windows crashed.

      I have customers who insist on windows servers. When they crash, the customer wants to know *why* -- dump files are handy in this case.

      For a home user, however, I see your point.

    23. Re:What Has Changed? by Anonymous Coward · · Score: 1, Interesting

      This is all very well as long as you don't run out of physical memory. When you do, Linux starts killing processes at random (well, sort of) until it's freed enough memory to carry on. This can be annoying.

      Disk space is cheap. Allocate a reasonable chunk of it to a swap file, and keep a bit of an eye on how much is used. If a significant amount of swap space is used, it's a good sign you haven't got enough RAM. Fortunately, RAM is also pretty cheap, so give it some more.

      How much is a "reasonable" chunk? Remember this is all easily changeable on the fly if you use swap files instead of swap partitions. So start out with, say, swap space to match physical memory. Watch it for a while. If it's never used, and you're short of disk space, remove it and give it a smaller amount. Keep watching it on and off, especially if your usage patterns change. You'll soon enough get a feel for how much you need.

      Me? I hate getting killed more than I hate running slowly, and I have spare disk space, so I have a big chunk of swap space, at least a couple of times physical memory. It's hardly ever used, but I know that if I kick off something heavy it's not going to be killed off. And if I need the disk space for a while I just get rid of the swapfile for the duration.

    24. Re:What Has Changed? by kasperd · · Score: 4, Insightful

      I have an Eee 901. It has 1GiB of RAM and 20GB of disk space.

      I suppose that is not really a disk but rather flash storage. Swapping to flash is not the best idea as it could cause the flash to last shorter than it should. So I'd say this is probably one of those cases where no swap is the correct configuration.

      --

      Do you care about the security of your wireless mouse?
    25. Re:What Has Changed? by renegadesx · · Score: 1

      I have a "half the swap" setup and yes it does get used but barley half full. Here is what I run on my 4Gb RAM/2Gb swap Ubuntu box:

      Vmware Server 2 w:/ Opensolaris, WinXP, CentOS 5.2, Server 2k3, gOS

      Usually at any given time I will have at least 3 or 4 of the follwing running ontop of that plus hosting a samba file server

      Firefox
      Banshee
      VLC or Totem
      OpenOffice
      F-Spot
      Pidgin

      So all in all I would say a half the RAM setup is more than enough though I cant speak for game setups (Cedgea etc)

      --
      Make SELinux enforcing again!
    26. Re:What Has Changed? by apoc.famine · · Score: 2, Informative

      Actually, the graying out of firefox isn't related to swap. On my EEE 4gb it happens as well. I have 1gb of ram, and put in a 4gb SD card which holds my tmp, swap, and var directories. I have 160mb of ram free, and the swap isn't being touched.

      I'm not 100% sure, but I think firefox grays out when trying to crunch big script(s) - it might be pegging the processor, but I don't know for sure. I've been meaning to track down the issue, but have been too lazy to so far. If anyone knows the cause/fix, I'd love to hear it.

      --
      Velociraptor = Distiraptor / Timeraptor
    27. Re:What Has Changed? by Sj0 · · Score: 4, Insightful

      You present several arguements, but none of them are really very good.

      Honestly, why does the 2x RAM guideline make any sense? Why is it that when I upgrade my 1GB to 8GB, I suddenly need 16GB of swap space, even though my total RAM+SWAP was less than half of my current memory? That makes no sense. Why should I want to increase the amount of swap I'm using if I've never used half the RAM I've got in the life of the computer?

      How about we practice some Engineering? I know, it's slashdot, it's a tough thing to do, but bear with me.

      So you've got a computer, and you know what you do with it. Simply do what you'll do, and figure out the peak memory usage over a period of time. Add 50% or so to get a target memory value, and if your current memory exceeds that value and thus you've got more than enough to never have to hit swap, pick a small number like 256MB for your swap partition to satisfy applications which demand swap even when enough memory is available. If you don't have enough memory, then create a swap file to make up the memory shortfall.

      Seriously, some of the suggestions for swap are impractical. If you're using 24GB of memory in my hypothetical, and your hard drive can only transfer 16MB of memory at once, you're not using your computer anyway because it's too slow.

      --
      It's been a long time.
    28. Re:What Has Changed? by Movi · · Score: 1
      Well, as far as i go, i have a 1GB Swapfile, whilst having 1,5GB of RAM, and having usage around 512MB. But the swap comes in handy when compiling gcc or glibc (i use Gentoo). Other than that, usually it isn't even touched by the system.

      There are advantages of having a swapfile - you can add them while the system is running, and delete them when you no longer need the extra swap space. Also, those using Macintels know that having a 4th partition is problematic if you wnt to use the neat Leopard-supplied Boot Camp assistant.

      They have one (in my eye at least) disadvantage - most hibernation methods in linux (i heard tuxonice isn't the case anymore) don't work with a swapfile. I don't care anyway, since the normal S3 suspend is good enough for me.

    29. Re:What Has Changed? by Gewalt · · Score: 1

      As to "how big should swap be?", I prefer the Mac OS X solution - all free space on your drive is swap. Nothing is reserved, and you can make swap go away by completely filling your drive (but you wouldn't do that, would you?)

      *looks at my activity monitor in osx* Ya, um... "Swap used:0 Bytes" As it has always been and will always be.
       
      Proactively reducing the performance of infrequently used applications in favor of a theoretical gain to an application you might decide to launch later is just stupid logic.

      --
      Modding Trolls +1 inciteful since 1999
    30. Re:What Has Changed? by Tanktalus · · Score: 1

      On my previous PC, I had 4GB RAM on a 32-bit intel box. I put on an 8GB swap partition. On a 200GB disk. Yes, 4% of the disk. But, really, when I ran out of disk space, I stuck a 500GB disk in for cheap, and used WAY more than 8GB on that disk, so it really wasn't significant. Anyway, I started to find that I was swapping heavily (say 1-2GB going into the swap space). And the system started to slow down. A lot. Eventually, I upgraded.

      Now, I have a PC with 8GB RAM on a 64-bit amd box. I have a 15GB swap partition, on a 1TB disk. So, only 1.5% of the disk used for swap. And, according to conky, I'm using 4.16GiB of swap and 5.74GiB of physical RAM. And the system isn't slow.

      As to your recommendation to upgrade RAM - both this and the previous boxes are maxed out. Their MBs don't support more RAM. Can't upgrade.

      Why am I using so much RAM? Well, firefox is currently eating 11.52% (approx 1GB) ... :-) I really need to shut it down and restart it ... I think I've installed one or two updates to firefox since the last time I started it.

    31. Re:What Has Changed? by digitalhermit · · Score: 2, Interesting

      I'd agree that the relative size of 8G page space is probably smaller than a 512M partition a while ago... However, some corrections:

      Technically swap space is not page space, though the distinction is being blurred quite a bit. Swap space was used to actually swap out entire processes, while page space was used to page out memory, er, pages. I'll use swap here :D

      The wikipedia link is a little incorrect. In many cases a swap partition can be more efficient than a swap file at least in Linux. For one, there's an extra overhead involved in dealing with files because of the OS filesystem layer. Perhaps there's a raw file option with a swapfile, but I'm not aware of it. In most cases (i.e., desktop and moderate server use) there's probably not a lot of difference and swapfiles are ostensibly easier to use. With LVMs it doesn't really matter.

      In some OSes the swap space is not necessarily additive. In some versions of the Linux kernel, for example, only swap space above that of physical memory was additive. This was a consequence of the virtual memory subsystem.

      In other OSes it worked similarly for performance reasons. E.g., once a page is requested from the OS and written, the OS would write both to physical memory and to the page space. If the page needed to be swapped out it was merely an update to the page table to indicate whether the page was in memory or not rather than doing a full write on every page-out. This could drastically improve performance under some circumstances but diminish it in others (thus it's usually a tunable parameter).

      Having some page space is generally good too. Modern OSes will still swap out dormant pages if it can free up memory for running processes even if memory is not near capacity. This is also tunable.

      There are also reasons to run without swap (i.e., no hard disk or slow hard disk). You can disable swap entirely by tuning the overcommit options of the kernel.

      Having too much swap can be bad too. In some OSes the page table size (which cannot be swapped) was dependent on the size of total memory (physical + swap). An overenthusiastic administrator may decide to really bump up the size of his page space if he saw that physical memory was close to capacity. If he happened to be on one of the boundaries (4G, 16G in some cases) then adding more swap space would actually DECREASE his available physical memory because the size of the page table would grow.

      In other words, there's no valid "rule of thumb" :D

    32. Re:What Has Changed? by hedwards · · Score: 1

      I do that with FreeBSD as well. I run a debug kernel at all times and the swap is the only safe place to put the core dump. Anything else is going to get corrupted, including partitions with a swap file on them, otherwise.

      It doesn't happen often, but if I do it like that I have the core available, complete with debugging symbols, should anybody need it to fix the problem.

    33. Re:What Has Changed? by kasperd · · Score: 4, Informative

      what I do is get the OOM killer to take action and kill some processes sooner.

      Just killing processes more or less at random when the system runs low on memory is not a good idea. (I know it is not completely random, but there surely ain't any guarantee that it will make sane decisions). What you really want is for programs to get an out of memory error when trying to allocate memory, and then they can shut down as gracefully as possible. (Would be neat if the choice of who get the first ENOMEM was chosen by the heuristics that would otherwise kill the process, but I guess that has not been implemented). Guaranteeing that you will never need to kill a process because you are out of memory means the kernel will have to not commit to more than can be backed by memory and swap. However since actual usage tends to be somewhat lower than what is actually committed to, that would be a bit wasteful. This is the main reason why it makes sense to have a large swap partition that is mostly unused. Just so you have backing for the amount you need to commit to in order to optimally use the physically available memory.

      You typically wouldn't want to make use of most of that swap. So once any significant amount start getting used, you'd want to start giving ENOMEM errors. And that should help ensuring that the swap will only be used for a short time. There are a few pieces of data in virtual memory that are only used under very rare circumstances, and those it is nice to have on swap so they don't take up precious memory. So the aim is not to have zero swap in use, just some low number of pages that are really not needed in memory.

      Is there any kernel out there that gets all of this right? I don't know. But at least those I know about can be tweaked to do pretty well.

      --

      Do you care about the security of your wireless mouse?
    34. Re:What Has Changed? by Anonymous Coward · · Score: 1, Interesting

      I don't think it was the/a decimal mistake. A lot of people do the math and come up with, for example, 0.04. Four percent. But since they want to express "four percent" they think they have to add the "%" to the expression, which now becomes 0.04% or four one hundreths of a percent.

      When you see the number of people posting everywhere who can't discern the proper uses of then and than it's not hard to see how something as esoteric (to them) as 0.04 and 0.04% would throw an error. It's because English is so contexual and streamlined incorrect spelling often has no affect on the concept being explained.

    35. Re:What Has Changed? by crispin_bollocks · · Score: 1

      If you want to use per cent, you need to move the decimal point a couple orders of magnitude to the right.

    36. Re:What Has Changed? by PAjamian · · Score: 3, Insightful

      Linux will use swap sometimes even if you don't fill up your RAM. It can swap out idle programs and use the recovered RAM for file caching which gives a performance boost to the file system.

      --
      Windows is a bonfire, Linux is the sun. Linux only looks smaller if you lack perspective.
    37. Re:What Has Changed? by rcw-home · · Score: 4, Informative

      I am thinking of reducing the amount of swap on my primary compute server

      For best performance, don't reduce your swap below the amount of RAM you have, unless you want to get rid of it entirely. The reason is that Linux 2.2.x and later will, when your disks are idle, preemptively copy your physical memory to swap - that way if you do run out of RAM, all Linux has to do is reuse that RAM for other things - your application's virtual memory has already been written out to disk. This can't work as well if the swap space isn't there for it.

      With 2.0.x and earlier, I would have recommended you pick the amount of virtual memory you think you need, subtract the amount of physical memory you have, and set up that much swap. With 2.2.x and later, I recommend you pick the amount of virtual memory you think you need, and set up that much swap.

      For what it's worth, Windows NT derivatives do the same thing.

    38. Re:What Has Changed? by Anonymous Coward · · Score: 1, Interesting

      It's those days when I'm playing Warcraft through wine, listening to streaming radio through Amarok, have 20 windows open behind it, idling a LAMP server for my development projects, running a vent client, some form of news aggregater, pidgin & an e-mail client hooked up to several POP3/IMAP accounts that I am happy I erred on the side of a whole ton of swap space.

      If you are relying on a ton of swap space to make that happen, you are hating life. If your system is constantly swapping all that in and out, you are running slower than most humans can tolerate.

    39. Re:What Has Changed? by pimpimpim · · Score: 1

      I never changed the default xandros. It comes without swap. Using openoffice, firefox with plenty of tabs, and then another application might actually bring the thing to a halt. The disk-access light starts flickering and won't stop for a good while. I wonder what it is trying to do, as it is certainly not writing to swap :)

      --
      molmod.com - computing tips from a molecular modeling
    40. Re:What Has Changed? by pasamio · · Score: 1

      Why not use your actual Windows install with vmware? You'd probably need to crack the stupid WGA that'd keep thinking your hw config changed but VMware has an option to enable you to reuse an existing partition for its vm.

      --
      I always wondered where this setting was...
    41. Re:What Has Changed? by apoc.famine · · Score: 1

      As a followup, it does seem to gray out when the processor is pegged, trying to run either 1 big script or a bunch of smaller ones. CNN is a big culprit there. I use noscript, but lots of sites require a script to display the content. If anyone knows how to fix this, again I'd love to hear it.

      --
      Velociraptor = Distiraptor / Timeraptor
    42. Re:What Has Changed? by Anonymous Coward · · Score: 5, Funny

      "Some people actually want to debug something and find out *why* windows crashed."

      It crashed because they booted it. Next.

    43. Re:What Has Changed? by PAjamian · · Score: 2, Insightful

      I am thinking of reducing the amount of swap on my primary compute server -- the reason is simple: if the machine starts using appreciable amounts of swap, it becomes so slow, it is unusable. So, really, by reducing the swap, what I do is get the OOM killer to take action and kill some processes sooner. I may have an unusual situation that when my machine is out of memory, the cause is almost certainly due to a process that I want killed anyway.

      The problem with this is that there is no guarantee that the process(es) that the kernel kills are the ones that are causing the problem (basically put a process is killed when it requests a resource that is not available and that is not necessarily the process that is hogging the resource to begin with). A better approach is to limit the resources that a given process can use with utilities such as ulimit and similar so that it sees the resource as being unavailable sooner and is killed off instead of something else more critical.

      --
      Windows is a bonfire, Linux is the sun. Linux only looks smaller if you lack perspective.
    44. Re:What Has Changed? by Anonymous Coward · · Score: 0

      This is an honest question: what the fuck are you running that you're using nearly 6 GB of RAM?

    45. Re:What Has Changed? by pasamio · · Score: 1

      So when are you going to upload your multigigabyte dump file to MS? More over beyond the minimal dumps, Windows won't handle dumps over 2GB by default anyway.

      "Complete memory dumps are not available on computers that have 2 or more gigabytes of RAM"
      http://support.microsoft.com/kb/274598/

      More information on recommended sizes for Windows page file wrt memory dumps:
      http://support.microsoft.com/kb/254649/
      http://support.microsoft.com/kb/307973/

      --
      I always wondered where this setting was...
    46. Re:What Has Changed? by Miguelito · · Score: 1

      With a 750GB [newegg.com] hard drive selling under $100, what has changed?

      We support some applications that run on hosts with up to 256 Gig of RAM right now (EDA IC design) and have had vendors say straight out, that they think we should have 4x RAM in swap.. even on a host with that much RAM.

      Never mind that a job swapping into any decent percentage of that amount of swap is likely not going to finish in our lifetime... we'd rather not have to put in several disks (we tend to hw mirror these because the apps are long running already and critical) just to handle an insane level of swap.

      --
      - My favorite error message: xscreensaver, running on an old Sparc 5 w/ 8bit color: bsod: Couldn't allocate color Blue
    47. Re:What Has Changed? by Anonymous Coward · · Score: 5, Insightful

      what on earth is the point? have you actually looked at how many rewrites the disks get, and how the wear levelling algorithms work? your Eee will be years old, and worthless, long before the disk runs out of write cycles

    48. Re:What Has Changed? by Anonymous Coward · · Score: 0

      Why, crysis of course!

    49. Re:What Has Changed? by pdxp · · Score: 1

      Mount partitions with noatime, or relatime if you are using one of the very rare programs that use atime (mutt is the only one I know of);

      Is nodiratime a valid flag for most filesystems as well? I recall seeing it at one point...

    50. Re:What Has Changed? by arbiter1 · · Score: 1

      on windows swap file always gets used but in terms of the general rule of 2x the ram you have, now days you don't, i have 4gb ram and i been using 2gb swap for years with 0 problems

    51. Re:What Has Changed? by FooBarWidget · · Score: 2, Interesting

      Because I don't have a Vista reinstall CD or even a restoration partition. Dell didn't provide one. If VMWare fscks up my existing Vista install then I'd have a problem.

    52. Re:What Has Changed? by Anonymous Coward · · Score: 0

      if your hdd is ssd, you shouldnt be using swap

    53. Re:What Has Changed? by trisweb · · Score: 0, Redundant

      Perhaps you'd like to tell us whether a GB is base 2 or base 10 then.

      It's a disambiguation, and no programmer/engineer/nerd worth their salt argues for less specific information for the sole reason of being socially favorable.

      --
      "!"
    54. Re:What Has Changed? by stdarg · · Score: 1

      Hey,

      If you're talking about Firefox 3, try disabling the security options for detecting attack and forgery sites. I've heard that the freezing behavior is due to the new database engine it's using to keep track of stuff like that.

    55. Re:What Has Changed? by thisissilly · · Score: 3, Informative

      noatime includes nodiratime. nodiratime is for when you want atime on files but not dirs.

    56. Re:What Has Changed? by TheNetAvenger · · Score: 2, Informative

      Why would I want that? If Windows crashes, I want it to restart and quickly, not waste my time dumping memory.

      Agree, but having a pagefile the size of RAM in Windows is not for crashes as the parent suggests.

      Having a pagefile the size of RAM in Vista for example, lets the OS do writethrough to the pagefile, so when you hibernate, it is faster, as it is a snapshot that doesn't have to be written to the HD.

      I only recommend this for laptop users that want that extra second or two of speed when sending the computer to hibernate though.

      If you have 4GB of RAM, a swap file is not needed 99% of the time for most users with today's applications. The only exceptions is gamers running multiple instances of large games, or using applications that are dealing with multiple GB of data, then you should have a 1.5 to 2x RAM pagefile or more according to the amount of data you are processing.

    57. Re:What Has Changed? by TXG1112 · · Score: 5, Informative

      Base 2. Storage numbers using base 10 are for disk manufacturers that are filthy liars.

      --
      I will not be pushed, filed, stamped, indexed, briefed, debriefed, or numbered. My life is my own.
    58. Re:What Has Changed? by Anonymous Coward · · Score: 0

      *codes a virus that makes this actually true, spreads around, makes millions*

      ...

      *is actually joking*

    59. Re:What Has Changed? by duguk · · Score: 4, Informative

      I guess I'm one of the few people who uses windbg to do this then?

      Try it out, it's amazingly useful for debugging BSODs.

    60. Re:What Has Changed? by Anonymous Coward · · Score: 0

      It's base 2 when dealing with RAM and base 10 when dealing with disks. Pretty consistently. It's generally base 2 when dealing with throughput.

    61. Re:What Has Changed? by lgw · · Score: 1

      It's never ambiguous. Engineer-to-engineer it's always clear from context. Marketing-to-customer it's redefined to give more GB every year.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    62. Re:What Has Changed? by AlphaZeta · · Score: 1

      Since harddrives are much slower than main memory. It is always desireable to have as much physical memory as possible. Having a larger physical memory is always better than having to resort to swap partition. And if your physical memory is large enough (e.g. 16 GB), you might not even need a swap partition at all.

    63. Re:What Has Changed? by lgw · · Score: 1, Insightful

      I've run Windows with no swap file for many years, and never had any issue. I just don't see any need for a swap file on a desktop, and consumer OSs should really abandon the concept (there is apparantly some downside to not using a swap file in Windows, as it assumes in some places that it can allocate all physical memory and use the swap file to clean up).

      The kernel could be made more efficient, and *many* drivers made simpler, if the whole concept of "page fault" ceased to exist.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    64. Re:What Has Changed? by Gibbs-Duhem · · Score: 1

      I don't believe you need swap if you have enough RAM that you never run out. For me, this amount is about 2GB, even running VMware with windows.

      HOWEVER:

      If you are on a laptop and want to be able to hibernate your computer, by default it will copy the RAM into your active swap partition and copy it back to the RAM when you restart your computer!

      So, if you are on a laptop, your swap should *always* be at least the size of your RAM or else hibernate won't work (although suspend is still pretty good)!

    65. Re:What Has Changed? by fracai · · Score: 1

      I have an Eee 901. It has 1GiB of RAM and 20GB of disk space. A swap partition on the 'twice your RAM' rule would be far from trivial.

      No, 2GB (or 2GiB for you crazy) is still trivial. If you're running into space issues where 2GB is a big issue you need to get some additional storage. That's the answer pretty much whenever you get near 15 or 20 percent remaining space. If it's a laptop, as in your case, it means you at least need some large drive at home, perhaps hanging of a desktop or router.

      --
      -- i am jack's amusing sig file
    66. Re:What Has Changed? by jrothwell97 · · Score: 2, Interesting

      Perhaps Asus neglected to set swappiness to 0. Anyway, I have a 701 which I use as a general workhorse with no swap and a ramdisk /tmp, and it zooms with Ubuntu on it. On HDD based machines, a swapfile is a better, more flexible solution than a dedicated partition IMO. If the machine's only ever going to be used for office work (word processing, etc) I doubt a swap area will even be needed.

      --
      Those using pirated Tinysoft signatures(TM) are a real threat to society and should all be thrown in jail.
    67. Re:What Has Changed? by Kryptonian+Jor-El · · Score: 1

      then why is my "750 GB" hard drive only registering 698 GB?

      --
      All your 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0 are belong to us
    68. Re:What Has Changed? by AvitarX · · Score: 0, Offtopic

      Really?

      Because storage is usually measured in Base 10 on the box, and Base 2 when used.

      People who say it's never ambiguous confuse me. We would all think the same thing about what units scientists use on a Mars mission, but we all know that can be ambiguous after all.

      --
      Wow, sent an e-mail as suggested when clicking on "use classic" banner, and got a fast response that addressed my msg
    69. Re:What Has Changed? by TXG1112 · · Score: 1

      Base 10 on the box

      That's why the manufacturers are filthy liars. When you need to calculate how much space is left in the frame, you better use base 2.

      --
      I will not be pushed, filed, stamped, indexed, briefed, debriefed, or numbered. My life is my own.
    70. Re:What Has Changed? by petermgreen · · Score: 1

      Some people have the time skill and inclination to analyse a dump themselves or the money and inclination to pay someone to do it but I would imagine for desktop and low end server systems that they are by far in the minority.

      and windows swap is file based so it should be easy to increase the swap at the same time as turning on the full dump option (which iirc is disabled by default because for most people it is nothing but a big waste of time)

      --
      note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
    71. Re:What Has Changed? by BrokenHalo · · Score: 2, Informative

      Indeed, the cost of RAM is now such that it makes sense to simply buy enough to make sure that swap is rarely used. But by the same token, where drives if 1TB or more are no longer uncommon, it doesn't hurt to allocate a couple of gigs of swap for special occasions, and find something else to worry about.

      If you find your apps leaking to the extent that they swap a lot, simply consider alternative applications, or at least reload them more frequently.

    72. Re:What Has Changed? by lucas+teh+geek · · Score: 3, Informative

      compiz fusion greys out a window when the app owning the window is being unresponsive. assuming the Eee is running compiz, that would be your cause.

      --
      TIAEAE!
    73. Re:What Has Changed? by ChrisMP1 · · Score: 1

      I have a "half the swap" setup and yes it does get used but barley half full.

      Jeesh, I know nobody likes barley, but this isn't the time for grain jokes!

      --
      <sig>&nbsp;</sig>
    74. Re:What Has Changed? by kyz · · Score: 4, Insightful

      Looking at my own OS X activity monitor:
      * 320MB free (i.e. in use as disk cache)
      * ~320MB wired
      * ~970MB active
      * ~400MB inactive
      * ~500MB swap used

      And it's not about applications launched later; it's about applications running now, and the files they're accessing now.

      What kind of OS would say "I could use more memory right now to give better disk caching... but fuck it, there's a service that hasn't been used in 6 weeks. Better let it keep that inactive program in memory and just keep reading the disk over and over again instead of caching it"

      --
      Does my bum look big in this?
    75. Re:What Has Changed? by Mr+Z · · Score: 5, Insightful

      Well, that doesn't mean it isn't swapping. If faced with memory pressure, the OS can throw away file backed pages instead, such as program executable pages, and then bring them in later. Those file backed pages will be scattered all around the partitions that hold your programs, though, not concentrated in the swap partition.

      It also means that buffered writes will need to be pushed to disk sooner too, which reduces your disk buffering for anything that writes a lot of data will impose more pain on your system.

      The bummer in all this is that you have nowhere to put anonymous pages. These are the pages associated with "malloc()" (or "new" if you prefer), as well as any other per-task writable structures such as the stack and global variables. These pages aren't backed by any file and could only go to swap. Without a swap file, they will always accumulate in RAM until unmapped, crowding out program pages and disk buffers. This includes pages that don't actually hold anything at the moment, but remain part of the process' malloc heap due to internal heap fragmentation.

      So, that's where the increasing thrashiness comes from on a swapless system. If you get under enough memory pressure from anonymous pages, then it's hard to keep enough program pages and disk buffers around to make real progress. And when you do need those other kinds of pages, they're spread all over the disk so you suffer from tons of seeking penalty, unless you're on an SSD.

      --Joe

    76. Re:What Has Changed? by Mr+Z · · Score: 2, Interesting

      Having a swap partition doesn't necessarily mean having a lot of swap traffic. Often what gets placed in swap are portions of the heap that got allocated, but won't be referred to for quite some time. It gives room for other types of pages (as I mention here).

      That said, if what you're doing doesn't cause a lot of thrashing when there is no swap, don't add swap on your flash SSD.

    77. Re:What Has Changed? by Anonymous Coward · · Score: 0

      No you don't. Unless you want it to just crash again and again and again, rebooting all the time.

      The generated dump file can be analyzed fairly easily (perhaps not by "grandma", but any computer-savvy person) using windbg and simple commands (google is your friend), which will let you find out exactly what crashed your machine, and then you can take the proper course of action so the computer doesn't crash again (e.g. update your buggy nvidia drivers).

      But hey, if you prefer a machine that crashes & reboots [quickly] everyday instead of fixing the problem, then sure.

    78. Re:What Has Changed? by Anonymous Coward · · Score: 0

      put 1g swap as swap file or partition
      i always do that, on desktop systems. you will rarely ever hit swap but if you need to for some reason, you have space before hitting the OOM killer.

      then if you realize you need more (note that, when you go into swap it means your system is crawling, so its doubtful you need it), you can always add a swap file on the fly. (you can have many swap files)

    79. Re:What Has Changed? by a9db0 · · Score: 1

      Kubuntu desktop, 2GB ram, 340GB disk, 1GB swap. Firefox, Konqeror, Dolphin, xterms, digikam. Ram used: 1035MB, swap used: 0mb

      Debian server 1.5GB ram, 750GB disk, 1GB swap. apache, php, gallery2, tt-rss, postfix, spamassassin, greylist, dovecot, mysql, mythtv, samba, etc. Ram used: 869mb, swap used: 72kb. Yes, kb.

      It would seem that I need no swap.

      --
      -- "Never underestimate the power of human stupidity." - R.A.H.
    80. Re:What Has Changed? by Anonymous Coward · · Score: 0

      The biggest problem is if you have a lot of SWAP space, and you are trying to read/write from/to it, while simultaneously trying to read/write from/to the disk on another part of the drive, you'll thrash the disk. So if you don't care about thrashing the disk, and possibly causing ironic slowdown in your r/w, then go nuts. Personally, I like to keep it around four gigs of SWAP.

    81. Re:What Has Changed? by Mr+Z · · Score: 4, Informative

      It's base 2 when dealing with RAM and base 10 when dealing with disks. Pretty consistently. It's generally base 2 when dealing with throughput.

      Pop quiz:

      Throughput: How many bits per second peak can a 14.4kbps modem move? 1.544Mbps T1 line? 10Mbit Ethernet?

      Disks: How many bytes are on a 1.44MB floppy? A 2.88MB floppy? A 650MB CD-ROM?

      Answers:

      Throughput: 14,400. 1,544,000. 10,000,000. Hmmm... so much for base-2 throughput numbers. And yet, when you see the "kB/sec" rate in your browser download dialog, that is most likely in a 1024 byte/sec quantities.

      Disks: 1,473,560 (1440 * 1024, a mixture of base-10 and base-2), 2,949,120 (2880 * 1024, again a mixture), and 681,984,000 (purely base-2, derived from 333,000 sectors * 2048 bytes/sector / 1,048,576). And yet when you look at disk capacities from most computer software, it's reported as purely base-2 sizes.

      So, what's consistent about this again? RAM seems to be the only thing that gets it right most of the time, though I do remember seeing plenty of adverts for Commodore 64s that listed them with 65K of memory back in the day.

      And for the real brain bender: If we agree that bits should always use power-of-2 meanings and everything else should use power-of-10, what do we do when the two collide, such as when talking about areal density? (That's bits per square meter.)

      That said, whoever came up with the names gibibytes, mebibytes and kibibytes must have wanted us all to sound like we have a speech impediment or something, as the pronunciation for these sounds worse than baby talk. I'll stick to saying gigabytes, megabytes and kilobytes and their understood power-of-2 meanings where it makes sense, knowing full well that it has deep flaws. It's just an unfortunate circumstance, but most of the time it thankfully doesn't matter.

      --Joe

    82. Re:What Has Changed? by sweetnavelorange · · Score: 2, Informative

      The kernel could be made more efficient, and *many* drivers made simpler, if the whole concept of "page fault" ceased to exist.

      Page Faults are not about swap, they're about Virtual Memory - which a different (though related) thing. You should read up some more.

    83. Re:What Has Changed? by hlt32 · · Score: 1

      that's a normal HDD on that model.

      --
      à_à
    84. Re:What Has Changed? by negRo_slim · · Score: 1

      and 8GB of space is still trivial with a 750GB hard drive.

      Yeah when you are talking about a straight 8gigs of space, but we are talking about using 8 gigs of hard disk in place of ram... regrettably as size of media has increased access and read times have not kept pace. Hence 8 gigs could be far worse then 1, but in reality all one must do is figure out when, if ever, the system is using the swap. In windows xp this is easy, Control Panel > Admin Tools > Computer Management > Performance Logs and Alerts

      Highlight "Counter Logs", right click and select "New Log Settings", Enter a Name... And hit the Add Counters button.

      You'll notice a "Paging File" counter... Feel me now? You can count Usage and Usage Peak and go from there. I believe the task manager also shows PF Usage, personally I went with 1024mb years ago and haven't looked back since.

      --
      On the Oregon Cost born and raised, On the beach is where I spent most of my days
    85. Re:What Has Changed? by siride · · Score: 3, Insightful

      Yes, let's go back to the days of overlays and manual management of transferring data to and from disks and other devices. That was so much simpler.

    86. Re:What Has Changed? by dakameleon · · Score: 1

      Perhaps you'd like to tell us whether a GB is base 2 or base 10 then.

      It's a disambiguation, and no programmer/engineer/nerd worth their salt argues for less specific information for the sole reason of being socially favorable.

      Indeed - See http://physics.nist.gov/cuu/Units/binary.html

      --
      Man who leaps off cliff jumps to conclusion.
    87. Re:What Has Changed? by Taxman415a · · Score: 1

      The wikipedia link is a little incorrect. In many cases a swap partition can be more efficient than a swap file at least in Linux. For one, there's an extra overhead involved in dealing with files because of the OS filesystem layer. Perhaps there's a raw file option with a swapfile, but I'm not aware of it. In most cases (i.e., desktop and moderate server use) there's probably not a lot of difference and swapfiles are ostensibly easier to use. With LVMs it doesn't really matter.

      Andrew Morton disagrees with you. I'm not sure how the filesystem overhead is avoided, but presumably it is. And that link is cited right in the Wikipedia article, so unless you want to analyze the issue at a deeper level than Andrew has, I think you've got to concede this one.

    88. Re:What Has Changed? by SEWilco · · Score: 1

      then why is my "750 GB" hard drive only registering 698 GB?

      You've configured 52 GB swap? :-)

    89. Re:What Has Changed? by Rossjman1 · · Score: 1

      I have a laptop running Ubuntu with 1GB RAM. I didn't know how much swap space I should havve, and I didn't want to use 2 GB of my 60GB HDD on a unused swap partition. I made the partition 487.20MB and right now I'm only using about 7MB of that and my laptop has an uptime of 14 hours.
      I have heard that you should set the swap space greater than or equal to the amount of RAM - especially if you are planning on hibernating your laptop.

    90. Re:What Has Changed? by siride · · Score: 1

      Only private and/or anonymous mappings are put into the swap file. Shared mappings (e.g., program text segments, libraries, etc.) can be discarded from RAM and reloaded directly from the files they came from in the first place. In fact, this is how they are loaded in the first place. So you aren't saving much by not having a swap partition unless you have an absolutely huge amount of private or anonymous mappings in use by your mostly idle services.

    91. Re:What Has Changed? by fm6 · · Score: 1

      No programmer/engineer/nerd worth his salt worries about wimpy concepts like ambiguity!

      Seriously, though, the GB versus GiB issue makes me cringe every time I think of it. I'm a tech writer, and I ought to be all Usage Nazi about making sure people stick with the SI meaning of "Giga" and insist that the use the IEEE conventions when referring to powers of two. But arguing with engineers about this is just not a productive use of my time. So I always say "GB", and spell it out if there's any ambiguity. And there's usually not: nobody makes DIMMs that hold 4 x 10^9 bytes. I can safely assume that when I refer to a 4GB DIMM, people know I mean 4 x 2^30.

      And remember, sticking with SI and IEEE conventions is no guarantee that you'll not be misunderstood. If I rely on SI conventions in a context where people are expecting nerdy powers of 2, I'll probably be misunderstood. The only solution is to spell it out.

    92. Re:What Has Changed? by djcapelis · · Score: 2, Interesting

      >(basically put a process is killed when it
      >requests a resource that is not available and that
      >is not necessarily the process that is hogging the
      >resource to begin with)

      That's not true at all, please read oom_killer.c in the kernel source code before continuing to make statements about a piece of code you seem to never have read. (Or if you read it before, you haven't kept up to date...)

      The oom_killer scores processes using a metric that takes into account usage and generally will kill the task using the most resources. It does not kill tasks based on which task most recently requests it unless you explicitly configure out the standard oom_killer.

      --
      I touch computers in naughty places
    93. Re:What Has Changed? by timster · · Score: 5, Interesting

      Perhaps you'd like to tell us whether a GB is base 2 or base 10 then.

      You obviously aren't worth your SALT!

      Remember kids, it DEPENDS!

      Bandwidth? Base 10 -- always has been.
      ROM? Base 2 -- always has been -- and traditionally in bits, not bytes.
      RAM? Base 2, and bytes.
      Hard disk? Base 10 in the manufacturer's specs, base 2 in the OS display. Always has been that way, always will be.
      Floppies? Base 2 until you get to MB, where 1MB = 1000 base 2 KB (seriously).
      Clock speeds? Base 10, always has been, always will be.
      Flash? Who knows.

      Isn't it great that we have such an easy, convenient system that is focused around the needs of us humans, and not the needs of the computers (who don't care in the slightest).

      --
      I have seen the future, and it is inconvenient.
    94. Re:What Has Changed? by furry_wookie · · Score: 1

      Dude...How many YEARS OLD is this text you copy/pasted?

      --
      -- Given enough time and money, Microsoft will eventualy invent UNIX.
    95. Re:What Has Changed? by quenda · · Score: 1

      i assume you dont hibernate, thats the only reason i have 1x my ram in swap.

      You don't need compression to have less swap than RAM. Much of your RAM will be used as disk cache, which obviously doesn't need saving on hibernate.

    96. Re:What Has Changed? by Anonymous Coward · · Score: 1, Insightful

      For best performance, don't reduce your swap below the amount of RAM you have, unless you want to get rid of it entirely. The reason is that Linux 2.2.x and later will, when your disks are idle, preemptively copy your physical memory to swap - that way if you do run out of RAM, all Linux has to do is reuse that RAM for other things - your application's virtual memory has already been written out to disk. This can't work as well if the swap space isn't there for it.

      Your post is being labeled "Informative." Do you have a reference for your statement that you need at least a 1xRAM swap file because Linux writes a complete copy of physical memory there?

      It doesn't really make sense for the OS to write to disk parts of physical memory holding read-only pages like the kernel, libc, your GNOME libraries, the Firefox executable, etc. These pages are never discarded (the Linux kernel isn't paged) or could just be reread from the original library or executable file already residing on disk.

    97. Re:What Has Changed? by daniel+de+graaf · · Score: 1

      You can turn off overcommit in Linux if want to - most people find the default behavior more useful since many applications allocate memory they do not need to use, and don't handle out of memory errors gracefully. Change the sysctl "vm.overcommit_memory" to 2, and see "Documentation/vm/overcommit-accounting" in the linux kernel source for related sysctls.

      There are occasions where you might want to use a lot of swap, if there are one-time-run applications that use a ton of RAM to do something like image manipulation/scientific computing/whatever. Those might be rare, but it would be very irritating to get out-of-memory errors just because the kernel doesn't feel like using swap.

      When the OOM killer is invoked, the application isn't usually allocating memory - it's using memory that it has allocated before and that the kernel overcommitted on. So there's no good way to send an out-of-memory error other than by something like a signal handler. I think the reason this isn't done is because the signal handler would likely need to allocate RAM to run (maybe to get its code paged off disk) and this wouldn't help with the memory pressure.

    98. Re:What Has Changed? by msuarezalvarez · · Score: 1

      What you really want is for programs to get an out of memory error when trying to allocate memory, and then they can shut down as gracefully as possible.

      In an out-of-memory situation, there is very little that an app can do to shut down gracefully, unless the application is essentially trivial.

    99. Re:What Has Changed? by PCM2 · · Score: 2, Informative

      They use solid-state drives (except some 1000-series models and the 904), which are faster than mechanical devices but can be rewritten fewer times.

      Actually, on my Eee PC 901 they're not even faster than normal drives. The stock Eee PC comes with one boot drive that seems to run at more-or-less "normal" speed, and one larger "data drive" that seems ... slow. The slowness is especially noticeable during writes. For example, when I stored my Firefox profile on the data drive, I could expect a 1-4 second pause every time I loaded up a Web page, during which the program would be unresponsive. Presumably this happened when Firefox was writing to its cache, history, etc. Moving the profile to the boot drive cut that time in half. Also, when downloading to the data drive over a 6Mbps cable line, I can't saturate the line. The drive is the bottleneck. Some people have suggested that Asus's drivers for the controller may be flawed. All I can say is, don't believe [all of] the hype about SSDs.

      --
      Breakfast served all day!
    100. Re:What Has Changed? by piojo · · Score: 4, Informative

      Linux will use swap sometimes even if you don't fill up your RAM. It can swap out idle programs and use the recovered RAM for file caching which gives a performance boost to the file system.

      Conversely, if you have enough ram for file caching and running applications, then you will get a performance boost from disabling swap (because applications would be faster if they weren't ever swapped out).

      --
      A cat can't teach a dog to bark.
    101. Re:What Has Changed? by LO0G · · Score: 1, Informative

      It's probably trying to make room for open office's code.

      Because you don't have a swap partition configured, the system can't swap out your data so it's trying to find memory the only place it can - it's discarding the code segments for firefox.

      But of course when open office wants to run it needs to swap in the code for the open office which means it needs to find some memory to throw away. And that means it throws away the memory for firefox.

      And when firefox wants to run it needs to find a place to put the memory for the firefox code. Because it can't page out your data, it finds the memory in the only place it can: it throws out the memory used by openoffice and uses it for firefox.

      wash, rinse, repeat.

      There's a reason that most modern OS's have swap partitions (or paging files).

    102. Re:What Has Changed? by supernova_hq · · Score: 1

      the version of vmware that does this is not free (beer or freedom), so I'm stuck pirating it, which I'm not going to do. I'd rather use something free (beer) and preferably open source to do it, but nothing free seems to be able to handle an actual partition. :(

    103. Re:What Has Changed? by Merls+the+Sneaky · · Score: 1

      GB is context sensitive(due to HDD manufacturers), no programmer/engineer/nerd worth their salt asks for redundant information for the sole reason of making it easier for the novice to understand.

    104. Re:What Has Changed? by Gr8Apes · · Score: 1

      It's those days when I'm playing Warcraft through wine, listening to streaming radio through Amarok, have 20 windows open behind it, idling a LAMP server for my development projects, running a vent client, some form of news aggregater, pidgin & an e-mail client hooked up to several POP3/IMAP accounts that I am happy I erred on the side of a whole ton of swap space.

      It's those days I'm glad I bought 8GB of RAM.

      Swap? Yick.

      --
      The cesspool just got a check and balance.
    105. Re:What Has Changed? by adolf · · Score: 2, Informative

      Because if you've already successfully chewed through 8GB of RAM, having an extra 256MB of swap available just in case isn't likely to be a very meaningful stop-gap.

      The other advantage of swap, which I've not seen anyone discuss here yet, is that unused programs and data will be flushed out of RAM to make room for more buffers and cache.

      Might not seem like a big deal, either, but: Suppose you've got OpenOffice and Firefox open, but you haven't used them for awhile. They're each using a few hundred megs of RAM. You then decide to, say, start editing a DVD (or some other disk-intensive thing). With enough RAM and enough swap, the unused programs will be swapped to disk, and the RAM freed by doing sowill be used to cache as much of the DVD as possible. This makes the editing process quicker, and less CPU intensive.

      In other words, swapless systems (or those with limited swap) are cache-starved.

    106. Re:What Has Changed? by rcw-home · · Score: 1

      I just wrote it this afternoon. Wait - how old does that make me?

    107. Re:What Has Changed? by Anonymous Coward · · Score: 0

      You should have looked at Cannondale or Trek for those new CPU cycles. Both are decent.

    108. Re:What Has Changed? by Tacvek · · Score: 1

      Atr you sure about that? The recovery partition is normally available on OEM's as part of the Windows Recover Environment.

      Windows Recovery Environment is a Windows PE based system that supports "recovery" (replacing many windows core files with known good versions, which is believed to fix many issues), rolling back to a previous System Restore point, or restoring a full disk backup. In addition to these features, when installed to a partition, it is trivial for an OEM to add an additional option to the list, that restores the primary partition to factory condition. IIRC this feature uses a WIM file created by the manufacturer as the disk image. This system is really nice, because the interface is identical across all OEMs, and the less intrusive options are right there for you to try first.

      Windows Recovery Environment can be run in one of four ways. It can be run from a Vista Setup CD, or it can be run from from the Windows vista recovery disc (a stripped down version of the Windows Vista Install CD, which actually still claims to be the install CD, but is missing some files actually needed to install vista, microsoft has a free download which can be used to create your own Windows Vista Recovery Disc, or it can be installed into a partition.)

      The last option is the best option, because the environment can then be automatically booted if Windows failed to start. It is also the only version to support the Restore to manufacturer default option. When it is available it shows up in the boot.ini menu or perhaps the F8 menu (like you use to enter safe mode), I forget which. You can access the boot.ini menu from the f8 menu if your computer is configured not to show it.

      I would be very surprised if a Dell Vista laptop lacked the Windows Recovery Environment Partition.

      --
      Stylish sheet to fix many problems in Slashdot's D3: https://gist.github.com/801524
    109. Re:What Has Changed? by iabervon · · Score: 1

      With a solid state drive the cost factor between RAM and "disk" is less extreme. Think of it this way: the same amount of RAM is definitely better than swap, if you could afford to triple your memory. The cost of SSD is such that, if you can afford that much SSD, you can nearly afford it as RAM, and the RAM will behave better. Think of the EEE as having 256M of RAM, with another 768M of RAM as fast, no-wear swap (other system features are more in line with a 256M machine than a 1G machine).

      For your desktop PC, it's relatively hard to use up 4G of RAM unless you've either got a 64-bit userspace or are doing a lot at a time, because programs only have ~3G of virtual address space (each) available. This means that you're going to have a relatively hard time generating memory pressure (of course, the kernel will fill up the 4G with stuff from disk that you're pretty likely to want fast access to, so it's not wasted, but the kernel is unlikely to do into swap instead of dropping cache at that point).

    110. Re:What Has Changed? by Anonymous+Conrad · · Score: 1

      on windows swap file always gets used but in terms of the general rule of 2x the ram you have, now days you don't, i have 4gb ram and i been using 2gb swap for years with 0 problems

      The only issue with using less swap than RAM on Windows is that you can't do a full memory dump on blue screen because in the first instance it writes the dump to the swap area.

      That said, if you didn't know that you probably don't need it. The mini-dump it creates is usually good enough for most crash analysis.

    111. Re:What Has Changed? by jamonterrell · · Score: 3, Informative

      The 2x RAM guideline makes perfect sense, though as someone mentioned elsewhere, Oracle's guideline (http://ask.slashdot.org/comments.pl?sid=982541&cid=25225967) is better. The recommendation assumes that you need as much memory as you have. Early on in computing this was almost certainly the case, nowadays, memory is so cheap that a lot of people buy more than they need (me included). If in fact you have 4GB and you actually use the 4GB of memory regularly, then having an additional 4GB of swap space to store the stuff you aren't CURRENTLY using makes perfect sense. (Though it makes more sense on servers than on desktops :)

      --
      I can count to 1023 on my hands. Ask me about #132.
    112. Re:What Has Changed? by Anonymous Coward · · Score: 0

      I just wrote it this afternoon. Wait - how old does that make me?

      If you still think the 2.0 kernel is worth mentioning: really, really old.

      Either that or you're in Debian Release Engineering.

    113. Re:What Has Changed? by Easy2RememberNick · · Score: 2, Interesting

      Kind of like running a LiveCD all the time.

    114. Re:What Has Changed? by jd · · Score: 1
      • Because programmers don't use engineering techniques - if they've twice the RAM, they're half as likely to use memory-conserving techniques. (Compare TORCS to REVS and remember that REVS took 7K to store a 3D track representation, aerodynamics models, AIs, user-adjustable aerodynamic profiles and the 3D velocities and locations of 20 cars. And it ran perfectly well on a 4MHz 8-bit machine. Hey, I love TORCS, but don't tell me modern coders can write to nearly the same degree of compactness.)
      • Because Linux uses unused RAM for caching and buffering, so all sleeping processes SHOULD be kept on disk whenever humanly possible.
      • Because it's normal to want some horribly large number of desktops under X, but it is abnormal to want them in physical RAM except when they are being displayed.
      • Because if you compile software, you can get better compile-times and better optimization if you use lots of memory-hungry techniques which stuff lots of things in memory at the same time. See first point on why crappy compiling techniques force you to use more memory in the long-run anyway.
      • Because if you're smart and running a lot of commonly-used stuff in a RAMDisk, you want the unused portions of that disk pushed onto physical disk.
      • Because if you're running a database - even for family history - most serious database engines dwarf most home computers, and you really don't want everything to grind to a halt. Why database engines are so large requires going back to the first point.
      --
      It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
    115. Re:What Has Changed? by Alpha830RulZ · · Score: 1

      To your point, what is the size of the largest thing that needs to get swapped out? If your largest process was 700MB before you went to 8GB, does it grow when you increase the space?

      I run some processes that will grow to available assigned memory (Xmx=14000mb on one machine), so I think I need larger swap. Yours might not.

      Now, that said, my machines rarely swap, because they're used to run one big data mining job, and we want that job to more or less own the machine while it's running. So I will confess that I really don't have a fricking clue whether the 32GB of swap I have configured matters.

      --
      I was taught to respect my elders. The trouble is, it's getting harder and harder to find some.
    116. Re:What Has Changed? by apoc.famine · · Score: 1

      That would make sense, as it's pegging the processor to grind the scripts out. And yes, I am running compiz on this thing. Thanks for the pointer. Doesn't exactly solve the problem, but I guess I know what it is now.

      --
      Velociraptor = Distiraptor / Timeraptor
    117. Re:What Has Changed? by Glonoinha · · Score: 1

      Anybody want my opinion on the matter?

      --
      Glonoinha the MebiByte Slayer
    118. Re:What Has Changed? by Anonymous Coward · · Score: 0, Troll

      We really need an "idiotic" moderation...

    119. Re:What Has Changed? by apoc.famine · · Score: 1

      That was one of the first things I turned off. It seems that compiz grays out the window when they're unresponsive. They're unresponsive because some scripts are using 100% of the processor power. I'm wondering how the recent updates to the JS engine will help this problem.

      --
      Velociraptor = Distiraptor / Timeraptor
    120. Re:What Has Changed? by ozphx · · Score: 1

      I prefer when I'm running my dev tools, and I want to game for a bit that even though the game and VS can fit into RAM, that Windows pages out all of VS's crap and uses the RAM as disk cache for level loading etc.

      Repeat after me: Memory managers are smarter than I am.

      --
      3laws: No freebies, no backsies, GTFO.
    121. Re:What Has Changed? by Anonymous Coward · · Score: 0

      ROM is traditionally in bits? I don't know... Most computer's ROM is still in bytes. Game cartridge were also first in bytes and I'm not sure who was the first to use bits (probably to make the console looks much better than the older generation).

    122. Re:What Has Changed? by dadragon · · Score: 1

      +3 funny, sure. But the same reasoning can be applied to Linux crashing. That said, I watched Windows XP survive having its boot hard drive disconnected and then reconnected while the system was running. I didn't know it could do that.

      --
      God save our Queen, and Heaven bless The Maple Leaf Forever!
    123. Re:What Has Changed? by ozphx · · Score: 3, Interesting

      But then people might find out it was Realtek or Nvidia fucking up and won't be able to blame Micro-dollars-oft.

      You can't spell goatse without Gates and a big O you know!

      --
      3laws: No freebies, no backsies, GTFO.
    124. Re:What Has Changed? by Anonymous Coward · · Score: 0

      Why is it you suddenly needed 8GB of memory instead of 1GB? Because times have changed and you've decided you use programs that take huge amounts of memory is why. And if that's the case, then it's not unreasonable to increase your swap partition thusly.

      That said, maybe you got way more memory than you need at the moment, and you don't need much or any swap space. That's why it's a rule of thumb. If you aren't sure how much you need, 2x RAM works as well now as it ever did.

    125. Re:What Has Changed? by fimbulvetr · · Score: 1

      I get this too with Intrepid 8.10 alpha6 on a core 2 duo w/ 4gb of ram. I can get it 100% of the time w/ S3Fox. Point is - it's certainly nothing related to lack of horsepower, since this machine isn't exactly old school. It's also extremely frustrating and made me all but abandon s3fox.

    126. Re:What Has Changed? by rcw-home · · Score: 1

      Do you have a reference for your statement that you need at least a 1xRAM swap file because Linux writes a complete copy of physical memory there?

      Whoa, didn't think I'd run into Stephen Colbert here. *Waves!*

      Linux runs fine without swap. It also runs fine with less swap than RAM. I'm just saying that in certain situations it'll be faster if Linux can immediately reuse RAM for something else (because it's already swapped out) than if it can't. That something else might be an application or it might be file system cache (priority for this is tuned with the swappiness sysctl). The easy way to make sure you always have enough swap to take advantage of this is to have at least as much swap as RAM.

      It doesn't really make sense for the OS to write to disk parts of physical memory holding read-only pages like the kernel, libc, your GNOME libraries, the Firefox executable, etc.

      Not everyone's RAM is mostly full of clean mmap()'d pages. It depends on what you're using the computer for. And of course most of libc would never get swapped out - even if marked dirty, it'd be on the bottom of any least-recently-used algorithm's list.

      Anyway, you can search for "linux swap cache" for more references if you want, but here's two: 1. Linux automatically moves RAM reserved by programs but not really used in swap so that this ram can serve the better purpose of having more cached memory.
      2. There are times when a page is both in a swap file and in physical memory. This happens when a page that was swapped out of memory was then brought back into memory when it was again accessed by a process. So long as the page in memory is not written to, the copy in the swap file remains valid.

    127. Re:What Has Changed? by s1a2n3c4e · · Score: 1

      I think you mean 7% and 4%..

    128. Re:What Has Changed? by FlyByPC · · Score: 1

      the short answer to this is to look at your swap partition as your extended virtual memory.

      Seymour Cray said it best: "Memory is like an orgasm -- it's a lot better if you don't have to fake it."

      --
      Paleotechnologist and connoisseur of pretty shiny things.
    129. Re:What Has Changed? by Estanislao+Mart�nez · · Score: 1

      Proactively reducing the performance of infrequently used applications in favor of a theoretical gain to an application you might decide to launch later is just stupid logic.

      So pretty much all kernels in common use are designed around stupid logic? You should write your own kernel following your theory, then.

      Here's the logic, how it should really work: your system uses disk blocks and memory pages. A block or page that's accessed very frequently is "hot," and one that's accessed infrequently is "cold." You'll get the best throughput when the hottest stuff is in RAM, and the coldest is on disk, period. Application private memory vs. cached disk block doesn't factor in the logic, only frequency of use. The granularity of the decisions isn't at the application level, either.

      No swap means your system can't make the most efficient use of all of your memory, period.

      *looks at my activity monitor in osx* Ya, um... "Swap used:0 Bytes" As it has always been and will always be.

      Then your system is almost certainly using RAM inefficiently, because it has more than it actually needs. All the hot blocks and pages fit into available RAM, with room to spare, so there are always cold disk blocks falling off. You could have gotten the same performance with less RAM.

    130. Re:What Has Changed? by damentz · · Score: 1

      You couldn't be more wrong. Swap is only used when ram is filled completely. Then according to vm.swappiness, it will decide to cut file and application cache or place it into swap. It doesn't just throw crap into the swap partition because it thinks it's funny.

    131. Re:What Has Changed? by DiegoBravo · · Score: 1

      Same here, just for one web site that sadly I often check (www.elcomercioperu.com) when using the selectors for pagination (lots of javascript.) Most of the times the full window system (Compiz) turns unresponsive for 2-8 seconds. Annoying. The Gnome panel do not responds. This do not happen with FF2.

      BTW I don't understand why GP assumed some relation of these firefox issues with the Linux swap.

    132. Re:What Has Changed? by digitalhermit · · Score: 1

      Yeah, things change from day to day and year to year. AM's post says that the swapfile bypasses the OS. But... ...Keep in mind that creating a swapfile uses dd. When dd creates a file there's nothing to specify that the file is contiguous. Therefore it's likely to be fragmented. Whether the fragmentation is significant is another story worthy of benchmarks. Andrew Morton knows this of course, and says to create the swapfile early. I.e., not early in boot time, but soon after the system is installed. Even so, that won't guarantee a contiguous swapfile. May not matter except on a heavily loaded system. But at that point you want it to be as efficient as possible. :P

      BTW, there's another developer who mentioned way back that swap partitions were more efficient:

      http://kerneltrap.org/mailarchive/linux-activists/1992/10/24/14522

      Things have changed of course, and shame on me for breaking my own rule about rules of thumb.... As I said, there's probably not a lot of difference and swapfiles are generally easier to use.

    133. Re:What Has Changed? by Sj0 · · Score: 1

      But here's the thing. You only had 3GB of combined RAM and swap before. Why would you need a juggernaught 16GB of swap (again, remember this is going to be 16GB transferring very slowly, so if you're using that much memory, you've probably already reached for the reset button) if you've got twice memory than you've ever used in your entire existence until now?

      The whole idea is insane. You don't need swap at all. You wouldn't need swap with HALF the memory. with half the memory you've STILL got a gigabyte more memory than you had hard drive and swap before the upgrade. The reason I suggested the 256MB wasn't just in case you're a complete idiot and manage to accidentally use up three times more memory than you've never even filled up in the life of your computer.

      --
      It's been a long time.
    134. Re:What Has Changed? by gumbi+west · · Score: 2, Funny

      Yeah, that's all fine and good until you print an old paper scanned in from jstor to your printer, it uses pstopdfil and uses as much memory as I can buy and continues to swap like a drunken bastard. Not using the printer is not exactly an option here.

    135. Re:What Has Changed? by Sj0 · · Score: 1

      Hey, that's all I'm saying. YMMV, but think about what you need instead of just using a rule of thumb which will, as a general rule, give anyone using linux as a desktop system may orders of magnitude more swap than they really need.

      --
      It's been a long time.
    136. Re:What Has Changed? by stfvon007 · · Score: 1

      at least its better than the 1.44MB floppies, with the 1.44 being an unholy combination of base 10 and base 2 using base 2 for bytes to KB and base 10 for KB to MB. *shudders*

      --
      All misspellings and grammatical errors in the above post are intentional and part of my artistic expression.
    137. Re:What Has Changed? by Dolda2000 · · Score: 1

      Honestly, why does the 2x RAM guideline make any sense?

      It doesn't, and I'm surprised and chocked to see that noone here on Slashdot has posted the reason yet.

      The reason why twice as much swap as RAM is commonly recommended is because an ancient Linux swap implementation (I don't know exactly when) was optimized that way. When there was twice as much swap as RAM, it performed the best. It has not been that way for years, though, so that recommendation is simply obsolete.

      When you create your swap space today, you should simply be considering how much total virtual memory you want. Nothing more and nothing less.

    138. Re:What Has Changed? by cookd · · Score: 2, Insightful

      No. "Enough ram for file caching" is approximately infinite RAM, so the premise is flawed. If you did somehow have "enough" RAM that there was no noticable benefit from having more file cache, then adding a swap file would make no difference one way or another -- the system simply wouldn't ever swap anything out. (You might still see some of the swap file as "in use", but that's just the OS doing agressive optimization. The OS will copy data from RAM to disk during idle cycles. It does this just in case there's a sudden increase in memory requests. If data has already been sent to the swap file and the OS later decides to give the RAM to some other program, the other program doesn't have to wait for the RAM to be copied to disk since it's already there -- the memory just has to be zeroed out and it is ready to reassign to the new program. But if the data is needed before some other program needs the memory, the data is in RAM ready for use, and the copy on disk doesn't hurt anything.)

      In any case, it's generally best to let the OS pick what stays in RAM based on what is used most often. If you're using files more than apps, your file cache will grow at the expense of RAM reserved for apps. If you're using apps more than files, your file cache will shrink. Removing swap from the equation simply means that you've made it impossible for the OS to do the best job of optimizing your system's performance if it gets low on free RAM -- instead of keeping stuff in RAM based on what gets used most often, it has to keep stuff in RAM because it has nowhere else to put it.

      --
      Time flies like an arrow. Fruit flies like a banana.
    139. Re:What Has Changed? by cookd · · Score: 3, Informative

      Perhaps for a very specific definition of "swap", you might be correct, but swap has a more general meaning. Your definition seems to be full process swapping (where swap = suspend process, send all code and data to disk). That certainly is pretty rare, and is generally a last resort. Since it is so rare, the verbs "page" and "swap" generally get conflated and discussed together. On most systems (pretty much all systems with virtual memory support), swapping/paging definitely happens way before memory fills completely, as you could see using any system monitor like top (Unix) or TaskMan (Windows).

      --
      Time flies like an arrow. Fruit flies like a banana.
    140. Re:What Has Changed? by pjbgravely · · Score: 1

      I thought the same until I tried to hibernate. My Distro's hibernations writes the memory to the swap so it doesn't work. Good thing you can make a swap file now so I didn't have to shrink a partition.

      --
      Star Trek, there maybe hope.
    141. Re:What Has Changed? by davolfman · · Score: 1

      But wouldn't multiple writes for the same data be considered again a BAD THING when talking about flash storage? By my count we might be talking buffer, journal, then write here!

    142. Re:What Has Changed? by davolfman · · Score: 1

      Actually I'd assume this means the data drive is MLC memory which has a painfully slow write.

    143. Re:What Has Changed? by inKubus · · Score: 1

      The problem with swap is that the system will always use all available RAM for system cache. And once it has it it will not give it up and will swap stuff out. There are people using RAM disks for swap on mysql servers which makes some sense, and gives you some control over stuff. I mean, if you can fit your entire table space into RAM, you don't want linux messing it up by swapping out some lesser used tables just to get system cache.

      It's always a good idea to get a lot of RAM and less swap. Having a big swap file is not going to be a benefit. If you have 8GB of RAM and you are swapping 8GB your system is going to be so slow you won't be able to move. Swap is for emergencies, and if you want to move some less used processes there it's ok for that also.

      --
      Cool! Amazing Toys.
    144. Re:What Has Changed? by Mr+Z · · Score: 4, Insightful

      If the paging algorithm does its job well and the active working set stays stable in RAM, then the bulk of the writes to the swap file are for the dead weight inactive anonymous pages. Freeing up additional RAM for disk buffers could also prevent writes on other random files if they were short lived and deleted before ever getting written. This happens more often than you might think, and is one of the motivations (but not the only one) behind deferred allocation. (The other big one is multiple files opened for streaming writes in parallel.)

      So, like all things, it's a tradeoff. When you're on an SSD, if your working set fits in RAM and you don't really thrash, then by all means turn swap off. If you find yourself thrashing a little, do yourself a favor and make a small swapfile and see if that stabilizes things, since at least some of that additional activity will be writes that could go away if you had more RAM--may as well let the VM throw out some deadweight pages to make room for transient pages that might live and die in RAM. If you're oversubscribing your RAM such that you need a truly huge swapfile, consider getting more RAM, because you're likely punishing your SSD.

    145. Re:What Has Changed? by inKubus · · Score: 1

      You can use your VRAM for swap..

      --
      Cool! Amazing Toys.
    146. Re:What Has Changed? by inKubus · · Score: 1

      That's actually not totally funny. With compcache you can actually turn your spare cpu cycles INTO RAM (well, a ram disk) by utilizing compression on swapped pages.

      --
      Cool! Amazing Toys.
    147. Re:What Has Changed? by gullevek · · Score: 1

      Seriously who uses floppies nowadays.

      Anyway, the whole disk size *IS* confusing.

      Let's see here. I have a box written 160GB SATA II disk.

      I call fdisk and it gives me this back:

      Disk /dev/sdb: 160.0 GB, 160041885696 bytes

      If I now take the bytes and divide through 1024 (kb) and again through 1024 (mb) and again through 1024 (gb) I get 149.05 GB

      So ... seriously. Even the tools don't know what they say.

      But in general what's written on HD box is not what you actual get 1TB HD is not 1TB, sadly ...

      --
      "Freiheit ist immer auch die Freiheit des Andersdenkenden" - Rosa Luxemburg, 1871 - 1919
    148. Re:What Has Changed? by Sj0 · · Score: 3, Funny

      "Enough ram for file caching" is approximately infinite RAM

      You know what I love? I love how you're not afraid to say something unbelievably stupid without irony. You should run for President.

      --
      It's been a long time.
    149. Re:What Has Changed? by felixhummel · · Score: 1

      Truth be told. In a nutshell:

      Swap is used for idle processes freeing RAM for active processes and file caching.

      My system has 4 GB RAM and *no* swap. It can hibernate (and actually wakes up again).

      If this is about performance, try to widen the HDD-Bottleneck (say RAID). There's a difference you can *feel*.

    150. Re:What Has Changed? by Ashtead · · Score: 2, Informative

      ROMs, EPROMS, EEPROMs, and other static or non-volatile memory devices tend to be advertised as having some 2^N number of bits in them. Even if they most commonly are organized and used as words of 8 bits.

      This tends to be reflected in the part numbers, which frequently have a strong relationship to the number of bits of storage in the device. EPROMs in the 27xx series and EEPROMs in the 24xx and 28xx series are the most likely. For example, the 2764, 27C64, 2864, 24C64, etc., all have 64K (65536) bits of storage, although available and used as 8192 by 8, and the 24256 and 27256 have 256K (262144) bits in them, organized and used as 32768 by 8. There are several other sizes of these memories with corresponding part numbers.

      --
      SIGBUS @ NO-07.308
    151. Re:What Has Changed? by Anonymous Coward · · Score: 0

      I suppose it is a little late to add to this conversation, but the inclusion of numerals > 1 in those throughput numbers eliminates any possibility of them being in base-2. The difference between manufacturer's specs and OS specs is that the manufacturers misleadingly divide the total, base-10 capacity of drives by powers of 10 rather than powers of 2 and inaccurately report the results as megabytes and gigabytes. You can't totally blame them, though, because the computing industry hijacked and bent the metric prefixes kilo- mega- and giga- in the first place.

    152. Re:What Has Changed? by Antique+Geekmeister · · Score: 1

      This sort of logic is a good reason to use swap. There is also another one: by using a / partition of, say, 16 Gig, and a swap partition of 16 Gig, in a pinch you can transfer your / partition to your swap partition in order to do an emergency backup or keep a copy around for upgrade procedures or to repartition your disk. This used to be much more difficult when filesystem changing tools were not so broadly availble, but a spare under-used partition space can be really useful in an odd moment. I've also taken advantage of it as a place to store a compressed copy of a database, while I rebuild the filesystem of the database to test something interesting for performance.

      Swap space is a resource that can be used for other purposes on a temporary basis.

    153. Re:What Has Changed? by Anonymous Coward · · Score: 0

      What is meant by "base 2" in this discussion is that the prefixes refer to power-of-2 quantities, motivated by the base-2 implementation of the hardware.

    154. Re:What Has Changed? by phtpht · · Score: 2, Insightful

      I have been this 'bold' for many years now. I configure zero swap on almost all modern computers that have >=2GB ram, knowing that there is no real reason for it. (Even in microsoft os despite countless 'are you REALLY sure?!?!' thingies.) And heck, one day I even stared at a photoshop message saying something about 'no swap found - are you nuts' - i mean, why should a userspace application care about swap? (I can understand that in truecrypt but photoshop?)

      Anyway, my reasoning behing why swap is useless (in Linux):
      1. I have enough RAM for everything these days.
      2. In the rare ocassion I need more memory I can always dd /dev/zero into as many swap file(s) as i desire and swapon, and dispose of them when I'm done.
      3. If I needed more RAM routinely, I'd buy it (and perhaps sacrifice one lunch :).
      4. Swapping out those mingettys for 100K of extra disk buffers is nice, but neglectable.
      5. When an application goes on a memory rampage, it gets OOMed without my hard drive going nuts first.

      Moreover, having no swap allows me to create diskless computers with everything on NFS. Also, I'm not sure how healthy it is to put swap on a SSD/flash (i know, vista boost, but we'll talk in 3 years when flash drives get massively boosted out of service).

      Finally, swap is really useful for one thing: hibernation. And that is only because it happens to be used as hibernation space. However, with tuxonice, you can as well use a separate file.

    155. Re:What Has Changed? by lannocc · · Score: 1

      That said, whoever came up with the names gibibytes, mebibytes and kibibytes must have wanted us all to sound like we have a speech impediment or something

      How about gibs, mebs, and kibs? In a computer context it's probably obvious you're referring to bytes.

    156. Re:What Has Changed? by Amiralul · · Score: 1

      "With a 750GB hard drive selling under $100, what has changed?"

      Well, when I had a 20GB HDD, movies were 700MB each, maybe 1.4GB the largest ones. Now it's true that we have HDD ten times larger, but also we have HD movies of at least 4.3GB each. And complete series. And comics. And games spanning on Dual Layer DVDs. I never wasted 4GB for swap(as I have 2GB of RAM).

    157. Re:What Has Changed? by LO0G · · Score: 0, Offtopic

      I love /. This comment replies to the same comment I replied to and it says essentially the same thing that my comment is and it's moderated insightful. My comment is marked flamebait and I'm described as "idiotic".

      Redundant I could absolutely see. But I don't get flamebait.

    158. Re:What Has Changed? by Anonymous Coward · · Score: 0

      It would seem that I need no swap.

      You have more RAM than you actually need for your load. If your machines aren't using swap, then, most likely, your RAM is being used "inefficiently" in a benign way. In other words, you've well past the point where adding RAM improves performance for your workload, so extra RAM doesn't help.

    159. Re:What Has Changed? by Mr+Z · · Score: 1

      It still makes you sound like Mushmouth, speaking in Ubbi Dubbi.

      (I didn't know the name for how he talks until I looked it up just now, but he's who I thought of when I first heard "mebibyte" and friends. I guess it's not an impediment as much as it is annoying and childish sounding.)

    160. Re:What Has Changed? by Fulcrum+of+Evil · · Score: 1

      You don't really need a partition to do that sort of thing - dd a properly sized file and you have your backup. Unless it's /, you can even mount it on loopback.

      --
      "We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
    161. Re:What Has Changed? by catscan2000 · · Score: 1

      If you don't mind giving up dual-boot, an alternative is to use VMware Converter, which is free as in beer. After it is converted to a VMware virtual machine, the similarly free as in beer VMware Server can be used to run it. That is what I did with my pre-installed Vista, though I actually haven't used it in a long time..

      Note that with pre-installed Vista, you will most likely need to set SMBIOS.reflectHost = "TRUE" in your .vmx file so that Vista sees the real computer's BIOS keys instead of the emulated BIOS's keys. (I admit that "BIOS key" is a topic that I know very little about, and it's probably actually called something else).

      Hopefully, this helps.

    162. Re:What Has Changed? by SL+Baur · · Score: 1

      With a 750GB [newegg.com] hard drive selling under $100, what has changed?

      The relative speeds of disks and memory have changed.

      The economics have changed too. Does anyone else remember the comment, I think in /usr/include/sys/vm.h that defined memory pressure parameters and related them to (then) current core and disk prices on a VAX? This would be around the System V/R2, 4.2 BSD, SunOS 3 and 4 days. Or better still, knows who wrote it?

    163. Re:What Has Changed? by Fulcrum+of+Evil · · Score: 1

      This is what happens when you let marketing play with technical tools. Bandwidth is base 10 because it's derived from Hz, which is also base 10. Everything else is base 2. HDs are reported in base 10 because the numbers are bigger, so you have to correct for that, but everything inside a computer is base 2.

      --
      "We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
    164. Re:What Has Changed? by ralatalo · · Score: 1

      Why did you waste money upgrading from 1GB to 8GB of ram if your total memory needs never went beyond half of the original 1GB? If you don't believe in margins or planning for futures, why did you upgrade the memory? Anyway, swap is more than just dumb storage, it's a backing store, it's insurance.

      System ram falls into three categories: Available, Borrowed, and Busy. Available system ram is basically being wasted and Busy memory is just that busy and can not be used for anything else without causing serious problems. So, you want as much of your memory to fall into the Borrowed category. I call it borrowed because it's being used but it can be given back without causing a problem.

      Without swap, most of your memory falls into Available or Busy. While some library and executable pages may be classified as borrowed since they can be re-loaded from disk, they can't all be due to a combination of shared libraries and dynamic loading/mapping (which does cut down on the needed for memory, but does make it that much harder get back the memory that they are using)

      Once you add swap, most of your memory falls into the Borrowed category because there is a saved copy of required things on swap. That means more of your ram can be used for things like file access buffers which means you can do more things faster.

      Without swap, if you run out of memory, you're done....the end... nothing can be done without causing something else to fail and release memory.

      With swap, you only run out of memory when you run out of swap. As long as you have swap available you can go from paging to swapping which grinds everything to a crawl but at least they don't need to die.

    165. Re:What Has Changed? by SL+Baur · · Score: 1

      Is there any kernel out there that gets all of this right? I don't know. But at least those I know about can be tweaked to do pretty well.

      You have answered your own question. The answer is load specific. It's a hard problem.

      I'll admit to one of the meanest things I did to a visiting speaker. There was a company seminar that invited folks from AT & T to speak to interested employees regarding the internals of Unix System V/R3, particularly with respect to the implementation of STREAMS and virtual memory. I asked him point blank at an inconvenient moment if he was saying that Unix no longer crashed when going OOM and got a "deer in the headlights" look back.

      I still feel bad about that.

      It's a hard problem and the optimum solution appears to be, as you wrote, give the admin the flexibility to tune the system.

    166. Re:What Has Changed? by SL+Baur · · Score: 1

      In an out-of-memory situation, there is very little that an app can do to shut down gracefully, unless the application is essentially trivial.

      In which case it doesn't matter and probably does not do much to alleviate OOM. It is decidedly "non-trivial" to decide which process(es) should be shut down to do minimal damage to the system.

      Now, if we just had a computer like Multivac, we could ask it to design an optimum OOM algorithm ... (and hope to get the answer before Asimov's Multivac came up with one).

    167. Re:What Has Changed? by Mr+Z · · Score: 1

      Oh, I understand why many of these things ended up as they did. If you're aware of the history, then most of it seems far less arbitrary. My point was that it's still a mishmash, and hardly consistent.

      A T1 line or a voice band modem is measured in power-of-10 megabit and kilobit. But, my last DSL modem was 6Mbit down and 1Mbit up. When I looked at its status page, I was informed that that meant 6144kbps down and 1024kbps up--power of 2, at least between the "M" and "k" steps. Apparently marketing was asleep at the wheel for the DSL folks?

      Fortunately, most of the time it doesn't matter, and when it does, it's generally not hard to look up what was intended in a given situation. It's darn annoying though.

    168. Re:What Has Changed? by DJStealth · · Score: 1

      I maintain a server for research use with 16GB of RAM.

      If any process uses up more than 90% of that, in most cases, better to kill the process than to let it go to swap.

      If swap actually needs to be used, chances are that there is a huge memory leak that is out of control and the system will end up thrashing.

      As a result of past experience, I believe in such situations, better to set memory limits, and disable swap completely. The system itself will run on a few hundred megs, keep that reserved, all the other memory is up for grabs by research processes, anything more than that will bring the system to a crawl anyway, so may as well stop the process than the entire system by not using swap altogether.

    169. Re:What Has Changed? by Anonymous Coward · · Score: 0

      This *STILL* gets modded funny? After all these years?

    170. Re:What Has Changed? by Octavian · · Score: 1

      Usually you set the swap partition as the first partition in the system to have the fastest disk access, which has to do with the mechanics of the disk. So with a swap file you still have to make sure that that swap file is on the first partition.

    171. Re:What Has Changed? by PingPongBoy · · Score: 1

      I decided to be bold and installed Hardy with no swap partition

      Back in the good old days when you had 2, 4, or 8 Mb of RAM and had an operating system that even let you think you had more memory with virtual memory, swapping a few Mb didn't cost too much time compared to how fast the processor ran. Nowadays, swapping even 500 Mb on a low-RAM computer makes you think your computer has gone off the deep end. 500 Mb of disk I/O can take a lot of time. Never mind asking why simple things like IE sometimes requires 200 Mb or 300 Mb for IE6 with no tabbing and how computers booting into Windows XP used to run ok with less than 256 Mb, now may consume more than 1 Gb and never give any of that memory back after just booting. Even swapping to get an extra 256 Mb costs an enormous amount of time, so the question should be why software requires so much memory to do so little.

      One time, I installed Oracle on virtual machine, but I wanted to save RAM so I set the virtual machine's memory to 400 Mb. It swapped like crazy and every time I clicked on something it took 20 minutes. Having a big swap doesn't let you do anything better.

      Strangely, I have 2 Gb of RAM, and I try to keep more than 600 Mb unused, but a lot of programs still swap. But I'm using Vista, which may like to send idle software into virtul memory to keep the RAM open because some people with 512 Mb would find Vista too hard to use.

      --
      Know your pads. One time pad: good for cryptography. Two timing pad: where to take your mistress.
    172. Re:What Has Changed? by Eivind · · Score: 1

      But the bandwith to disk hasn't been growing nearly as quickly as the size of ram and disk.

      Which means that though ram and disk may both have gone up by a factor of 100 since my first Pentium, the bandwith hasn't, infact at best it's gone up by a factor of 10.

      Which means that a 4 GB machine is unusable if it's actually actively using 8GB of swap. (at 16MB/s it'd take 10 minutes to read the entire swap once)

      Even though a 32MB machine back then using 64MB of swap -wasn't- nessecarily unusable. (at 3MB/s it'd take 20 seconds to read the entire swap once -- see the difference ?)

      If your machine is unusable when it's swapping 2GB --- then there's no point in having 8GB.

    173. Re:What Has Changed? by paganizer · · Score: 1

      I've been around forever, built ICs from bearskins and flint, etc, etc.
      My rule of thumb has been, since around 1994:
      if less than or equal to 512MB RAM, swap should be RAM X 2, unless you are severely limited spacewise, in which case TRY RAM X 1.5; if greater than 512MB, Swap should be equal to RAM.
      It's worked pretty well. I think the problem most people have, with Windows systems at least, is that they don't set min=max.
      With Solaris, I usually go for swap = 25-50% of RAM, depending on how busy the system is.
      Debian, I just make it equal to RAM, but I haven't got any reason for it.
      Vista, is Evil. No amount of swap will change that.

      --
      Why, yes, I AM a Pagan Libertarian.
    174. Re:What Has Changed? by NtwoO · · Score: 1

      The rule for swap:

      1G swap partition. If it's used regularly upgrade RAM.

      This is a sensible solution, I think.

      My setup has similar swap room. I use system monitor tray with a rather large pixel width. In the sysmon, the Eth IO and swap are enabled. The swap has a very vivid colour. This makes it noticeable when the swap starts to play. This is then followed by a process check and a rationalisation in the running apps. If the app list is what I _need_, then more ram.

      --
      ! /* */
    175. Re:What Has Changed? by Fulcrum+of+Evil · · Score: 1

      Keep in mind that creating a swapfile uses dd. When dd creates a file there's nothing to specify that the file is contiguous. Therefore it's likely to be fragmented.

      No it isn't - using dd doesn't make it at all likely; creating a swapfile soon after install generally means that the free space is largely contiguous, and since ext2 allocates files in fragmentation resistant ways, you will get a mostly contiguous swapfile.

      --
      "We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
    176. Re:What Has Changed? by Isauq · · Score: 0, Redundant
      I, too, fail to see how GGP is flamebait: In truth, I'd say it's a fair approximation of the interaction between two incredibly and inexplicably memory-hungry applications.

      I would also like to mention the AC that is my GP is not somehow "insightful" for being a bog-standard troll calling someone names on the internet.

      --
      RTFM
    177. Re:What Has Changed? by laddiebuck · · Score: 1

      No. In fact, modern OS kernels often opt to swap out little-used pages and bring more files into the cache. What you said was superseded in the 1990s.

    178. Re:What Has Changed? by mgblst · · Score: 1

      $750, really, for a laptop hdd? No.

    179. Re:What Has Changed? by Fulcrum+of+Evil · · Score: 1

      Dunno about your DSL woes, but I'm actually okay with a bit of inconsistency - it's just part of life. What bothers me is the idea that we should go change something basic like how we measure megabytes when we have something that works already and everybody can agree on. The whole MiB thing is a solution in search of a problem.

      --
      "We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
    180. Re:What Has Changed? by Sensible+Clod · · Score: 1

      You know, I've been thinking about that for some time, but I'm not sure where you set that. Do I put that in /etc/fstab?

      --

      The difference between spam and poop is that you don't have to dig through septic tanks looking for real food. -- Me
    181. Re:What Has Changed? by flape · · Score: 1

      I'm power user and Java developer and I've been turning off swap file since the time I had 2GB of RAM. It was quite an improvement(on WinXP). And with 4GB it was a real treat. Don't use swap file unless you really need to!

    182. Re:What Has Changed? by TheLink · · Score: 2, Informative

      If you're using ADSL, sometimes what you end up with is TCP/IP over PPPoE over ATM over DSL (whoopee).

      Your DSL could be 6144kbps but since ATM cells are 48 byte payload with 5 byte header, your theoretical max TCP/IP speeds would be significantly less than 6144kbps. PPPoE also has some overheads but it does allow for larger packets.

      --
    183. Re:What Has Changed? by aqk · · Score: 1

      Well, I hope you ordered the "tri" cycles, and not that cheap bi-cycle stuff.
      Not many people realize that the third wheel on the tricycle is a parity wheel, and will detect any spoke errors.

      And above all, stay away from those cheap unicycles being gray-marketed to newbies. They make no sense in the digital world!
      .

    184. Re:What Has Changed? by orzetto · · Score: 1

      That may well be, but I see no reason to stress the disks unnecessarily. The measures I indicated are pointed out in Eee forums as good practice (so I suppose there is some sort of consensus about that), and do not affect performance (unless you run out of memory).

      Also, the first Eee units were released just short of one year ago. Whatever the manufacturer is saying about rewrite cycles, what counts is when the SSDs start breaking down among sold units. I'm just making sure that I am not among the first ones, in case the units used in Eees are substandard (they are, after all, cheap laptops).

      In any case, mounting with noatime is common practice, and when I found out about tmpfs (which I had been previously too lazy to look up) I started using it for my desktop machine's /tmp folder as well, as a privacy measure: the /tmp folder may contain temporary copies of sensitive data, and it's a good thing they are wiped when the computer is shut down.

      Anyway, do you have a link to data about write cycles in the SSD used in Eees? 'Cause that would be interesting to put on the wikis.

      --
      Victims of 9/11: <3000. Traffic in the US: >30,000/y
    185. Re:What Has Changed? by jonaskoelker · · Score: 1

      Isn't it great that we have such an easy, convenient system that is focused around the needs of us humans, and not the needs of the computers

      My ironymeter went out of batteries this morning, so if it's there I wouldn't know for sure.

      Now, one of the properties doesn't have the unit "bits" or "bits per second", but simply "per second"; that'd be the CPU speed. That being different from the rest is manageable. [Aside: GNU units is a wonderful program; if you're a little into physics, you may learn something interesting from reading units.dat]

      But the differences for the rest seem pretty dumb; it means I have to remember a lot of crap with no rhyme or reason. It'd be much easier for this particular Homo Sapiens [and all his Silico Sapiens companions would be indifferent] if everything was in one base.

      Especially "interesting" is that I can look at how much disk space my OS says I'm using, buy a disk "that big", and not have the data fit on it.

      Also, it'd be an improvement if all {K,M,G}{b,B} figures had an annotation stating "this is $n bits".

    186. Re:What Has Changed? by Laser+Dan · · Score: 1

      The main reason I, and many other people, don't use a swap on eeePCs is the slow speed of the secondary SSD.

    187. Re:What Has Changed? by aztracker1 · · Score: 1

      I personally use 2x the amount of ram up to 2GB of swap, then the RAM + 256MB or 2GB whichever is greater... this allows enough for a full memory dump, and a little extra... the 2GB is where diminishing returns of 2X the physical ram really comes out. I wouldn't suggest no swap in general, unless using SSDs as mentioned above, 256M is the least I would probably use.
      Like has been said many times over, ymmv.

      --
      Michael J. Ryan - tracker1.info
    188. Re:What Has Changed? by aztracker1 · · Score: 1

      Not sure where the floor is on XP/Vista's swap, generally the baseline is memory + 170mb or something similar, which is generally good enough for most people, in most situations. If you run a lot of memory intensive applications, or games, more can be needed... but I haven't run on less than 2gb of ram on anything in a long time now (5+ years).

      --
      Michael J. Ryan - tracker1.info
    189. Re:What Has Changed? by piojo · · Score: 1

      Removing swap from the equation simply means that you've made it impossible for the OS to do the best job of optimizing your system's performance if it gets low on free RAM -- instead of keeping stuff in RAM based on what gets used most often, it has to keep stuff in RAM because it has nowhere else to put it.

      Right--the reason to go swapless is if one genuinely knows better than their OS does. In this case, I know that I have plenty of memory, and I never want my apps to get swapped out. My OS didn't agree, so I turned off swap.

      --
      A cat can't teach a dog to bark.
    190. Re:What Has Changed? by Anonymous Coward · · Score: 0

      Then turn off full dumps, or dumps completely. There's four different options you can set, you know..

    191. Re:What Has Changed? by vrt3 · · Score: 1

      The point is why did we go change something basic like 'mega' meaning 1e6 into 'mega' meaning 2^30 when the whole scientific community had something that already worked and everybody agreed on.

      If non-decimal prefixes are more appropriate in certain circumstances, then it only makes sense to use other prefixes than the long-established decimal prefixes to make the difference clear.

      --
      This sig under construction. Please check back later.
    192. Re:What Has Changed? by Fulcrum+of+Evil · · Score: 1

      We changed from 1e6 to 2^20 because it worked better for computers. It makes sense in context, where everything is binary anyway. Science uses base 10 because people mostly use base 10 - nature doesn't care one way or the other.

      --
      "We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
    193. Re:What Has Changed? by Anonymous Coward · · Score: 0

      Sorry to contradict you, but endurance for flash memory is much more affected by read than write operations. Thus, the best way to ensure your SSD last is not using your PC. Have fun.

      BTW why bother when it is likely that you will change your computer years before you can even notice degradation in disk performance?

      Last, but not least, most flash controllers already cache data to reduce read/write ops, so try not to optimize what is beyond your reach, or the only result you will get is a poorly performing OS.

    194. Re:What Has Changed? by vrt3 · · Score: 1

      I absolutely agree that powers of 2 are often more convenient. But my point is: those prefixes already existed with established values; if you need other values, you should use other prefixes.

      One of the strong points of the SI system is consistency. 'k' always means 1000, whether it's about grams, metres, volts, tesla, newtons or whatever. Likewise the values of the other prefixes are independent of context. It makes no sense it all to break that consistency by modifying the value of prefixes in specific contexts.

      The standard unit of energy is J (Joule). In the context of particle physics, that unit is much too large to describe the energies involved, so scientists often use another, more convenient, unit with another name, eV (elektron-Volt). They did *not* continue to use the existing name J but with another value than in other contexts. Likewise computer scientists shouldn't have used existing prefixes with other values.

      What are we going to do if research on ternary computers ever delivers something useful? Create even more ambiguity by overloading k, M, ... with values of ternary powers? Or be sensible and create prefixes with names that unambiguously indicate their values?

      --
      This sig under construction. Please check back later.
    195. Re:What Has Changed? by Antique+Geekmeister · · Score: 2, Informative

      Duplicating filesystems with dd does not allow resizing, myshandles database files that are in the midst of atomic operations, and only gets that data that has actually been written to disk. The fact that modern Linux kernels keep as much in possible paged out in RAM, to improvde access times, means that you can rely on nothing having been written to disk unless you go through additional, complex and service interrupting steps. It also doesn't compress well, since any unused bits on unused blocks also wind up read and included in the duplication. No, dd is not a good backup or data transfer tool in most circumstances.

    196. Re:What Has Changed? by RAMMS+EIN · · Score: 1

      ``The administrative flexibility of swap files outweighs that of partitions;''

      Speaking of which, isn't it about time partitions and filesystems got more flexible? How about, say, the following scenario: storage is partitioned according to performance characteristics (how long does it take to read, how long to write?), then filesystems are created based on usage characteristics (read-only vs. read-write, many small files vs. few large files, many writes vs. many reads, etc.), and then storage is allocated to filesystems dynamically to achieve certain goals (performance, reliability, cost, etc.)

      I realize the last thing we want to do is make storage so complicated that we can't depend on it working reliably anymore, but I also feel the way things work nowadays is a bit too rigid. You basically have to guess right when you set up the system, and maintaining the system is a non-trivial operation. Try reassigning some unused space from one partition to another partition, for example, or think about what you would need to do when adding a harddisk to the system...

      --
      Please correct me if I got my facts wrong.
    197. Re:What Has Changed? by rew · · Score: 1

      Two sensible answers above.

      I still hold to the rule of thumb: twice RAM. (I convinced SuSE and apparently red hat too, to stick to this rule a long time ago...) Anyway, it is also an "emergency brake". If a program in your system starts taking memory uncontrollably, your system will lock up for minutes at a time without swap, before it starts doing the "out of memory" thing. That usually results in killing off the wrong program. With swap your system will show signs of life during that time, and you might be able to kill the correct program in time....

    198. Re:What Has Changed? by infonography · · Score: 1

      in Soviet Russia drive partitions you.

      Soviet Russia is no more.

      in New Russia drive swaps you

      --
      Sorry about the writing. Robot fingers, you know? Cliff Steele in DOOM PATROL #23
    199. Re:What Has Changed? by Malc · · Score: 1

      I do. I've found several problematic drivers over the years and removed them, which has resulted in stopping BSODs. On one machine analysis of a handful of mini-dumps made me realise that I might have bad memory. Swapped it for decent ECC memory and random crashes went away. The question is: why don't more people know about this technique? It only takes a few minutes to check it out, and for me that quite often includes Googling for "windbg minidump" to refresh my memory on what to do (Windows is so stable these days that I don't have to do this very often), and probably downloading WinDBG itself.

    200. Re:What Has Changed? by dotancohen · · Score: 1

      Just make sure that your swap partition is large enough to hold your physical RAM and Video RAM when you suspend. For instance, on my Dell Inspiron with 2 GB RAM and 256 MB of Video RAM, I use a 2.5 GB swap partition. That's where the memory goes when the computer suspends.

      --
      It is dangerous to be right when the government is wrong.
    201. Re:What Has Changed? by jozmala · · Score: 1

      At some point in some distributions, the swap partition accumulated the used pages. If something was swapped in the pages were kept in page partition also, so that next time if nothing changed in the page there would be no disk activity in swapping them out. That resulted swap partition being required to be far larger than system memory to be use full. Since you would end up far less free pages there.

      --
      ©God :Copyright is exclusive right for creator to determine the use of his creation.
    202. Re:What Has Changed? by vtcodger · · Score: 1

      I'm not sure that running with no swap space at all is a good idea. But if you run with a very small swap space -- say 20mB -- what will happen if you run out of memory is that the machine will slow to a crawl. A very slow crawl. A really, really, slow, very slow crawl. But it will continue to run (probably) and you will eventually be able to kill a task or two and restore usability. If it never slows, you don't need swap space. If it does start swapping, you'll be able to look at what you were running and make a more informed guess about how much swap space you need. At least that's the way it has worked for me the couple of times I've missized a swap partition.

      --
      You can't see ANYTHING from a car, You've got to get out of the goddamned contraption and walk...Edward Abbey
    203. Re:What Has Changed? by Bert64 · · Score: 1

      I always thought it was the overhead of having to make filesystem calls rather than physical placement on the drive that made swap files slower...
      Creating a single swapfile at install time will still result in a large unfragmented block, same as when using a partition.

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
    204. Re:What Has Changed? by JasterBobaMereel · · Score: 1

      Most Page Faults are caused by programs trying to use/allocate memory that does not exist (or does not as far as they are concerned)

      A program trying to use the memory at address 0 is never going to work no matter how much memory you have, and the memory at address 0 is unlikely to ever get swapped out ....a bug is a bug ...

      --
      Puteulanus fenestra mortis
    205. Re:What Has Changed? by Anonymous Coward · · Score: 0

      I'd have to run an OS that was subject to BSODa in order to care about debugging BSODs!!

    206. Re:What Has Changed? by Count+Fenring · · Score: 1

      To sideways echo the original poster... how big does a ramdisk /tmp need to be?

    207. Re:What Has Changed? by orzetto · · Score: 1

      If you mean noatime, yes, you just add it to the list of options in /etc/fstab for the relevant file system. If you mean tmpfs, yes again; add the following line:
      tmpfs /tmp tmpfs defaults 0 0

      Remember that you have to wipe the current contents of the /tmp directory before mounting tmpfs. Also, you should do this from the console, not a terminal emulator in X, since (in my experience) when you delete all the contents of tmp before mounting you cause some crashes or odd behaviour, in the worst case data loss depending on how applications use temporary files.

      --
      Victims of 9/11: <3000. Traffic in the US: >30,000/y
    208. Re:What Has Changed? by MrAngryForNoReason · · Score: 1

      All I can say is, don't believe [all of] the hype about SSDs.

      When used in a device like the Eee PC a SSD is used to make the device more rugged and reliable, rather than for a speed boost. By not having any moving parts a SSD is much better at protecting data if the machine is dropped or rattled around in a bag while switched on.

      You are right about the speed benefits generally though, fast hard drives are still beating a lot of SSDs in speed tests. Better ones are starting to come on to the market though.

    209. Re:What Has Changed? by FooBarWidget · · Score: 1

      "Atr you sure about that?"

      fdisk is pretty sure that there is no such partition. I don't have the Vista setup CD, nor the the recovery disk.

    210. Re:What Has Changed? by innit · · Score: 1

      While that rule of thumb is a good one, there may in fact be applications today in the graphics and processing world that require insane amounts of memory. While Firefox is probably never going to reach that critical mass [..]

      You've clearly never run FireFox on a Mac :)

    211. Re:What Has Changed? by hab136 · · Score: 1

      GiB is a made-up term.
      No programmer/engineer/nerd worth their salt (bandwidth?) uses it.

      Yeah, those programmers/engineers/nerds at NIST and IEC need more salt. Possibly pepper too.

      http://physics.nist.gov/cuu/Units/binary.html
      http://www.iec.ch/

    212. Re:What Has Changed? by Anonymous Coward · · Score: 0

      What kind of OS would say "I could use more memory right now to give better disk caching... but fuck it, there's a service that hasn't been used in 6 weeks. Better let it keep that inactive program in memory and just keep reading the disk over and over again instead of caching it"

      I hear there's this modern new system call Windows that has this feature...

    213. Re:What Has Changed? by hab136 · · Score: 1

      But here's the thing. You only had 3GB of combined RAM and swap before. Why would you need a juggernaught 16GB of swap (again, remember this is going to be 16GB transferring very slowly, so if you're using that much memory, you've probably already reached for the reset button) if you've got twice memory than you've ever used in your entire existence until now?

      Modern OSes will preemptively swap out when the disk is idle (leaving the block in RAM and on disk), so swapping out data is as fast as freeing the memory.

      The whole idea is insane. You don't need swap at all.

      Of course you don't, if you have enough memory to load everything you ever want.

      However, even in machines where you have gobs of memory (for example dedicated servers), the OS can often swap out a few bits of itself that were needed to initialize the OS and running applications, but won't be used again until the server is shut down. You could add more memory to support those bits sticking in memory, or the OS could swap out 512mb or so of itself and then reclaim that memory for disk cache.

      On servers, swapping is normally a one-time cost at startup, and then you've traded 512mb of disk for 512mb of more memory. It's usually a good trade.

      You can have more memory than you ever need, and that eliminates the need for swap. But on that same system, if you added swap, you'd have a little more disk cache, normally improving the speed of the system.

      For a web server serving static files, you could take this one step further and make a RAM disk to serve files from. But other applications with a non-static set (database server, file server) can benefit from more disk caching, up to the size of storage. Since disk is cheaper than RAM, you almost never have "enough" RAM to cache everything.

      The same principle applies on home machines, but you also have the idea that some applications may sit in the background, doing nothing, for long periods of time. It's cheaper to swap programs in and out of memory when needed and tie up some disk space than to add the extra memory.

    214. Re:What Has Changed? by Error27 · · Score: 1

      It gets zillions of rewrites if you don't use noatime. Hardware wear-leveling algorithms suck.

      http://valhenson.livejournal.com/25228.html

    215. Re:What Has Changed? by electrofelix · · Score: 1

      So what about hibernation or suspend? Do they not require swap space? I thought the main reason to continue the swap = 2xRAM was to support the follwoing: Size of RAM + equal size of swap for normal operation, + enough additional swap space for all data in RAM to be moved to swap for hibernation/suspend to disk?

    216. Re:What Has Changed? by Anonymous Coward · · Score: 0

      Hi,
      the question is more how big me virtual memory space shall be. with 4Gb of memory I initialy seted a 2gb swap space and saw that I never ever use it, so did stop to use swap and removed the partition.

      so yes it would be trivial to setup a 8Gb swap partition on my system but really what is the point for me to do that ??

      of course if you manipulate lot of data, video, pictures or whatever you may need more memory and then concidere to setup a swap. Always concider how much total memory you will need to setup your swap that's all.

    217. Re:What Has Changed? by hab136 · · Score: 1

      Because I don't have a Vista reinstall CD or even a restoration partition. Dell didn't provide one. If VMWare fscks up my existing Vista install then I'd have a problem.

      You can copy your existing system, make sure it works under VMWare, then remove the original Vista partition.
      http://www.vmware.com/products/converter/overview.html says "Clone and backup physical machines to virtual machines as part of your disaster recovery plan." In other words, you can leave your existing partition as-is.

      Besides, what if MS Office messes up your existing Vista install? What if Vista itself does? You need a regular backup system regardless of OS, virtualization, or installed applications.

      P.S. Have you tried calling Dell for a restore CD?

    218. Re:What Has Changed? by dkf · · Score: 1

      While that rule of thumb is a good one, there may in fact be applications today in the graphics and processing world that require insane amounts of memory.

      You shouldn't do more than 2x simply because if you've got any single application that is using significantly more than physical memory (or a combination of apps that goes more than twice physical) then your performance will be so terrible that you'd probably be faster going out and buying more memory. (I say this from the perspective of someone who has written apps that had working sets larger than physical memory many years ago; intensely painful!)

      Swapping/paging of your working set memory is a guaranteed ticket to slow. If you've got problems there, it's time to stop being cheap and get that upgrade.

      --
      "Little does he know, but there is no 'I' in 'Idiot'!"
    219. Re:What Has Changed? by Anonymous Coward · · Score: 0

      It's base 2... unless you're in the marketing department of drives makers.

    220. Re:What Has Changed? by FooBarWidget · · Score: 1

      "then remove the original Vista partition."

      I can't. I use the real Vista installs for playing games, and Direct3D doesn't work well in VMWare.

      "Besides, what if MS Office messes up your existing Vista install?"

      That's why I install MS Office into VMWare while games into the real Vista install.

    221. Re:What Has Changed? by Bert64 · · Score: 1, Insightful

      Enough ram for file caching = enough ram for all your apps plus a complete copy of all attached storage...
      I had a sun e45k with 14gb ram and a single 9gb drive attached, it was able to cache everything from the drive and still run all it's apps adequately.

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
    222. Re:What Has Changed? by Anonymous Coward · · Score: 0

      65K is -209 degrees Celsius / 344 degrees Fahrenheit.

      You must have meant 65kB.

    223. Re:What Has Changed? by Bert64 · · Score: 2, Informative

      Those "1.44MB" disks actually had a 2MB capacity, and the actual usable capacity depended on how they were formatted... Some places sold them as 2MB disks, some didn't...

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
    224. Re:What Has Changed? by mariushm · · Score: 1

      At 4 GB of memory, you usually don't need swap at all in usual computer work, so a small fixed amount like 1GB would be more than enough.

      I have 2GB of memory and the swap file is fixed at 1536MB (1.5GB) and it's quite enough.

      It's not recommended to disable swap, if you have enough memory just leave it a small size.

      Of course, this doesn't apply to Windows Vista. If you have Vista, stay on the safe side and keep it double the size of your memory.

    225. Re:What Has Changed? by DavidRawling · · Score: 2, Interesting

      As usual the information is 100% correct but not necessarily helpful. The disk is marketed as 160GB. GB is an SI unit denoting 10^9 bytes, so you should have at least 160,000,000,000 bytes (which you do). Your OS is reporting your 160GB disk as 160GB, it's quite clear. You, however, have calculated that it's 149 GiB, not 149GB.

    226. Re:What Has Changed? by DavidRawling · · Score: 1

      Anybody want my opinion on the matter?

      Frankly, no.

    227. Re:What Has Changed? by electrictroy · · Score: 1

      >>>look at your swap partition as your extended virtual memory.

      In that case, why can't I just let Windows XP or Vista manage the virtual memory size by itself? I don't see why I should need to establish a fixed size when Windows can manage it dynamically.

      Also, just curious, what if I set my swap file == 0? I have 4 gigabytes, so surely that's sufficient to run my programs without needing virtual memory.

      --
      The government is not your daddy. Its purpose is not to raid middle-class neighbors' wallets and give it to you.
    228. Re:What Has Changed? by Snaller · · Score: 0, Troll

      "Yeah, your 256MB of space was trivial when you had a 30GB hard drive ... and 8GB of space is still trivial with a 750GB hard drive. "

      Its trivial if YOU buy us one.

      --
      If Google really cared they would fix Android Chrome to reflow text, instead of discriminating
    229. Re:What Has Changed? by swilver · · Score: 1

      The question then is, will swapping out 500 MB of programs on a 4 GB system result in any tangible benefits for the disk cache, or rather in user frustration when those apps are getting swapped back in...

    230. Re:What Has Changed? by Snaller · · Score: 1

      Great, so solid state drives shouldn't be used for best usage!

      --
      If Google really cared they would fix Android Chrome to reflow text, instead of discriminating
    231. Re:What Has Changed? by jeremyp · · Score: 1

      Actually, the memory at address 0 (virtual address 0, that is) is unlikely to ever get swapped in. The first page is often made inaccessible as a mechanism to catch null pointer dereferences.

      --
      All I want is a secure system where it's easy to do anything I want. Is that too much to ask ~~ Randall Munroe
    232. Re:What Has Changed? by swilver · · Score: 2, Interesting

      Let's assume for a second that my harddisk is just as fast as main memory. Does it make sense to cache this? Do you think memory managers make a distinction here? I know they don't. So, what about the situation where my harddisk is not as fast as main memory, but instead I'm uploading a 4 GB file over night, at a rate of 1 MBps. Does it make sense to cache this 4 GB file? There's no hard disk stress on the system, other than some prefetching, there's no benefit at all from caching all this data that is being accessed only once. Do you think it likely this file will suddenly need to be accessed at top performance and thus benefitting from caching? What if the file is always accessed sequentially and is slightly larger than the total amount of RAM in your system? Does it make sense to try and cache the whole thing, knowing that it will never fit? I'm afraid that memory managers aren't that smart, in fact, they're downright stupid. They donot KNOW what makes sense to cache, they just use highly tweaked LRU type algorithm and don't pay any attention to usage patterns and whether or not the underlying media would benefit from caching for a given task. So they will do stupid things, like trying to cache a 4 GB data file which was uploaded the other night. This leaves you with a crippled system in the morning because it decided to slowly swap out everything during the night for this purpose.

    233. Re:What Has Changed? by 4D6963 · · Score: 1

      What I love even more is when such posters are awarded insightful mod points for the confidence of their tone.

      --
      You just got troll'd!
    234. Re:What Has Changed? by Trilobyte · · Score: 1

      Thanks for adding this non-MSDOS-centric note before I had a chance to...

    235. Re:What Has Changed? by digitalhermit · · Score: 1

      Good lord, are you a politician?

      Quote my whole comment instead of pulling out sections to argue a point I didn't make. Yes, dammit, create the swapfile soon after installation otherwise it's likely to be fragmented. BUt at that point, just create a partition when you build out so that the page space is completely contiguous. ext2/3 is not fragmentation proof and can fragment. As the file gets larger (and swapfiles are very large) then the likelihood of fragmentation goes way up.

    236. Re:What Has Changed? by harry666t · · Score: 2, Insightful

      Haha. But what happens if your OS absolutely has to swap a page out, and there's no swap file/partition? That's it - one of your apps will die a painful death. Here are your choices: let the SSD last (theoretically) a few months longer, or have your workflow disturbed every time a swapping should occur. A tip: starting the crashed app and getting your documents / web pages / whatever back will ALSO wear the SSD.

      And if you're extensively using much more than this 1GB on this small netbook, then you're probably using a wrong tool for the job anyway.

      OBTW, wear leveling anyone?

    237. Re:What Has Changed? by swilver · · Score: 1

      It's assumptions are faulty. Let's assume for a second we have 1 GB of RAM. Per Oracle's guidelines I thus need 1 GB of Swap. I'm happy with this system and can do everything I want with it. It just sometimes feels a bit sluggish for some reason.

      So... why not put 2 GB of RAM in it and then disable swap? I will use the system the same way as before and it works perfectly fine and never feels sluggish. However, suddenly Oracle's guidelines find that I need another 2 GB of Swap? Why?

      It's because these guidelines assume that memory is expensive, and that it makes good sense to only buy as much as you absolutely need. Need in this case is defined as just enough to make the system usable and not be constantly bogged down by heavy swapping. The guidelines are based on the minimum amount of RAM you NEED, not on how much RAM you actually HAVE. Yes, it makes good sense to have as much swap available as the minimum amount of RAM you need to work comfortably. As soon however as you have much more RAM than what you really need, swap makes no sense at all.

      Case in point: I recently upgraded a Linux System doing various tasks which had 2 GB RAM and no swap. I do everything with this machine, including posting here on Slashdot using a rather memory hungry tabbed browser. Never have I had problems with this configuration. The upgraded system however now contains 4 GB RAM. Why? Well, it was dirt-cheap, and I saw no reason to waste precious DIMM slots I may need in the future with newly bought 1 GB sticks. Think I need swap?

    238. Re:What Has Changed? by hab136 · · Score: 1

      I can't. I use the real Vista installs for playing games, and Direct3D doesn't work well in VMWare.

      Oh. You should say that next time instead of implying that you can't move Vista to VMWare because it would mess up your Vista install in some undefined way. 3D support works for some games, but not all.

      "Besides, what if MS Office messes up your existing Vista install?"

      That's why I install MS Office into VMWare while games into the real Vista install.

      Okaaaay.. what if one of your games messes up your real Vista install? Or your hard drive crashes? The point is, it doesn't matter what you have installed; you should have backups.

      Your original post made it sound like you're fine without backups, unless you installed VMWare. You really should have backups regardless of which programs you have installed, and VMWare doesn't pose any great threat to the stability of your system (especially since you apparently already have it installed!).

    239. Re:What Has Changed? by Anonymous Coward · · Score: 0

      I had laptop acer aspire not sure what seria, around 3 years ago. I upgraded it to 2 gigs of ram, migrated to Linux put Gentoo onto and was happy...
      Ram was more than enough for me. I am hardcore gamer. Again, now I have 4 gigs of ram, all sort of applications, thunderbird/Firefox3 with 20 tabs in it, audacious(mp3player), several terminals. I often compile programs, also i play ETQW, NEVER had any problems...

    240. Re:What Has Changed? by hesaigo999ca · · Score: 1

      I would like to know how you set up your nix bos to play WoW, as I am trying to switch from windows to linux, and my only reason not to is WoW, if I can get WoW to work on linux at home, then I would gladly switch.

      Could you tell me which distro you use, did you have to set up wine or was it already set up on the distroo...and for installing WoW, a quick step by step if you could would be great as I am still trying to figure out why last time I tried it failed...thanks a million in advance!

    241. Re:What Has Changed? by Anonymous Coward · · Score: 0

      No. Linux optimizes available resources. Less resources = less optimal.

    242. Re:What Has Changed? by nurd68 · · Score: 1

      I have 8GB of RAM in my new machine.

      I've filled it, and gone 2GB into my swap.

    243. Re:What Has Changed? by Sj0 · · Score: 1

      I upgraded from 1GB to 8GB in my hypothetical because I was trying to completely eliminate the assinine "lol but wut if u need swap?" arguement that I keep on seeing by giving the user more memory than they've ever used in their entire lives.

      Regardless, you end up making that very arguement, which is retarded. If you need more than twice the memory you've ever had even remotely available, then you would've crashed your machine with 1GB of RAM which followed the "2x RAM" rule.

      --
      It's been a long time.
    244. Re:What Has Changed? by Anonymous Coward · · Score: 1, Informative

      In windows it's a good idea to set a fixed size for the swap as it avoids fragmenting the swap file, which I can assure you it does, at least in XP.

    245. Re:What Has Changed? by sqlrob · · Score: 1

      !analyze -v

      Doesn't require an upload to MS.

    246. Re:What Has Changed? by Anonymous Coward · · Score: 0

      Probably faster for contiguous read/write; the rotation speed is likely comparable, so the dramatically increased density (25 times, assuming the same number of platters) means about 25 times as many bits will pass under the head per unit time.

      Random read/write is every man for himself.

    247. Re:What Has Changed? by ezzzD55J · · Score: 1

      This includes pages that don't actually hold anything at the moment, but remain part of the process' malloc heap due to internal heap fragmentation.

      Only if they've been touched..

      After being used and freed they are probably kept aruond, admittedly, yes.

    248. Re:What Has Changed? by FooBarWidget · · Score: 1

      "You should say that next time instead of implying that you can't move Vista to VMWare because it would mess up your Vista install in some undefined way."

      I did. In my first post I said I use my main Windows install for games, and the VMWare install for things like testing with Internet Explorer and Visual Studio.

      "3D support works for some games, but not all."

      None of the games I care about work on VMWare.

      "Okaaaay.. what if one of your games messes up your real Vista install?"

      Not likely, I installed them a year ago and never installed anything new. In my VM on the other hand, I install new things all the time.

      "Or your hard drive crashes?"

      I haven't seen a hard drive crash since I started using computers 10 years ago. Yes, I'm not kidding. This doesn't mean it won't ever happen, but happens rarely enough that I don't care too much about the possibility.

      "The point is, it doesn't matter what you have installed; you should have backups."

      I already have backups of my data. I just don't have a backup of Vista. And just because I have backups doesn't mean I to go through the trouble of restoring them when I don't have to.

      "Your original post made it sound like you're fine without backups, unless you installed VMWare."

      No. Installing stuff into VMWare doesn't take away the need, but it *reduces* the need because the chance that my Vista install gets screwed up by some virus/malware becomes smaller.

    249. Re:What Has Changed? by Sprinkels · · Score: 1

      No, the 30 GB drive runs 20 times faster out of disk space than the 750 GB one.

    250. Re:What Has Changed? by damn_registrars · · Score: 4, Interesting

      In that case, why can't I just let Windows XP or Vista manage the virtual memory size by itself? I don't see why I should need to establish a fixed size when Windows can manage it dynamically.

      I have yet to see a version of Microsoft windows that does not end up with a hopelessly fragmented swap file over time. And if you let windows dynamically use space for swap, you're just asking for an even more hopelessly fragmented drive as it starts grabbing space anywhere it can find some to expand the swap file.

      On my own windows installs I have brought some old-school unix (FreeBSD in particular) methodology to partitioning, and I make a partition just for swap (still 2x my total memory size). Of course in windows you still have to partition it, but I just don't write anything to it myself, and tell windows to only swap to that partition. Then my main partition doesn't end up as terribly fragmented.

      --
      Damn_registrars has no butt-hole. Damn_registrars has no use for a butt-hole.
    251. Re:What Has Changed? by joss · · Score: 1

      Actually, 14.4kbps means 14.4 k *bits* / second

      --
      http://rareformnewmedia.com/
    252. Re:What Has Changed? by Anonymous Coward · · Score: 0

      That's the default for windows, not linux. normally, linux doesn't swap files unless there is no ram left.

    253. Re:What Has Changed? by TopherC · · Score: 1

      I think the advice to set swap at 2x RAM is a very rough guide based on having a typical desktop setup that has been optimized with about as much RAM as it needs. So from that point of view if you have 8GB RAM then you probably also are running very demanding apps that use it, and some more swap might help during usage spikes.

      The other issue is using RAM for disk caches. The more you store in cache, the better your performance (to a point). So if some rarely-used data sits in memory, it might be better to swap it out and use that much more memory for cache. Again this assumes you've chosen your RAM size for optimal price/performance.

    254. Re:What Has Changed? by Amouth · · Score: 2, Informative

      on top of fragmentation - if you set it to "let windows manage" instead of setting a fixed pagefile size windows has a very very bad habit of only allocating what it needs at the current moment with no flex space..

      Meaning..

      evry time it swaps something to disk it has to look up and allocate more space (this causes the fragmentation and takes time)

      every time ti swaps something from disk to memory it frees up the space for the File system (takes even more time and opens others things to fragment by releaseing things if 4kb peices)

      in the even that it is a true swaping of pages.. it will allocate space on disk then write from memory to disk the current page then read from disk the page it wants then it frees the space on disk.. so not jsut swaping memory but eating disk time to do it.

      having windows manage pagefile is just asking for slower preformace if windows ever decieds to swap.. which it does alot even if you arn't running alot of programs that eat memory as windows likes to do system and program cacheing - so you run somethign and quit.. windows will leave it in memory so it doesn't have to read it back next time.. only issue is it doesn't treat this special compared to other things and will page this cache just like anything else..

      if you set a fixed size.. then all of the allocating and freeing of disk space goes away.. which makes swaping alot faster in windows.. not to mention that it helps prevent fragmentation of the swap space.. which just compounds the speed issues

      --
      '...if only "Jumping to a Conclusion" was an event in the Olympics.'
    255. Re:What Has Changed? by Anonymous Coward · · Score: 0

      Yes. And rightly so.

      The other day I rebooted my Windows machine. It got up, I logged in, waited for services and stuff to start. The machine eventually settled. About two minutes later, it blue-screened. Repeated the process twice, with the same result. The third time it stayed up.

      The process above has happened once before.

      When it finally stays up it tends to be very stable for a long time.

      Diagnosing why it sometimes crashes and sometimes doesn't? Fat chance.

      I hate Windows. For each day that passes I get one step closer to being able to finally ditch it.

      (I already have ditched it on all machines except for my gaming PC. It's the last remaining one.)

    256. Re:What Has Changed? by Bert64 · · Score: 1

      You can reduce the memory footprint of firefox by turning off some of the caching...
      Firefox will also dynamically adjust the amount of caching depending on the available ram i believe...

      But WTF are you doing to use up 8gb of ram and 4gb of swap? I have tons running, and i'm nowhere close to that level of usage...

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
    257. Re:What Has Changed? by Anonymous Coward · · Score: 0

      ELF files (programs and libraries) don't get written to swap... they're already on the disk.

    258. Re:What Has Changed? by CrazedSanity · · Score: 1

      I believe (though I have no empirical evidence at hand to prove it) the reason swap should be 2x the size of your total amount of RAM:
        1.) single program chews up all of your available memory
        2.) kernel swaps all of that out for more important processes
        3.) the new processes chew up all of the available system memory
        4.) the original process(es) become important: kernel swaps all RAM out (making swap now 2x the amount of available RAM), pulling the original swapped memory back into physical memory

      I'm pretty sure it's something like that. If there's not enough swap to handle this process (assuming it can't just create swap files on-the-fly), the kernel goes into Rambo mode and starts killing processes that are taking up too many resources. Trust me, nobody wants to see the kernel become Rambo (I know there's a pun in there somewhere about the "colonel" in the Rambo flicks).

      --
      Sanity is like a condom: rather have it and not need it, than need it and not have it.
    259. Re:What Has Changed? by phision · · Score: 2, Informative

      No swap partition, which would predictably have many more writes than the rest of the disk;

      The firmware of the SSD will do the job to avoid wearing a particular cells of the flash memory, no matter of the partitioning. The partitioning of the SSD is purely logical.

    260. Re:What Has Changed? by Mr+Z · · Score: 1

      Oh, and speaking of journaling... You really should be using a flash-friendly filesystem, not one that concentrates writes in a journal. If you combine a flash-friendly filesystem with a swapfile (assuming that combination is supported, and admittedly I haven't checked), then you get wear leveling at a higher level.

    261. Re:What Has Changed? by CrazedSanity · · Score: 1

      Just a few years back I helped one of my friends put a bigger hard drive into a TiVo that was running an incredibly old kernel... I think it was in the 2.0 era, or very close to it (there's a possibility I'm wrong here, and the information was written to a corrupted part of my brain).

      --
      Sanity is like a condom: rather have it and not need it, than need it and not have it.
    262. Re:What Has Changed? by saintsfan · · Score: 1

      I have 2 gigs of ram on an amd64 running ubuntu. i don't recall how large my swap is, although I think I set it pretty low as my hd is not that big, but the point is that I have watched the use of ram and swap "real-time" in a system monitor. i've never seen the ram deplete enough to activate use of the swap. that being said, i or someone in my position could probably get away with very little (500 megs?) for emergency use only

    263. Re:What Has Changed? by goarilla · · Score: 1

      i'm not certain that's true for minidumps, which is the default dump setting in boot.ini iirc

    264. Re:What Has Changed? by Mr+Z · · Score: 1

      I said "How many bits per second peak can a 14.4kbps modem move?" and provided the answer "14,400." How is this inconsistent with "Actually, 14.4kbps means 14.4 k *bits* / second"? All I've done is multiply out to show "k = 1000" in this context, not 1024.

      It's not like is said "kilobaud" anywhere, which is its own nest of confusion.

      And it's fun to contrast: If you have an ADSL modem with an advertised 128kbps upstream, that's actually 131,072 bits per second.

      (Someone pointed out that the end-to-end throughput on a ADSL connection is far lower due to network overhead, but that's non sequitur. It's not like PPP lacks overhead, for instance. This is a matter of the bandwidth on this section of the pipe, not what you're doing with that bandwidth.)

    265. Re:What Has Changed? by goarilla · · Score: 1

      i always forget how to obtain the symbols

    266. Re:What Has Changed? by anomaly256 · · Score: 2, Informative

      Have you ever tried to use an app that needed 12gb of memory, when 8gb of it is swap????? You'll be sitting there FOREVER waiting for it to do anything as it's moving 8gb of crap to disk. Basically, if you hit this point, you don't need more swap, you need more RAM! 2gb of swap is plenty. Regardless of setup or application. If this runs short, buy more ram and use a 64bit OS.

    267. Re:What Has Changed? by goarilla · · Score: 1

      after reading this http://support.microsoft.com/kb/254649/ i mean small memory dump (64 kb), minidump... is just the filename windows gives it

      my apologies

    268. Re:What Has Changed? by tzot · · Score: 1

      Do you imply that if there are in-memory dirty data for, say, /dev/sdb1, and I do a
      dd if=/dev/sdb1 of=somefile bs=64k
      then I get what's in the disk image without the in-memory data?

      If yes, because it seems you do imply that, you need to check your basic operating system knowledge. Really.

      Otherwise, per compression, resizing etc, you do have a point.

      --
      I speak England very best
    269. Re:What Has Changed? by WuphonsReach · · Score: 1

      Because if you've already successfully chewed through 8GB of RAM, having an extra 256MB of swap available just in case isn't likely to be a very meaningful stop-gap.

      Exactly.

      On most systems, especially servers, swap is there so that if things go wrong, there's room (and time) for recovery before the system crashes completely. Given today's disk speeds, I feel like that's somewhere between 4 and 8 GB of swap... give or take a few GB.

      (You can probably blow through 2GB of swap in about 1 minute on today's drives if things are really going pear shaped.)

      --
      Wolde you bothe eate your cake, and have your cake?
    270. Re:What Has Changed? by Sj0 · · Score: 1

      No, I went with 8GB in my hypothetical because it's far more memory than you've ever been able to use before, since your previous swap partition was only 2GB, giving you only 3GB of total memory if you include swap.

      As a rule of thumb, it's absolutely stupid today compared to the past. In the past, if you had 8MB of RAM, then you're probably already hitting the edge of swap before you even open a browser window. It's entirely sensible to need much more swap than you do memory when each program uses a significant amount of your available memory. Today, I browse with hundreds of tabs open over multiple browser windows, and leave my browser running for days or weeks at a time, and I've never seen my browser use more than a gigabyte of memory. If I put 4GB into my computer at this moment, I'd have more memory than my RAM and Swap put together, and more importantly, my applications wouldn't be likely to use even half the memory on a regular basis. Unless you've got a practical reason for having insane amounts of swap, I don't see why you'd want to go beyond a gigabyte or two. Hard drives are very slow, if you're using more swap than that, odds are you've hit the reset button anyway because moving 16GB around is expensive with a hard disk.

      --
      It's been a long time.
    271. Re:What Has Changed? by Anonymous Coward · · Score: 0

      Google `linux overcommit memory'.

    272. Re:What Has Changed? by Sj0 · · Score: 1

      I don't see how this is relevant. As long as you've got a token swap file, what does the ability of linux to commit more memory than exists in RAM and swap combined have to do with anything?

      --
      It's been a long time.
    273. Re:What Has Changed? by Eric+Sharkey · · Score: 1

      Well written applications will tell the memory manager what their expected usage pattern will be using functions like posix_madvise and posix_fadvise.

      If an application is uploading a 4GB data file and uses POSIX_FADV_SEQUENTIAL followed by POSIX_FADV_DONTNEED for the bits it's done with, then the memory manager shouldn't do stupid things like "trying to cache a 4 GB data file which was uploaded the other night".

      Of course, this presupposes well written applications, which may be a bit much to ask...

    274. Re:What Has Changed? by mrchaotica · · Score: 1

      Wow. You might as well just stick a battery on the RAM and remove the HDD entirely!

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

    275. Re:What Has Changed? by PitaBred · · Score: 2, Informative

      The OS doesn't just randomly "throw away" memory. There is no mechanism for doing so, asking programs to relinquish RAM they previously allocated. What the OS IS doing is dropping file caches from memory, stuff Firefox has read for rendering pages, and leaving them just on the disk. But that's not Firefox's memory... that's the operating system's memory. It can't throw out OpenOffice memory at all. The ONLY thing an OS can do is say "no, you can't have more memory" when a program wants more, or kill the program entirely. It can't find "safe" places to reclaim RAM.

      Go take an OS design course, or at least read up on it. There is nothing in your post based in fact.

    276. Re:What Has Changed? by mrchaotica · · Score: 1

      How about gibs, mebs, and kibs? In a computer context it's probably obvious you're referring to bytes.

      Or exploded chuncks of flesh in a first-person shooter. But that's okay, because it's still a much better idea than "__bibytes!"

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

    277. Re:What Has Changed? by mrchaotica · · Score: 1

      What are we going to do if research on ternary computers ever delivers something useful? Create even more ambiguity by overloading k, M, ... with values of ternary powers? Or be sensible and create prefixes with names that unambiguously indicate their values?

      What do you propose, calling things "kitty-bytes" (ktB)?

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

    278. Re:What Has Changed? by cytg.net · · Score: 1

      So thats a yes then? fail.

    279. Re:What Has Changed? by Fulcrum+of+Evil · · Score: 1

      So don't do it in a fs mounted rw - easy enough. DB backups already have an established process.

      --
      "We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
    280. Re:What Has Changed? by tjrw · · Score: 1

      Please be careful not to conflate the 32-bit Windows 2GB dump limit with not being able to get a crash dump on said systems. You cannot get a *complete* crash dump, but as TFA correctly states, these are hardly ever necessary. A kernel-only dump (which is not a mini-dump) is almost always sufficient. And these won't be >2GB on 32-bit Windows.

      On 64-bit versions of Windows, it isn't an issue anyway (apart from having to tweak the registry if you actually want a complete dump).

    281. Re:What Has Changed? by chis101 · · Score: 1

      I think he knows what he is talking about. When he says "it can't throw away your data, but it can throw away code", I believe he means that the code will have a file backing (you can always re-read the code from the executable), so it is okay to throw it away. Your data, on the other hand (the programs working set of data, not including the program code) is NOT file backed, so can't be thrown away. So, it should be possible, even without a swap file, for an OS to still 'throw away' pages, as the GP mentioned.

      And also, what's with Go take an OS design course, or at least read up on it. There is nothing in your post based in fact? Little inflammatory comments like that at the end of posts don't add anything to the conversation, it is just trying to pick a fight.

    282. Re:What Has Changed? by jrothwell97 · · Score: 1

      After digging through my /etc/fstab, I can see mine is 100mB, which is quite a reasonable amount of space for a /tmp partition, I think.

      --
      Those using pirated Tinysoft signatures(TM) are a real threat to society and should all be thrown in jail.
    283. Re:What Has Changed? by woboyle · · Score: 1

      I have a dual quad-core workstation w/ 8GB of RAM, so I configured a 16GB swap partition. Why so much? Well, I don't normally use that much, but I do run one and sometimes two virtual machines that get allocated about 2GB of memory each, so there goes up to 4GB taken from the OS (CentOS 5.2) and application use. Now, having ample swap space doesn't seem so useless to me...

      --
      Sometimes, real fast is almost as good as real-time.
    284. Re:What Has Changed? by Anonymous Coward · · Score: 0

      Which is incredibly stupid for when you minimize some program, copy over a huge file from somewhere, and reopen the program. Everything has been flushed and you'll have to wait several seconds for it to swap back in. I'm not sure this is how it works in linux since I don't use swap on linux (8 gigs of ram on my desktop and 4 on my laptop), but in windows that's been a major annoyance in the past.

    285. Re:What Has Changed? by sexconker · · Score: 1

      Durrrr.

      Storage is base 2.
      Transfer is base 10.

      Storage claims are base 10 so you can claim a higher number. This is bullshit, and the main reason behind the "standard" of SiB (shittibytes).

      There have been oddities:
      1.44 "MB" = 1.44 x 1000, base 2 KBs.
      Some of the early GB-scale hard drives noted that "1 MB = 1,000,000 bytes", yet their capacities were in the GB-scale, based on 1 GB being 1024 MB.
      Similar shenanigans occurred with early MP3 players.

      As for why we use base 2 for storage, it's because all data is (logically) quantum, and we care about counting that data. When you start counting stuff, you care about capacity and combinations.
      Since computers are BINARY, we use base 2 to calculate combinations.
      If computers were tertiary, we'd use base 3.
      If computers were decimal, we'd use base 10.

      For people who bitch about all other areas of science using base 10: We used 10 because our counting system was based on 10. (Why is our counting system was based on 10? Because we have 10 digits on our hands! </myth>)

      Your counting system in the "real world" is based on 10, and your orders of magnitude, which are merely a convenience, are based on powers of 10.
      Your counting system in the "digital world" is based on 2, and your orders of magnitude, which are merely a convenience, are based on powers of 2.

      BUT WAIT! I already hear the bitches and moans about bandwidth measurements and clock frequencies. (Bandwidth measurements are NOT the same as throughput measurements!)

      These are MEASUREMENTS, in the classical sense. We measure the physical signals. These are analog, and are not quantifiable (countable), they are qualifiable (measurable). These things were being measured long before we had our precious microcheeps, and apply to other ares of science. Thus, we use ye' olde base 10.

      And if you want to bitch about the universe being quantum: I agree, and that means all our classical measurements are useless, we need to start counting our distances now! Do we know the grid size of the universe? I propose we call it the quantumeter.

    286. Re:What Has Changed? by musicmaker · · Score: 1

      Of course if any of your programs that were actually in use went into swap, your computer would be rendered virtually unusable as it frantically swapped programs in and out just to keep them running.

      --
      Everyone is living in a personal delusion, just some are more delusional than others.
    287. Re:What Has Changed? by sexconker · · Score: 1

      Modems and T1 lines, aren't measured in bits per second. They're measured in BAUD.

      We don't rate them (or ethernet) on throughput, we rate them on physical signal rates.

      Throughput != bandwidth.

      You count bits and measure signals, area, etc.

      Counting a logically binary thing with a base of 2 is helpful for many reasons, which is why we do it.
      Same with counting a logically decimal thing with a base of 10, which is why we do it (in the classical sciences, our number system is based on 10, and so are our orders of magnitude).

      Bits per square meter? Easy.

      Count the "bits" in your given area. (I used quotes because bits are logical, and do not necessarily correlate 1:1 to the physical method of storing a single bit on a disk. It is up to you to decide if you want to count actual usable bits or "I could've had this many" bits.)

      Measure the given area in your unit of choice.

      You know have bits / area.

      Say you had 422,521,627,293,434 bits / 1 square meter.

      You want that in millimeters.
      422,521,627.293434 bits / square millimeter.

      You can't have a fraction of a bit since it's a logical entity. You can drop the fraction, or you can retain it, depending on what you're using this data for. Those fractions of a bit over a larger area will still exist, so it can be useful to keep the fractions around. Your choice.

      But you want that in GB / square millimeter.

      0.39350392976164259016513824462891 GB / square millimeter.

      Round / truncate it however you want.

      You do NOT apply significant figures bullshit to this result - this is an exact conversion, and you were COUNTING the bits. Significant figures should only be used on imprecise (different from inaccurate) measurements (such as when you were measuring the area of the world's largest drive platter in single meters instead of in cm or mm).

    288. Re:What Has Changed? by sexconker · · Score: 1

      Then why doesn't his OS report GiB?

      Oh, because the world and the science doesn't revolve around the politics and marketing and other bullshit of some "standards" body.

    289. Re:What Has Changed? by Mr+Z · · Score: 1

      Modems and T1 lines, aren't measured in bits per second. They're measured in BAUD.

      Nice try.

      0.39350392976164259016513824462891 GB / square millimeter.

      Nice try. What happens when you want to cancel the prefixes out so you have one prefix for the whole result? Doesn't work out so well does it?

      Ah, that's enough troll feeding for one day.

    290. Re:What Has Changed? by sexconker · · Score: 1

      Your shittipedia link supports my claim, moron.

      Even on the Simpsons, when Homer starts his tech business (Hyper-Compu-Global-Mega-Net), Comic Book Guy comes in and asks if Homer would be able to provide him with a 1.544 megabaud T1 fiber optic line.

      Why would you want to cancel the prefixes? You're counting and measuring.

      If you get 1,500,000 liters of corn per square kilometer, what do you say?

      1.5 Megaliters of corn per square kilometer.
      1.5 liters of corn per square meter.

      Just because you lose the prefix doesn't mean you lose the information. The are separate. In this case, they happen to match up in scale quite nicely, so you can drop the order of magnitude prefix and use liters and meters.

      What if your output ramped up by a factor of 1000 (or you were measuring something other than corn - these numbers are actually typical for corn)?

      1.5 Gigaliters of supercorn per square kilometer.
      1.5 Kiloliters of supercorn per square meter.
      1.5 Liters of supercorn per 1000 square millimeters.

      15 Liters of supercorn per square centameter (or square hectometer, or "hectare", if you're lame and love your illogical "standards").

    291. Re:What Has Changed? by sexconker · · Score: 1

      Oops.
      Should be:
      15 MegaLiters of supercorn per square centameter.
      15 Liters per square decimeter.

    292. Re:What Has Changed? by Anonymous Coward · · Score: 0

      Erm... did you read what he said? A 14.4kbps modem is 14.4kilobits per second. That Wikipedia article says "The term baud rate has sometimes incorrectly been used to mean bit rate, since these rates are the same in old modems as well as in the simplest digital communication links using only one bit per symbol, such that binary "0" is represented by one symbol, and binary "1" by another symbol. In more advanced modems and data transmission techniques, a symbol may have more than two states, so it may represent more than one binary bit (a binary bit always represents one of exactly two states)." What's the baud rate of a 14.4kilobit modem, genius?

    293. Re:What Has Changed? by Anonymous Coward · · Score: 0

      what?

    294. Re:What Has Changed? by bzipitidoo · · Score: 1

      I have another reason to go easy on swap space on an Eee 901. Boot times. I installed Ubuntu Eee and made a 768M swap partition. I could be misreading the dmesg output, but it looks like it takes 13 seconds to mount swap. So, I'm going to try again, and keep swap to a tiny 64M.

      Always good to have a little bit of swap instead of no swap space, for 2 reasons. It's a place to shove all the crud left lying around in memory that should have been cleaned up but never was. Stuff like the boot script that starts a few processes and then never exits the shell even though it has nothing left to do (xinit and startx are dirty that way), and automatically started apps that you never use. The other reason is so performance degrades gracefully if you do run into memory pressure. I like to have a chance to kill runaway processes myself before the kernel is forced to guess and zap things arbitrarily.

      --
      Intellectual Property is a monopolistic, selfish, and defective concept. It is "tyranny over the mind of man"
    295. Re:What Has Changed? by lgw · · Score: 1

      Check your arrogance at the door, kid. I've *written programs* on architectures where we had virtual memory, but didn't have the concept of page faults. The reason that page faults are common as a mechanism is that they provide a nice hook to swap back from disk.

      Page faults, as commonly implemented, because they assume you might need to do I/O to resolve them, are a big ugly wart in anyone's dispatch/interrupt-level model, and require the idea of non-pageable memory and just in general are an annoyance when writing drivers.

      If you don't have a swap file, you can guarantee that access to the next executing instruction, and to previously allocated memory, will always succeed. That's not the architecture that's common today, sure, but that was the *entire point* of my post.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    296. Re:What Has Changed? by lgw · · Score: 1

      We're rapidly reaching the point where you *still* wouldn't be using all the memory in an inexpensive desktop PC. I paid less that $1000 for a desktop box that had 8GB of memory, and I've never needed all of it, even doing just what you describe.

      As 16 and then 32GB becomes practical for a sub-$1000 box, there's just no need for swap space. It's a relic of history.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    297. Re:What Has Changed? by lgw · · Score: 1

      I've written programs on architectures where 0 was a pefectly cromulent address, and the OS used the first page as temporary storage for context switches (the first page was the only place you could address without changing a register first).

      There's are a great many OS and machine architectures out there, it's not all just Windows and Linux. Don't get me wrong, making access to the first page an error is a *good* idea, but not everything works that way.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    298. Re:What Has Changed? by sweetnavelorange · · Score: 1

      Apologies, I misunderstood your point.

    299. Re:What Has Changed? by Anonymous Coward · · Score: 0

      you can run Portal and Starcraft perfectly in wine.

      WoW also works fin in wine. you may be able to get rid of windows depending what other MMORPGS you play

    300. Re:What Has Changed? by lgw · · Score: 1

      We're just now moving to a time when it's common for the address space to be *much* larger than available physical memory, allowing each process to have all of its memory in a distinct (but not necessarily contiguous) range of addresses without knowing ahead of time how much memory each process will allocate. That allows for some cool efficiencies.

      Of course, this is hardly the first time this has happened. Unlike the early days of 32-bit addressing, however, there's now a strong security motivation to "randomize" the addresses used by a process, and the processing cost of "relocating" an executable upon loading has become quite minor.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    301. Re:What Has Changed? by Anonymous Coward · · Score: 0

      For a desktop the 750GB example maybe fine, but the questions was about laptops. So it's more like 250GB to 8GB.

      And well, following your argument for our servers is a little more difficult too. That would mean 128GB*2=256GB where the hdds the datacenter installs are 50GB at max. So we would need to buy 5+ hdds (did I mention those are NOT cheap and we were explicitly asked by our customer to cut back on infrastructure costs, especially storage?) just for swap? :)

      That said, yes there was a memory subsystem once in linux, which would barf a lot in extreme situations, when not having twice as much swap as RAM, but these are past times ... Noone needs to waster space. Just think about how much pr0n you can store on the extra Gigabytes saved!

    302. Re:What Has Changed? by Anonymous Coward · · Score: 0

      100 millibytes? How is 0.1 bytes useful for anything?

    303. Re:What Has Changed? by jamonterrell · · Score: 1

      If your system was sluggish with 1GB ram, you were most likely thrashing (having to constantly swap what you're actively working on). In this case, your machine is memory STARVED, and an additional 1GB as you suggest is not sufficient. If you are actively using only about 25% of your memory at peak, you probably don't need swap. If you're actively using about 50% or more, you'd benefit from swap space so that it can swap out stuff that almost never gets used, freeing memory for disk swap. Further, if you're running linux, you should always have some swap, to store background junk that doesn't get used very often and freeing up the space for disk cache. It's almost impossible to have too much memory when you're using it for disk cache. What's the point of having something in your memory that you aren't using when it could save you from hitting the disk again (causing an additional seek) for some data.

      --
      I can count to 1023 on my hands. Ask me about #132.
    304. Re:What Has Changed? by Bert64 · · Score: 1

      Would need to be a pretty big battery to power all the ram, they were all 128mb strips and lots of them.

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
    305. Re:What Has Changed? by Antique+Geekmeister · · Score: 1

      That's exactly what I'm implying, for several reasons. The primary reason is that because actions that are 'atomic', such as database write operations, are not 'atomic' as far as the filesystem is concerned. So operations that affect one part of the database and have not yet written to another part of the database will be inconsistently available on disk. You've raised an interesting point, that dd'ing should be getting the data that has not yet been paged back to the disk from the page in RAM, not from the disk itself. That's a good point I'll have to think about.

    306. Re:What Has Changed? by Tacvek · · Score: 1

      Very odd. The recovery CD is worthless for re-installation, but is available for free download. It is worth having the recovery environment in some form just in case you lose the ability to boot into Vista. It should be possible to install it into a partition yourself, but if you don't have a spare partition that won''t work. It might be possible to install it alongside Vista in the same partition in the same way that the XP recovery console could be, but I don't have the details on it.

      Any which way, without a Dell Factory Image or a real Vista Install CD, you are absolutely correct that you would be hosed if you needed to re-install Vista for any reason.

      But Dell definitely should have had the Vista Recovery Environment pre-installed along with the dell factory image. Hmm quite odd that they didn't. I have no idea why.

      --
      Stylish sheet to fix many problems in Slashdot's D3: https://gist.github.com/801524
    307. Re:What Has Changed? by adolf · · Score: 1

      I used to maintain a proper, multiuser Linux box. It ran under a bench at work, and always performed every task we ever asked of it quickly and without complaint, from mail and IRC serving to remote X sessions with Netscape.

      It was a 486DX4/100 with 24 megs of RAM. Swap, I believe, was in the range of 50MB.

      Honestly, I don't see why anyone needs any more than that -- I don't really do any more stuff with a computer now, than we all did with that box, back then. You're really preaching to the choir.

      But on the other hand, my computer sure does work a lot faster with a couple (or more) gigs of RAM and a proper swap file, than it does pared to its bare essentials.

      So I guess, to answer your question: Time marches on. Computers get faster, have more RAM, do more stuff, cost less money. Software catches up with these new computers, over time, and grows to be as slow and bloated as the new machines are fast and efficient.

      Right now, RAM is relatively cheap for the benefit of having it. So, enjoy it while it lasts -- history has shown that it won't be that way forever. But swap is still much cheaper. And so, when one discusses the difference between 256MB, or 8, 16 or even 32 gigs of swap, we're talking about a couple of dollars worth of disk AT MOST. There's better (ie: more expensive) things to spend time optimizing than trying to minimize swap.

      So set the swap to be huge, and forget it. Spend the time you've saved by not worrying about it (time==money) on some more RAM or a good glass of beer or something.

    308. Re:What Has Changed? by Anonymous Coward · · Score: 0

      That said, whoever came up with the names gibibytes, mebibytes and kibibytes must have wanted us all to sound like we have a speech impediment or something, as the pronunciation for these sounds worse than baby talk

      They sound less babyish if you expand them further.

      GiB -> binary gigabytes (rather than gibibytes).
      Mib -> binary megabits (rather than mebibits).

      They sound more babyish if you contract this expanded version, although in English the prefixes become pronounceable at least.

      BiGBytes, BiTbits, BiMwords, etc.

      Oh all for want of a 10-bit byte at the dawn of the hobby computer era...

    309. Re:What Has Changed? by gullevek · · Score: 1

      Which means fdisk or Linux is wrong? Or the disk is wrong? Somehow the whole thing is very confusing to me.

      --
      "Freiheit ist immer auch die Freiheit des Andersdenkenden" - Rosa Luxemburg, 1871 - 1919
    310. Re:What Has Changed? by victor.zamanian · · Score: 1

      Yep. My desktop PC has 2 GiB of RAM, and I set my swap partition to 1 GiB. Whenever I look at gnome-system-monitor, the memory usage is always between like 10 and 25 percent, and swap usage is at a static 0 percent. All the time. Probably never swapped a byte in its existence. I don't do much else than code and download/play media, so I don't imagine it should consume a lot of RAM (which is one of the reasons I chose to use such a small swap partition); I guess it all depends on what you plan to do with your machine. All the best!

    311. Re:What Has Changed? by Snaller · · Score: 1

      (Reposted to combat stupid children who mod everything as troll)

      "Yeah, your 256MB of space was trivial when you had a 30GB hard drive ... and 8GB of space is still trivial with a 750GB hard drive. "

      Its trivial if YOU buy us one.

      --
      If Google really cared they would fix Android Chrome to reflow text, instead of discriminating
    312. Re:What Has Changed? by dfn_deux · · Score: 1

      There is no accurate standard by which the long term actual performance and reliability of these new SSD devices are measured. I've personally burned out SLC and MLC disks in a matter of weeks by throwing large numbers of very small writes at them. The wear leveling algos don't help much and any small writes are going to hit the "write amplification factor" due to the way that flash memory has to write an entire block if even a single bit is shifted. The advice of the GP is pretty solid as atime, tmp files, and swap space are the single largest offenders of numerous sub block sized writes which are amplified by the block size of the underlying flash.

      --
      -*The above statement is printed entirely on recycled electrons*-
    313. Re:What Has Changed? by dfn_deux · · Score: 1

      dd is just as good a tool now as it has ever been. Your arguments while valid only encompass a small subset of the use cases. Additionally you are presenting a straw man by mentioning that the data on disk isn't going to match the active database since it is kept in memory. It is just as accruate to say the same thing for ANY backup operation which uses the disk as a source; which is to say that the the "complex and service interrupting steps" of blocking new changes, flushing, and syncing will be required regardless of what tool you are using.

      --
      -*The above statement is printed entirely on recycled electrons*-
    314. Re:What Has Changed? by Antique+Geekmeister · · Score: 1

      Would you mind if I take your paragraph apart? > dd is just as good a tool now as it has ever been. Yes, this is true. It hasn't changed noticeably. > Your arguments while valid only encompass a small subset of the use cases. It's a surprisingly large set, in particular the wasteful of duplicating the unused and unlinked and occupied by old random bits parts of the disk. They don't compress well, they slow down transfers, etc. > Additionally you are presenting a straw man by mentioning that the data on disk isn't going to match the active database since it is kept in memory. This is not a straw man. It's a critical part of backup. I've encountered many new, excited admins who entirely neglect it when planning backup solutions, believing that 'dd' will handle their problems because people recommend it without explaining the dangers. > It is just as accruate to say the same thing for ANY backup operation which uses the disk as a source; which is to say that the the "complex and service interrupting steps" of blocking new changes, flushing, and syncing will be required regardless of what tool you are using. This is true. However, in addition, backing up with 'dd' does not allow you to exclude the potentially damaged raw data. And because dd is so relatively slow due to backing up all the unused contents of the partition and potentially useless files as part of it, that locking step becomes longer and even more painful to handle. There are ways to make it work: using a snapshot-capable system, such as LVM, allow one to sync the data and snapshot it and dump _that_ with dd. But it requires a lot more thought and work for which the expense could go to a larger tape drive or other, more generally useful tool.

    315. Re:What Has Changed? by tzot · · Score: 1

      The disk devices, as presented by the Linux kernel, are block devices and they go through the buffer cache. If you want (on Linux) to access a block device as a raw device, you should use the raw(8) command to bind the block device to a raw device, and then you have to obey alignment restrictions (much unlike various Unixen raw devices, available by default).

      But in no OS (that I've seen and differentiates between raw and block devices) raw devices can be mounted.

      --
      I speak England very best
  2. None by Anonymous Coward · · Score: 0

    I haven't made a swap partition in years. I've got 2GB; if that's not enough, then one of the processes is leaking memory like crazy and using a swap partition is just delaying the inevitable. If you ever do need to use extra memory, you can always make a swap file (not partition)

    1. Re:None by compro01 · · Score: 3, Interesting

      Delaying is largely the point as I see it. If you're out of ram and it's eating into the swap, things are going to slow to a crawl and you'll know something is wrong, so you can look for, find, and kill whatever is running amok before it consumes all and triggers a panic/BSOD/etc.

      --
      upon the advice of my lawyer, i have no sig at this time
    2. Re:None by hey! · · Score: 4, Informative

      Well, I do occasionally need more than 2GB of RAM, without there being a memory leak. I've been running GIS programs, an IDE, a couple of RDBMSs, and then I fire up the old compression program...

      Which brings me to my point. The question "how much swap do I need" is probably meaningless, even for a given amount of memory. There are people who find 2GB with no swap fine, and others, like me, who probably could get by with 2GB of RAM and maybe 512MB of swap, and others who might need more.

      I think the 2x RAM rule of thumb has one virtue: excepting certain exotic kinds of systems, it's fairly safe that anybody who finds themselves needing more than that is probably feeling a world of pain that can only be fixed by getting more RAM. On the other hand, in most cases 2x RAM amounts to a trivial amount of disk. Probably most people could get by with 25% of RAM, but the value of thinking about whether that is true for you is very likely less than the cost of the disk space.

      Common sense applies. If you have some kind of scientific computing device with a gazillion bytes of RAM, your swap requirements might not be related to your maximum RAM requirements at all. If you're running some kind of operating system that launches a bunch of rarely used garbage, you probably ought to think about your swap. I had awful problems with Vista until I figured out the page file Windows created had something like eight thousand fragments. I was actually better off getting rid of the page file

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    3. Re:None by TheDreadedGMan · · Score: 1

      yeah, I used to follow the rule, then with the upgrade from 1GiB to 2Gib, I changed my rule to 1x so a 2GiB swap..

      Then just last month I got annoyed with the whole idea of swapping and just disabled my Windows XP page file and seeing that my peak only ever hits roughly 1GiB (this is with SQL Server Management Studio, Visual Studio .NET 2003 *and 2005*, Firefox 3, IE7, Outlook 2003, Excel 2003, and a few other programs, all at once)
      So far I've been pretty safe (never had a BSOD or out of memory error yet)

      So to summarize if you really run lots of large apps, maybe you should have a swap file.. (if you can't afford some cheap memory,)
      if you want windows performance to be "snappy" disable your page file... I have yet to test linux, but I would assume it's similar, you can just disable the swap file and get slightly improved performance.

      Anyway, my personal opinion is that Virtual memory is a hold back from the $20 a MiB pricing from the old days of RAM.. these days at $20 a GiB (or much less) it's just a 32bit problem I guess...

    4. Re:None by pasamio · · Score: 1

      Linux will typically run the OOM killer and identify which process is the 'baddest' and kill it to free up memory. Windows might crash but it does that normally anyway.

      --
      I always wondered where this setting was...
    5. Re:None by Rich0 · · Score: 1

      I have a swap file of about 5X RAM - I certainly don't use it all but I do sometimes use quite a bit of it.

      The reason is tmpfs. Junk that I don't need to persist always goes in tmpfs - which speeds up lots of stuff. At worst it gets swapped out to disk opportunistically, but the fact that the kernel knows that I don't really care about it at all means that it can take full advantage of ordered writes / caching / etc.

      I also run gentoo - which means that I'm often doing compilations, which generate tons of files that I don't care about long-term. Those go in the tmpfs. For most software it probably never hits disk, but if I'm compiling firefox or whatever the swap comes into play. Performance is better than just compiling on disk - since a file that gets created and deleted 60 seconds later may never hit the disk at all.

      But, gentoo users are a bit of a special case there. Most people don't generate large numbers of transient files.

    6. Re:None by usasma · · Score: 1

      Swap file size doesn't have any strict correlation to your physical RAM. Some systems can work just fine without them, others will insist upon one. This is also affected by the amount of physical RAM that you have - the less RAM, the more frequently the system will have to rely on the swap file. It depends on how your system utilizes the swap file, and how the programs that you have installed use it. The only "sure" way to tell is to monitor swap file usage to see what the maximum value is.

    7. Re:None by Anonymous Coward · · Score: 0

      yeah, I got 2GB of RAM and my computer never uses more than 1.5GB. So I turn the swap file off (for some odd reason, Windows will write to the file and slow down the computer if I have a swap file when switching between tasks). I run some of the newest games, photoshop, Visual Stuido, and browse around the web.

    8. Re:None by markdavis · · Score: 1

      That is not necessarily true at all. Linux likes to use swap even when there is plenty of RAM, since it can free it up for something more useful, like disk buffering. Anyway, you can be running out of RAM and eating into swap space and operate at nearly normal speed. It depends on how many processes are actively running, and what they are all doing. Swapping is not a bad thing. Excessing swapping to the point of "thrashing", is, however. In that case, actively running programs are competing for more memory and there isn't enough physical memory to satisfy them, even after buffers are reduced and everything inactive is already swapped out.

      Now, if there is a BROKEN program that is gobbling up all the memory, yeah, it will always be a problem, since it will eventually consume everything, anyway.

      It is unfortunate that most *ix systems don't handle running out of [physical+swap] memory very well.

    9. Re:None by ozphx · · Score: 1

      Having pages on disk means you can use RAM for other things, such as disk cache. This makes sense when you've got "MemoryHungryAppYouArentUsing" minimised, and are using a program thats using half your RAM, and hitting a bunch of files on disk.

      --
      3laws: No freebies, no backsies, GTFO.
    10. Re:None by swilver · · Score: 1

      Not even Windows crashes from out of memory conditions anymore these days. It will also kill the process deemed most offending and continue.

  3. I'm no expert, but... by Redlazer · · Score: 1
    I'm not sure anymore, but I don't think "double your ram" is really necessary anymore. The size of programs is not increasing at the same rate as our RAM - now we could easily house most programs entirely in RAM (including most of the OS), so I doubt its REALLY necessary.

    For what its worth, I've noticed a lot of databases (Oracle especially) insists on insane levels of swap space on the swap partition.

    So, yeah. I'd go with = your ram, and if you experience problems, run gparted and grow the partition a bit. But, I can't imagine any real problems from a 4gig partition.

    -Red

    --
    Guns don't kill people, "with glowing hearts" kills people.
  4. Definitely not twice... by 42forty-two42 · · Score: 5, Informative

    The origin of the 'twice real RAM' came in the early days of windows, in which windows could not use any swap unless you had at least as much as real RAM. That's been gone for ages now - and you should actively avoid too much swap.

    If you allocate, say, 8G of swap for 4G of RAM, most of the time almost all of it will go unused. If it actually /is/ used, your machine has probably spent the past hour or so frantically swapping to try to accomidate this 12G request; ie, your system is completely unresponsive due to every program being mostly swapped out. The additional swap merely delays the out of memory event, and in the meantime you can't control the machine.

    Swap is still useful for holding data that's not part of the working set, in order to free memory for cache; but this shouldn't be very much RAM (256-512mb should be enough). It's also useful for software suspend on linux - if you have a laptop, make it a little bit larger than physical RAM. And always have /some/ - linux's memory manager doesn't like having none.

    1. Re:Definitely not twice... by pete-classic · · Score: 5, Insightful

      your system is completely unresponsive due to every program being mostly swapped out.

      Uh, report this to your vendor as a bug. No amount of swap space should cause your system's memory manager to make such lousy decisions.

      And, in fact, having an "unreasonable" amount of swap can actually pay off. If your system can swap out really stale memory to disk and use the RAM to cache stuff on disk that you might actually want, you're going to see a really big performance gain.

      -Peter

    2. Re:Definitely not twice... by Anonymous Coward · · Score: 0

      I've always used 1.5 X (memory size) so 2GIGS: 1.5 * (2048) = 3072mb pagefile

    3. Re:Definitely not twice... by 680x0 · · Score: 1

      No, if a program requests 12GB, and your machine doesn't have that much (RAM + swap) space available, the allocation will fail. If the program is smart and checks the allocation return value, it will tell you it's unable to do whatever it was trying to do. If it isn't smart, it'll likely try to access the space pointed to by NULL, and crash.

    4. Re:Definitely not twice... by Bryansix · · Score: 1

      Not quite there. I have a server that runs SQL and IIS on the same box and it's running a .net website with over a million lines of code in it. I had to bump up the Swap a lot even though the box has 8 Gigs of RAM. (Yes it's 64-bit)

    5. Re:Definitely not twice... by Anonymous Coward · · Score: 0

      i'm running a macpro with 6GB of RAM here..

      i have several big applications running all the time (like photoshop) and several webbrowsers that eat RAM like no tomorrow (usually safari, firefox and opera at 300mb each, but recently safari grabbed 1.2GB - not funny)

      swap file after 5 days of uptime is about 3GB, but i rarely get any slowdown due to swapping.

      just some points of data to the pool.
      ++ chris

    6. Re:Definitely not twice... by thePowerOfGrayskull · · Score: 1

      THe problem is that - much like Windows - linux swaps waaaay to early. It will swap out the working set of applications I was just using minutes ago if I start doing a large file copy operation - which means that it's swapping out /needed/ memory in exchange for /potential/ gains.

      I dunno - I just turn off swap on Windows and Linux both. System remains responsive with no churning. I don't have memory issues, though I do have to pay a little more attention.

    7. Re:Definitely not twice... by Anonymous Coward · · Score: 0

      I have to agree with the GP, at least for my mode of operation. If you've got really stale memory, you probably have an application that is leaking memory or otherwise should just be shut down.

      When I write programs that use a large amount of RAM, it can be easy to have a bug (or user error) that causes just a little too much memory to be used and all other applications and most of the OS get swapped out, making the system unresponsive (often for several minutes). This happens for me with both Windows and Linux. Even killing the offending application can take some time as the OS code for killing it has been swapped out.

      For me, I'd like a little bit of swap space so that things don't suddenly die if I need to start using virtual memory, but if too much VM is being used, I'd prefer the big application just die quickly (since I'm going to have to kill it anyway).

      So, I tend to have a max swap file of 1-2GB on a machine with anything between 1GB to 32GB of RAM.

    8. Re:Definitely not twice... by Reziac · · Score: 1

      The "how much swapfile" question is the oldest troll in the book :)

      However... since I'm here anyway...

      On machines with more RAM than Windows reasonably uses, ie. over 512mb, I've been running without ANY swapfile for the last 10 years, or with only a very small swapfile when some braindead app insists on it (the only things I've encountered with this issue are Photoshop plugins). Performance is better and nothing else gripes about it.

      Hmm.... How much does linux really need? Can its swap function be turned off entirely, on systems with RAM exceeding its needs? if so, how does one do that?

      --
      ~REZ~ #43301. Who'd fake being me anyway?
    9. Re:Definitely not twice... by Anonymous Coward · · Score: 0

      > Uh, report this to your vendor as a bug. No amount of swap space should cause your system's memory manager to make such lousy decisions.

      Uhm... you never saw a program that actively tries to use twice the amount of physical memory, have you?

      In that situation, the program (or a set of programs) is really using all of its virtual memory;
      like using it as a gigantic hash table, or to store intermediate results of a calculation.

      There is little that a memory manager can do; all memory pages are needed in a short amount of time!
      So it must swap like crazy.

      It happened to me several times... I would be happy to give you a real use case if you are interested.

      Cheers,
          Igor

    10. Re:Definitely not twice... by Carnildo · · Score: 1

      And always have /some/ - linux's memory manager doesn't like having none.

      My desktop system has 8GB of RAM, so I've been running for the past year without swap. What sort of bad things have I not been noticing?

      --
      "They redundantly repeated themselves over and over again incessantly without end ad infinitum" -- ibid.
    11. Re:Definitely not twice... by kelnos · · Score: 2, Informative

      It's tunable on Linux at least... you can set /proc/sys/vm/swappiness to something between 0 and 100 -- default is 60, lower values make the VM swap less aggressively. Not useful for average users, but we can handle it.

      --
      Xfce: Lighter than some, heavier than others. Just right.
    12. Re:Definitely not twice... by ShieldW0lf · · Score: 1

      It's also a good idea to have multiple smaller drives rather than one large drive. If you set up multiple swap partitions on independent disks and give them all the same priority level, the kernel will interleave it's swapping between them and function like a RAID-0. I've got 4 80G drives on my development box, with a 1.5G swap partition on each drive, 4 192MB boot partitions and a RAID-10 filling up the rest. I'm not a benchmark junkie, but it's pretty fast.

      --
      -1 Uncomfortable Truth
    13. Re:Definitely not twice... by 42forty-two42 · · Score: 1
    14. Re:Definitely not twice... by AaronLawrence · · Score: 1

      Indeed. While hard drive space is 100-1000 times what it used to be, the speed is only about double or triple. So in terms of useful, responsive swap space you can only use a little bit more than you used to.
      Using (say) 8GB of swap is much, much slower than using 256MB of swap.

      --
      For every expert, there is an equal and opposite expert. - Arthur C. Clarke
    15. Re:Definitely not twice... by Anonymous Coward · · Score: 0

      By following the 2x swap idea, most people will end up with 8, maybe 12 GB worth of swap space. Having too much swap is almost never a bad thing, but having too little can cause problems. If you are a moderate power user, you can probably get by most of the time on 4GB of RAM without even touching swap. Why would you want a system that paged all of the time anyway? I manage an AIX database server with 64GB of memory and it only uses ~300MB of swap under load.

    16. Re:Definitely not twice... by zippthorne · · Score: 1

      Yeah that's been my experience, too. All I ever read about is how swap is supposed to improve things and at least not-hurt-things.

      But all I ever hear is the clickity-clack of the heads seeking a new track while whatever I'm working on gets swapped out and back in again.

      To be fair, I've started using swap on Ubuntu again, and haven't seen any performance hits lately. Windows XP on the other end of the disk, however, will not be allowed to use pretend-RAM under any circumstances.

      --
      Can you be Even More Awesome?!
    17. Re:Definitely not twice... by Anonymous Coward · · Score: 0

      then imagine what happens when you load that 2.5gb photoshop (or gimp, choose your posix) back into physical ram. you're waiting at least 45 seconds to swap the least used physical ram to disk and load the virtual memory to real. of course this can be defeated by putting swap on a fast drive (raided 15k scsi drives or a flash drive)

    18. Re:Definitely not twice... by peter · · Score: 1

      I've found that the default swappiness = 60 was bad if you're running a bittorrent client on your desktop. When I came back to the computer, programs like firefox would always be swapped out and take > 10 seconds to get going. It was a couple years ago that I started setting swappiness = 30 or 10, so I don't know if Linux has changed any. Anyway, p2p filesharing makes Linux think it's a good idea to cache files for what should be low priority I/O, at the expense of your desktop.

      Hmm, I wonder if ionice affects Linux's desire to push other things out of memory to cache files...

      --
      #define X(x,y) x##y
      Peter Cordes ; e-mail: X(peter@cordes , .ca)
    19. Re:Definitely not twice... by prefect42 · · Score: 1

      Define lousy decision. If I've got a single batch job that wants all physical memory and then some, and I've got some pesky interactive tools in memory that I'm not currently using, they get paged out. When I come back to use firefox, I'm in for a big wait.

      --

      jh

    20. Re:Definitely not twice... by Anonymous Coward · · Score: 0

      but this shouldn't be very much RAM (256-512mb should be enough).

      Yes. - And how much does 512 MB RAM cost today? $4?
      What about spending $20 more on RAM and just forgetting the whole paging/swapping bullshit completely?

    21. Re:Definitely not twice... by Drawsalot · · Score: 1

      I've got one very fast drive partitioned (80GB- 2x40GB) for dual boot, but I like my multiple drives BIG-- 4x500GB!! I set my paging file to 2048, my PC has 4GB installed -32-bit XP I know will only see 3GB :p Of course the 500's aren't all that slow really.

    22. Re:Definitely not twice... by thePowerOfGrayskull · · Score: 1

      Good to know, thanks.

    23. Re:Definitely not twice... by swilver · · Score: 1

      Memory managers do make louse decisions. Perhaps not in the case illustrated by the parent, but definitely in other ways. Best example are virus scanners. They scan every file over night, usually in a fairly slow fashion to not stress the I/O system too much. Memory managers will try and help out and swap out as much programs as possible in favor of the disk cache. Unfortunately, the memory manager does not realize this data is only accessed once (or is simply too much to complete cache for a second run of said virus scanner).

      And that's something most people simply forget. Caching is ONLY effective if the data is:

      1) Actually used more than once before it is discarded again.
      2) Requested fast enough for it to become a bottleneck.

      Examples of 1: Virus scanners, watching a large movie, copying large numbers of files. Is it likely any of those actions will benefit from caching because you might do it again right after performing that action?

      Examples of 2: Any process that requests data in a slow but consistent manner. Uploading/downloading files, watching a movie, playing music files, a well-behaved virus scanner. All of these consume data at a speed that is below your maximum disk speed, in other words, the disk is not a bottleneck. The only reason to cache could be that this data might be needed again at higher speeds, but how likely is that to be the case? Does it really help that if I listen to an MP3 twice in a row that it is cached the second time?

    24. Re:Definitely not twice... by Anonymous Coward · · Score: 0

      It's also useful for software suspend on linux

      Don't you mean hibernate?
      Suspend keeps everything in RAM and powers down everything else, just leaves some power going to RAM since it's volatile...

    25. Re:Definitely not twice... by Anonymous Coward · · Score: 0

      That wasn't a Window's limitation, that was a Solaris limitation back in the days before Windows even knew what swap was.

  5. What Oracle Wants by stoolpigeon · · Score: 4, Informative

    If you were running Oracle - here is what they recommend:
        RAM -> Swap Space

        1 GB - 2 GB -> 1.5 times the size of RAM
        2 GB - 8 GB -> Equal to the size of RAM
        more than 8GB -> 0.75 times the size of RAM

    I don't know if this would carry across to general computing - it seems to me if it's enough for an Oracle RDBMS server, it ought to do it for most things.

    --
    It's hard to believe that's how Micronians are made. Why don't we see it right now by having you both kiss one another?
    1. Re:What Oracle Wants by RiotingPacifist · · Score: 2, Informative

      for a server thats probably about right, on a desktop where stability is not quite as important id go with about half that

      --
      IranAir Flight 655 never forget!
    2. Re:What Oracle Wants by rjstanford · · Score: 1

      That gets truly bizarre though.

      Let's say that I have a machine with 4GB ram (and a 4GB swap partition). I never run out of memory, but I do see times when swapping is causing performance issues.

      I choose to - without changing the machine's processing load one iota - install another 4GB of chip ram to fix the swapping problem. Instead of having 8GB of memory (half fast, half slow), I now have 12GB of memory (2/3 fast, 1/3 slow).

      If I then remove my swap partition completely, I'm back to my original 8GB of available memory, but instead of being half fast and half slow, its all fast.

      WTF do I then magically need another 8GB of slow memory in the form of a swap partition?

      --
      You're special forces then? That's great! I just love your olympics!
    3. Re:What Oracle Wants by Anonymous Coward · · Score: 0

      Unless your running the 11g client for some reason it wants 12 GB of swap

    4. Re:What Oracle Wants by at_slashdot · · Score: 1

      One caveat, if you use hibernation you need a swap partition at least equal to the size of your RAM,

      --
      "It is our choices, Harry, that show what we truly are, far more than our abilities." -- Prof. Dumbledore
    5. Re:What Oracle Wants by Fulcrum+of+Evil · · Score: 1

      WTF do I then magically need another 8GB of slow memory in the form of a swap partition?

      Slow memory is better than no memory - it's not like you're going to use swap until ram gets short.

      --
      "We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
    6. Re:What Oracle Wants by BigBadRich · · Score: 1
      Yep, that's what they recommend. Let's select a random node from one of my clusters here. Each node has 3sGb of RAM, and runs linux.

      Top output:

      Mem: 33285824k total, 28389184k used, [...]
      Swap: 30736352k total, 50592k used, [...]

      So you can see that even with 32Gb of RAM, a node in an 8-node cluster is not swapping even close to 1Gb). That's a LOT of wasted disk space.

    7. Re:What Oracle Wants by Anonymous Coward · · Score: 0

      Oracle is a very specialized workload - and the workload, and kernel swap / paging thresholds / activity are going to determine the amount of swap ultimately required.

      E.g., Oracle on Solaris, will have a very conservative swap requirement, as Oracle is fairly good at managing its own memory allocations (because the DBA tells it how much it can have), and Solaris will only start to throw pages out when it is really low on RAM.

      On the other hand, general workload handlers like the linux kernel and Windows kernel, tend to throw pages out much more agressively - mostly because of a more vairiable workload. The idea is to be 'ready' for new applications to start up, by having lots of free memory around. This situation is a bit bizarre, because adding more swap can actually make the system perform less well under certain circumstances (like walking away from your machine for a while).

      So, how much swap do you actually need? Short answer is enough so that you don't run out of memory. You have to figure out your workload, and then figure out how much swap you need.

      Oh, and often times you will need as much swap as physical RAM to be able to do a proper core dump. The real trick is that often you must have a particular kind of swap for this to work (e.g. on Windows you need it on the C: drive, and you need enough space for the core dump file). This can be a major pain if you have a server that is crashing, but you can't get core dumps because you were too aggressive with slicing up the OS volumes.

    8. Re:What Oracle Wants by Anonymous Coward · · Score: 0

      What a stinking pile of crap Oracle is though, really. Truly magnificently awful.

    9. Re:What Oracle Wants by illumin8 · · Score: 1

      If you were running Oracle - here is what they recommend:
              RAM -> Swap Space

              1 GB - 2 GB -> 1.5 times the size of RAM
              2 GB - 8 GB -> Equal to the size of RAM
              more than 8GB -> 0.75 times the size of RAM

      I don't know if this would carry across to general computing - it seems to me if it's enough for an Oracle RDBMS server, it ought to do it for most things.

      The Oracle recommendations as a general rule are good, however, I've recently been deploying Oracle RAC nodes with 64GB of memory each, and I'm wondering if 48GB of swap is overkill. I think in the next few months I'll be deploying nodes with 128GB of memory and I'm pretty sure 96GB of swap is not necessary. At a certain point, don't the rules break down?

      The reason this becomes an issue is that I only have a pair of 146GB drives for root disks (mirrored) so you start to run out of space for Red Hat, Oracle, and the other software that should normally be on root.

      --
      "When the president does it, that means it's not illegal." - Richard M. Nixon
    10. Re:What Oracle Wants by rjstanford · · Score: 1

      Slow memory is better than no memory - it's not like you're going to use swap until ram gets short.

      Then why didn't you need more than 4GB of swap in the previous example? My point was that you started out with 8GB of available memory. You still have 8GB of available memory, but its faster. Why do you suddenly need 12GB (or 16GB) when you never did before?

      --
      You're special forces then? That's great! I just love your olympics!
  6. Which OS? by antdude · · Score: 0

    Linux? Windows? Mac OS X?

    --
    Ant(Dude) @ Quality Foraged Links (AQFL.net) & The Ant Farm (antfarm.ma.cx / antfarm.home.dhs.org).
    1. Re:Which OS? by Anonymous Coward · · Score: 2, Funny

      How many Windows users do you know with a swap partition?

    2. Re:Which OS? by Vectronic · · Score: 1

      I have one, although it doesnt work as a swap partition as in linux (et al) it's just a partition that holds the pagefile.sys(s) for my various Windows installs (2 XP, 1 Vista) and the only other partition on that HD is my "Downloads" partition, so if im not downloading, any paging that is done has a HD to itself to play with.

    3. Re:Which OS? by Guy+Harris · · Score: 1

      How many Windows users do you know with a swap partition?

      Probably about as many Windows users as OS X users; both of 'em use a file/files as backing store for anonymous pages. (You could probably arrange to have those files on a separate partition, as per Vectronic's comment.)

    4. Re:Which OS? by Anonymous Coward · · Score: 0

      All Windows users I know, who asked me to make their systems faster and more reliable NOW have swap partitions.

  7. Depends on what you are doing by ChienAndalu · · Score: 1

    I'm not an expert, but I'd say that depends on what you are doing. At some point your applications won't be able to allocate new memory. So if you do hidef video editing, extra swap *could* be useful.

    I have 1GB of RAM and no swap partition, and I don't remember ever having trouble with firefox-surfing, watching video or gaming. That said I don't use KDE or Gnome but a minimalist window manager.

    1. Re:Depends on what you are doing by IhuntCIA · · Score: 1

      I'm using Windows XP with disabled swap file(s) for 3 years now. I did not have any problems playing Anarchy Online, World of Warcraft, Spellforce the order of Dawn. Other software that I use does not need much RAM, I am OK with 1 GB of RAM for now.

      RAM is really affordable right now, and buying a new PC with 2+ GB is must have. I see no point in Swap file, at least for average home user / gamer.

  8. 4 gigs? by Anonymous Coward · · Score: 0

    Guess what... you probably could get away without ANY swap! How often are you planning on using more than 4 gigs of RAM?

    1. Re:4 gigs? by ozphx · · Score: 1

      Heard of disk caches and prefetch?

      8 gig of RAM fkn rules, its cheap as hell and Vista barely touches the disk until I use an app I haven't run in a while.

      --
      3laws: No freebies, no backsies, GTFO.
  9. More sensible suggestion... by Vexler · · Score: 4, Informative

    Reading through OpenBSD's FAQ:

    "The 'b' partition of your root drive automatically becomes your system swap partition. Many people follow an old rule of thumb that your swap partition should be twice the size of your main system RAM. This rule is nonsense. On a modern system, that's a LOT of swap, most people prefer that their systems never swap. You don't want your system to ever run out of RAM+swap, but you usually would rather have enough RAM in the system so it doesn't need to swap. If you are using a flash device for disk, you probably want no swap partition at all. Use what is appropriate for your needs. If you guess wrong, you can add another swap partition in /etc/fstab or swap to a file later."

    HTH.

    1. Re:More sensible suggestion... by sofar · · Score: 1

      yes, well not entirely

      you want a LITTLE BIT of swap in all cases.

      - for netbooks (asus eee pc) I recommend 128mb of swap (max).

      - for most laptops up to 256mb swap is more than enough.

      desktop swap size may be bigger depending on your personal needs. If you gimp gigantic images, use more.

    2. Re:More sensible suggestion... by ColaMan · · Score: 1

      Sorry, your attempt at being authoritative has completely failed for me. You can't just throw out statements like this without at least trying to back them up with facts (or at least plausible assertions).

      you want a LITTLE BIT of swap in all cases.

      Why? A little bit of swap does SFA if some big memory-hogging app gets loaded.

      for netbooks (asus eee pc) I recommend 128mb of swap (max).

      Why? With a SSD that has speedy reads and sluggish writes, you might as well not have it and just get more physical ram if you find your apps keep getting suddenly terminated.

      for most laptops up to 256mb swap is more than enough.

      Why? With 2GB of ram becoming more common on laptops, an extra 10% does SFA.

      --

      You are in a twisty maze of processor lines, all alike.
      There is a lot of hype here.
    3. Re:More sensible suggestion... by Anonymous Coward · · Score: 0

      Most single user computers don't swap all that much since people buy enough RAM to prevent it. Large amounts of swap (ie. virtual memory) is good for large multiuser systems where you have lots of idle users and idle processes. This is not the typical case anymore. Keep swap to a minimum on single user computers.

    4. Re:More sensible suggestion... by zippthorne · · Score: 1

      If you gimp gigantic images, use more.

      If you can't fit the whole thing in memory, then what's the point of loading it off the disk, through memory, and back onto the disk again?

      --
      Can you be Even More Awesome?!
    5. Re:More sensible suggestion... by John+Hasler · · Score: 1

      With Linux you want at least a little bit of swap under most circumstances because the kernel works better with it (no, I don't know why, and yes, this may have changed recently). I agree that you probably want no swap on an SSD-only system.

      --
      Warning: this article may contain humor, sarcasm, parody, and perhaps even irony. Read at your own risk.
    6. Re:More sensible suggestion... by Anonymous Coward · · Score: 0

      What all of those swap naysayers out there with gazillions o-bytes of ram need to realize there is an aweful lot of memory used just once for program initialization and the like that will never be referenced again. Even if you have tons and tons of memory having a reasonably intelligent operating system page unused memory segments to disk leaves more room for I/O and disk caches. This can have a significant impact on overall system performance even if your applications never come close to exhausting real memory.

      There are valid reasons not to use swap files (security, reliability against failing disk drives) but doing so for performance reasons is ususally a bad idea.

    7. Re:More sensible suggestion... by ari_j · · Score: 1

      Ah, yes. OpenBSD, home of many a humble opinion.

    8. Re:More sensible suggestion... by sofar · · Score: 1

      you actually pointed out the right thing. Linux on itself does work better with a little bit of swap because it gives the VM just the opportunity to page out really old data. This will in the long run result in a few more megabytes of data being available for buffers/cache while it's unlikely that hot items are constantly being swapped out.

      it also gives the VM at least ONE alternative to killing a task immediately when it really goes near OOM. Without that alternative the system would immediately grind to a halt.

      even on netbooks this story holds. it's still good to have a little bit of swap on them.

    9. Re:More sensible suggestion... by sofar · · Score: 1

      you'd provide a storage for the VM to put other things into that are less important than the image data, such as other program data that is currently not in use.

      if you use images larger than your system memory, all bets are off :)

  10. Just test? by rasteri · · Score: 4, Informative

    Just make a note of your virtual memory use every hour or so (or just whenever you remember) for a few days/weeks. Then just give yourself maybe 2-3 times the peak usage.

    I imagine different people will need different amounts of swap space, so use a size that's right for you.

    1. Re:Just test? by Anonymous Coward · · Score: 0

      In Windows you can do this automatically using perfmon. In UNIX you can use cron and vmstat.

    2. Re:Just test? by MarcQuadra · · Score: 1

      In addition to this, there's absolutely no need to use a swap 'partition' when you can use a swap file.

      I have 4GB RAM, but I've never -used- more than 200MB of swap, so I have a 1GB swap file in /var/swap

      Here's how I made it:

      #dd bs=1m if=/dev/zero of=/var/swap count=1024

      #mkswap /var/swap

      .

      Works like a charm, and I can change the size on-the-fly by using #swapon and #swapoff.

      --
      "Sometimes, I think Trent just needs a cup of hot chocolate and a blankie." -Tori Amos on Nine Inch Nails
    3. Re:Just test? by petermgreen · · Score: 2, Informative

      Remember to set permissions on swapfiles, letting any user read them is not a good idea as they may end up containing sensitive information (e.g. passwords).

      --
      note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
    4. Re:Just test? by crocodill · · Score: 1

      I disagree. I think people should use a swap size that is wrong for them.

  11. If you need crashdumps, same rule applies by bugg · · Score: 4, Informative

    If you're debugging your kernel or are helping people to debug your kernel, and are generating crashdumps either manually or as a result of kernel panic, you need your swap to be twice as big as the memory so it all fits comfortably (You can probably get away with X times bigger, where 1X2, but 2 is a safe number).

    To my understanding that's always been the reason for the rule of thumb about doubling the memory. If you can afford the disk, go for it, because you never know when you might hit a panic and need crashdumps. If you are in a live environment and are sure you will never, ever need or even want crash dumps, and the disk space is at a premium, you can size it based on need.

    Another thing to keep in mind is that as you have more ram, you have more pages, and the whole point of swap is to get pages to disk as well in case you need to free up physical ram quickly.

    --
    -bugg
    1. Re:If you need crashdumps, same rule applies by allenw · · Score: 1

      On some operating systems (Solaris comes to mind), the crash dump is stored in swap compressed, so 2x may still be overkill even if you are doing crash dump testing.

    2. Re:If you need crashdumps, same rule applies by multipartmixed · · Score: 2, Interesting

      There's other reasons for big swap, on Solaris though. (I don't know about other OSes, don't use 'em much).

      One, which recently bit me in the foot, has to do with forking. The system basically pre-allocates swap against process space size (vm size, not rss), even though the pages may not actually get physically allocated. This is because the kernel wants to make sure that when you want to write to the memory, it's going to be able to allocate pages in the VM for you to write to -- remember, we're forking so we're doing copy-on-write.

      I bumped into this a few months ago retrofitting a bind-listen-accept-fork daemon to make use of a 200+ MB data structure which was populated into the parent and read in the children. Even though I had plenty of swap "free", the OS had enough of it bookmarked for use in case I wrote to it that it refused to fork all the children I needed.

      For the curious, the solution to my particular dilemma was to write my own [trivial] allocator backed by mmap; IIRC I used MAP_NORESERVE | MAP_SHARED to convice Solaris not set aside excessive amounts of swap [excessive because I had knowledge the OS didn't] and allow my program to fork enough times to handle the requisite load.

      --

      Do daemons dream of electric sleep()?
    3. Re:If you need crashdumps, same rule applies by allenw · · Score: 1

      Correct. Solaris does not support memory overcommit. Linux does, not sure about others.

    4. Re:If you need crashdumps, same rule applies by alcourt · · Score: 1

      Too small swap partitions is the bane of my existence right now, and might help explain how an application is causing me to run out of swap space on Linux every week.

      We're not even at one tenth of eventual application dataset size, and we've exceeded the RAM capabilities of Linux and the application design.

      It doesn't help that as Linux finally joins the ranks of modern operating systems and you can use the swap device to write kernel panics, that you need a little more than RAM as swap (assuming you don't tweak the dump parameters from the default, but then again, this is Linux, not an enterprise ready OS.)

      --
      "I may disagree with what you say, but I will defend unto the death your right to say it." -- Voltaire
  12. 1x System RAM by dopaz · · Score: 1

    I normally make the swap file the same size as the memory. If you're using more than twice your physical memory, you need to upgrade.

    When I used FAT32 I made sure the swap file was at the beginning of the hard drive, but my NTFS defragger doesn't let me fine tune file placement like that.

    1. Re:1x System RAM by Anonymous Coward · · Score: 0

      One of my friends used a separate partition at the beginning of the drive for a swap file.

  13. 256M by bluefoxlucid · · Score: 1, Informative

    If you need more than like 512M of swap, you need more physical RAM.

    Seriously though, maybe like 10% of your physical RAM; but if you reach a point where you need to access a lot of swap in a short time (say a graphics intensive program, or a Web browser that has 2 gigs relevant data in swap), your machine will slow to a crawl.

    This is why I use like 128M swap and swapd on Ubuntu.

    1. Re:256M by Drinking+Bleach · · Score: 1

      swapd sounds very interesting, thanks for mentioning it. I currently have 1GB of RAM and almost never swap; the swap partition is only 1GB, but it'd be nice to get rid of it :)

    2. Re:256M by Anonymous Coward · · Score: 0

      I've never understood the 2x rule. The less RAM you have the more swap you should have. If you upgrade the RAM on a system are you supposed to increase your swap size? That's completely counterintuitive and stupid.

      I've routinely run 128MB embedded systems with 1GB of swap. A little slow at times, but it gets the job done.

    3. Re:256M by TeknoHog · · Score: 1

      I've never understood the 2x rule. The less RAM you have the more swap you should have. If you upgrade the RAM on a system are you supposed to increase your swap size? That's completely counterintuitive and stupid.

      You design your machine so that the RAM is good for all practical uses. Swap space is there as a last resort, to let the system fail gracefully. If you're using bigger applications, chances are that the "failures" are bigger.

      I've routinely run 128MB embedded systems with 1GB of swap. A little slow at times, but it gets the job done.

      I've run 8 MB systems with about 64 MB of swap, and I thought it was a little painful. There's the basic problem that the code/data has to be in actual RAM in order to be used. In these cases, 8/9 of total memory access involves disk activity in addition to the usual memory latency. So again we should worry about the RAM:swap ratio.

      --
      Escher was the first MC and Giger invented the HR department.
  14. Swap size by Wowsers · · Score: 1

    Talking about my Linux setup. I originally had 2GB RAM but had a swap of 1GB, upgrading the RAM I kept the swap of 1GB. The amount of times the system has ever used the swap space can be counted on one hand. The once it did, was when a process went out of control and ate all the system ram, then all the swap space, before crashing the OS.

    I would have a swap of 512MB and not bother with any more.

    --
    Take Nobody's Word For It.
  15. It depends. by stevedmc · · Score: 0

    It depends on the size of your hard drive. I wouldn't recommend an 8 gig swap partition if your hard drive is only 10 gigs. Think about it...

    1. Re:It depends. by Inner_Child · · Score: 1

      If you have 4gb RAM and only a 10gb HDD, you have bigger problems than how much swap to use.

      --
      Today is red jello day - all workers must eat all of their red jello. Failure to comply will result in five demerits.
    2. Re:It depends. by stevedmc · · Score: 0

      Maybe they couldn't afford a newer hard drive because they spent all their money or RAM.

    3. Re:It depends. by Drawsalot · · Score: 1

      If they have a 10GB drive, chances are they need to upgrade to a faster hard drive as a number one choice. Other than SCSI, 10GB drives haven't been made in a while.

  16. How big? by zoomshorts · · Score: 2, Funny

    42 Petabytes for Vista, the next version, who knows.
    The page file system needs to be able to juggle the
    fake RAM sizes effectively, So petabytes seems to fit the bill.

  17. For Suspend to Disk more than actual RAM by Britz · · Score: 5, Insightful

    Whatever you do, you need to remember to setup you swap partition to as large or bigger than your ram in order to be able to use the "suspend to disk" function in Linux. On older laptops suspend is sometimes handled by the bios. Then you need a special partition. But nowdays Linux just suspends to your swap. And if your memory was full ...

    1. Re:For Suspend to Disk more than actual RAM by FauxPasIII · · Score: 2, Informative

      For built-in suspend this is true. TuxOnIce offers, among other things, suspend-to-file support which eliminates the need to keep gobs of swap around if you don't want to.

      --
      25% Funny, 25% Insightful, 25% Informative, 25% Troll
    2. Re:For Suspend to Disk more than actual RAM by RiotingPacifist · · Score: 1

      certain tools can compress your ram before you suspend (also means a faster restore) so you can get away with about 70% of your ram (especially if your ram isnt 100% used)

      --
      IranAir Flight 655 never forget!
    3. Re:For Suspend to Disk more than actual RAM by Anonymous Coward · · Score: 0

      So, you still need RAMx2 (in case your RAM was 100% full when you tried to suspend)?

    4. Re:For Suspend to Disk more than actual RAM by slash.duncan · · Score: 1

      Replying here as it covers one angle I was going to mention.

      The parent is correct, but the grandparent misses something. If using (Linux) kernel suspend, the default suspend image is half a gig, but you can make it up to half the size of your actual RAM. This must be in a single swap partition. Why half the size? Because in ordered to avoid various problems with deadlocks and etc, the kernel reads in the swap to the vacant half, then atomically switches to it. (This is in the kernel documentation dir, in the power subdir.)

      So if planning on using kernel suspend to full effect, you need a minimum swap of half the size of RAM, in a single partition. Then ensure that the appropriate image size is written to the appropriate file under /sys/power before suspending, or it'll only use a half-gig image, which will dump most of your hard-earned cache.

      If using user mode suspend, TuxOnIce being the usual one, it works somewhat differently. I'll not try to explain it since I'm using the kernel built-in suspend, but I know it can compress the image while kernel suspend can't, and saves user-mode and cache separately and first, then dumps it and saves the kernel state, according to the little documentation I've read on it.

      For actual swap, that half as much as memory (on a decently modern multi-gig memory system) per swap partition (or file) can be a decent practical limit too, simply because disk is so much slower than RAM... and if you're heavily swapping on a single spindle it'll be about locked up anyway. However, if you have mutliple hard drives, multiple such images are a good thing! I have four drives, 8 gigs of RAM, and a four gig swap partition on each drive. That works reasonably well, even when I DO go heavy into swap.

      Finally, if you do compiles or the like, consider making your /tmp and/or /var/tmp tmpfs, and pointing your compiles at it for scratch space. For Gentooers at least, this can make a BIG difference (set PORTAGE_TMPDIR to a tmpfs), as then all those temporary scratch files normally don't hit disk at all. Worst-case, you run into swap and they do, but that'd be the normal case otherwise. Of course in this case you want a big swap. Again, the 16 gigs I mentioned above, 4 gigs each on four different drive spindles, works very well.

      --
      Duncan
      "Every nonfree program has a lord, a master,
      and if you use the program, he is your master."
      R Stallman
    5. Re:For Suspend to Disk more than actual RAM by hedwards · · Score: 1

      Probably, you'd need just RAM plus whatever swap was in use at the time of hibernation. RAM x 2 isn't necessarily a bad estimate, it's probably a bit on the conservative side since most of the time you're not going to be more than a quarter paged anyways.

    6. Re:For Suspend to Disk more than actual RAM by Trogre · · Score: 1

      Suspend to swap strikes me as a really really bad idea. What if your memory was near full and you had data in swap?

      Swap files (a la the TuxOnIce project and Windows XP's hiberfil.sys) seem a much better idea, so long as you're not short on immediate disk space.

      --
      "Nine times out of ten, starting a fire is not the best way to solve the problem." - my wife
    7. Re:For Suspend to Disk more than actual RAM by Britz · · Score: 1

      I thought I was clear. You need Ram + x (where x can be as small as you like) for secure suspend to disk not using one of those awsome tools the other people described.

      Not Ram x2 !

    8. Re:For Suspend to Disk more than actual RAM by Anonymous Coward · · Score: 0

      What if you're also using some swap, and you want to suspend to disk?

      What you really need is swap = RAM + swap. Good luck with that.

    9. Re:For Suspend to Disk more than actual RAM by Toll_Free · · Score: 1

      Seriously,

      What do you do that requires 24 gigs?

      I use a machine dedicated as an audio processor for a transmitter here, and haven't had any problems yet, but I'm not doing much with it.

      Serious question, just wondered what some high power users are doing with all that ram.

      --Toll_Free

    10. Re:For Suspend to Disk more than actual RAM by SanityInAnarchy · · Score: 1

      Where can I find a description of how this actually works?

      They claim things like FUSE support, which makes no sense (a FUSE filesystem can be anything, and swsusp is supposed to suspend your running userspace apps, not leave them running).

      And how would suspend-to-file work? I suppose if the file in question is not on a FUSE filesystem, and you flush everything but the filesystem first, it could work... or if you preallocate everything needed...

      --
      Don't thank God, thank a doctor!
    11. Re:For Suspend to Disk more than actual RAM by n17ikh · · Score: 1

      I've asked this question as well and never gotten a straight answer. Linux hibernation and suspend is mostly undocumented and still relatively new. I assume it just fails - I've had the hibernate go halfway through dumping the RAM to disk and just suddenly come right back to my X session like I never told it to do anything. At least the suspend is fairly reliable - In Windows it's about a 50/50 gamble whether it comes back or just shuts off after bringing it back out of suspend.

      --
      Hard work pays off tomorrow, but procrastination pays off NOW!
    12. Re:For Suspend to Disk more than actual RAM by slash.duncan · · Score: 1

      I would have expanded a bit but I was on my way to work... So now that I'm back and you replied, I can.

      Actually, I've only run it close to totally out only once... with a runaway process. I actually saw it eating RAM before it ever got into swap at all, realized what was happening, got a kill for the process in question all set to run at boosted priority, and then just sat and watched it eat RAM for the fun of it. I let it eat all of the 8 gigs RAM and 15 gigs into the 16 gigs of swap, before I hit the enter on that kill. (If you've ever been in a spot where the kernel is /really/ squeezed for RAM... it hurts, well before the OOM-killer kicks in, and even with swap entirely off so it's not swapping, it's spending all its cycles squeezing those last few bytes of RAM out. I didn't want it to get to that point, a point at which I've actually /been/ before, so I killed it with ~1/2 a gig or so of RAM left, just in case.)

      As for what I do with it... not really /that/ much. The computer is my hobby/toy, my "geek hot rod" for the most part. I did mention I run Gentoo. It's on a 2x Opteron 290s, so dual-dual-core 2.8 GHz, top of the line for that mobo (Tyan s2885 dual-CPU-socket). I run it in NUMA-mode, 4 gigs (2x 2-gig sticks) off of each CPU-socket (dual-cores per). I'm running 4-spindle kernel/md/mdp RAID, RAID-0/1/6, RAID-0 for /boot (GRUB understands only RAID-0), RAID 6, so two-way-stripe, two-way-parity, I can lose 2 of the 4 without losing data, for my main system, and 4-way-striped RAID-0 for speed, for various caches and my kernel and Gentoo package trees, since they need no redundancy as I can simply redownload off the net if needed. My latest upgrade was finally to LCDs from CRTs. I was running 2x 21" CRTs @ 1600x1200 stacked for 1600x2400. I /wanted/ to upgrade to two of those 30" 2560x1600 LCDs, but @ the ~$1400+ a piece they are running, plus the fact that I'd have had to upgrade the video card (to one that could handle 2x DVI-D dual-link) at the same time to handle them, it wasn't in my budget. I settled for 2x 1920x1200, ~$350 each, and they're still running on my old video card, one on single-link DVI-D, the other on analog/VGA. The video card is the last thing on my list to upgrade. At present I'm still running an old Radeon 92xx series, since at the time I bought it, it was about the best that could be had that ran freedomware Linux drivers. Now that /that/ has changed... But the mobo is AGP, not the newer PCI-E. But I can still upgrade the video quite a bit from the Radeon 92xx series I'm running now, and intend to do so within the year, capping off my system upgrades for now. I'll continue to run this system for another three years anyway, maybe five, at which point I'll probably more side-grade than upgrade, to a by then lower end quad-core w/ another 8 gigs RAM, but modernizing to PCI-E and by then, probably USB-3, etc, probably for under $500 by then.

      Anyway, in context, the 8 gigs real RAM balances the total 4 cores quite well. When I had dual single-core Opteron 242s in the rig, the 8 gigs RAM was simply not all that useful, and would have been a waste of money, but I deliberately over-bought on the RAM, as I figured I'd use it once I got dual dual-cores in it, and I have. 4 gigs wouldn't be squeezed, but since I did the upgrade to the 4 cores total, I do feel like I'm getting my money's worth out of the 8 gigs.

      I don't really need 16 gigs of swap, you are correct. However, I was balancing the layouts on the 4 spindles and wanted 4-way striped swap for speed as well. 4 gigs each on 4 swap partitions, one on each drive spindle, set at the same priority so the kernel would stripe them, was what I setup. At the time, I didn't actually realize that the kernel's suspend to disk functionality couldn't stripe the suspend in swap just as the kernel did normal swap, so it was more or less luck that I chose the magic 4 gigs per swap partition that was th

      --
      Duncan
      "Every nonfree program has a lord, a master,
      and if you use the program, he is your master."
      R Stallman
    13. Re:For Suspend to Disk more than actual RAM by MrNemesis · · Score: 1

      I've set up suspend-to-file before, since my laptop has 8GB of RAM and taking a >8GB chunk out of even a 250GB disc is no small feat - as long as your kernel has support for your filesystem of choice built in, you just run a tool to find the address of the file in question (think it's just a mater of setting your file in the suspend config and then looking in /sys for the address). This way, if I desperately need an extra 8GB of space, I can just `rm /swapfile`, instead of going through the palaver of resizing swap and the surrounding partitions. For the record, I keep a 512MB swap file of which I've never seen more than 15MB used. Anyone's who's ever done anything like accidentally rsync 8 billion files [thank god for rsync 3] will know that having gads of swap available is a curse, since disc speeds haven't kept parity with RAM - the system will become almost totally unusable until it hits the memory limit and oom-killer has its way. In such an event, you *want* to run out of swap as soon as possible.

      I thought the idea of using an 8GB swap file ridiculous, since my apps rarely use more than 2GB physical for their working data set - but they do lots of random lookups on data so the huge file caches are a massive bonus to me.

      What I can't understand is why suspend doesn't seem to flush the file caches from memory when hibernating - writing 8GB of memory to swap, even when using compression, takes an utter age.

      Edit: just found this, added in 2.6.16. Will give this a whirl and see if it improves hibernate any... http://linux-mm.org/Drop_Caches

      --
      Moderation Total: -1 Troll, +3 Goat
    14. Re:For Suspend to Disk more than actual RAM by Anonymous Coward · · Score: 0

      Suspending to disk uses compression by default.

    15. Re:For Suspend to Disk more than actual RAM by Toll_Free · · Score: 1

      Thank you for the reply. It was more informative than you probably thought.

      I can completely understand having a geek hot rod. At one time, for an endtable in my living room, I had a Dell Server. Dual XEON 450s, 2 gigs of ram, 6X18 gig cheetah drives, etc., etc., etc.

      This was in 1999. Was a > 20K dollar machine. I really appreciate Federal Express giving me the machine, it was REALLY nice of them (incidentally, I will ALWAYS ship comp equipment via them. They might break it, lose it, etc., but I've ALWAYS had a check within 48 hours from them, usually next day. EGL Global Logistics, same way. EGL also doesn't want bad hardware back, enabling me to have another Dell server).

      I used that for Pitou, the linux emulation software for watching DirecTV back in the day. Was capable of running on 4 megs of RAM with a 286, but hey, a little overkill was worth it, right?

      Again, thanks for the well thought out reply. I'd actually suggest the original article writer read it, as you went pretty in depth with the ram vs swap thing, how much your swap has actually been used (vs processor cores / power, etc). Gave me a little more insight into the question posed, as well as for my own system (just a lowly Turion X2 laptop, but hey, it works for text editing on Slashdot :) ).

      Have a good one. Wish I had some mod points left, you deserve them.

      --Toll_Free

    16. Re:For Suspend to Disk more than actual RAM by SanityInAnarchy · · Score: 1

      This way, if I desperately need an extra 8GB of space, I can just `rm /swapfile`

      Ah, so it's suspend-to-swapfile, not just suspend-to-file. Oh well.

      I was kind of hoping for something cooler, like: Suspend process allocates exactly as big a file as it needs (and fails right there, coming back up, if that space isn't available), auto-stores the created file's current location, and hibernates. On resume, it simply rms the file.

      But it seems like it's making a lot of assumptions. What about filesystems where there isn't necessarily a one-to-one relationship between a byte in a file and a byte on disk (compression, etc)? And that's to say nothing of FUSE...

      I actually had (have?) an aggressive plan for refactoring the layer design between filesystems and volumes, and, as an emergent property, it solves this problem for the more interesting filesystems. But it's 3 AM, and I'm not in any state to do it justice -- nor will I have time for any ambitious hobby projects for probably a month.

      Anyone's who's ever done anything like accidentally rsync 8 billion files [thank god for rsync 3] will know that having gads of swap available is a curse

      Technically, in that case, the curse is rsync insisting on building the entire fscking file list ahead of time.

      What I can't understand is why suspend doesn't seem to flush the file caches from memory when hibernating - writing 8GB of memory to swap, even when using compression, takes an utter age.

      I imagine there's some way to configure it not just to drop all caches, but to drop a certain arbitrary percentage of them.

      You see, when I first ran software suspend, it was pretty much what you describe -- and it sort of makes sense. Not saving caches means you hibernate faster, and it means the initial restore is faster. It also means that as soon as you restore, every single program that just woke up is going to have to pull its data off some random location of the disk, thrashing it to hell. That takes a lot longer than the entire boot process of just reading a bit more, but sequential.

      --
      Don't thank God, thank a doctor!
  18. Depends on how much you need to address at once by GaelTadh · · Score: 1

    One other thing to consider when setting swap is the amount of memory you will need to address at once. Linux can't map more than physical and swap combined so if you are going to be mmaping 80GB files you'll need at least 80GB between swap and physical memory.

    --
    Search your logs like the web: splunk!
    1. Re:Depends on how much you need to address at once by fred+fleenblat · · Score: 1

      I think mmap since kernel 2.4 (maybe even earlier?) swaps right off the file system w/o moving it to the swap device. You'd have to do MAP_PRIVATE and scribble all over the segment to start eating into regular swap space.

    2. Re:Depends on how much you need to address at once by GaelTadh · · Score: 1

      Sure you don't map into regular swap but you cannot address more than swap and physical.

      --
      Search your logs like the web: splunk!
    3. Re:Depends on how much you need to address at once by fred+fleenblat · · Score: 1

      do you know if is this true even for 64 bit proggies?

    4. Re:Depends on how much you need to address at once by GaelTadh · · Score: 1

      Yes it is true for 64 bit AFAIK

      --
      Search your logs like the web: splunk!
    5. Re:Depends on how much you need to address at once by siride · · Score: 1

      Uhh...no. As long as your process has enough virtual memory space (which 64-bit processes most certainly do), you can map as much as you want. You can't get away with mapping more anonymous/private mappings than you have physical + swap because those mappings have to be backed by physical RAM or swap (other mappings are backed by files on the disk). You can overcommit, however, if all of those mappings won't be used at once. Dangerous that is.

    6. Re:Depends on how much you need to address at once by GaelTadh · · Score: 1

      Yes and what do we call the place where this virtual memory resides ? Swap. So if you have 4GB ram and 8GB of swap you will be unable to map a file that is 20GB, I think overcommit might help you in the short term but from my use it is very dangerous.

      --
      Search your logs like the web: splunk!
    7. Re:Depends on how much you need to address at once by siride · · Score: 1

      Uhh, no. Because the virtual memory for a real file that is memory mapped is backed by the file itself, not the swapspace. The swapspace is ONLY used for pages that are not mapped to actual files and then only when those pages must be evicted from RAM due to low memory conditions.

      If you map an 80GB file, the pages are associated with the file itself. When you access part of the mapping, the pages are brought in to page frames in RAM. If they are modified, and then need to be evicted, then they are written back out to the file. Otherwise, the frames are discarded outright. Nowhere in that process is swap required. Indeed, it would be stupid to copy the contents of any file to swap (which is effectively just another file) before using it.

  19. Depends on what the machine is used for by corsec67 · · Score: 1

    Sometimes I generate really big files, by stitching photographs into large panoramas that are 30,000 x 10,000 pixels. That can use all of my 4GiB of ram, causing everything else to be put into the swap file for a while. (I have 4 GiB of swap on each of my 2 * RAID 1 arrays, for a total of 8 GiB of swap. That is a bit of overkill.)

    Other than that, if I actually use more than 4GiB of ram at once, performance is going to take such a massive hit that it might be better to let the "Out of Memory" errors appear.

    --
    If I have nothing to hide, don't search me
  20. Forget the RAMx2 rule by jmorris42 · · Score: 4, Insightful

    Forget the RAM X 2 rule. Capacity of drives are way up, base RAM load is way up. Drive transfer speed isn't up very much. Doesn't really matter how much ram you have, long before you get a Gig of swap utilized the system is going to be trashing to the point of being unusable under any but lab conditions.

    Running with no swap can cause some problems, because it does help if the system can push out blocks of memory that aren't backed by a file and also haven't been used for awhile. Still on an all flash system with an adequate amount of RAM running without swap is probably the right move. On a machine with a spinning disc give it a 1GB swap and forget it.

    The exception being in cases where the a system is doing suspend to disc into the swap. I don't have any Linux machines that will do suspend to disc so don't ask me about any details.

    --
    Democrat delenda est
    1. Re:Forget the RAMx2 rule by Gazzonyx · · Score: 3, Informative

      tip:
      Lower the amount of RAM Linux uses by changing vfs_cache_pressure to > 100. This will make the kernel dedicate less RAM for caching dirents (directory entries) for quicker lookups. For instance, to cut the amount of directory caching in half, double the pressure by doing:
      'echo 200 > /proc/sys/vm/vfs_cache_pressure'.

      HTH

      --

      If I mod you up, it doesn't necessarily mean I agree with what you've said, sorry.

    2. Re:Forget the RAMx2 rule by dstar · · Score: 1

      Forget the RAM X 2 rule. Capacity of drives are way up, base RAM load is way up. Drive transfer speed isn't up very much. Doesn't really matter how much ram you have, long before you get a Gig of swap utilized the system is going to be trashing to the point of being unusable under any but lab conditions.

      Really?

      dstar@pele:/home/public/dls% free
                                total used free shared buffers cached
      Mem: 902908 873320 29588 0 187536 149356
      -/+ buffers/cache: 536428 366480
      Swap: 2931820 675860 2255960

      And my system is nice and snappy. Any other wild claims you'd like to make?

    3. Re:Forget the RAMx2 rule by Lumpy · · Score: 1

      HUH? My 10,000 RPM SATA drives are screaming fast. Almost as fast as my U320 SCSI raid 0 array.

      hard drive speeds are way up. Go and use a old P4 IDE Compaq from 2002 that takes almost 10 minutes to boot. Those 4200 RPM drives are slow as hell compared to modern quality sata drives.

      That said, if you need a swap file if you have 4-8 gig of ram, Either your OS is crap or you are doing things that are out of the norm for home computing.

      This is coming from the guy that has 12 gig of ram on his G5. Even doing HD video editing I have NEVER gone past 8 gigs used.

      --
      Do not look at laser with remaining good eye.
    4. Re:Forget the RAMx2 rule by jmorris42 · · Score: 1

      > hard drive speeds are way up.

      I didn't dispute that. Capacity is just up way more.

      Go back a decade to 1998. I can't find a consumer level drive with 10GB selling in 1998. We have 1TB drives now. So that is a factor of 100 increase in capacity. Speed has also increased but closer to a factor of 10 instead of 100. Ten years ago system RAM in a typical PC was 64MB or less while now 2GB is lowball for anything other than a netbook. That is a factor in the 30+ range. Swapping hurts more than it used to.

      Also look at how big the working set of apps have grown in the past decade. Back then swapping out the entirety of (statically linked mind ya) Netscape Communicator after it had been leaking memory for a week of browsing wouldn't kill that much swap. Now the typical applets in the GNOME/KDE system tray gulp down more memory right at startup.

      --
      Democrat delenda est
    5. Re:Forget the RAMx2 rule by swilver · · Score: 1

      There's really no need. I've been running several systems without swap for years now, even with high uptimes, and never did the lack of swap give any problems at all (well, Photoshop complains when you start it that there's no swap, but allows you to continue anyway). If you ever do think you need swap, it's possible to activate swap at any moment you please (goes for both Windows and Linux). You just need to reboot to turn it off again. I never ran into such a situation though, programs seem well-behaved these days and donot go allocating 1 GB chunks of RAM willy nilly just because they might need it later.

    6. Re:Forget the RAMx2 rule by Quietlife2k · · Score: 1

      "Doesn't really matter how much ram you have, long before you get a Gig of swap utilized the system is going to be trashing to the point of being unusable under any but lab conditions."

      Err - ok that must make me a lab.

      Machine Spec - e2140 with 2Gb ram - 10Gb swap (just in case).

      I see 2-3 Gb of swap in use and 1.3 - 1.8 Gb of ram in use.

      My machine still flies despite circa 150 pages open in firefox 2-3 instances of monodevelop 2-4 of vlc and 3 virtual machines.

      Just because I am using 2-3 GB or swap does not mean that it is all in constant use - thats the point of swap.

      While I reference one "block" of say 10 pages in firefox the remaining 140 are probably paged out and are only read from disk when I select them.

      I will admit that my machine occasionally "pauses for thought" when I select something that has been paged, but this seems to have little to no effect on any application other than the one I am "activating" and is typically no more than 2 seconds.

      Trashing / swap thrashing is a sign of too little physical ram and a system that is being FORCED to page ACTIVE sections of ram in order to fulfill the demands placed on it.

      With todays multi-gigabyte machines this is FAR less common.

  21. if you run Firefox and OpenOffice at the same time by Anonymous Coward · · Score: 0

    I'd suggest about 50G of swap.

  22. It Depends, but at least as much as RAM by rcoyner · · Score: 5, Informative

    In the end, it depends. If you are running several memory intensive applications you're going to want more swap space. At the very least, you should have as much as your RAM because when you hibernate it takes all the pages in your RAM and puts it into the swap space before powering off your computer. I wrote about this a while ago: http://www.bytetrap.com/blog/2008/06/02/swap-space-linux/

    1. Re:It Depends, but at least as much as RAM by Anonymous Coward · · Score: 4, Informative

      Yeah, hibernate actually DOES mean "use no electricity". Perhaps you mean "suspend"?

    2. Re:It Depends, but at least as much as RAM by Elrond,+Duke+of+URL · · Score: 2, Informative

      "Hibernate" does not mean "use no electricity."

      Actually, "hibernate" is no different than "off" from an electricity use perspective. When you hibernate with Linux (or even Windows), the contents of memory are stored to disk and the machine is powered off just as if you had performed a normal shutdown procedure.

      At this point, a hibernating system is using exactly as much power as a system that is off. For an ATX system this is not zero since the power supply has to provide some power for the on/off button to function as well as to power the USB ports.

      Suspending your system, on the other hand, does use more power since the RAM must be continually refreshed, though most of the other components are off.

      --
      Elrond, Duke of URL
      "This is the most fun I've had without being drenched in the blood of my enemies!"-Sam&Max
    3. Re:It Depends, but at least as much as RAM by compro01 · · Score: 1

      Yes, it does. Hibernate (ACPI S4. Sometimes referred to in Linux as "suspend to disk" and "safe sleep" on OSX) dumps the contents of RAM to the swap (or in some implementations (Windows and TuxOnIce), to a dedicated file) and then powers off. On startup, it tosses all that stuff back into RAM, putting you right back where you were, and it's much faster than a full boot. I think you're mixing it up with S3 suspend to ram (referred to as "standby", "sleep", "suspend", or "suspend to ram"), which just stops the processor, and spins down the hard drive, while leaving the ram populated and being refreshed.

      --
      upon the advice of my lawyer, i have no sig at this time
    4. Re:It Depends, but at least as much as RAM by ozphx · · Score: 1

      True, but you can switch the power off / move your PC, and resume it later when hibernating. Its effectively power-off.

      --
      3laws: No freebies, no backsies, GTFO.
    5. Re:It Depends, but at least as much as RAM by hab136 · · Score: 1

      Yes, it does. Hibernate (ACPI S4. Sometimes referred to in Linux as "suspend to disk" and "safe sleep" on OSX)

      "safe sleep" on OS X is a hybrid of suspend and hibernate. It writes all RAM to disk and then suspends. If your battery gets low while suspended, it powers off. Then when you power back on (after finding a wall outlet) it will restore from the hibernation file. If you just pop the lid open before the battery gets low, the system just resumes since everything is in RAM.

      I'm not quite sure whether "low" means low as in 10% left or low as in 0%. However it turns out you can also enable safe sleep on some desktop Macs and it works the same way - hit suspend, it writes all ram to disk and suspends. If you hit a key or something, it pops right back up. If you yank the power and then plug it back in and start up, it will resume from the hibernation file.

    6. Re:It Depends, but at least as much as RAM by hab136 · · Score: 1

      or, you could just turn the damn desktop PC off when you're not using it anymore, and stop pretending the 30 seconds it takes for it to boot is somehow destroying your life.

      Most modern computers, when not being used, can turn off the monitors and step down the CPU to a lower speed, reducing something like 90% of the energy it would normally use. Spinning down the hard drives, and just auto-suspended are options too. Suspending to RAM uses so little electricity it's silly to argue about it.

      Regardless of the efficiency of suspending, the amount of power a computer uses while just idling is negligible. Conversely, there are decent reasons I leave my computer running:

      1. Skype (replaced my landline and international dialing)
      2. iTunes sharing to other computers/AppleTV (replaced my DVD player and DishTV)
      3. Playing music through remote speakers (replaced my stereo)

      The amount of electricity to run my computer vs. running the devices I've replaced is probably on par, or less.

      Of course, my computer is basically silent (a requirement when I bought it) so aside from energy considerations there's not a real downside to leaving it running.

  23. Don't do 2 times your RAM. by Anonymous Coward · · Score: 0

    With the exception of specific applications, having large amounts of swap space is not overly important in this day and age. Its a good idea to have it around for infrequently accessed bits of memory to be tossed to, but if your system actually gets to the point that you're swapping actively accessed memory to disk, you're going to see serious hits on system performance. I recommend only having ~2G of swap on systems you're not using suspend to disk on, and just matching the amount of ram in your system (maybe a hair more) on systems you're going to suspend to disk on.

    Note: This is very general. You need to be aware of what you're using the machine for in order to make a good call. Some applications (I'm looking at you Oracle) depend on you having gobs of swap available.

  24. swap for what? by Anonymous Coward · · Score: 0

    unless you're suspending to disk or something that requires a mirror of actual RAM on the disk, kind of hard to come up with a reason for swap.

    my box is linux running 4gb ram with vmware taking up 2gb. still plenty to run openoffice, firefox, etc without any swap at all.

  25. Reasonable Limits Aren't by HTH+NE1 · · Score: 1

    Reasonable limits aren't.

    Insufficient swap space is one cause of enduring Green Screen of Death on early TiVo expansions (Series 1). There it wasn't the size of the memory (fixed) that was the issue; it was the size of the video storage and how much space you would need to do the equivalent of fsck on it.

    So make it something unreasonably huge. Got an old spare 40 GB drive lying around? Make it all swap and use it 'til it dies. If your environment has as an upper limit something smaller, use that instead. Disks are cheap.

    --
    Oh, say does that Star-Spangled Banner entwine / The myrtle of Venus with Bacchus's vine?
    1. Re:Reasonable Limits Aren't by HTH+NE1 · · Score: 1

      Or no swap at all. That still fits the axiom. The point is, always make your limits unreasonable in the right direction, or time will make them so.

      --
      Oh, say does that Star-Spangled Banner entwine / The myrtle of Venus with Bacchus's vine?
    2. Re:Reasonable Limits Aren't by HTH+NE1 · · Score: 1

      Or no swap at all. That still fits the axiom. The point is, always make your limits unreasonable in the right direction, or time will make them so.

      ...or time will make them so in the wrong direction.

      (And always read your postings before submitting. Preview only helps if you actually review the result.)

      --
      Oh, say does that Star-Spangled Banner entwine / The myrtle of Venus with Bacchus's vine?
    3. Re:Reasonable Limits Aren't by merreborn · · Score: 1

      So make it something unreasonably huge. Got an old spare 40 GB drive lying around? Make it all swap and use it 'til it dies.

      That'd be a spectacular waste of electricity, seeing as the drive would be spinning all the time, but almost never actually used.

    4. Re:Reasonable Limits Aren't by HTH+NE1 · · Score: 1

      That'd be a spectacular waste of electricity, seeing as the drive would be spinning all the time, but almost never actually used.

      Won't a drive hosting swap do that regardless of non-zero swap capacity? Seems to me a dedicated drive would be better than one hosting comparatively infrequently accessed data. (A solid state drive would need very large capacity in which to spread the wear to be used for swap, and thus very expensive. Better an obsolete drive die instead.)

      Unless you're doing operations that need the low latency of constantly spinning drives like live data stream capture.

      --
      Oh, say does that Star-Spangled Banner entwine / The myrtle of Venus with Bacchus's vine?
    5. Re:Reasonable Limits Aren't by Free+the+Cowards · · Score: 1

      Why, is your OS incapable of spinning down HDs that aren't being used?

      --
      If you mod me Overrated, you are admitting that you have no penis.
    6. Re:Reasonable Limits Aren't by ozphx · · Score: 1

      So turn off the 20W bulb in your parents basement and go upstairs and get some damn sunlight. That will offset both the power usage of a single drive and your pasty complexion.

      Whats that... ten bucks a year of power? About a buck a month?

      And you sit on slashdot pretending you can afford internet. GTFO.

      --
      3laws: No freebies, no backsies, GTFO.
  26. Oh, nonsense by Anonymous Coward · · Score: 4, Informative

    2X RAM was the standard rule of thumb at Sun, for SunOS long before Windows was around.

    If anything, Microsoft ripped it off from Sun.

    1. Re:Oh, nonsense by Anonymous Coward · · Score: 0

      It was *MY* idea I tell you.

      --Darl

    2. Re:Oh, nonsense by Obfuscant · · Score: 4, Interesting
      Here's my understanding of the "rule".

      In early Unixes (SunOS, e.g.), the memory manager was dumb and preallocated swap space sufficient to swap your entire process out if it became necessary, and it really did want contiguous. Running out of swap was common, even if it was really never used, and the "rule" to avoid that problem was 2xRAM. Further, if you had two swap partitions, or a partition and a file, your process stayed in whatever swap it started in and did not split across both. You could be out of swap space and still have a completely empty swap file.

      Memory managers have gotten smarter, mapping smarter, and now swap is only used when it really is necessary. Pages that are not dirty don't get swapped, they get reloaded from the disk they came from. Pages that are swapped are often used soon enough that they never leave the RAM buffers.

      Yesterday, I had a user come to me saying he was getting an "out of memory" error from Matlab. Matlab is notorious for not garbage collecting when it needs to. His Matlab process had 800Mb of resident memory, even though he said he had just 300Mb of data. The kicker? Somehow, over the last couple of years, the swap file I had created to extend the 512Mb swap partition had gotten lost. Dunno where it went, just not there. He had 512Mb of swap, and most of that wasn't being used. Never noticed it until yesterday. His 2Gb of RAM was sufficient for what he was doing.

      It's a case of people who learned early just doing what they know works, telling youngsters the "rule" so they do the same thing.

    3. Re:Oh, nonsense by MoeDrippins · · Score: 1

      I don't know about "ripping off", but I'd heard this tale LONG before Windows (at least the 3.x, or 9x varieties) came on the scene.

      Except I'd heard it was SunOS 4.x that would only use at least as much RAM as it had swap... I was transitioning from SunOS 4.x/NeWS/etc. to full on Solaris 2.x at the time, so I'm probably mis-remembering versions and such.

      But it was definitely a unix that had this RAM/swap issue; not Windows.

      --
      Before you design for reuse, make sure to design it for use.
    4. Re:Oh, nonsense by Caduceus1 · · Score: 4, Informative

      Yes, I believe it was the BSD memory manager (possibly earlier, V7 maybe) that had the 2xRAM rule. Less and you could have issues - more was wasted disk space.

      BSD was the foundation for SunOS (pre-Solaris 2.X), Ultrix, etc. so they all inherited this requirement - and from there the "requirement" became gospel on other systems.

      I've actually never heard the 2xRAM in relation to Windows, but it certainly predates it. I was setting up systems with 2xRAM when Windows was a DOS app... :)

      --
      rm /dev/mem
      Sci-Fi Storm
    5. Re:Oh, nonsense by Anonymous Coward · · Score: 0

      SunOS (and Solaris) needs lot of swap because of the Virtual Memory architecture - each time a program asks for memory, equal amount will be reserved as swap space before the alloc succeeds - so you have a database with 4Gb cache, it needs 4Gb free swap whether or not it is going to be used.

      Linux on the other hand will hand out 4Gb without reserving or allocating anything - if you happen to have enough RAM and Swap it will work without having a lot of swap - otherwise the OOM killer will rear its ugly head.

    6. Re:Oh, nonsense by francium+de+neobie · · Score: 1

      There was a 2.5XRAM recommendation for swap files in early versions of SiSoft Sandra. Many hardware junkies took it as some kind of universal truth after using the benchmarking software.

  27. Depends on if you want suspend to Disk. by Anonymous Coward · · Score: 0

    Depends on if you want suspend to Disk in linux

  28. Determine it yourself by Anonymous Coward · · Score: 0

    If you're on Windows, it's easy enough to determine how much you actually use (it might also be easy on Linux, I just don't know how). One of the menus of the task manager has a place to select which columns to show, two of the available options are Virtual Memory and Peak Virtual Memory. Show those columns, leave task manager open (it helps to show it on a second monitor), and then run a bunch of applications and start using them. The second monitor helps with games, I was able to run Crysis the other day with task manager open on another monitor to watch the resource usage as I was playing and loading things (if anyone cares, it used between 950MB-1350MB on a XP system with 2GB physical). Also on the bottom of task manager is a "Total Commit" line that shows the used amount of RAM+virtual and the total available.

    The numbers for task manager probably aren't going to be exact, but when we're dealing with 4-8GB it doesn't matter if it's accurate down to 1KB (or even 1MB).

  29. How big should your swap partition be? by Anonymous Coward · · Score: 0

    I find this an odd -- yet fitting -- question to ponder, having just watched the "2 girls 1 cup" video for the first time.

  30. The TRUTH by alexborges · · Score: 1

    Is that transactional servers that swap are useless.

    There, ive said it (more than once and ive heard it from the mouths of real unix gawds): swap is not usable in a heavy production environment webserver, mailserver, printserver or whatever thingie that does syncronous jobs (need to provide an answer in seconds or minutes after a request comes).

    OLAP Database servers are also in this category: if youre swaping, it aint workin.

    There are only a few applications that actually benefit from swapping (large datawarehouses come to mind), but they almost do the part of their job that consumes more memory in an asyncronous way.

    Bottom line: set your swap to whichever reasonable figure you can calculate from a realistic-as-possible memory usage scenario for the particular application you are using.

    --
    NO SIG
    1. Re:The TRUTH by Alpha830RulZ · · Score: 1

      There are only a few applications that actually benefit from swapping (large datawarehouses come to mind)

      I'm curious as to why you say that. I ask because I'm tasked with building a new DW running on postgres/linux. Is there anything I should know?

      --
      I was taught to respect my elders. The trouble is, it's getting harder and harder to find some.
    2. Re:The TRUTH by alexborges · · Score: 1

      Well... when they get big, the queries just plain wont fit in your RAM. This is true for any DB that gets big enough to not be able to fit the whole thing in ram.

      Since in a DW you want users to be able to browse, but seldom in realtime data (you generally process and insert into the dwh asyncronously, not on-demand from end users). In those cases, using a good very fast swap device may be the ONLY choice to actually finish your processing

      --
      NO SIG
    3. Re:The TRUTH by Anonymous Coward · · Score: 0

      Could your UNIX gawds spell synchronous?

    4. Re:The TRUTH by Alpha830RulZ · · Score: 1

      Ah, that makes sense, and is consistent with our planning. But won't that be using paging, rather than process swapping?

      We actually have relatively low query processing requirements for traditional reporting style needs. The DW's primary purpose is for accumulating and constructing datamining source data, which will be processed outside of the database.

      --
      I was taught to respect my elders. The trouble is, it's getting harder and harder to find some.
    5. Re:The TRUTH by alexborges · · Score: 1

      Interesting (and correct) distinction between paging and process swaping.

      There is, however, an important corelation: buffers and read caches take ram, ram is needed by proceses, proceses get swaped out (and that generally fucks them up if they are interactive or snappy, like an httpd).

      Its good that you pointed this out, because what Ive seen with my own eyes, is precisely that: very intensive I/O with large writes can be very aggressive towards your RAM and cause swaping elsewere (ive seen it... you can tune many parameters to get ahold of the beast), but i guarantee it: if you have a 64GB key sort cache on your DB, youll need a ridiculously large box to get the whole thing to work decently (say, 128GB RAM?), or a very good and fast SAN or local storage device that can help you out in your memory shortage (which, for those sizes, its always gonna be short).

      As you can see, the logic still applies: in some of those cases, your only way out will be to aggressively use swap. On other cases, you may tame as the provider recomends: if oracle tells you to use their mem page manager (no idea, im just inventing here) to configure it for the resources you have, you go ahead and do that. But there are other apps that will expect you to come up with a livable environment.

      --
      NO SIG
    6. Re:The TRUTH by alexborges · · Score: 1

      nai

      --
      NO SIG
  31. 2x RAM was very helpful by Anonymous Coward · · Score: 0

    In my experience, the 2xRAM guideline was useful for engineering workstations, because a working problem larger than that would effectively not complete in a reasonable time.

    I.e., you could run a problem that spilled into swap about that much, and still get results in a small-integer multiple of the expected time. Like, noticing swapping and deciding to get more soda, or lunch.

    If you needed to run a problem that required 10x RAM, you might as well just fail quickly. Then the operator could make sure you were going to both add a swapfile, and start the run on Friday before going home. Or else reconsider.

    There is probably a similar experience with multi-user systems, perhaps a different rule-of-thumb, based on how many users would be compiling or running, and how many buffers would be visible, etc. That scenario probably has NFS-mounted homedirs, and so a file in swap is significantly faster to access when the user goes back to it than re-reading it from disk.

  32. Eee PC... by metageek · · Score: 1

    runs without swap, at least the version of Xandros that comes pre-installed (SSD's do not seem to be the best medium to hold swap partitios).

    On regular desktops that do not need to hibernate I usually have between 512Mb - 1Gb. On laptops it is useful to have 1.1X size of RAM to be able to hold the system state there.

    --
    metageek
    1. Re:Eee PC... by SanityInAnarchy · · Score: 1

      SSD's do not seem to be the best medium to hold swap partitios

      I'm curious what the rationale for this is. I just got a shiny new Dell laptop with a 128 gig SSD, preloaded with Ubuntu, and it seems to have 4 gigs of swap. (Actually seems to be exactly as much swap as RAM.)

      --
      Don't thank God, thank a doctor!
  33. my formula: by sparcnut · · Score: 0

    swap_size = min(2gb, max(512mb, phyram * 2))

    With more than 2gb your machine will surely crawl due to massive disk storms, with less than 512mb the Linux VM may not be happy (sometimes it just HAS to swap or go to the oom-killer). 512mb is probably overkill to prevent that scenario, but that's what I use.

    --
    perl -e 'print $i=pack(c5, (41*2), sqrt(7056), (unpack(c,H)-2), oct(115), 10);'
  34. /tmp on tmpfs and large swap by hpa · · Score: 2, Insightful

    I personally prefer to put /tmp on tmpfs, and combine with a large swap partition (much larger than 2x RAM). tmpfs is a lot faster than a regular filesystem *even if it has to hit disk*, simply because it doesn't have to care about consistency. If the machine goes down, the data disappears.

    1. Re:/tmp on tmpfs and large swap by Anonymous Coward · · Score: 0

      I agree for tmpfs.
      Also, I use my swap space for suspend to disk. But even with those uses, I only have a 3GB swap (and 2.5GB RAM) and never had any problem. Most of the time swap usage is zero.

    2. Re:/tmp on tmpfs and large swap by Gazzonyx · · Score: 1

      Don't forget that tmpfs will 'soft' allocate up to half of your RAM unless you use a mount option to specify how much memory it is allowed to use. I do the same thing with one of my boxes, but I have found it to be slightly less graceful than a pure swap (I think I had an unusual situation with a high priority process entering the run queue and something got paged in a rather ugly fashion, IIRC). That being said, it's a great option, and a great ace up your sleeve when you need to optimize your server.

      --

      If I mod you up, it doesn't necessarily mean I agree with what you've said, sorry.

  35. Just ran into this today... by Hokie06 · · Score: 1

    On some new servers. 50+ GB of RAM and 1GB of swap. I guess that is what happens when you trust HP to install the OS.

    --
    Kilroy was here.
    1. Re:Just ran into this today... by John+Hasler · · Score: 1

      Unless you have unusual requirements (which you should have told HP about) that should work fine.

      --
      Warning: this article may contain humor, sarcasm, parody, and perhaps even irony. Read at your own risk.
  36. 0 MB by timeOday · · Score: 2, Insightful
    I have run linux systems without swap for years without trouble, including the laptop I'm on right now.

    On a system with adequate RAM, the primary effect of swap is to make the system bog down before it crashes when a runaway process tries to allocate a huge amount of memory.

  37. As much as you think you'll need by discord5 · · Score: 2, Informative

    How big should my swap be?

    It really depends on what you're planning on doing with the machine:

    • If you're using XFS on large volumes (eg 10TB on a fileserver), you'll need a lot of swap for xfs_check.
    • If it's a desktop, you probably don't want to start swapping too much, so you want lots of RAM. I usually add as much swap as I have RAM. I gave up on the "twice the amount of RAM" rule years ago. If you're swapping that badly on a desktop you won't have a comfortable "desktop experience" anyway.

    It really depends on what you're doing. A simple firewalling machine will never need to swap. Low trafic websites and mailservers will probably hardly ever need it.

    Also, you can always add swap later if you resize another partition. It really isn't that much of an issue, so pick a value and adjust according to your needs.

  38. Oodles by Rinisari · · Score: 1

    I'm running 8 GB of RAM and haven't used a swap file in a year in Linux. I keep it around in Windows because Windows likes to have it, but even then, it's only 2 GB.

    1. Re:Oodles by Anonymous Coward · · Score: 0

      I've been running my Windows desktop for years with the swap file turned off, and it's worked just fine.

    2. Re:Oodles by Anonymous Coward · · Score: 0

      Same here, but with 2GB of RAM :)

    3. Re:Oodles by Reziac · · Score: 1

      How do you set linux to have no swapfile? Use small words, linux is not my native tongue :)

      I've been running Win98 and XP with no swapfile for years; as noted above, the only thing that complains are a few stupid Photoshop plugins. When system RAM considerably exceeds the OS's max usage, why waste time swapping it out?

      --
      ~REZ~ #43301. Who'd fake being me anyway?
    4. Re:Oodles by SanityInAnarchy · · Score: 1

      Easiest way: When installing Ubuntu, choose "Manual Partitioning", not "Guided Partitioning". Then, create whatever partitions you need -- you really only need one for the root partition, roughly equivalent to C: on Windows.

      If you don't create a swap partition, you won't have a swap partition. End of story.

      Simplest way I know of to check if that's working: run 'free' on the commandline. The bottom line, for Swap, should be three little zeroes.

      If you've already installed, it's somewhat more complicated, as you now have to repartition. That's beyond the scope of a simple Slashdot post -- it's not terribly hard, but there's too many steps, and too many cases of "it depends".

      The simplest way would be to edit /etc/fstab and remove any lines mentioning "swap", then reboot -- but this just tells Linux not to use the swap partition. It's still there, taking up space. And if you're already wasting space on it, you lose nothing by activating it -- Linux doesn't much use swap until it's out of RAM.

      --
      Don't thank God, thank a doctor!
    5. Re:Oodles by DerWulf · · Score: 1

      I'm curios, what happens if you do run out of RAM on WinXP without swap? Do you get errors from across your apps? Can you still open the taskmanager to kill applications?

      --

      ___
      No power in the 'verse can stop me
    6. Re:Oodles by Reziac · · Score: 1

      Hell if I know... my XP machine has been running 24/7 for over 6 years and it's never been a problem. (It's almost never rebooted, either. Uptime record is 11 months.) That box has 768mb RAM; the most I've ever caught WinXPPro using is about 450mb, and that was when I had a bunch of image-editing apps up at once. Otherwise its main jobs are handling my digital camera, making backups of clients' data, and playing DVDs and other media.

      Its almost-twin brother (with 1GB RAM) with Win98 has never complained either, other than as noted, and it's run 24/7 since 2001.

      --
      ~REZ~ #43301. Who'd fake being me anyway?
    7. Re:Oodles by Reziac · · Score: 1

      Thanks very much! Your words gave me enlightenment. :D

      (Really, they did. I experienced a small but worthy breakthrough in my still-dim understanding of linux.)

      In the past I'd let Ubuntu do whatever it wanted (it's been test-flown on a dedicated system); this last time, v8 went thru the motions but neither repartitioned the disk (I tried both manual and automatic) nor installed anything. [scratching head] Next time I venture into linux, it's back to Mandrake, er, Mandriva for me!

      I vaguely recall that Partition Magic recent-version does linux filesystems -- presumably one could apply that in the usual way to kill or shrink an unloved swap partition, not much different from merging FAT partitions. -- Is there a FOSSish PMagic replacement that's *reliable*? I've become disenchanted with the latest incarnation (crappy activation scheme and no floppy-usable component).

      --
      ~REZ~ #43301. Who'd fake being me anyway?
    8. Re:Oodles by managementboy · · Score: 1

      wow, a 11 month old unpatched Windows... ;-)

    9. Re:Oodles by Anonymous Coward · · Score: 0

      Is there a FOSSish PMagic replacement that's *reliable*?

      gparted is pretty good. It's included by default on the Ubuntu 'live/install' disc, so you just boot from that, run gparted, right click on the swap partition and select the swap off option, then use the delete option, then you can right click on the partition before or after the now empty space and use the resize function to incoporate the swap space into the previous or next partition.
      Note that you may not be able to extend a partition backwards from its start point if it's formatted with something other than ext3/ext2. There's an option in gparted (on the file menu I believe) to show exactly which operations are supported on which filesystem types.

      Note that if you extend a large partition (100s of Gb)at the beginning the operation can take several hours. It's vital you don't power off while that sort of operation is in progress, and ideally you should always back everything up to an external drive before changing your partitions (particularly the partition you're extending).

    10. Re:Oodles by swilver · · Score: 1

      If you run out of RAM without having swap, the same thing happens as when you run out of RAM when you have swap. The only difference is, it won't take ages before your system realizes there isn't enough space available.

      Anyway, what happens is that a process is chosen by the Kernel to be killed off. Usually this is the process that has been making large memory requests recently and caused the out of memory condition. This goes very fast if you have no swap, you try to start the program and it will be killed halfway due to lack of memory. With swap, the same thing happens, but it takes much longer before the system "realizes" there's not enough space before killing the offending process.

    11. Re:Oodles by swilver · · Score: 1

      Edit your /etc/fstab. Comment out all mountpoints which say "swap" in the second column and reboot. Alternatively you may add "noauto" as an option for those mountpoints.

      If you want to activate swap again on a live system, and your swap partition is /dev/hda6 for example, type:

      #> swapon /dev/hda6

    12. Re:Oodles by Reziac · · Score: 1

      A six year old unpatched Windows :)

      It doesn't have net access, so if it ain't borked, I don't fix it.

      --
      ~REZ~ #43301. Who'd fake being me anyway?
    13. Re:Oodles by Reziac · · Score: 1

      An AC suggests gparted as included on the Ubuntu live CD... um, how do I get to that? last time I tried Ubuntu, v8, the default partitioner that comes up during install went thru the motions but did nothing. Doesn't sound like the same tool...??

      --
      ~REZ~ #43301. Who'd fake being me anyway?
    14. Re:Oodles by tbq · · Score: 1

      I haven't used a swap file in years in Windows. If it only used the swap when the RAM was completely full it would be one thing, but Windows uses the swap file even when the RAM is almost empty. With no swap file my laptop battery lasts significantly longer since it isn't constantly writing to the hard drive. Both desktop and laptop have higher performance as DDR2 is a little bit faster than my fastest disk drives.

    15. Re:Oodles by SanityInAnarchy · · Score: 1

      First, if it's included, it's included as a program, not as part of the install.

      That is: Boot it as a livecd (choose "Try Ubuntu without making any changes"), then don't click the big "install" link on the desktop. Instead, go looking for gparted. If it's not installed, you can actually install it to the livecd, the same way you'd install software on a running Ubuntu installation.

      Regarding your earlier attempt: When you clicked "manual", you seem to be expecting something magical to happen:

      neither repartitioned the disk (I tried both manual and automatic)

      If you were wondering, "manual" means you have to do it. It should show you a partition table, and you then have to click on partitions and delete them, resize them, mark them to be formatted, set their target mountpoint, etc.

      Finally, a nit: It's not "v8" per se. 8.04 is a date -- 04 (April) of 2008.

      --
      Don't thank God, thank a doctor!
    16. Re:Oodles by Reziac · · Score: 1

      No, "manual" gave me an interface vaguely akin to Partition Magic (which I use all the time), and I moved stuff around til it was sized how I wanted it... clicked Continue (or whatever the button said), and it proceeded to spend the next hour going thru the motions (even asked all the normal install questions) but nothing happened, except it got to a certain point and froze (it did this, with minor variations, four times in a row, on a machine that ran Ubuntu 5-6-7 just fine). Found out later (from several folks I see at the local LUG) that this isn't unusual with Ubuntu 8; reportedly it has something to do with them having removed support for middle-aged NVidia video cards.

      It did nuke the existing install (last year's Ubuntu), but left the HD with no viable partitions; it's so messed up that FDISK won't touch it. I'll have to write zeros to the disk to make it usuable again. (Which per one of my fellow LUG-nuts, it did to his laptop too. So it ain't just me.)

      Didn't know they'd tied the "version number" to the year... it just says 8.something on the CD.

      In the four attempts, only once did it get as far as the LiveCD interface, tho it ran in some oddball low-colour resolution. The INSTALL icon was present, but did nothing. Literally nothing!! Next three tries didn't get anywhere near as far along. Gave up on this version!

      --
      ~REZ~ #43301. Who'd fake being me anyway?
    17. Re:Oodles by SanityInAnarchy · · Score: 1

      reportedly it has something to do with them having removed support for middle-aged NVidia video cards.

      I'm fairly sure that you can add that back in, as well. It's tricky, but you can coerce it to boot to a console (or just hit ctrl+alt+f1 once booted), then upgrade the drivers and restart X.

      Or, if you just wanted to install, the Alternate CD should be fine.

      Of course, I'm aware that at this point, you probably would be better off just picking a livecd that works with your video card, and includes a decent parted.

      it's so messed up that FDISK won't touch it. I'll have to write zeros to the disk to make it usuable again.

      Did you try gpart? I believe it's a tool to guess what the partition table used to look like. And you can always just zero out the MBR (the first 512 bytes), then try to guess what the partitions look like.

      But then, maybe you were halfway through something like resizing a partition, making this very unlikely to work.

      Didn't know they'd tied the "version number" to the year... it just says 8.something on the CD.

      True, and you shouldn't have to. It's irrational, but it just bothers me when people call it "version 8".

      --
      Don't thank God, thank a doctor!
    18. Re:Oodles by Reziac · · Score: 1

      I think that's probably what happened -- the new partition didn't get fully baked, so it wound up mangled. (I know it didn't restart the machine after it was supposedly done repartitioning.) It's a test box and no one really cares about the old Ubuntu 7 (2007? :) install, just annoying cuz U8 wasted a bunch of my time. I'm not overly fond of Ubuntu anyversion... but that week I was supposed to demo it for the PC user grope, and was quite frustrated that it wouldn't play nice!

      Gonna install Mandra^H^H Mandriva current-version on that box next... they've FINALLY fixed a small bug in Konq's filebrowser interface (or at least that's where it manifested, tho I'm not sure it was a Konq bug), that despite being very minor, was a showstopper for me due to being a chronic every-bloody-time-I-used-it annoyance. HOORAY!

      Now if I can find a copy of Corel Photopaint v8 for linux (it exists, retail box no less!), or be assured the WinVersion will run reliably in WINE, I might FINALLY end up with a linux box I can love. :)

      Actually, that level of linux underpinnings, such as the "just do this and that then restart X" are a major source of frustration for me. I completely grok DOS, and I can usually beat Windows-anyspecies into submission (and am quite comfy rooting in the registry), but I feel like I'm blindfolded in linux. :( For users like myself (and most of the small local LUG, for that matter) there's a real need for some middle-ground system tools, that neither hide everything from the Stupid User nor assume everyone is a kernel-geek. Alas, IANAprogrammer, so I can't do anything about it!

      --
      ~REZ~ #43301. Who'd fake being me anyway?
    19. Re:Oodles by SanityInAnarchy · · Score: 1

      Now if I can find a copy of Corel Photopaint v8 for linux (it exists, retail box no less!), or be assured the WinVersion will run reliably in WINE

      None of the free tools work for you?

      Not a problem, really -- I mean, I'm probably about to buy Parallels, even though there are many open source virtualization options. I'm just curious -- usually when Gimp isn't enough, people want Photoshop.

      there's a real need for some middle-ground system tools, that neither hide everything from the Stupid User nor assume everyone is a kernel-geek.

      I would say, a lot of these tools exist, but are unfortunately commandline, and not incredibly well documented. I don't know if that puts them out of your league...

      I think the assumption is that every user who's as far in as you is willing to learn more, and eventually become a kernelgeek :P

      --
      Don't thank God, thank a doctor!
    20. Re:Oodles by Reziac · · Score: 1

      The GIMP has never liked me much, and I don't like Photoshop much. (I won CS2 a while back, but detesting v5/6, haven't yet installed it!) I can do 10x the work in half the time in Photopaint, and it will run on any system less than 15 years old, too :) v8 is the very definition of a user-friendly yet competent bitmap editor.

      I've seen Parallels running, it's nice! and the fact is, if I do wind up with an everyday linux desktop, it's probably going to have some species of both Windows and real DOS running fulltime in VMs. There are a few old DOS apps I can't live without either, including one I need for business that I've never found a wholly-suitable replacement for. (I do have source, but it's in Pascal. After so many years I know the app so well that the source makes sense even without comments. :)

      If someone would compile Vern Buerg's LIST (source for v6 is public domain, but is in assembly) for linux, that would get me further than anything else -- I learned more from snooping around my old 286 with LIST than from all other sources combined!! I think it's perfectly normal to peer at a binary's innards or to read a document in hex mode. :)

      Commandline doesn't bother me, but the fact that I feel blind in the linux environment DOES (LIS, a tool like LIST would help a lot.. Midnight Commander comes close, but isn't real convenient to use that way) ...along with a certain lack of patience when it comes to long strings of esoteric switches and CL arguments... where it's too easy to make a mistake, and *NIX is unforgiving.

      Yeah, I think you're right that the assumption is that anyone who's already a DOS dweeb or a Registry wrangler will eventually become a kernel-geek, and 10 years ago, that was pretty much so. Nowadays ... me and most middle-aged people, even advanced users elsewise, just don't have youth's time and patience for slogging through and absorbing new material. We want it to Just Freakin' Work, and if it doesn't, gimme a hammer and I'll *make* it work. :) But the desire to spend months learning to work with more-refined tools just isn't there anymore. (But I don't want a Mac, because I hate the whole interface with a passion, not to mention the *enforced* ignorance. And yes, I own one!)

      What I'd really like is a linux config interface that works like some HTML editors: a nice GUI where you're shown the available choices, and a second panel where the actual changes are being made in realtime (where you could also edit, if you felt brave). Since most (all?) linux config stuff reputedly lives in textfiles, and since such a dual interface has been in some HTML editors for at least 12 years, ISTM it wouldn't be that hard to implement. With such a tool, the user could use whichever config method he feels comfortable with, and can LEARN if he wishes, by watching exactly what changes the GUI makes to the config files.

      Ideally, any changes made to the text side would be reflected in the GUI too, with Help (maybe info balloons or dialog popups) available for wrong or dangerous choices.

      I think such a tool would go a long ways toward demystifying linux for we who've outgrown the need to tinker with everything and learn every detail, but still want to know Just What The Hell Is Going On In There. IOW, a middle ground for the otherwise-advanced user with limited remaining patience. :)

      --
      ~REZ~ #43301. Who'd fake being me anyway?
    21. Re:Oodles by SanityInAnarchy · · Score: 1

      if I do wind up with an everyday linux desktop, it's probably going to have some species of both Windows and real DOS running fulltime in VMs.

      I doubt I would, mostly because Wine is much better when it's working. The advantage of Parallels, for me, is mostly anything that doesn't work in Wine, and doesn't require a great video card -- if I remember, Parallels actually borrows some Wine code in order to make the DirectX -> OpenGL layer necessary to have decent Windows game performance on Linux.

      There are a few old DOS apps I can't live without either, including one I need for business that I've never found a wholly-suitable replacement for.

      For DOS, there's already a very good, independent program called DOSBox. I imagine that's going to be a lot more efficient than booting an entire VM. But you may not need either...

      I do have source, but it's in Pascal.

      Does it compile with this?

      If someone would compile Vern Buerg's LIST (source for v6 is public domain, but is in assembly) for linux, that would get me further than anything else

      Couldn't find it in a quick Google, but if it's got anything to do with LISP, there are all kinds of LISP dialects for Linux.

      I think it's perfectly normal to peer at a binary's innards or to read a document in hex mode.

      The few times I've wanted to do that, there are hex editors.

      along with a certain lack of patience when it comes to long strings of esoteric switches and CL arguments...

      I haven't often found that to be the case. Most commands have tons of switches, but there are only a few you need to memorize, and manpages help a lot.

      And once you know it, well, I'm never going back from anything Unix-like to anything DOS-like, without very good reason.

      Nowadays ... me and most middle-aged people, even advanced users elsewise, just don't have youth's time and patience for slogging through and absorbing new material.

      Neither do I, really. I make time.

      Never stop learning. And that's not just about Linux. I suppose I could get a job programming COBOL and not have to learn anything else, but at my current job, most weeks, I learn something incidentally. Most months, there's at least one thing I am forced to learn.

      What I'd really like is a linux config interface that works like some HTML editors: a nice GUI where you're shown the available choices, and a second panel where the actual changes are being made in realtime (where you could also edit, if you felt brave).

      I think that would be marginally useful in a few really confusing places (like xorg.conf, fstab, and cron), but not much everywhere else.

      Really, it's not that hard to edit the text. And it's also not that hard to edit text. Start with a good sample config file, and it'll be littered with comments explaining what does what.

      I'd also recommend KDE if you want GUI configurability. It's mostly better at configuring itself -- still not quite what you want -- but at least in KDE 3.5, if I want my panel to be tiny, transparent, at the top of a particular monitor, and possible to maximize over, I can.

      It's also got a nice textual config file layout -- check out ~/.kde/share/config -- nice and consistent, for all KDE apps.

      Since most (all?) linux config stuff reputedly lives in textfiles, and since such a dual interface has been in some HTML editors for at least 12 years, ISTM it wouldn't be that hard to implement.

      For things which already have GUI and textual tools, that might be easy. And maybe not.

      But they are fundamentally different animals.

      See, an HTML editor can just pull in any rendering engine it wants -- Webkit, Gecko, even Trident. I wouldn't go so far as to call i

      --
      Don't thank God, thank a doctor!
  39. New rule of thumb, Swap = 1.2x of Ram by zx-15 · · Score: 1

    I'd say I'd stay on the safe side and follow this rule - my laptop has 1.2G of ram and even at the times when I have lots of applications open under KDE3.5: 5 firefox windows with 15-20 tabs each, evolution, amarok, a couple of krusader instances, 3 consoles with 5 tabs each, eclipse and apache2 running in the background, I've never seen swap usage go over 100Mbytes, so I can say, that for normal work I don't need more than 256 Megs of swap, however, hibernation to disk dumps memory into swap space, so I need at least 1x for Ram for that. So I guess the new rule of thumb is: Swap space = 1x Ram + (Swap at peak memory usage) Of course I use LVM for virtualizing partitions, so resizing a partition is not nearly as painful as it used to be. Also I suggest reading man pages for swapon, swapoff and mkswap; You'd be amazed the flexibility of linux when managing swap partition/files.

    1. Re:New rule of thumb, Swap = 1.2x of Ram by NotQuiteReal · · Score: 1
      I used to use the SQRT(2)*RAM size. Now I find that Pi/3 * RAM size is just fine.

      Of course, some folks consider me quit irrational.

      --
      This issue is a bit more complicated than you think.
  40. In 10 years experience.. by ZERO1ZERO · · Score: 1
    you hould have an idea of just how much memory / swap you tend to use, and you must have at one point done something dumb, like open 500 25 meg images or something by mistake, and thought Shit! and checked the mem usage, just for laughs..

    Anyway. Ime, I have often used same as ram, but twice, i.e. on 2 different drives. and used the priority option to run them at the same level.

    Also, the problem with swap, is that if it does get used alot, then the whole system slows right down. If you have a lot of swap, and a lot in use, your system will be slowed down, but for much much longer.

  41. As with anything... by Anonymous Coward · · Score: 0

    the answer is: It depends.

    If this is a personal computer, set it low or not at all...see what happens. If you need more, increase it (don't be afraid to use swap files).

    If it's a server, try to get a feel for the software that will be running on it and set it accordingly. Over allocating isn't a bad thing unless you have resource limits.

    --AC

  42. Personal research? by daveywest · · Score: 1

    Why don't you conduct some personal tests. Consider creating a script that encompass your typical applications and file sizes that reflect you day-to-day work. Now run the script with ... say 1 gig, 2 gig, 4 gig and 8 gig swap files.

    or /flamebait=on just use a system utility like Activity Monitor on the Mac to compare the number of page ins and page outs.

    I have 4 gigs of ram on an intel iMac, and my swap file weighs in at just under 6 megabytes. This is a production machine that uses CS3, and it's been up and running for 5 days, 21 minutes right now. I'm not working with a lot of large files, but I've been working on a 160 mb (lzw compressed) PSD today while everything else is open.

    YMMV

    1. Re:Personal research? by sr8outtalotech · · Score: 2, Informative

      If you're running Windows, use perfmon and see what the usage is under heavy load and scale accordingly.

  43. Keep swap low by shellster_dude · · Score: 1

    With large ram sizes fairly cheap these days, you don't need much swap. On fairly fast systems, I usually set only a half gig swap partition. This keeps the system from wasting time swapping when it doesn't need to. It also will deal with most normal use requirements for swap. Also, as previously mentioned, as of kernel 2.6 in linux, swap files are basically just as fast as swap partitions, so if the need for more swap arises, you can just handle it that way.

    1. Re:Keep swap low by swordgeek · · Score: 1

      "This keeps the system from wasting time swapping when it doesn't need to."

      Um...no. That's not how it works. Thanks for playing, though.

      --

      "People who do stupid things with hazardous materials often die." -- Jim Davidson on alt.folklore.urban
  44. Depends on what you run. by 427_ci_505 · · Score: 1

    I have a laptop with 4gb ram, and a 1gb swap file just in case. While compiling linux in a vmware hosted linux and using the 'real' os (also linux) for amarok/firefox/gaim/terminals/thunderbird/open-office/etc. I was using 1GB ram. I don't think it's hit swap ever.

  45. If it's a server... by cgroneman · · Score: 1

    ... make sure you have a swap partition, so if you ever need to do a memory dump, it can do it right to the partition. Logic follows that you would need to have the swap partition at least as big as your memory. Also look ahead to any potential memory additions. I do my swap partitions 100 MB larger than my physical RAM max size just to be safe.

  46. Monitor you page in / out counts by q256 · · Score: 0

    I noticed when I exceeded 2 gb on both the Wintel and Mac side my page swaps dropped to 0 page in/out.

    With a 0 swap in / out I have eliminated ALL my swap spaces. I have over the years encounter too many problems with hard drive failures / errors and the operating system to not recover from simple errors which will occur with year of writing the same data over and over (frequently it is the few processes that access these swap spaces anymore).

    Also if you are running Photoshop - creating a dead drive space for just the swap disk is useful when working on LARGE data . . . Earse this space / drive from time to time to eliminate stupid errors that develop over time (shame there are few simple methods to do the same for vitual memory spaces).

    --
    Once upon a time, a soon to be mommy and daddy loved each other very much (the lust was strong as well as the drinks)
  47. what are your apps? by WindBourne · · Score: 1

    Look, I have a 2G ram Linux desktop system. I now used a flash ram disk with zero swap on it. On my server, I have 3G ram, and 4G CD flash HDD for / and 1 TB for other storage, (which sleeps most of the time). On the laptop, it is 1G and has 2G swap. I can tell you that this it depends on apps being used. If I start running google earth for any length of time, then I will add swap on desktop. At this time, it handles KDE, KDETV, and vi for development, make, g++ nicely. With swap turned off and using CF, the system is slightly faster AND 10 degrees cooler (and a lot quieter). SO, are you running MASSIVE APPS, or is it a standard laptop. If so, turn off the swap.

    --
    I prefer the "u" in honour as it seems to be missing these days.
  48. If your database server by XanC · · Score: 1

    If your DB server is swapping, either you've misconfigured things, or some process has run away with your memory.

    Keep your swap file small so that the OOM killer kicks in sooner rather than later.

    1. Re:If your database server by mangu · · Score: 1

      If your DB server is swapping, either you've misconfigured things, or some process has run away with your memory.
      Keep your swap file small so that the OOM killer kicks in sooner rather than later.

      What you say makes sense, but unfortunately Oracle doesn't. The Oracle installer simply won't start if you don't have at least 1GB of swap space, no matter how much RAM you have.

      Want something that works well? Get Postgres. Want to make your boss happy and keep your job? Get Oracle... Sad but true :(

    2. Re:If your database server by djcapelis · · Score: 1

      >If your DB server is swapping, either you've
      >misconfigured things, or some process has run away
      >with your memory.

      Or the kernel is operating properly and pre-emptively swapping out stuff your processes aren't using at all to use that space for increased things like, file caches which, if your database is doing any disk I/O, can be quite useful.

      --
      I touch computers in naughty places
  49. Vista Swap Size by Dolphinzilla · · Score: 1, Flamebait

    Minimum of 5 TB for a Windows Vista Swap file..

  50. No Swap Works for Me by TheTempest · · Score: 1

    I run a laptop with 4GB real memory and a desktop with 8GB - both are running XP64 and have 64GB SSDs (though the desktop is 3x32GB RAID0). I have no swap under either and they are both stellar performers. I never use all my real memory - so why would I need swap?

    On my old desktop the drive ran continuously even when RAM was not completely utilized. The drive was a Raptor so I really noticed it and it annoyed me. It's one of the reasons that I went solid state (besides having an insane urge to blow money) but the constant swapping is gone as well.

    Right now I am running my normal system and 2 1GB VMs and I still have 4.8G available.

    Seems good to me...

    --
    -Dave
  51. What if we just got rid of paging? by Databass · · Score: 3, Interesting

    Maybe we should be asking "should we even bother with swap files?". I took a class on that where we calculated the steps it takes to get the final memory address in a paged memory system. It was something like 36 steps per address! We had PDEs, PTEs, convert this, change that. I didn't grok all the steps, but I do know there were a lot of them. I know 36 steps per little itty bitty piece of memory is a lot, even if you are a very fast CPU, when you have to do this hundreds of millions of times.

    Back in the day, it made sense to convince your programs you had an extra 100 megs of RAM, because a lot of programs needed that and didn't have it in memory. Today, memory is more abundant than things we would really need it for at the non-industrial level. I don't personally have any non-industrial applications that will fill up 4 gigs of RAM. Even Vista + WoW won't take up all that.

    So, and my professor suggested this, maybe the ideal swap size is ZERO. What if your operating system just operated under the concept of "If you can't fit it in 4 gigs, tough. Just wait until memory is free. I'm not even going to bother to split memory into pages because I'm always going to use RAM, not a hard drive page. Case closed." We could save so much overhead and complexity if we just admit that we never need to pretend hard drive is RAM. With 4 gigs or more of RAM, why even have a glacial slow hard drive in the mix?

    1. Re:What if we just got rid of paging? by TheDreadedGMan · · Score: 1

      Amen!

      No swap FTW

    2. Re:What if we just got rid of paging? by autenil · · Score: 1

      I think you're missing the point. Getting rid of paging is way more than just turning off swap. Paging is required for each process to have its own address space (which is in turn required for memory protection). Turning off paging means that we go back to DOS when programs and drivers could unintentionally write over each other and cause each other to crash. Though paging sounds complicated, the support for it is largely baked into the CPU and is generally very fast. And I think virtual -> physical address translation is much fewer than 36 steps :)

    3. Re:What if we just got rid of paging? by Anonymous Coward · · Score: 3, Informative

      Either your professor is an idiot, or you had no understanding what (s)he was talking about.
      Swap is not the reason for paging. Memory fragmentation between programs is the reason for paging. Saying a program can't allocate memory because it has bumped into the next one, when there is a large amount on the other side is insanity. This is exactly like saying you can't write to a file because there is another file right after it on the hard drive. Paging has the nice side benefit of efficient swap (swapping out pages instead of entire processes).
      Having /some/ swap is helpful because often you have data in RAM that you are not actually using, but is not file backed, so you can swap it out to disk and use that memory for something useful, like disk cache for your active set.
      Also, all of those addressing steps are only needed on a full cache/page miss. If this is happening often, your system is thrashing. Think spending 10,000 times the time waiting for page loads than doing address look-ups, or more.
      In any case, suspend to disk requires at least as much swap as you have RAM to store your suspend image.

    4. Re:What if we just got rid of paging? by fifirebel · · Score: 2, Informative
      You are confusing swapping and virtual memory.

      Swapping requires virtual memory. The converse is false.

      All this scary PDE, PTE and other TLB stuff is what happens when a virtual address is converted to a physical address. That has nothing to do with swapping or paging.

      Now, you cannot seriously consider abandoning virtual memory and all that comes with it (inter-process protection, kernel protection from user-space errors amongst others), can you?

    5. Re:What if we just got rid of paging? by multipartmixed · · Score: 1

      > Now, you cannot seriously consider abandoning virtual memory and all that comes with it
      > (inter-process protection, kernel protection from user-space errors amongst others), can you?

      Can you imagine the hit you'd take on fork() without VM? You'd have to re-write every single pointer in the data segment.

      Which would mean you'd need to _know_ what was a pointer and what wasn't.

      *shudder*

      --

      Do daemons dream of electric sleep()?
    6. Re:What if we just got rid of paging? by Anonymous Coward · · Score: 0

      Well, you can disable swap support entirely in Linux (CONFIG_SWAP). There's still paging due to PAE though.

    7. Re:What if we just got rid of paging? by Anonymous Coward · · Score: 0

      You're confusing paging with swapping... The OS pages memory to let every program pretend that it has 4GB of memory all to itself, addressed from 0x0 to 0xffffffff. There are other ways to fit multiple programs into physical memory without paging, such as the base and bounds method, but they all have their own huge problems (The OS needs to know how much memory a process will use at runtime, memory fragmentation issues, etc).

      It may be that swapping to disk doesn't make sense anymore, but paging and virtual memory is here to stay.

      P.S. The real bottleneck in the Virtual Address->Physical Address translation is the memory access time for the page table, not the CPU. :)

    8. Re:What if we just got rid of paging? by petermgreen · · Score: 1

      All modern operating systems use a page based system to map process address space to physical address space. Dedicated hardware in the CPU means that once an address is accessed once the CPU knows instantly where that page is next time.

      By keeping each process in it's own address space relocation fixups on process load can be avoided (there are other soloutions to this such as position independent code but they have downsides of thier own) and program code can be shared among multiple instances of the same program. Also if part of a program binary or shared library is never used that part need never be loaded into memory in the first place.

      Once you have a page based system to provide process seperation and allow processes to have thier own private addres space layout then support for swap comes pretty much for free.

      --
      note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
    9. Re:What if we just got rid of paging? by Anonymous Coward · · Score: 0

      So, and my professor suggested this, maybe the ideal swap size is ZERO. What if your operating system just operated under the concept of "If you can't fit it in 4 gigs, tough. Just wait until memory is free.

      And your professor has worked on which operating systems in a non-academic professional capacity?

      Didn't think so.

      Now go stand in the corner and STFU.

    10. Re:What if we just got rid of paging? by Just+Some+Guy · · Score: 1

      So, and my professor suggested this, maybe the ideal swap size is ZERO.

      I hate to be disillusionary, but your professor sucked. First, you get paging almost for free as a byproduct of implementing virtual memory. Second, the same mechanisms give you cool things like using an executable's binary image on the filesystem as the backing store for that executable, or even mmap(). Don't you like mmap()? Sure you do! Finally, virtual memory is absolutely, utterly critical for system stability. Unified, flat memory spaces were obsolete even before personal computers brought them back into common usage (too bad the 68000 didn't have an MMU), and VM is as good a thing as any I can think of to spend those 6 billion cycles per second on.

      Your professor really told you that swap is bad? Pity.

      --
      Dewey, what part of this looks like authorities should be involved?
    11. Re:What if we just got rid of paging? by Anonymous Coward · · Score: 0

      Even if you don't have a swap file you still need to split RAM into pages - that's how the OS/hardware provides each process with its own address space. Besides, most of the time page tables will reside in the processor's L2 cache which means accessing them is relatively fast.

      I'm not sure why you wouldn't want swap space... it's the responsibility of the OS to use the swap space and RAM in whatever it finds the most efficient way. If you have no swap space, there's no room for it to make a decision. For example, suppose you have a 50MB program that wakes up every 20 days, does computation for an hour, then waits another 20 days. This program should probably be swapped out so the OS can use the extra memory for caching files from the file system, but this wouldn't be an option if you had zero swap space.

    12. Re:What if we just got rid of paging? by dsg123456789 · · Score: 2, Informative

      This is not a good idea. Paging enables all sorts of other behavior besides swapping, such as security and virtualized processes (the standard on all O/Ses). It also allows more esoteric things, like letting user applications use more of the address space, and paging hardware is really optimized, plus, compilers help make decisions to improve the use of the CPU's caching hardware. Paging is a good thing.

    13. Re:What if we just got rid of paging? by Anonymous Coward · · Score: 0

      You might be able to make an argument that, if you have a reasonable amount of RAM to begin with, most users would be best off if they never swapped. Getting the average user to buy a reasonable amount of RAM in their rock-bottom PC is another challenge entirely, but let's assume you could.

      There's more to virtual memory than the ability to swap RAM to the disk, and essentially all of the complexity remains even if you remove that one ability -- memory-mapped files, shared memory, write-xor-execute, copy-on-write, etc. -- they all need virtual memory to work, and most of them are well worth the complexity.

    14. Re:What if we just got rid of paging? by Anonymous Coward · · Score: 0

      Paging is necessary for a variety of reasons. Getting rid of paging is extremely bad idea because it is terribly inefficient to do without the mechanism. Take, for example, a simple executable with a .text/code section a total size of 4MB. Sure, all of it can fit in memory, but what if 3MB of that 4MB code is not getting executed? Does not seem too serious? What if instead of MB, we were using GB's? The reason this was incorporated was because, generally, programs and programmers like to think they can consume all the available physical resources the system has. This simply allows the system to have a way to prevent inefficiency from loading things that are not being used frequently enough into active memory. The summary is that in a highly active system, paging to disk allows a lot more processes/threads to run where originally they would not have been able to run simultaneously (some program would have to wait until memory was freed).

    15. Re:What if we just got rid of paging? by Fulcrum+of+Evil · · Score: 1

      36 steps is a lot, but a whole lot of that is cached - a 32 entry cache is enough to make it a fairly unusual event.

      --
      "We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
    16. Re:What if we just got rid of paging? by famebait · · Score: 1

      "If you can't fit it in 4 gigs, tough. Just wait until memory is free.
      [...]
      We could save so much overhead

      Think that one over again. What about the overhead every application would need to implement in order to operate well under circumstances where this is a common occurrence?

      Development time is hideously expensive, as are errors in production environments.

      --
      sudo ergo sum
    17. Re:What if we just got rid of paging? by Anonymous Coward · · Score: 0

      You are, in fact, an idiot. It doesn't take 36 steps to compute a memory address in such a system. Here are the steps as I best remember them from my graduate OS class:
      1) Take virtual address and split into page number and offset. This is a fixed split.
      2) See if the address is in memory by running it through the translation lookaside buffer while searching the page table. If there's a hit, then you can use the hit result. If there's a miss, then you look through the page table.
      3) If the page table marks the page as in memory, it has the corresponding physical address. Go there. Done.
      4) If the page table marks the page as on disk, free a page in physical memory and copy in.
      5) After copying in, go to the offset. There is your value.

      Aside from that, you want at least a small amount of swap. You want to page out unused parts of shared libraries and programs that are not currently active or running to make room for file system caching. This is a big win.

      Plus, without paging, you lose memory protection.

      Overall F, see me after class.

    18. Re:What if we just got rid of paging? by illumin8 · · Score: 1

      So, and my professor suggested this, maybe the ideal swap size is ZERO. What if your operating system just operated under the concept of "If you can't fit it in 4 gigs, tough. Just wait until memory is free. I'm not even going to bother to split memory into pages because I'm always going to use RAM, not a hard drive page.

      Both you and your professor are ignoring the fact that inactive pages in memory can be paged out to disk, freeing up that memory to be used as a disk cache and increasing performance. Do you really need some shared object sitting in memory the entire time when it is only rarely used by program foo? There really is a valid reason to have virtual memory, even in today's large memory systems.

      --
      "When the president does it, that means it's not illegal." - Richard M. Nixon
  52. I still use a 32-bit CPU by Sloppy · · Score: 1

    So I figure 4GB of total virtual memory is enough for anyone. Um, I mean, enough for me.

    --
    As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
    1. Re:I still use a 32-bit CPU by multipartmixed · · Score: 1

      I don't know about Wintel (or even Linux/x86), but there is no reason to limit yourself to 4GB of VM in a 32-bit environment. You only need to limit yourself to 4GB of address space per process.

      Segmented addressing (all the vogue on the 80286 -- is it still on x86?) allowed 20-bit addresses in 16-bit address space.

      I have even seen OLD (10-12 years old) Sun machines which could take 5GB of RAM but only had 32-bit sparc CPUs.

      --

      Do daemons dream of electric sleep()?
  53. Rules of Thump are useful, until thumps become old by Anonymous Coward · · Score: 0

    Indeed, that was a common saying during the 90s. Since then, lots of things have changed. Among others, memory is cheap and disks not at all dramatically faster, to the point that managing them (HDDs) might actually slow down your system. There are reports that disabling your swap completely actually *increases* your system performance, because the VM code management overhead is gone.

    In practice, you will need some swap so that your system can gracefully degrade in times of memory need, and will just eventually slow down instead of crashing applications (and data) here and there. Read for more on OS terms: "Trashing"

    If you look here, on middle of page #6, even High Performance Computing sysadmins (Hi LCG people!),
    are nowadays departing from 1:2 memory:swap ratio.
    http://arxiv.org/abs/0705.1915

    In fact, my recommendation would be to go towards something like 2:1, 4:1 or even more conservative scenarios, unless you have a *reason* to do else.
    The graphs mentioned above do the same. Note that for practical reasons it is customary to keep the memory:swap ratio a (negative) power of two.

    Note that swapfiles can always help you in case you run tools like "varnish" and find out you are low on virtual memory.

    "Old tradition" is not a good guide in systems administration. Thank you for asking, you are one of few, that actually challenge bad habits...

  54. With a caveat... by michaelepley · · Score: 1

    I'd actually like to set up more swap, for the times I need more RAM than I've got (only 1GB on my work LT, oy). Nevertheless, I generally do not use any swap space for two reasons: 1) windows at least seems to poorly manage memory, even when I am not using anything close to my physical RAM, it insists on swapping, slowing things down unnecessarily; and 2) I usually need the HDD space...why is it that windows and other OSes cannot dynamically allocate/deallocate swap space as needed?

    1. Re:With a caveat... by compro01 · · Score: 1

      Windows can. You can set minimum/maximum swap file size and it will grow/shrink the swap as needed, though that has a tendency to severely fragment the swap file after awhile if you don't have a sizable amount of contiguous free disk space.

      --
      upon the advice of my lawyer, i have no sig at this time
    2. Re:With a caveat... by Gewalt · · Score: 5, Interesting

      Oh dear FSM, Please for the sake of everyones sanity, NEVER LET WINDOWS GROW THE SWAPFILE! besides the fact it it will fragment the pagefile, it will also completely lock up the computer for X amount of time... right when you need it most! ...it ALWAYS happens at a bad time.

      --
      Modding Trolls +1 inciteful since 1999
    3. Re:With a caveat... by Anonymous Coward · · Score: 0

      ...it will also completely lock up the computer for X amount of time... right when you need it most! ...it ALWAYS happens at a bad time.

      Hmm, "always", hey? I can't say I've ever seen this behaviour. But then again, I've only been using Windows for about 16 years. Maybe next week I'll experience this behaviour that always happens.

    4. Re:With a caveat... by Culture20 · · Score: 1

      Also, scheduled (or manual) defrags don't defrag the swap file since it's an in-use system file.
      I once saw a pagefile.sys with >10,000 fragments on a user's disk after he reported performance issues.
      Had to remove the pagefile, defrag(2x), then set a large static size and warn him not to reset to dynamic no matter how much vram he thought Visual Studio needed.

    5. Re:With a caveat... by Mathness · · Score: 1

      it ALWAYS happens at a bad time.

      With luck there is a chance for a FP another time. :P

      --
      Carbon based humanoid in training.
    6. Re:With a caveat... by 19Buck · · Score: 1

      Windows (at least vista and XP) will not grow the page file size until page file demand grows to 150% of current total available page file. If you are having problems with running out of pagefile space in windows, you have either artificially set it extremely low, or your pc is insanely low on RAM, you're beating the crap out of it and are too cheap to buy more RAM.

    7. Re:With a caveat... by Blakey+Rat · · Score: 1

      Dude, this is Slashdot, remember? I can practically guarantee the grandparent hasn't used any version of Windows newer than Windows ME.

      All the criticisms of Windows on this site are either factually incorrect, or apply only to ancient versions. (Oh, and you're not allowed to criticize ancient versions of Linux, just so you're aware.)

    8. Re:With a caveat... by Anonymous Coward · · Score: 0

      Why would it matter if the swap file is fragmented?

    9. Re:With a caveat... by hab136 · · Score: 1

      Also, scheduled (or manual) defrags don't defrag the swap file since it's an in-use system file.
      I once saw a pagefile.sys with >10,000 fragments on a user's disk after he reported performance issues.
      Had to remove the pagefile, defrag(2x), then set a large static size and warn him not to reset to dynamic no matter how much vram he thought Visual Studio needed.

      Not the built-in defragger, no. 3rd party tools like PerfectDisk can defrag the swap file (and other system files), though some of it has to be done during bootup.

    10. Re:With a caveat... by hab136 · · Score: 1

      Why would it matter if the swap file is fragmented?

      Same reason it matters that regular files are fragmented - it's slow to pull 200 pieces of a file off of 200 random locations on the disk. It's much faster if all of those 200 pieces are lined up in a row next to each other.

    11. Re:With a caveat... by Anonymous Coward · · Score: 0

      You pray to finite state machines?

    12. Re:With a caveat... by Gewalt · · Score: 1

      That's just as logical as praying to flying spaghetti monsters, so sure, why not!

      --
      Modding Trolls +1 inciteful since 1999
    13. Re:With a caveat... by redmoss · · Score: 1

      Uhh... how does the Flying Spaghetti Monster affect swap?

      Just wondering...

    14. Re:With a caveat... by Anonymous Coward · · Score: 0

      wow.. and i thought that windows is supposed to crap out during the most critical of moments?
      isnt that how they do their advertising? (olympics, speech to text preview, etc)

    15. Re:With a caveat... by Anonymous Coward · · Score: 0

      Windows DOES dynamically allocate/deallocate swap. Ever had the message "Your computer is running low on virtual memory" while the disk sounds like it's about to destroy itself? That's windows allocating more swap. It leaves you with a horribly fragmented swap file though, because this always only happens when your system is already fragmented!

      The best way to configure your swap file on windows is:

      1) Disable swap completely, and reboot.
      2) Run defrag, making sure you end up with a nice large block of free space. Reboot in safe-mode and repeat if required.
      3) Turn swap back on, with the min and max values set to the same size. Reboot again.

      You'll now have a contiguous swap file, causing much less disk thrashing when your system is heavily loaded.

    16. Re:With a caveat... by Anonymous Coward · · Score: 0

      So...what's the "good" time for locking up your machine?

  55. Been There Done That... by killmofasta · · Score: 3, Informative

    I have made hundreds of swap partitions for OS X, AU/X, Windows, Schmindows, and just about every flavor of Unix I came across.

    I would advise...
    For Windows, load Process Explorer, and look at the Commit Change Peak RAM. Nice...

    Now load a browser, a word processor, and Acrobat. OR Load the game you want to play.

    Make the partition the size of that peak RAM+10%.
    Make the swap size, the larger of the system cache or the minimum peak commit change. ( There is a brilliant trick here, but Id have to kill you...)

    System 1:
    1024MB ram.
    Peak is 70%.
    Swap partition is : 1916Mb, 64K Clusters.
    Swap file size is : 512~1668Mb
    Swap file size on OS Partition is 2Mb.
    ( Someone warned me about this, and I actually listened. Sure has helped when imaging drives )

    More Later...( It gets trickier for smaller ram values...) I am working on a 512MB system, a 384MB system, and a 256MB system.

    1. Re:Been There Done That... by Anonymous Coward · · Score: 0

      I wish I had mod points now :(

    2. Re:Been There Done That... by killmofasta · · Score: 1

      Thanks for the 5!

      I left out something: You sould shave off 2xRAM for what you would never use! ( i.e. Max Commit is how much you cannot swap out! ).

      So, If you have 512Mb Ram, and you only use 420 of it, then if all of that was swapped out ( dont swap out UNUSED RAM DUMMY! ) Then you can shave off at least 80Mb off your virtual memory partition.

      The next cut should be look at what you really use Real+Virtual. L@@K at your Page file usage in Task Manager. With A Browser, a Word Processor and Adobe Acrobat, Im only using 488 Swap file.

      OK! Ill play a movie. Only went up my 30Mb. Geez.

      Point is You need to look at what your maximum page file USAGE is, and add 10% to that, for the partition size.

      System 2:
      512MB Ram
      Peak is at 100%
      Swap partition is 896Mb.
      Swap file size is 448~890Mb
      Current use is 525Mb ( abd Mut$oft recommends 760 ) Which is to say, you shoudlnt waste disk space on Recommendations.
      ( and the movie is still playing )

    3. Re:Been There Done That... by killmofasta · · Score: 1

      System 3
      256MB of RAM, 32MB shared memory,
      so its 224Mb to start.
      Peak is again at 100%,
      and I have shaved Win2k down to 46MB,
      so I have about 178Mb free.
      2x is 448, so I made the swap partitioin 416,
      and the Swap file size is 400.
      Current use is...crash master @ 380Mb.
      but its fast....

      Ok...Now I have only the attention of the few...
      Best kept secret? CacheMan! Cuts down the ram footprint, and only slightly impacts the swap file, while makeing the whole damn system MUCH more reliable. Cant wait to get it on the 2k system.

  56. Zero can work fine for Linux. by gweihir · · Score: 1

    At least I have a firewall/fileserver 1GB memory but without swap. It gets uptimes > 1 year. I have not observed any problems so far.

    --
    Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
  57. Use a swap file instead. by astrosmash · · Score: 1

    You probably need less than your RAM size. On my laptop with 1 GB of RAM it's 512 MB:

    astro@myrtle:~] ll -h /var/vm/
    total 3145728
    -rw------T 1 root wheel 1.0G 6 Feb 2008 sleepimage
    -rw------T 1 root wheel 64M 1 Oct 13:21 swapfile0
    -rw------T 1 root wheel 64M 1 Oct 14:32 swapfile1
    -rw------T 1 root wheel 128M 1 Oct 14:35 swapfile2
    -rw------T 1 root wheel 256M 1 Oct 14:35 swapfile3

    --
    ENDUT! HOCH HECH!
  58. Re:separate partitions for / and /home by QuantumG · · Score: 1

    Is there any point to separate partitions for / and /home? I mean, if you were running different file systems on each of them I could see the point.

    --
    How we know is more important than what we know.
  59. Run multple instances ;)Re:Definitely not twice... by Anonymous Coward · · Score: 0

    #include
    #include
    #include
    #include
    #include
    #include
    #include
    long long int *x;
    int main()
    {
    long long int i;
    long long int *p;
    long long int *q;
    int bignum=1024+1024;
    p=x;
    printf("mallocing alot\n");
    p=malloc(1024*1024*bignum);
            if(p == NULL) {
            printf("error no more memory.\n");
            exit(1);
    }
    printf("entering loop\n");
    printf("Filling memory with 1's.\n");
    for (i=0; i (1024*1024*bignum)/8; i++){
    p[i] = 1;
    } /*printf("Comparing stored value to 1\n");
    for (i=0; i (1024*1024*bignum)/8; i++){
            if (p[i] != 1) {
            printf("compare error\n");
            }
    }*/
    printf("exiting loop\n");
    printf("malloc'd alot\n");
    printf("Done\n");
    sleep(5);
    printf("freeing memory\n");
    free(p);
    return(1);
    }

  60. Mod parent up by John+Hasler · · Score: 1

    This is sensible. The sum of swap and real memory should exceed the largest amount of virtual memory you ever expect to need. On Linux it is desireable (but not necessary) to always have a little swap.

    --
    Warning: this article may contain humor, sarcasm, parody, and perhaps even irony. Read at your own risk.
  61. That's not the point of swap space. by Estanislao+Mart�nez · · Score: 3, Informative

    The point of swap space isn't to kick in when you run out of physical memory. The point of swap space is to allow the kernel to make use the most efficient use of your RAM, by swapping out the contents of infrequently accessed memory pages, and putting that memory to better use, like caching frequently accessed disk blocks.

    If you have no swap space at all, any memory pages that your processes are hardly using have to stick around in memory forever, even if you'd get better performance by swapping the contents out and using it for caching disk blocks. So seriously, you should add some swap space, at least as much as your RAM.

    1. Re:That's not the point of swap space. by Anonymous Coward · · Score: 0

      Swapping to disk is slow. That is why I added more memory so my system would cache the swap file. ;)

    2. Re:That's not the point of swap space. by Estanislao+Mart�nez · · Score: 1

      Swapping to disk is slow. That is why I added more memory so my system would cache the swap file. ;)

      Reading from disk is slow compared to memory. If the lack of swap space prevents you from swapping out a page, you may end up doing more I/O than if you had swapped it out.

      There are a lot of details in the full story here, but here's a toy example. Assume writing and reading a single block in disk always costs the same, and that memory pages are the same size as disk blocks. Compare the cost of these two scenarios:

      1. Processes request the same filesystem block three times. To satisfy these requests, you go to disk each time. Total cost incurred: 3 disk I/Os.
      2. Processes request the same filesystem block three times. For first request, you swap a memory page out, read the filesystem block, and cache it; cost is 2 disk I/Os. For the second and third request, you give them the cached block. Then the page you swapped out gets touched, so you swap it back in; cost is 1 disk I/O. Total cost incurrend: 3 disk I/Os.

      Swapping in and out breaks even in this case. It's an extremely simplistic example, but it demonstrates the point: swapping pages out and back in costs you some disk I/O, but reading filesystem blocks from disk also costs you some disk I/O. You don't actually want to minimize swapping; you want to minimize disk I/O, whether it's from swapping or reading a filesystem. Swapping in fact helps you minimize disk I/O, and that's why you always want to have some swap.

  62. RAM-based hard drive by suck_burners_rice · · Score: 3, Interesting

    I have 64 GB of RAM and my swap partition is the same size at 64 GB. I thought 128 GB is a little excessive. What I would really like is if someone would make up an IDE interface to RAM modules and build a large amount of such RAM into the form factor of a hard disk drive. Then, you could populate this RAM-based "hard drive" with the necessary data during startup, and use it for swap and for all of your system's various "temp" folders. This would make swapping (and temp stuff) extremely fast to access, and more importantly, it would eliminate the need to encrypt your swap and/or temp partitions, as the data would simply disappear when power is removed. So when the agents (including Agent Smith) come to bust down your door, all you do is pull the plug and voila! Your secrets are safe. :-)

    --
    McCain/Palin '08. Now THAT's hope and change!
    1. Re:RAM-based hard drive by Tony+Hoyle · · Score: 2, Interesting

      .. or you could just install the RAM in the machine and remove the need for swap at all. tmpfs takes care of the rest.

    2. Re:RAM-based hard drive by suck_burners_rice · · Score: 1

      But the machine doesn't support more than 64 GB, or in the case of most machines, you usually can't install more than 4 GB or 8 GB. An IDE interface to such a thing allows ANY computer to access ANY amount of RAM. The IDE interface will know how to select the proper memory bank because you can split it up into several groups if the total amount you need exceeds the addressing capability of a RAM addressing scheme.

      --
      McCain/Palin '08. Now THAT's hope and change!
    3. Re:RAM-based hard drive by everphilski · · Score: 1

      There is a PCI Express card that takes RAM and shows up as a hard drive, look up DDRDrive x1 for one example.

    4. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      They make ram disk cards that let you use ram as a drive, but most max out at 4gb

    5. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      So a little bit like Gigabyte's iRAM?
      Admittedly it keeps it powered when the computer is off, and it's hardly "heaps" of memory, but compared to your 64Mb it should be nice.

    6. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      What I would really like is if someone would make up an IDE interface to RAM modules

      You mean create a ramdisk. That is easy. And with 64bit computing, your ram limit is rather high.

    7. Re:RAM-based hard drive by Anonymous Coward · · Score: 1, Informative

      They have this technology already
      http://www.tomshardware.com/reviews/gigabyte,1111.html

      Can't find the other product that actually fits in 5.25 inch drive bay, but it was 10x's the cost a few years ago.

      I picked up 4 of these cards for $60 on ebay 3 years ago, and then sold on ebay for twice that each.

      However these cards have battery backup, but this could be removed. =]

    8. Re:RAM-based hard drive by felipekk · · Score: 1
    9. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      You mean like a Violin 1010?

    10. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      This already exists.

      http://www.tomshardware.com/reviews/hyperos-dram-hard-drive-block,1186.html

    11. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      What a flamebait idea. Interesting? The purpose of RAM is to be fast. IDE is the SLOWEST transfer technology in use today (because remember it's BURSTING to up to 133mbps not sustaining). I can sustain those speeds with anything besides UDMA. What we need is a less resource-intense way to transfer data. Like databass said, there are a ton of micro steps involved in simple procedures. Many of the more complex procedures have been simplified by enhanced instruction sets like SSE3, but the simple tasks that require many steps are still handled very simply. And still require many steps.

      To the point, apply this to swap. Linux manages memory very well. However, there are some old instructions on how to manage memory - such as keeping old bits cached - that were very useful 20 years ago when we used two pieces of software one at a time. Hence 2xRAM is not a bad idea. However, now I'm running at least 50 things all at once including a memory intensive rebranded firefox, real firefox through wine if I want real flash, a game through wine, an IM application, an email application, 3 terminals, I'm ssh'd and ftp'd into different computers through dolphin, etc, etc. It's very easy to load a program into RAM and cache it until we run out of memory, but it's much more difficult to cache the parts of a program that I specifically am most likely to use, and remove it from RAM completely if I'm not likely to open it again. I just got done developing for the day and played a game. Top says my load average is around 2 and I'm currently using 1GB of swap with 2GB of RAM. Until we get rid of this ancient (although tuned and efficient - don't get me wrong) memory model, how can we get away from the old swap model?

    12. Re:RAM-based hard drive by supermanwashere · · Score: 2, Informative

      Actually stuff stored in RAM isn't safe either. If you remember a couple of months back an article was posted were researchers were able to recover contents from RAM more than 10 minutes after power was shut off. The only way it's safe is if you write something to all locations in RAM. Additionally you wouldn't gain significant speed. On a server most of your stuff is already in RAM when the system is running. On a desktop you would be better off prefetching, 1 GiB RAM costs around 300 times what 1 GiB HD space costs (1 gig RAM $30, 1 gig HD space $0.05 more or less).

    13. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      You know the ram degrading takes enough time that they could just plug it back in and read it right?

      Something like 10+hours if supercooled with liquid nitrogen, ~15 minutes if hit with some compressed air, ~2 minutes uncooled.

      see: http://citp.princeton.edu/memory/

    14. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      Yes, because the 100MHz IDE interface wouldn't create a bottlneck. Have you ever heard of a RAM disk? If I had 64GB of RAM, I would be using one just to play with.

    15. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      What I would really like is if someone would make up an IDE interface to RAM modules and build a large amount of such RAM into the form factor of a hard disk drive. Then, you could populate this RAM-based "hard drive" with the necessary data during startup, and use it for swap and for all of your system's various "temp" folders.

      you mean something like this? (note the article date)

    16. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      they exist, they'rejust pricy
      http://en.wikipedia.org/wiki/I-RAM
      http://www.hyperossystems.co.uk/07042003/index.htm

    17. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      It already exists. It's called Battery Backed Memory. It will set you back around 60K for 16GB

    18. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      They do!
      http://www.anandtech.com/storage/showdoc.aspx?i=2480

    19. Re:RAM-based hard drive by jfim · · Score: 1

      I have 64 GB of RAM and my swap partition is the same size at 64 GB. I thought 128 GB is a little excessive. What I would really like is if someone would make up an IDE interface to RAM modules and build a large amount of such RAM into the form factor of a hard disk drive. Then, you could populate this RAM-based "hard drive" with the necessary data during startup, and use it for swap and for all of your system's various "temp" folders. This would make swapping (and temp stuff) extremely fast to access, and more importantly, it would eliminate the need to encrypt your swap and/or temp partitions, as the data would simply disappear when power is removed. So when the agents (including Agent Smith) come to bust down your door, all you do is pull the plug and voila! Your secrets are safe. :-)

      Or you could simply add more RAM to the system, use no swap and put the temporary folders in RAM(using tmpfs). Such a product exists, by the way.

    20. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      Ever heard of ram disks?

    21. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      This is kind of like what you are looking for: http://en.wikipedia.org/wiki/I-RAM. The only problem is that it still has max size limitations. The other problem is the bandwidth bottleneck. This is with a sata disk I can only imagine what it is like through an ide interface.

    22. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      Something like this....

      http://techreport.com/articles.x/9312

      Its a PCI card that takes DDR SDRAM modules that you can then hook up via SATA

    23. Re:RAM-based hard drive by Frogbert · · Score: 2, Informative

      Yeah that would be a great idea.

      And yes, those bad boys do raid together and they max out SATA transfer rates.

    24. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      You mean like a RAM disk? Available since early versions of DOS? Or going the expensive route battery backed SSDs utilising standard D-RAM also available for decades.

    25. Re:RAM-based hard drive by b1c1l1 · · Score: 1

      This would make swapping (and temp stuff) extremely fast to access, and more importantly, it would eliminate the need to encrypt your swap and/or temp partitions, as the data would simply disappear when power is removed. So when the agents (including Agent Smith) come to bust down your door, all you do is pull the plug and voila! Your secrets are safe. :-)

      Wrong.

      A simple cold boot attack can dump your memory contents, mostly intact. DRAM bits don't fade as quickly as you think.

    26. Re:RAM-based hard drive by dogganos · · Score: 1

      >I have 64 GB of RAM and my swap partition is the
      >same size at 64 GB. I thought 128 GB is a little
      >excessive.

      I have 640KB RAM, and never needed more.

      B.G.

    27. Re:RAM-based hard drive by Stoutlimb · · Score: 1

      What you describe exists, and it's not even expensive. It's called the I-RAM. And some people use it for that purpose. If you're really paranoid run your whole OS off of it... Or at least keep all your temp folders there.

      http://en.wikipedia.org/wiki/I-RAM

      Enjoy!

    28. Re:RAM-based hard drive by Viperpete · · Score: 1

      There is a whole wiki page on Solid State HDs:

      http://en.wikipedia.org/wiki/Solid-state_drive

      There is a SATA one by gigabyte for example:

      http://en.wikipedia.org/wiki/I-RAM

      Newegg has a wide variety of them available, bit pricey for me 'tho:

      http://www.newegg.com/Store/SubCategory.aspx?SubCategory=636&name=Solid-State-Disks

      --
      loose: not fitting closely or tightly != lose: to suffer the deprivation of
    29. Re:RAM-based hard drive by m50d · · Score: 1

      No need to dick around with IDE (you'd probably have to repartition that every boot), just use tmpfs to store files in system memory as if it were a hard drive.

      --
      I am trolling
    30. Re:RAM-based hard drive by cps42 · · Score: 1
      For enterprise data bases, I ran across this a while ago:

      http://www.violin-memory.com/

      The Violin 1010 connects to a server and provides almost 10 times the capacity of memory per rack and per Watt. A single rack of Violin 1010 can support 10 TByte of DRAM at less than 1W per GByte! The 90% power savings per GByte is important for the green data center.

    31. Re:RAM-based hard drive by Jabroney · · Score: 1

      Except when seizing computers it's now proper procedure to remove the wall socket and attach a battery backup, before snipping the wires on the mains. Your machine never goes down! o.O

    32. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      They have RAMDisks, they are usually SATA in my experience and while they sit in your pci slot (for power) they plug into the SATA port. I have seen a computer run off a pair of these (with 4GB each) in a RAID 0, it was QUICK! anyhow, if this is your ideal ram, then by all means pick up one and load it with a spare GB or 2 of ram (i think there are a lot of DDR1 spec'ed boards available) but it will be more expensive than a spare 2GB sliver of your 500GB drive. If you do a lot of movie ripping, this may be worthwhile though...or DB work or something else.

    33. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      not really, ddr memory tends to be in same position for a couple of minutes I believe it was. In that period they can freeze your dimms, en transport it to a forensic lab.. and then, well you're done for

    34. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      So you want to use part of your physical memory as a swap file, which is a virtual memory storage system...

      How about just declaring no swap and then you'll have the same effect without the overhead of calling the swap subsystem? You can still use tmpfs to store /tmp.

    35. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      Check out Gigabyte's i-RAM:

      http://techreport.com/articles.x/9312

      It's looking a bit dated now, but it gives you up to 4GB per card with DDR and a SATA interface. You can raid the cards if you needed more space.

    36. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      They exist, look up RAM-based SSD: http://www.sparcproductdirectory.com/ssd1.html

    37. Re:RAM-based hard drive by jon3k · · Score: 1

      "What I would really like is if someone would make up an IDE interface to RAM modules and build a large amount of such RAM into the form factor of a hard disk drive."

      http://www.gigabyte.com.tw/Products/Storage/Products_Overview.aspx?ProductID=2180

    38. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      Sounds like the parent needs a ramdisk. Does anyone have a tmpfs to spare? ;)

        -AC

    39. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      see fusionio.com
      pretty awesome.

    40. Re:RAM-based hard drive by dvs01 · · Score: 1

      This is what you're looking for: http://en.wikipedia.org/wiki/I-RAM

    41. Re:RAM-based hard drive by 6th+time+lucky · · Score: 1

      1) You can buy such IDE-RAM drives :), and i guess if you can afford a system with 64GB RAM you might actually be able to afford them. Then again why not just have 128GB RAM and put half to a RAM disk. But then, would I need 256GB of HDD swap? but then why not more RAM /head-explodes

      2) Pulling the plug aint gona help if they dunk the computer in liquid nitrogen... far fetched, yes, but if you are that paranoid... /summary:DRAM keeps data for up to several minutes even at room temp, and for months when really really cold

    42. Re:RAM-based hard drive by Anonymous Coward · · Score: 0

      This has been available for quite some time as a PCI card.

  63. None may be a good option by thogard · · Score: 4, Insightful

    I've been setting up machines with no swap partitions for a few years. Swap partitions have a bad habit if collecting secure info you may have assumed was just in ram. All modern operating systems allow to you use a file or other blank space as swap means you don't need a dedicated partition. There is also the issues that if your starting to swap, where does it end? If your swapping on a machine with 4 or 8 gig of ram, will an extra gig help fix what ever is broken or just make the machine very slow until it gets around to telling the runaway program that there is no more memory. In the case of no swap, that tends to happen much faster. The only reason I see for swap partitions is that the OS will need a place to dump debug info if it crashes and the swap partition has traditionally been used for that.

    1. Re:None may be a good option by Randle_Revar · · Score: 1

      It is pretty easy to setup an encrypted swap partition (or even whole disk) nowadays.

  64. forgetting to forget??? by NemoinSpace · · Score: 1
    'Just set it to twice your RAM and forget about it.'

    forget about it was an inclusive instruction, not part of a for next loop. :)

  65. Errr... check your math. by sirwired · · Score: 4, Informative

    8GB swap on a 120GB drive is 7%, not .07%. On a 200GB drive, it's 4%, not .04%, etc.

    SirWired

    1. Re:Errr... check your math. by evilviper · · Score: 5, Funny

      8GB swap on a 120GB drive is 7%, not .07%. On a 200GB drive, it's 4%, not .04%, etc.

      It's "Verizon math"...

      Just my 0.02 cents worth.

      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    2. Re:Errr... check your math. by Chuck+Chunder · · Score: 1

      Just my 0.02 cents worth.

      <applause>

      --
      Boffoonery - downloadable Comedy Benefit for Bletchley Park
    3. Re:Errr... check your math. by Anonymous Coward · · Score: 0

      I was going to make a "just my 0.0002 cents worth" joke, but then I realized that I'm dumb.

    4. Re:Errr... check your math. by mockidol · · Score: 1

      "Just my 0.02 cents worth." I logged in just to point out hom much that made me laugh.

    5. Re:Errr... check your math. by srothroc · · Score: 1

      Yeah, it was pretty early in the morning for me and I forgot to multiply them all by 100 when I decided to put in percent signs... sigh.

    6. Re:Errr... check your math. by skeeto · · Score: 1

      I didn't realize it until I took a look for myself, but there are so many people make this mistake. 41,900 hits worth.

    7. Re:Errr... check your math. by Anonymous Coward · · Score: 0

      and it is not 0.02 cents it is $0.02 ... according to my understanding of the popular phrase "my two cents-worth"

    8. Re:Errr... check your math. by TheOtherChimeraTwin · · Score: 1

      Yes, but he was referring to Verizon Math

  66. Re: How big should my swap be? by 93+Escort+Wagon · · Score: 1

    Well, you know what they say - 640K ought to be enough for anybody.

    --
    #DeleteChrome
  67. I've always used by log0n · · Score: 1

    Before 1GB was typical, I always used 1.5 * total memory.

    Now with 1GB and more being typical, I've gone with .5 or .75 * total memory.

  68. Big enough that applications don't crash hard by Kjella · · Score: 1

    Hard OOM errors are really annoying, and sometimes hit the wrong process if it's unlucky enough to ask for more memory after another applciation has eaten 99%. Just make it enough that you know the disk is going crazy, go kill something. Even with all the wierd stuff I do I still don't run out of memory on 4GB. Actually I have some unused because I'm still running a 32 bit linux because I haven't installed the 64 bit version, but I don't care. And if I did manage to need more than 4GB I'd get 64 bit, 4x2GB and still not worry. And you actually don't pay much of a premium for 16GB either, a 4x4GB set costs about twice that of a 8GB set. Not that I'd have any clue what do to with that, but if you develop A3 posters in print quality maybe it's handy. In short, memory has run off the curve for me. Processors too, it's never very busy. The two things that still could improve are graphics and bandwidth (solution for latter: move, sigh).

    --
    Live today, because you never know what tomorrow brings
  69. Re:separate partitions for / and /home by eldavojohn · · Score: 5, Insightful

    Is there any point to separate partitions for / and /home? I mean, if you were running different file systems on each of them I could see the point.

    I have gone through four different version of Linux on my laptop: mandrake/mandriva -> fedora -> knoppix -> ubuntu. Guess how many times I've thanked 8 lb 6 oz baby Jesus that I had the foresight to separate the two? All my data from my college days is still intact under /home.

    For this simple reason, I heavily recommend it.

    --
    My work here is dung.
  70. Re:separate partitions for / and /home by ickpoo · · Score: 1

    It is handy when installing a new version of the OS. Just format the / partition and leave home alone.

    --
    I am not a script! .Sig?
  71. Re:separate partitions for / and /home by the+unbeliever · · Score: 1

    In case you want to switch distros and not lose all of your data.

    At least that's why I do it.

  72. I am a M$ guy.. so Ive used this: by undeaddemon · · Score: 1
  73. Re:Rules of Thump are useful, until thumps become by Anonymous Coward · · Score: 0

    Everything is just right about that comment, except that thrashing is thrashing and not trashing...

  74. RAM drive by peterofoz · · Score: 1

    I have a 4GB Win2k3 server as a development machine. I've installed a Gigabyte 4GB iRAM drive (with battery backup) and set my paging/swap file there for 2GB. The other 2GB are TEMP/TMP for java and other apps to use. SQLserver and Oracle databases are detuned to utilize smaller memory footprints for development. We also run the occasional VMWARE image.

    The C: drive is on a different mirrored disk and controller from the other drives which splits up the I/O there.

    Yup - its faster now

  75. Re:separate partitions for / and /home by QuantumG · · Score: 1

    Ahh, groovy. Thanks for the awesome reply!

    --
    How we know is more important than what we know.
  76. zero by Technomancer · · Score: 1

    Just add more memory.
    I have never seen my linux box with 5GB of memory run out of memory.
    If you cant add memory just set it to 1x or 2x the memory size. If your working set will be much larger than your available memory your computer will be unusable anyway.

  77. Need More Info... by Vrallis · · Score: 4, Insightful

    I also agree that the old "2 x RAM" standard is outdated.

    If you are a typical desktop user--browsing, email, games, etc, you will likely never swap. If you happen to edit photos a lot then you'll use a bit more. In these cases doing 4GB swap for 4GB RAM should be more than sufficient, and even then overkill.

    If you are a serous 'power' desktop user, heavy graphics / video editing or similar heavy-duty tasks, you will likely have significantly more RAM. If you ever did swap things would become so slow your productivity would be severely hampered.

    Were you talking about a server I'd say the same thing. Your swap space on an active server (thinking database or application server) is really just there to keep you operational should some process go haywire, long enough for you to fix it. If you are regularly swapping on a server then you need to upgrade your RAM or adjust your software on it.

    1. Re:Need More Info... by Overzeetop · · Score: 1

      I heartily agree. The only good reason I can see for swap is gone - expensive memory. The first PC I bought out of college memory cost me $40/MB and I bought 8MB so I could run NT. With memory costs so low, there's practically no excuse for not getting enough memory to run the system without requiring swapping by the OS. When I got my current laptop (which is almost 4 years old), I put in 2GB of memory so that I could run without a swapfile. With any data intensive operation, unless you happen to be swapping out unused processes (which is likely 10% of your base memory), any desktop/workstation machine will become useless when having to use HDD space as memory.

      Heck, I can't even imagine editing photos (save maybe a hassleblad) that would actually take up enough space to need more than 4GB of RAM. Even at 16bits and 24MP, you can hold 8 copies of the photo in memory with 75% left to run other things. Even in CAD, if you're producing files which are larger than a Gig, you're probably one of the 0.1% of hard-core CAD professionals or you're being too complicated with your model.

      Maybe linux isn't as graceful, but windows will tell you when you're near the limits of memory (it's happened to me once with a runaway photoshop process while I had several cad files and a 100+ page architectural PDF open in the background). Take that as a suggestion to go clean out all the wasted processes that are running, or close down some of the redundant files you've got open. Or go buy more memory.

      --
      Is it just my observation, or are there way too many stupid people in the world?
  78. Re:separate partitions for / and /home by pavon · · Score: 1

    For a desktop linux system - not really. I used to do it because I was told it was safer/easier to completely wipe your OS and install a new one while keeping the home partition, but I've never actually done that - I usually keep a rolling upgrade, and when I want to install from scratch I usually buy a new hard drive anyway, so I can keep using my old system if the install has problems.

    For a shared/server system it is useful to ensure that users can not fill up the partition, preventing the system from writing to files that it needs to. On OpenBSD it is a good idea because they have some additional security settings that are be applied per-partition, and you generally want different policies for /, /var, /tmp, and /home.

  79. I guess it never applied exactly by etrusco · · Score: 1

    Summary: If your "working set" fits your RAM then there's no use for swap.

    IMVHO the general rule should be "don't ever size your swap more than twice your RAM".
    If you needed more "virtual memory" than that you certainly should buy more RAM.
    Windows, up to Win2000, behaved very poorly without swap (at least half the RAM), but I never had a problem with Windows XP or Linux running without swap.

  80. Re:separate partitions for / and /home by FooBarWidget · · Score: 2, Insightful

    Yes. If an OS upgrade fails, then I can reinstall the OS (i.e. format the / partition) without having to move all my /home files to a backup drive first.

  81. Waste of time by Anonymous Coward · · Score: 0

    My server has 4GB ram and I don't choose to even bother with a swap file. If Linux _needs_ a swap file then we can question the stability of Linux's memory manager. I have tested it various times under load and the ram usage never goes about 2.75GB.

    Also even if you do maje a swap file or partition disk space is cheap enough that those 8-12GB space is so small compraed to the price of HD 4 years ago. I have a RAID 6 2TB array even I didi choose to have a swap partition I could easily afford even a surprising 15GB swap. Chances are with 4GB of ram you can completely shut off paging and still have a stable server.

    This is one of those things which is a matter of taste. Some people thing having swap 2 x ram is enough some make it the same amount as ram and other who live of the edge turn it off and use swap files as needed. Since swap files can be disabled enabled on a live system there is no need for a complete partiton dedicated for this.

    IF the server is loaded and the server laggs a bit adding a swap file will temp resolve the issue without the need for a reboot.

    This is the case on FreeBSD not sure how it works in Linux nor do I care much to even test it.

  82. It's not the size that matters by Reality+Master+201 · · Score: 0

    It's what you do with it.

    Also, you might want to consider some kind of memory protection if you're gonna be doing a lot of swapping. Leads to viruses, you see.

  83. If you are running Solaris 10... by Anonymous Coward · · Score: 0

    I believe you need to have swap space that is *at least* equal to the amount of RAM in your machine. When I set up a machine with less swap space than the amount of RAM installed, I saw applications crash under load with "... bad alloc ...", or "Could not fork: not enough space". I reinstalled the OS with swap space equal to RAM and all of my problems magically went away.

  84. 2x RAM if your kernel dumps to swap, otherwise 2GB by jheiss · · Score: 1

    My standard (which is deployed on 10s of thousands of machines) is 2x RAM if your kernel writes crash dumps to swap (i.e. FreeBSD and many others), 2 GB if your kernel writes crash dumps somewhere else (i.e. netdump on Red Hat). The 2 GB provides enough of a buffer that the system doesn't immediately puke if you go slightly over your actual RAM, but doesn't allow you to run way over your actual RAM. On servers with 16 or 32 or even 64 GB of RAM and a 73GB SCSI or 80 GB SATA drive you can't go 2x RAM anyway.

    This is for servers, desktops are probably a totally different story, but Mac OS X is my desktop OS and it just does some magic that I don't have to pay attention to.

  85. 8GB of swap is useful by OrangeTide · · Score: 2, Funny

    It lets you leak more memory for longer, this is a necessary feature for running modern software.

    --
    “Common sense is not so common.” — Voltaire
  86. No reason to worry :-) by franois-do · · Score: 2, Interesting

    The "rule of two" is due to Knuth's demonstration : "When the memory is 50% full, there is necessarily one free block at least as big as the biggest already allocated block", or something similar.

    Today, I would say the swap partition is mainly useful to store the state of the computer when you put it in hibernation mode, that is a little more that the size of your RAM if you want to be really cautious, just in case.

    That being said, A GB of disk is so cheap compared to 1 GB of RAM - which is already cheap, now - that there is no problem in doubling that size for very special purposes (alternating 2 different "hot" graphic users sessions or operating systems without rebooting, for instance). Just my two cents.

    --
    Signature omitted in order to save space. Thanks for your understanding.
    1. Re:No reason to worry :-) by Craig+Davison · · Score: 1

      I don't know much about memory management in Linux. What happens if you hibernate the system while the swap file is in use?

    2. Re:No reason to worry :-) by franois-do · · Score: 1

      I don't know much about memory management in Linux. What happens if you hibernate the system while the swap file is in use?

      I have never studied the kernel very closely, but I would expect normally what is on the disk not to be saved again since it's already there, and what is in RAM to be saved wherever possible in the remaining holes of the partition (hence the 2x rule ?), perhaps after some slight quick compression of every zone saved from RAM.

      Like they say in Perl, TIMTOWTDI ;-)

      --
      Signature omitted in order to save space. Thanks for your understanding.
  87. Re:separate partitions for / and /home by pm_rat_poison · · Score: 2, Funny

    home alone is a pretty nifty idea. Especially if you're a kid and it's around Christmas.

  88. Re:separate partitions for / and /home by hedwards · · Score: 1

    Yes there is, for a while I was literally reinstalling Linux every day because it would crash and the entire partition would go corrupt. Since I put everything on it's own partition that hasn't happened even once.

    There is the point about putting home on it's own so that you can switch between distros, but the biggest reason is that it reduces the likelihood of everything going corrupt because of a read on a different portion of the file tree.

    That being said, Linux always used to be a pain in the ass in terms of disk layout. If I understand things correctly, with LVM it's largely fixed, but whenever I do an install, I end up using like 5 or 6 partitions rather than 1 partition with several labels.

    But, with ZFS basically here, that's largely moot since you can have a couple dozen partitions and still not have any particular troubles.

  89. 4GB limit? by S-100 · · Score: 1

    So MS recommends no more than 4 GB for the paging file. This is also the limit for 32-bit unsigned arithmetic, so there may very well be a limit to how much of the file Windows will use, and that limit may well be 4 GB.

    So unless disk space is at a premium, just make your paging file 4 GB.

    1. Re:4GB limit? by conureman · · Score: 1

      32 bit Windows XP has a 4 GB limit on swap. I made my E: drive 4GB, (outer rims of the second hard disk) and use that. I have 4 GB of RAM, but leave so many pages open on Firefox that I probably use a bit of swap now and then, I just set a counter on it now as I am curious how much it actually gets used.

      --
      The cost of that cleanup, of course, will be borne by taxpayers, not industry.
  90. I never exceed 2GB swap by erroneus · · Score: 1

    RAM has become cheap lately. Running Max memory on my systems is the norm now. Routinely checking my "top" or whatever I feel like using to check system status shows that swap space is almost never being used. On my laptop with 4GB, it is never touched when I check. On my servers, the same is generally the case.

    Laptop I am on now: current use is 0k
    On my VM server now: 104k
    On one of my VMs: 137912k

    The Laptop and VM server have 4GB RAM. The VM I sampled has 512MB given to it. I suspect I should go ahead and push that to 1GB to see if I can reduce the swap usage. The point is that if your machine is tuned and configured for the application, you shouldn't use swap very much. And if you have too much memory, swapping that much will likely exceed the ability of the hardware to efficiently move that amount of data without impeding over-all system performance.

  91. Re:Run multple instances ;)Re:Definitely not twice by gparent · · Score: 1

    Why would you return 1?

  92. Three Considerations by xenocide2 · · Score: 1

    How much RAM do you have and use?
    How much disk do you have?
    What sort of usage profile is it?

    The last is the most general. There's three categories: server, desktop and laptop.

    Server:
    If you can afford it, buy enough RAM that what you need will never exceed what you have. Using swap kills performance and if your swap ever has significant churn, it's probably worth the investment to add more RAM.

    Desktop:
    Desktop RAM has taken off far beyond what you'll ever use. You could probably dispense with swap as well, but for one thing: hibernation. More and more desktops are supporting the technology, and for the cost of 1:1 swap:RAM you can hibernate. If you honestly hate hibernate, then it all comes down to expecting to use more RAM than you have. Possible, but unlikely.

    Laptop:
    Certainly never go below 1:1 for the hibernation need. Going higher depends on how RAM starved you are versus how much disk you have. Lots of laptops have tons of RAM, but those cheap netbooks are pushing it lower. 1.5:1 is probably a good upper bound.

    --
    I Browse at +4 Flamebait

    Open Source Sysadmin

    1. Re:Three Considerations by petermgreen · · Score: 1

      If you can afford it, buy enough RAM that what you need will never exceed what you have. Using swap kills performance and if your swap ever has significant churn, it's probably worth the investment to add more RAM.
      However having some swap is a good idea, it means that any leaked or otherwise rarely used memory can be swapped out and the ram used for more usefull purposes like disk caching. It also gives you a buffer between using all your ram and processes starting to get killed (this may be a good or a bad thing depending on the type of server)

      --
      note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
  93. Re:separate partitions for / and /home by rlk · · Score: 1

    I've started creating 2 root partitions on my hard disks. That's not trivial on my laptop (10% of the disk), but it made life a lot easier when upgrading from OpenSUSE 10.3 32-bit to 11.0 64-bit. I dd'd one partition to the spare, fixed up partition names in the spare, and then did an upgrade. Yes, it is possible to upgrade from 32-bit to 64-bit with OpenSUSE, although it doesn't get all of the RPM architectures right, so I had some stuff to fix up afterwards.

    So arguably I didn't need it, because I didn't need to back it out...but it did make for peace of mind, and it will in future upgrades.

  94. For the uninformed of us... by neokushan · · Score: 1

    It's kind of obvious that the answer to the question really depends on "It depends on how much you use", but for curiosity's sake, what happens on a modern day linux system (Say it's the latest version of Ubuntu or whatever) when you run out of System RAM and don't have a separate swap partition? Will things just stop with an "out of memory" error as days gone by? Will the OS ask you to close some programs? Will it create/manage a good ol' swap file for you? Or will your computer explode in your face?

    --
    +1 IDisagreeSoHeMustBeATrollOrAnAstroturferOrAShill
    1. Re:For the uninformed of us... by petermgreen · · Score: 1

      Linux by default uses an optimistic memory allocation policy. This means that by the time memory/swap actually runs out it is too late to return failure on memory allocations. When memory runs out on such a system the "OOM killer" will kill processes to stop the system as a whole going down. A variety of huristics are used to decide which process to kill but generally if one process is pigging out on the memory it will be the one that gets hit with the kill.

      BTW linux CAN swap to files (just create a big empty file, set the permissions and then use mkswap/swapon as you would for a partition) so if you need to add extra swap you can do so without repartitioning.

      --
      note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
  95. Need some swap by Anonymous Coward · · Score: 0

    We run on machines with 8GB of Ram, IT set the swap to 1GB. If you actually run out of ram, RHEL4 crashes in linux. (It begins by going real slow, but in the end, does nothing at all).
    Compiling with -j 80 will crash it.

  96. Don't take any advice from me by LSD-OBS · · Score: 1

    But in my decade or so of using Linux, I eventually found myself not particularly needing a swap partition. I've never noticed a problem on any of my workstations that don't have one - although it makes complete sense for servers.

    --
    Today's weirdness is tomorrow's reason why. -- Hunter S. Thompson
  97. Loopback Swap. by jellomizer · · Score: 1

    I like to set up Linux so the "swap partition" as a file and I mount it via Loop Back. That way I can adjust the size to fit my need much easer. Realizing that 8 Gigs is too much then I can remake the file a different size. I am somwhat disapointed that Linux still hasn't came with dynamic sized paging for swap at least as an option, It may be slower but it can keep more disk free or if you use a lot of extra ram you can keep your system running.

    --
    If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    1. Re:Loopback Swap. by peter · · Score: 2, Insightful

      Why would you use loopback when Linux can use swap files directly. They don't have to be block devices.

      For dynamics swap creation, check out swapspace(8), or swapd(8). They have to fill a file with zeros right when the system is under memory pressure and swapping, though. I use swapspace(8), and I like it. A runaway process will make the system thrash even harder, but if something is growing slowly it's great.

      What would help them would be an API like XFS's reserve space ioctl (xfs_io resvspace ...), but that worked for making swap files. XFS reserved space is still marked a unwritten, so it reads as zero, not as the data that was on the disk before. (old xfs without unwritten extent support worked for this, but it's a nasty security hole to expose stale disk data to anyone. A new API could allow it only for root, or for someone who could read the blockdev the FS is on anyway.)

      --
      #define X(x,y) x##y
      Peter Cordes ; e-mail: X(peter@cordes , .ca)
    2. Re:Loopback Swap. by petermgreen · · Score: 2, Informative

      afaict there is no need to bother with a loopback device on modern linux you can just mkswap and swapon the file directly.

      --
      note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
  98. Never use swap by Disoculated · · Score: 1

    Unless you happen to (really, not just-in-case) need images from crash-dumps or if you have some sort of suspend-to-disk system, you should NEVER use swap.

    Ever sit and listen to Windows randomly chug the disk for a while? Often, that's it doing stupid crap with swap when you want it to be working on something else. Swap is SOOO slow that even scenarios where the OS tries to shove stuff it thinks you'll never use again, which should be a good idea, results in you sitting and waiting while that happens at really irritating times.

    On servers, it's much worse. A host constantly hitting the disk for swap will have much higher power and cooling costs, and the life of the drives (although still very long) will be reduced. Using anything mechanical you don't have to is bad.

    Just buy more RAM. Anything arguments against are edge cases that you should engineer yourself out of anyway.

  99. Depends entirely on usage: an example by LucianoTsiros · · Score: 1

    So, imagine you are using a machine with 1 GB of RAM and 2 GB of swap, following the old rule. That adds up to 3 GB of virtual memory. Now you buy your new machine, that has 4 GB of RAM. If you run it totally swapless (which is perfectly possible), and your use of it is more or less the same that the use you gave to your old machine, then why whould you even consider using swap? It's totally pointless to use the "double your RAM" method. If you don't want to go swapless, just put something like 1 GB and it should be enough. You can always add more if you need later. Reference link: http://kerneltrap.org/node/3202

  100. Is it still constant? by KC1P · · Score: 1

    It's weird that people ever specified the swap size as being related to the size of real RAM ... seems like it ought to be obvious, the size of swap is the difference between the size of RAM and the max amount of VM you'll ever use at one time. If you honestly have no way of guessing what that is, then there's no answer to the "how big should the swap partition be" question in the first place. Honestly I feel weird blindly adding swap partitions to all my Linux boxes these days when all my PCs have vastly more RAM than my old machines ever had of RAM+swap, and I haven't changed what I do all that much.

    Anyway, is it seriously still required to be a fixed size? I mean of course you wouldn't want the VM system messing with partition sizes but I would hope that swap files could be grown as needed.

    Or better yet, I have some dim memory that one of the PDP-10 OSes, might have been ITS, would simply use *all* unallocated disk blocks as potential swap space. It meant that the VM system had to be good friends with the FS driver (so nothing horrible happens when the FS driver creates/extends a file) but it seems like a pretty neat solution to the problem.

  101. Strange recommendations by jopet · · Score: 1

    Maybe I am missing something here, but I find many recommendations made in here very strange: many argue that you should have no swap at all or just keep it very small. They argue that using swap would degrade performance.
    But I wouldn't one have to make a difference between just using swap to page out unneeded memory on the one hand and trashing on the other?
    If a single running application needs more memory at once than RAM is available, then pages need to get constantly swapped and that will case trashing and an unacceptable performance.
    But if you have a lot of applications just loaded that essentially only wait to get used eventually, I think it can make sense to let the OS swap the memory needed by them. Re-activating the memory might take a couple of seconds even, but then pages for some other application that has not been used for a longer while will get swapped out.
    No?

    1. Re:Strange recommendations by killmofasta · · Score: 1

      Takes me three to four minutes to get WindozXP to swap out all of the extra stuff, after I fill ram up a few times sequentially. Makes the system Cacge real small too!

      But really, on a Windwos 2000 server, without a ram manager, I can get two Terminal services clients running in Application mode. With a Ram Manager, Its at least 5 for four hours, and then I bang it again, and it will work for the rest of the day, and the two accountants for a few hours more. ( Machine has 512MB Ram, and only supported 1 TS client before I "tuned" it up. ).

      Ram is 512Mb
      Swap Partition is 840Mb,
      Swap file is 384 to 839Mb. ( Hmmm head scratcher.)
      Currently Alocated 512, ( any my system monitor deltas are always in single digits! i.e. Run the performance Monitor ferchristsakes! )

  102. Conversely by DynaSoar · · Score: 1

    Turn it around and look at it:

    You have 4GB RAM and want to know how much more RAM you need. Cost comparisons would figure in if we were comparing, but we're not. Take a look to see how much of your RAM is used during various tasks. If you're running out of RAM, you need more. Can your machine handle it? If not, you need another alternative. Now, can you afford it? Ditto.

    If anything's using up your RAM, find out what, and figure out if more RAM makes sense in that context. A question for clarifying things should be "need more RAM/swap space for WHAT?" If specific apps make the suggestion, it may be worth listening. If the OS makes the demand before the software is even installed, I'd ignore it. If the OS asks for swap space based on load, as Windows does under "let Windows decide" it may not be accurate, but it's thinking along reasonable lines.

    In addition to RAM load, take a look at RAM fragmentation. Some apps and OS pieces are very bad neighbors and your RAM ends up bogging down. These don't need more RAM, they need defragging or better RAM clearing built in, or you need it as a utility.

    --
    "I may be synthetic, but I'm not stupid." -- Bishop 341-B
  103. Re:separate partitions for / and /home by rk · · Score: 3, Informative

    Guess how many times I've thanked 8 lb 6 oz baby Jesus that I had the foresight to separate the two?

    My guess: At LEAST three. :-)

    I have three partitions on my system:

    • /
    • /home
    • /usr/local

    Home stores all my stuff, /usr/local stores all the stuff I download and build from source, and / is the stuff the distribution I use (currently Slackware 12.1) gets to muck with.

    When I want a new distro, I can nuke and pave / with impunity, and depending on the age of things in /usr/local, they may need to be recompiled, and that's about all I need. Every now and then, /home and /usr/local get moved to a new, bigger drive, which is a lengthy, but fairly painless process. I don't clean out; I can't justify spending hours figuring out what I can purge and what I can't when storage is so cheap. I just buy a bigger drive, and the old smaller one becomes the new /. If the old system drive fails, it's no biggie. The new one gets its critical files backed up. If I lose it, there will be some pain, but I keep the "If I lose these files, I'd rather just die" stuff burned to disk, copied to my virtual server 1000 miles away, and on my USB keychain drive.

    Multiple partitions FTW.

  104. Put your swap in a RAM disk by caluml · · Score: 1

    I configure my system with my swap set to /dev/rd/0. Seems to work OK.

  105. Rajesh Kumar by Anonymous Coward · · Score: 0

    On Windows you could set it to automatic management.

    Most newer machines are running atleast 3GB+ RAM.
    So i don't understand where Swap will be required for common usage.

  106. Re:separate partitions for / and /home by cayenne8 · · Score: 1, Troll
    "Is there any point to separate partitions for / and /home? I mean, if you were running different file systems on each of them I could see the point."

    I was wondering the same thing. I usually like to have 3 partitions...one for swap, one for / and one for /boot.....since I usually used something simple for boot like ext2....and reiserfs for /.

    --
    Light travels faster than sound. This is why some people appear bright until you hear them speak.........
  107. I don't have swap. by kevind23 · · Score: 1

    I have 3GB of memory and even when virtualising I've never needed more than that.

  108. Real-time OSs don't swap by Animats · · Score: 1

    It's time to get rid of swapping. Serious real-time OSs don't swap, and more of what's being done on the desktop today has at least soft real-time constraints, like playing music, videos, animations, games, audio, etc.

    With QNX, running as a desktop system, there's a bar at the lower right of the screen showing how much memory is in use. If it reaches the right, you can't load any more programs, and requests by existing programs for more memory will be rejected. This doesn't crash the OS; the system is well-behaved in an out-of-memory state, and executing programs will continue to chug away as long as they don't demand more memory. There's no reason Linux couldn't be made to work that way. Applications need to be reworked to behave better in out-of-memory situations, though.

    (Actually, QNX does have swapping support, but it's only used for a few programs, like compilers, which are inherently batch operations.)

  109. Re:separate partitions for / and /home by Anonymous Coward · · Score: 0

    Guess how many times I've thanked 8 lb 6 oz baby Jesus that I had the foresight to separate the two?

    My guess: At LEAST three. :-)

    <outrageously thick Australian accent>
    I see you've played baby-Jesus-thanks-counting game before!
    </outrageously thick Australian accent>

  110. RedHat EL 5 documentation says.... by invisik · · Score: 2, Informative

    Arguably RH is the authority on the subject... See their documentation here.

    -m

    --
    http://www.invisik.com
  111. dedicated SSD for swap? by brentonboy · · Score: 1

    Has anybody tried setting up a solid state disc that is dedicated as swap? The faster read/write times should make it ideal, and it is getting cheaper to buy SSDs all the time.

    Why not purchase a 32gb SSD and set it as swap--it's almost like free RAM. Then when it dies from overuse, buy a 128gb SSD for the same price you bought the original one for.

    Is there something I'm missing here, or is that actually an idea that would work?

    1. Re:dedicated SSD for swap? by Anonymous Coward · · Score: 0

      Bad idea if you like uptime. Better make sure it's at least an extremely modern SLC NAND Flash (which are still not very cheap), because allocating a whole MLC NAND Flash drive as swap space and then putting it under heavy load will kill its ability to write sectors in very short order. Maybe even a month or two. Fuck that. If you're allocating 32GB RAM, then buy more RAM instead, you lunatic.

      In fact, the manufacturers' recommendations for solid-state Flash drives explicitly states that Flash should never be used as swap space. In normal usage, SLC is reliable enough to outlast any hard disk, MLC about on the order of a hard disk, but something specifically that writes to the same spaces over and over again as scratch space, that's a bit much to ask out of the wear-levelling algorithms at the moment.

  112. SWAP FILES by Anonymous Coward · · Score: 0

    Alright, don't know if anyone brought this up yet, but whatever the guy said about oracle... correct. That is about the norm. For a SERVER...

    I say once you get to =>2GB of RAM... use 2GB max of swap/virtual memory. The other thing about swap files vs swap partition... garbage. The only time you see a payoff with any swap file, is if you dedicate the swap file to an independent physical drive. If you put a swap file anywhere on a RAIDed volume, you'll actually lose performance, i.e. a partitioned space on a RAID5 volume for example or if you create a swap file on a whole mirrored set.

    Hope that helps.

  113. My basic calculation by Todd+Knarr · · Score: 1

    My basic formula for swap space is: worst-case memory usage that I don't want the system to fail under, minus the amount of system RAM I have, rounded up to the nearest even amount (I usually make it an even multiple of 16M or an even number of gigabytes). My minimum for swap space is the amount of system RAM, to allow for things like hibernation, but that's a personal preference. I don't like running without swap simply because there's no overflow, no buffer for the occasional nasty memory hog. And a lot of the time it's useful to have somewhere to put idle program address space, freeing up system RAM for I/O buffer cache. I've a number of programs that really only become active in the wee hours of the morning, and I'm willing to let them take a moment to swap in when I'm not around to get the better performance during working hours that comes from having the memory they'd otherwise be occupying available for buffers and cache.

    And, on today's systems with 250+G hard drives, 2-4G for swap is almost negligible.

  114. Re:Run multple instances ;)Re:Definitely not twice by Anonymous Coward · · Score: 1, Funny

    The system is giving the program all that memory - to give nothing in return would be rude. That is why you should return 1 instead of 0.

  115. "Twice as RAM" is no longer necessary by microbee · · Score: 1

    In early Linux 2.4.x series, it was once the case that you need to put twice swap space as much as your RAM. The only reason this requirement existed was a badly designed and performed VM. In 2.4.10 the VM was replaced completely and in 2.6.x there was an even newer VM. So I don't think this applies anymore. You can put as much as you'd like as the swap. Only the total size (RAM + swap) matters.

  116. How much Swap per RAM? by atomic-penguin · · Score: 2, Informative

    Oracle has very specific requirements/recommendations:

    1 GB - 2 GB 1.5 times the size of RAM
    2 GB - 8 GB Equal to the size of RAM
    more than 8GB 0.75 times the size of RAM

    Our organization just bought 4 database servers with 32 Gb of RAM each. I personally setup and installed the servers. I told the DBA:

    This server has 32 Gb of RAM, if your database applications ever has to swap out 24 Gb, then something is seriously wrong. As a matter of fact, I would guess this much swapping would kill I/O throughput for any database application. However, if we have to put another swap partition in there for the Oracle installer; I have set aside enough free space on the disk to satisfy the installer demands.

    The DBA agreed with this, and we went with 8 Gb of swap. Haven't had any problems with the server or DB applications for more than 6 months. It is the most heavily utilized server in the entire organization.

    For a laptop, I would set the swap to equal or more of the RAM, only if you want to suspend to swap. Depending on the applications, I would say at least half the amount of RAM to double the amount of RAM, within reason. If you have 8 Gb of RAM on a workstation, you probably do not need 16 Gb of swap for everyday use.

    --
    /^([Ss]ame [Bb]at (time, |channel.)){2}$/
  117. absurd finite element example by jfb2252 · · Score: 1

    I ran a magnetic finite element job using a commercial code on Windows XP (company required for this code) which used 15.5 GB of RAM (16 available) and 11 GB of swap. It took five days to run and I couldn't do anything else with the PC, but that's OK - I have an RHEL 5 box next to it.

    1. Re:absurd finite element example by EmagGeek · · Score: 1

      I wrote some fortran code to do that in grad school. My god those NxN matrices get big...

      Just out of curiosity, which commercial code were you using?

  118. You don't need much by ChrisA90278 · · Score: 1

    FIrst off. Moderd OSes don't ever actually swap out programs. They simply delete the programs from RAM without needing to write them out to disk because the program is already stored on on the disk asthe executable file. Only RAM pages that have been writen ever need to be swapped out.

    In the old days, the address space of an entire process was swapped out to disk. The term back then was "roll out" and "roll in". OSes have gotten smarter and now the way a program is loaded into memory is by "mapping" the executable binary file to RAM. The mapping does not actually cause any data to move from disk to RAM it is moved s it is accessed.

    I have a Linux system here that has been up for days. Lots of stuff running. PostgreSQL DBMS, Apache, a web browser, and 12 terminal logins, a VNC session and I'm running another Linux system inside a VMware machine. I have only 4GB physical RAM, 8GB swap. I check and see that 2.8MB (yes M not G) of swap is in use. One a modern system 1/2 GB would be plenty of space.

  119. 640K by b1ng0 · · Score: 1

    640K should be enough for anybody. ;)

  120. As big as you prudently need by itsybitsy · · Score: 1

    The best size for a swap file or partition is the largest amount of virtual memory that you'd ever need for the set of applications that you are running and then some. Take an inventory of applications that you are using and how much RAM they need while running. Applications (server or desktop) that make use of in memory databases are becoming more popular and will push up the swap file size requirements for your needs.

    Generally I set a swap partition to be at least 20 GiB on machines with up to four gigs of RAM. Now for machines with 8 or more gigs of RAM I set the swap size to be four or five to eight times the RAM size. So eight 8 GiB of RAM would have something like 40 GiB of swap.

    Although their is only 8 GiB of RAM on the motherboard that can take 16 GiB of RAM it is prudent to set the swap size to 64 GiB to 80 GiB. This way when I increase the RAM to the maximum of the motherboard I have plenty of swap space.

    Planning for the future means setting up more swap space now.

    With TiB drives going for just over $100 it's fine to use large swap space if you don't need it for data. Besides your OS should be on the boot drive without data being on that drive at all. Data should be on other drives in a RAID configuration if possible. This leaves plenty of space for swap space on a TiB drive.

    Really it all depends on your needs.

    -----
    Metric units used in this post: http://en.wikipedia.org/wiki/Binary_prefix.

  121. My OS X installation... by mario_grgic · · Score: 2, Informative

    has a dynamically grown swap file currently at 64 MB.

    I have 8 GB of RAM and never page out even when I run dozens of memory hungry apps (photoshop, nikon capture etc).

    The general rule is if you are swapping pages out when running typical apps you use daily, get more RAM.

    --
    As the island of our knowledge grows, so does the shore of our ignorance.
  122. be careful by Anonymous Coward · · Score: 0

    In windows, I have a pretty powerful desktop/workstation setup. Windows Vista 32bit though so only 4Gb ram. Whenever I set the swap file greater than the default 3.9 managed by Vista, I found many common games would crash with page address errors.

  123. Your professor is incompetent by Anonymous Coward · · Score: 0

    Your prof is incompetent. Either he doesn't get operating systems, or he simply couldn't get you to get operating systems. Regardless.

    Memory isn't sliced into pages for any reason that has to do with paging to disk. Ram exists in pages to make dynamic allocation possible. You want a contiguous 1MB block of memory to store some image? Okay, we can piece one together from 4k chunks scattered about. Oh no pages? Well damn, you simply do not have a contiguous 1MB chunk free, it's all split into lots bits from space left over as programs started and stopped.

    The 36 steps is also completely misguided. Yes. There are lots of steps involved at some point or another, but 99.99999...% of the time the system is performing two steps: TLB cache hit on Virt->Phys, and fetch the memory. The case where it has to go to swap is slow and complicated, but since the disk is 1,000,000x slower than your CPU it really doesn't matter much how computational expensive paging in is.

     

    1. Re:Your professor is incompetent by p3d0 · · Score: 1

      On what application do you get a 99.99999% TLB hit rate? I've never seen that on a real app.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
  124. 42 by Anonymous Coward · · Score: 0

    42

  125. Re:separate partitions for / and /home by jargoone · · Score: 1

    This is a great idea. Even better if you have a desktop/server: put the partitions on a separate disk. Rather than using dd, rsync it nightly.

    Bad patch? Bork something up? Disk fails? Flip some BIOS settings/cables and you're done.

    My current employer utilizes a similar method on hundreds of servers for patches and upgrades.

  126. Nobody needs more than 640K by Anonymous Coward · · Score: 0

    Look, if you code your overlays (http://en.wikipedia.org/wiki/Overlay_(programming) properly, you shouldn't need much more than 512K of swap space. Just think through your program carefully and keep in mind the most likely execution paths.

  127. Yes, I'm bold by Anonymous Coward · · Score: 0

    Swapping is what happens when you run out of RAM. If you have plenty of RAM, you don't need swap. If you have a small amount of RAM, you'll need/use more swap. If you need more than 2GB of swap, what you really need is more RAM because you're swapping too darn much. The ideal computer would need 0 swap because it has infinite RAM. Swapping is not desirable. Assuming that we're only talking about laptops/desktops here (not super, research computers or specialized equipment):

    while swap = 4GB
        swap = ram / 2

    if that rule leads to poor performance, you either need to:
    1) get more ram
    2) stop using vista :)

    1. Re:Yes, I'm bold by Anonymous Coward · · Score: 0

      something happened to my formula when posting. let me try that again...

      while swap less than or equal to 2GB
          swap = ram * 2
      while ram greater than or equal to 4GB
          swap = ram / 2

  128. p3n1s by Dgawld · · Score: 1

    As big as the e-mails promise.

  129. If its any help... by segra · · Score: 2, Insightful

    Windows (XP/Vista atleast) can't be trusted with a swapfile, I noticed this the moment I put 2gig of ram in my system (years ago)... yet for some reason Windows still felt the need to page everything when only 500meg was in use. Now with 3gig and the problem hasn't changed, windows seemingly keeps as much ram free as possible, just incase it needs it... which it never does because its always paging everything :) Turn off your pagefile, reboot your pc and you'll notice an immediate difference in performance. as for FreeBSD, it doesn't appear to use it til its outta physical ram have a nice day

  130. eee pc here by eric31415927 · · Score: 2, Interesting
    I've got 2 gigs of ram and 4 gigs of SSD on my 4G. If I followed your maths, I'd have no SSD space for my OS.

    Actually - I've got a 4 gig swap partition set up on an SD card. However, I never run any programs needing more RAM than what I've got. I suppose the purpose of my swap partition is to keep me from plugging other cards in my only SD slot.

    Well this ought to change. My swap partition is going. Thanks for making me think a little.

  131. bungee swapping by Eil · · Score: 1

    I've always thought of swap space as the operating system's bungee cord. If a program decides to be stupid and allocate shit-tons of memory, you often have enough time to do a quick Ctrl+F1, log in on the console, and killall whatever while the disk is thrashing away. If you have no swap (or if you have it on a solid-state hard drive you silly bastard), you never get this opportunity.

    Also, I thought it proper that the quote at the bottom of the page says, "Never trust an operating system."

    1. Re:bungee swapping by Anonymous Coward · · Score: 0

      I've always thought of swap space as the operating system's bungee cord. If a program decides to be stupid and allocate shit-tons of memory, you often have enough time to do a quick Ctrl+F1, log in on the console, and killall whatever while the disk is thrashing away. If you have no swap (or if you have it on a solid-state hard drive you silly bastard), you never get this opportunity.

      I'm not sure why this is a good thing. You have enough time before... what? Why do you need this "opportunity"? If you don't have any swap, when you run out of RAM, the next time that program requests memory, its request will be denied. It will probably then segfault, freeing up all of the RAM that it was consuming, and it will do so without having pushed all of your other programs out to the swap disk first.

  132. Based on example by cybereal · · Score: 1

    On my Mac machines I have quite a lot of ram, 2gb on one 4gb on the other. I occasionally monitor memory usage as I'm a developer and that's just something I do. I've never seen my swap, even after days and days of editing video and so forth go over 2GB. Most of the time, however, it's around 256mb.

    Furthermore, at one point several years ago I was pointed to a revealing explanation of why, even with quite a lot of ram, swap is useful. Something about optimization through intelligently hibernating shared but inactive libraries preinitialized into virtual memory as well as using it as a cache to reorganize active memory? Anyway I wish I could cite the article.

    Point is, if I couldn't have a dynamic paging file I'd cap it at 2GB max 256mb minimum.

    --
    I read the script, and I think it would help my character's motivation if he was on fire. -Bender
  133. The question is not meaningless. by Anonymous Coward · · Score: 0

    Which brings me to my point. The question "how much swap do I need" is probably meaningless, even for a given amount of memory. There are people who find 2GB with no swap fine, and others, like me, who probably could get by with 2GB of RAM and maybe 512MB of swap, and others who might need more.

    No, "how much swap do I need" is not meaningless. It's just very hard to answer in practice, for the following reasons:

    1. You need very concrete assumptions about how your machine is going to be using memory and disk.
    2. Your assumptions about memory and disk use need to be correct. In other words, the load on the machine needs to be predictable.
    3. You need to fit these assumptions into a complex model that accounts for disk throughput and latency.

    Of these, I think the second is the hardest one, in fact, so the reason it's hard to estimate how much swap you want is because the load on most machines is hard to measure and predict.

    Anyway, a simple (or simplistic, perhaps) theory that applies here is that to maximize your machine's throughput, you need to minimize disk I/O. To minimize your disk I/O, your kernel's whole working set needs to be in memory during every interval you measure this working set.

    A working set is the set of all the memory pages and disk blocks that your processes touch during a specified time interval. If the working set is bigger than physical memory during an interval, then at some point the kernel will need to do disk I/O, which is what you minimize. If the whole working set is in memory, however, you are (almost) guaranteed that the machine will not need to go to disk during that interval at all. (Big exception: writing to disk.)

    So what you really want to do is to have enough physical RAM so that the whole working set fits in RAM over some well-chosen small interval size, and enough swap to fit all your non-working-set virtual memory pages in the same time. You want to pick the interval size on the basis of your disk throughput and latency. The goal, again, is to minimize the time the system spends waiting on disk I/O, whether the I/O is for file blocks or swap blocks.

    The most important, counterintuitive rule to remember: the cost of the following two things is more or less the same:

    • Swap a memory page out to disk, then read it back in.
    • Read the same filesystem block twice from disk.

    If the kernel swaps out a memory page and later has to read it back in, it breaks even if in exchange for that cost, it avoids reading the same filesystem block twice by caching on the first request and then using the cached copy on the second.

  134. Re:separate partitions for / and /home by jibjibjib · · Score: 1

    You don't have all your /home files on a backup drive already?

  135. Investigative Answer by Anonymous Coward · · Score: 0

    When you run your system, you can look at the %utilized swap space in system monitor. Use an estimate of your "max daily load" to get how much swap is actually used. Then allocate 10% to 50% more swap space depending on how confident you are with your estimate. Be sure to use a nice power of 2, 256MB, 512 MB or 1GB.

    As a point of reference, I run Ubuntu 8.04 with 2GBs of RAM and 1GB of swap. With Firefox, a bunch of other apps, and a virtual machine of Windows running with 512MB explicitly allocated for the virtual machine, I have never exceeded more than 1% swap utilization (102MBs). With 4GB of RAM I would recommend 512MB ~ 1GB of swap space.

  136. Old IDEs = swap space. by TheGreatOrangePeel · · Score: 1

    I've a few 2-4GB IDE hard drives kicking around, so I'll put one on a chain of its own and make the whole drive swap. Might not be the optimal performance solution, but neither is having to page anything out of RAM in the first place.

    My thinking is that everything going to swap is stuff I'm probably not going to need anyway and when I do, I'm probably not going to notice the extra few milliseconds it costs to shove it back into my nice speedy RAM.

  137. Linux Workstations/Servers, Windows workstations by Abattoir · · Score: 1
    This really isn't that difficult. The "standard" or "rule of thumb" is highly outdated. If you must have a formula, then here's what I would do.
    • Linux workstations: swap equal to half installed physical memory, up to 2G.
    • Linux servers: swap equal to installed physical memory.
    • Windows workstations: swap equal to installed physical memory.

    But really, if you're swapping a lot, you probably need more memory. If you have a reasonably modern system, you should have about 1G - I don't care what OS you're using. If you have a laptop or similar system that you need to suspend RAM to disk, you can do this to a swap file, or to a hibernation file. YMMV on Linux as suspend/hibernate is hit or miss with various laptop vendors.

  138. Re:separate partitions for / and /home by Anonymous Coward · · Score: 1, Informative

    Separate /var too. If the system goes down, active partitions are at the highest risk of corruption. /home /var and /tmp are the only things that are active. /etc only changes when you reconfigure. Anything else should only change during software a upgrade.
    You did make /tmp a tmpfs didn't you?

  139. Don't delay the out of memory process killer by kabloom · · Score: 1

    My suggestion is to use a whole lot less. I personally never use more than about 100MB swap unless the offending process should rightly be destined for the Out-Of-Memory process killer anyway.

    I only ever trigger the out-of-process memory killer when doing development. If I do, it means that (a) the program needs to be redesigned to use less RAM because even if I had lots of swap it would be too slow anyway, and (b) the extra swap is just making it take longer to regain control of my computer.

    If you plan to do suspend to disk, then you should have more swap, ideally a bit more than you have RAM. Maybe someone could comment on the sanity of the following strategy for this:

    I would have 2 swap partitions. One with the amount of swap space that you want to have under normal usage, and another equal to the size of physical RAM. Set up only the first one to be used at system startup. Run swapon on the second one (to make a disk area the size of RAM available) right before suspending to disk.

    Would it slow down the wakeup process too much to run swapoff on that extra space right after waking up? Or does the OS only recover things from disk as it needs them?

  140. This will tell you how much of swap is in use by borbetomagus · · Score: 0

    Doubtfully, anyone interested in this will have gone on by now, but I hope someone gets some use out of this information. First off, this is only for Windows 2000 and XP, so I don't know if it will work for Vista. I can't imagine that something similar doesn't exist for Linux, Mac OS X and/or one of the BSD variants (I haven't read all of the threads). You might want to read through this page, 'How can I optimize the Windows 2000/XP/2003 virtual memory (Pagefile)?' http://www.petri.co.il/pagefile_optimization.htm -- Bill James (Microsoft MVP) has a convenient tool, 'WinXP-2K_Pagefile', for monitoring the actual usage of the Page file, which can be downloaded {here}. A compiled Visual Basic version is available from {Doug Knox's site} which may be more convenient for some users. The value seen for 'Peak Usage' over several days makes a good guide for setting the initial size economically. Available here: http://billsway.com/notes_public/WinXP_Tweaks/ http://billsway.com/notes_public/WinXP_Tweaks/WinXP-2K_Pagefile.zip or here -- http://www.dougknox.com/xp/utils/xp_pagefilemon.htm http://www.dougknox.com/xp/utils/XP_PageFileMon.zip Currently, I'm running Windows XP Home with 1 GB of RAM. I have my swap file set to 500MB and currently, the 'WinXP-2K_Pagefile' script says I'm only using 86MB of it. One of the scripts logs the maximum swap you've used in a session, though you have to check it. The most I've used is 486MB and it warned me that swap was getting low. Needless to say, you milage will vary. -- You also might want to read through this page. 'Virtual Memory in Windows XP' http://aumha.org/win5/a/xpvm.htm I hope this helps.

  141. This big by ack_call · · Score: 1

    It really depends on how big your house is and how many people live in it. The general rule of thumb is no bigger than the room second smallest from the largest.

  142. Re: four different versions of Linux on my laptop by neonsignal · · Score: 2, Funny

    while on the other hand, some of us sad people have gone through four different laptops while still using the same version of linux...

  143. Special considerations to keep in mind by Anonymous Coward · · Score: 0

    Linux's kernel assumes that there is swap, especially for OOM conditions. First, there is the overcommit behaviour -- by default it lets you overcommit by your total swap size + 50% of RAM. If you have no swap, it will only overcommit to 50% of RAM, which is bleeding stupid.

    Also, tmpfs is NOT taken into account by the kernel when it's figuring out how much freeable RAM there is (file cache is considered freeable, because it's not really needed and can be flushed to disk). I'm pretty sure this is a bug, but try reporting it to the kernel people and they'll probably say "why would you ever run without swap?"

    This means that if you have 2 GB of RAM and 1 GB of files in /tmp and /tmp is in RAM, the kernel thinks it has 1 GB more available memory than it really does. When it runs out of memory thinking it still has 1 GB left, bad things happen (specifically it dumps the entire file cache, even important libraries, and must then read those from disk every time it needs them -- you don't really appreciate how much faster RAM is than disk until you've tried to recover a system from this).

    You can (and I do) run without swap, but you either need to keep well below the RAM limit or write your own version of the "free" command that subtracts what's in /tmp. You will probably also need to change the overcommit_ratio and overcommit_memory parameters.

  144. No by mkcmkc · · Score: 1

    Doesn't really matter how much ram you have, long before you get a Gig of swap utilized the system is going to be trashing to the point of being unusable under any but lab conditions.

    No--programs that are stopped or idle can be pushed out to swap, and depending upon what you have running on your system, this might be a lot of stuff.

    --
    "Not an actor, but he plays one on TV."
  145. It does have some correlation by p3d0 · · Score: 1

    If your program has a working set larger than the machine's physical RAM, it will be exceedingly slow (effectively running at disk speed rather than RAM speed). If your program's working set is 1/N of its total memory usage, then a swap space N times RAM will make sure you hit unbearably slow performance before you hit an out-of-memory error.

    --
    Patrick Doyle
    I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
  146. Re:separate partitions for / and /home by Anonymous Coward · · Score: 0

    I have to run Linux and Windows, so I use an ext3 partition for /home and redirect the Windows users' "My Documents" to each /home/someone. I use the ext2 IFS driver to read the partition. I have no problems with strange characteres and the configuration dot files appear as hidden. The result: flawless use and reinstalation of both Windows and Linux. If you need to use more than one *nix, you have to pay attention to user's ids, though.

  147. i don't use them by mistahkurtz · · Score: 1

    any more. my laptop still does until i go from 2gb to 4gb, but my workstation with 4gb runs w/ no swap, and runs better. bear in mind this is windows, i'm just returning to linux after a few years break, so haven't played with no swap in linux, but i imagine it's the same.

    back in the day, the rule of thumb was roughly 2 to 2.5 times physical memory.

    now, with 4gb (3.Xgb usable - 32-bit OS) i've never been without about 2.2gb free memory, even with bloat-tunes, wow, AV, and other crap running.

    in my experience, for non-(actual)servers, no swap is the way to go, assuming you have 4gb memory or more.

    --
    not only is time travel possible, it's irrelevant.
    1. Re:i don't use them by mistahkurtz · · Score: 1

      don't forget, too, that if you force a system to use swap, even if it doesn't need it, the system will force lower priority memory threads to the virtual memory, so you're still using your disk, slowing your performance, and producing wear and tear on your disk(s).

      someone correct me if i'm wrong, but i'm pretty sure that's how it works.

      --
      not only is time travel possible, it's irrelevant.
  148. Running XP with no swap by PhantomHarlock · · Score: 1

    has anyone tried running XP with no swap, playing games, etc? Do you even need it for photoshop, since it has it's own scratch files that you can define?

    what I always do is partition a new disk with a small inner partition, and put nothing but the windows swap file there. Since it's the fastest part of the disk it seems to make sense. Then I have the windows system partition, and then a program files partition. This seems to prevent excessive disk seek, and XP systems I build are still zippy a few years later.

    I also make the swap file a fixed size, and yes I use that old rule of thumb of double the RAM, since no one has given a good reason NOT to. Although it would be great just to not use a swap file, but I hear Windows likes to have one, even if it has plenty of RAM.

    With Photoshop, I created an inner partition on my RAID just for Pshop scratch disks.

  149. Re:separate partitions for / and /home by budgenator · · Score: 1

    You can also mount partitions that have system files read only until you update, making compromises another degree more difficult.

    --
    Apocalypse Cancelled, Sorry, No Ticket Refunds
  150. The problem with devices like the I-RAM by electrogeist · · Score: 1

    is that standard HD interfaces are slower than the RAM. I don't care if its IDE, SATA, u320 SCSI, whatever, they're all a helluva lot slower. Last I looked, which was a while ago, they only held a few GBs too. DDR2 is dirt cheap if you have a modern motherboard that takes it. I know the IRAM requires the older and more expensive DDR (DDR1) which would be expensive for 4x 1GB modules and the IRAM. A software RAMdisk and a UPS would seem a better choice for a hobbyist desktop, 4x2GB DDR2 could be had for less than $20/GB

    The DDRDrive that was mentioned, is this out yet or still vaporware? They have the right idea with PCIe interface but it only holds 4 modules (DDR1?). Without battery backup to be an advantage, more RAM on the motherboard would again seem to be a more attractive choice.

    The OP said he has 64GB already, may be more helpful if he elaborated on that. If thats 256 peices of 256MB modules I dunno WTF you'd do with that. But if 4GB modules installed in something like a 16-slot supermicro x7db8+ beast that could be fun

  151. No substitute for enough RAM to begin with! by beaststwo · · Score: 1

    For all the talk about programs and data being swapped out, the biggest problems I've seen are systems to too much swap and not enough RAM. By the time RAM gets short enough for serious swapping, the system is already thrashing so heavily as to be unusable. For me the bottom line is that the machine must have enough RAM to fully hold everything that normally runs with room to spare + cache space, then think about swap to cover peaks.

  152. At least 20 Pb by FearForWings · · Score: 1

    We all know storage and memory prices will continue to fall as capacity rises, and 2x ram will continue to have about the same cost in terms of $ and percent of disk space used. However, where many people have been lead astray is that there exists a means to make your swap space as large as you want with no cost. Just do like me and map your swap space to /dev/null. Now you can have petabytes of swap space on any size disk with no additional cost. What could possibly go wrong?

    --
    I don't know about angles, but it's fear that gives men wings. -Max Payne
  153. Re:separate partitions for / and /home by supernova_hq · · Score: 1

    Now if I could only find an easy way to do the same thing with my MySQL server (I am a web developer and test on my laptop)...

  154. 8GB of RAM and zero swap by Skapare · · Score: 2, Interesting

    ... and it works like a champ.

    --
    now we need to go OSS in diesel cars
  155. 8GB - 16GB swap by Ainu · · Score: 1

    I have 8GB of ram and set it up for 16GB of swap... mind you it's never been used in any manner. For that matter I rarely see my available ram drop below 5GB free.

  156. from Red Hat... by Anonymous Coward · · Score: 0

    FYI. According to Red Hat Enterprise Linux's deployment guide:

    If M 2
            S = M *2
    Else
            S = M + 2

    where M is the size of physical memory in GB and S is the size of swap partition in GB.

  157. zero swap space needed by Jessta · · Score: 1

    You've got 4GB of ram, you don't really need swap space. Swap space aka. virtual memory is only useful for pretending that you have more ram than you actually do. With 4 GB of ram, you pretty much have all the ram you're going to need...unless you are doing something that requires massive amounts of memory. I don't even use my 1GB of ram.

    --
    ...and that is all I have to say about that.
    http://jessta.id.au
  158. M+2 by Anonymous Coward · · Score: 0

    Total Memory + 2 is the general rule. Tis true, i read it on the internet

  159. Are you using a 32-bit processor? by Anonymous Coward · · Score: 0

    Am I wrong, or is it pointless to have more than 4 GB of RAM (be it real or virtual) if you are using a 32-bit processor?

  160. swap is a waste by Anonymous Coward · · Score: 0

    We're all being lied too.
    1-GIG is plenty of ram.

    If you must have swap make a file and use it.

    search on how to do this.

  161. Swap the swap by miguelfrommars · · Score: 1

    There's no swap on my Ubuntu business server for extra security. No x windows. No desktop. No games. And zero problems.

  162. Collecting data by Anonymous Coward · · Score: 0

    I wrote a small script to collect data from "free" and write it to a text file, with info about ram usage. Idea was to figure patterns on my ram usage.

    I inserted the script on a cron job, to run every 5 minutes. That started in 16 april, now the text file is 12749 lines long, 1.3MB.

    The system is a debian notebook with 2GB ram and ~1GB swap. I am an average user, running no scientific computing, and eventually doing some video/music stuff. Browsing, emailing and writing ooorg documents most of the time.

    Guess what? Swap usage equals zero all the time. Unless "free" is seriously bugged, swap is irrelevant to me.

    I am happy to provide either the script or the text file to anyone interested. Just reply here.

    If you are really curious, do the same for your system. It is very interesting.

  163. Just say no to swap. by rawg · · Score: 1

    I think I would rather have out of memory error then having the computer waiting for swap. Fail fast is good. I don't have enough apps running to run out of memory usually, and when my system does start swapping, it usually means something is wrong anyway. It would be nice for it to just crash then wait 10 minutes for it to finish swapping.

    --
    The above is not worth reading.
  164. Re:separate partitions for / and /home by Lord+Kano · · Score: 1

    I never put / and /home on the same partition. As someone else pointed out, it makes changing distros possible without needing to restore a backup but it also makes upgrading the same distro easier. No need to format the /home partition when I went from Mandrake 10.0 to Mandriva 2007.1.

    LK

    --
    "Hi. This is my friend, Jack Shit, and you don't know him." - Lord Kano
  165. Here's how big by TheLink · · Score: 4, Interesting

    It does hurt to allocate a couple of gigs of swap.

    I use swap only to tell me that I'm low on RAM. Basically once the machine starts using swap and getting slightly slow- it means I'm low, then I can try to shut down stuff (without it behaving otherwise strangely, or dying abruptly).

    Here's how I suggest you figure out _roughly_ how much swap you need.

    1) Figure out the amount of Virtual Memory your programs and services _allocate_ without really _using_ - call this F. There are some programs that allocate hundreds of MB of memory but never use it. But note that there are some programs that allocate lots of memory and may use it :). If you have lots of RAM and are too lazy to guess, set F=0.

    2) Figure out your drive throughput for swap access (swap in + swap out)- this is often related to random access throughput - and for a typical hard drive it could be in the order of magnitude of 10MB/sec - call this M. Note that many flash drives have pathetic random write speeds of 4MB/sec (or even less!).

    3) Figure out the time you are willing to wait for stuff to swap in and out (e.g. time to get an ssh prompt- call this T.

    Swap = F + T * M.

    So for example, if you have programs that allocate a total of 100MB and never use it, and your drive swap throughput is 10MB/sec and the amount of time you're willing to wait is 15 seconds.

    Swap = 100MB + 15 sec * 10MB/sec = 250MB.

    As you can see allocating gigabytes can hurt - since it'll take days to swap in and out processes that are using gigabytes of swap. You'll run out of time before you run out of swap, and when that happens somebody will do a hard shutdown of the machine - and that means ALL processes will be abnormally terminated, rather than just one.

    Yes, there are cases where the offending program might not keep accessing all of that swap, but when a program misbehaves like that, you'd rather find out sooner rather than have to shutdown the whole computer (because it takes ages to respond).

    Running programs from swap is best reserved for those who wish to experience the 1950s drum memory days. If you want to do retrocomputing keep in mind that memory speeds are now much faster than disk speeds, whereas in the 1950s memory speed = drum speed, and most modern programs assume modern memory speeds.

    --
    1. Re:Here's how big by BitZtream · · Score: 5, Informative

      So I'm a FreeBSD guy rather than linux, but I'm going to assume that Linux also supports 'limits' that define the maximum a program can utilize before its denied access to more resources. You won't get a normal app on my FreeBSD boxes to use more than 256M of ram, they aren't allowed. There are 2 exceptions, the PostgreSQL server on one of the machines, and the bot that connects to that database. They both deal with large datasets on regular basis so they are allowed to use more ram. Now mind you, these machines are used for my personal development projects and they aren't really 'servers' in the sense that they see real load. My instances of apache don't NEED a lot of ram, some do.

      My point is that there are other protections in place that prevent an app from 'running away' and taking a properly configured machine down.

      Second, swap can be VERY useful even if you NEVER run out of ram. The OS can swap apps that have used memory but aren't actually doing anything with it out, and leave that memory available for file/disk caching, which can make performance FAR better than if you kept the idling apps in memory and had less available disk cache. Some apps avoid buffering things in memory because its both easier and most times more efficient to use the disk and let the OS manange the buffering. I've seen NT based OSes aggressively swap out things that aren't in use just so there is more memory available for disk cache, and it makes sense cause there is a lot of crap the kernel and other apps load up that is very RARELY needed, if ever.

      So while you can ( and did ) point out the potential pitfalls of using swap, your examples don't apply to any modern OS. I'm excluding Windows from that statement cause lets face it, its not exactly modern at the core. Modern kernels are FAR better at deciding what to swap than you are in almost every case, just like compilers can do a far better job of optimizing applications that most developers can. Yes some can do better, but its not likely you are, and certainly not the guy asking this question.

      In short, if you're going to try to get technical with why you wouldn't want to use swap, at least use examples problems that weren't solved years ago.

      And for reference, you configure your swap poorly if you do what you say.

      --
      Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
    2. Re:Here's how big by TheLink · · Score: 1, Troll

      "taking a properly configured machine down"

      So what do you set your postgresql limits to? Firefox often uses more than 256MB.

      With 256MB process limits, 20 fat apache processes with the same php app bug and you could still hit gigs of swap and the very problem I mention - unresponsive machine - "swap death".

      My way doesn't take as much guessing (how much will this ever use reasonably etc) and works well enough.

      NOTE: I also turn vm overcommit off- because I prefer apps to run out of mem, rather than the Linux oom killer killing them (I believe freebsd also overcommits by default).

      I prefer putting up with a theoretically slightly lower performance (less disk cache) as a trade off for a more graceful failure mode where the system continues to stay up. The machine may get sluggish (to a controlled degree), but it doesn't become unresponsive.

      Maybe I don't trust "modern" kernels as much as you do. FreeBSD, Linux, Windows whatever, they're all buggy.

      You can call it poor configuration if you want. So far it has worked well enough for me.

      --
    3. Re:Here's how big by alexborges · · Score: 1

      We call this pam_limit here in penguin land. We hail he daemon too. Greetings.

      --
      NO SIG
    4. Re:Here's how big by Tuoqui · · Score: 1

      If he has 4 GB of RAM then an 8 GB swap partition either

      1) Wont be used

      or

      2) Be too big/slow to be worth a damn

      My advice would be to just throw 512MB-1GB of Swap Space and make that the standard instead of some arbitrary 2x RAM. We're getting to the point where 2-4 GB is becoming standard sizes. Sooner or later we'll be seeing 4-8GB or 8-16GB becoming standard sizes (not much more than that before 64 bit CPUs and 64 bit addressing though!). Do we really need 8GB, 16GB or 32GB of Swap space? I honestly dont think very many programs use that much anymore any extra RAM you get will either be used only when gaming OR for multitasking (IE. Browser + Office + IM Programs + etc...)

      --
      09F911029D74E35BD84156C5635688C0
      +2 Troll is Slashdot's way of saying groupthink is confused
    5. Re:Here's how big by TheRaven64 · · Score: 2, Interesting

      I've seen NT based OSes aggressively swap out things that aren't in use just so there is more memory available for disk cache, and it makes sense cause there is a lot of crap the kernel and other apps load up that is very RARELY needed, if ever.

      This is a model that NT got indirectly from Mach, and FreeBSD got directly. The idea is that each step in the memory hierarchy is just a cache for the lower level. Your disk is the lowest level, main memory is the next one, then each of the layers in the CPU cache. If a program is waiting for data from the disk then it doesn't matter whether that data was meant to be put in memory with mmap, malloc, or read - it's still causing the program to block waiting for I/O. If you really care a lot about performance, then you want to make sure that the data you want next is in memory, and favouring malloc'd data turns out not to be such a great heuristic for this. Lots of applications leak memory, or allocate large data structures where they only rarely access more than a small part of them. The well-behaved ones of these (e.g. Dovecot IMAP) create these in mmap'd files, so they don't take up any swap, but others don't and it makes sense to spill these into memory and use the space to cache data that really will be used.

      --
      I am TheRaven on Soylent News
    6. Re:Here's how big by swilver · · Score: 3, Insightful

      This formula is ridiculous and makes no sense at all. To determine if you need swap you are far better off just figuring out if your system has enough RAM to run the programs you want to use on a daily basis. If you have that, then there's no reason to ever use swap (as that was the original reason people needed swap in the first place). As an added bonus, systems without swap cannot swap out programs in favor of increasing the disk cache, keeping everything snappy even after days of not using certain programs. So, here's my formula:

      1) Donot turn on swap.
      2) If there's ever any problem with memory, create a swap file (if you don't have one yet) and type swapon on a live system.

      You can see when you have a memory problem by applications getting killed when they try to allocate large chunks of memory or by keeping an eye on a memory monitor. If you see most memory allocated to stuff that isn't the disk cache, then you'll need swap.

    7. Re:Here's how big by swilver · · Score: 3, Insightful

      Second, swap can be VERY useful even if you NEVER run out of ram. The OS can swap apps that have used memory but aren't actually doing anything with it out, and leave that memory available for file/disk caching, which can make performance FAR better than if you kept the idling apps in memory and had less available disk cache. Some apps avoid buffering things in memory because its both easier and most times more efficient to use the disk and let the OS manange the buffering. I've seen NT based OSes aggressively swap out things that aren't in use just so there is more memory available for disk cache, and it makes sense cause there is a lot of crap the kernel and other apps load up that is very RARELY needed, if ever.

      Unfortunately, these "aggressive" memory managers are rather stupid. They will happily swap out every running program to increase the disk cache even in situations where caching makes no sense. Caching only makes sense if the underlying media is a bottleneck for performing a given task. How much of a bottleneck is your hard disk however when you are downloading and uploading files? When you're watching a movie? When you're playing MP3's? Or even, when you are serving web pages (over a link slower than your hard disk)?

      In none of those situations will you get ANY benefit at all from disk caching... yet if I watch a 4 GB movie over a period of 2 hours, a lot of memory managers will decide that attempting to cache all of that data might be a good thing. Halfway through the movie, it will think that all those other running programs have been unused for an hour and can be safely swapped out in favor of caching more of that 4 GB file. The end result is that half your programs are swapped out after watching a movie, resulting in a sluggish system that is trashing all over the swap file to restore some sanity to it, and all for caching data that put NO STRESS on the underlying media in the first place.

      The same thing happens for idling systems left on over night, doing simple tasks like virus scanning, downloading files, rebuilding indexes, and so on. The end result is that a system feels sluggish the next day, for no tangible performance benefit.

      Ask yourself, if I have 4 GB of RAM, and 500 MB worth of applications running, effectively having 3.5 GB for disk caching. How useful is it to swap out that extra 0.5 GB worth of kernel/programs for even more disk caching? Is 4 GB of disk cache so much more valuable than 3.5 GB? I highly doubt it, so to prevent stupid memory managers from swapping out my favourite programs which I left running for a reason, I just turn off swap.

    8. Re:Here's how big by Foolhardy · · Score: 1

      In none of those situations will you get ANY benefit at all from disk caching... yet if I watch a 4 GB movie over a period of 2 hours, a lot of memory managers will decide that attempting to cache all of that data might be a good thing.

      That's what cache hints are for. The media player should be opening the file with a hint that it will be read sequentially. On NT, this means that the cache blocks go to the end of the list, the first to be recycled.

      Another problem is that the kernel doesn't know what data is important and what isn't. In Vista (and WS2008), there are 8 cache priorities, which helps fix this. Background processes run at the lowest priority and can't encroach on the high priority memory used by interactive applications.

    9. Re:Here's how big by Ash+Vince · · Score: 1

      As you can see allocating gigabytes can hurt - since it'll take days to swap in and out processes that are using gigabytes of swap. You'll run out of time before you run out of swap, and when that happens somebody will do a hard shutdown of the machine - and that means ALL processes will be abnormally terminated, rather than just one.

      Only if you actually rely on using the swap. The parent poster was obviously saying that you allocate a ton of swap you don't need just because hard drives are cheap.

      I allocate twice the memory I am ever likely to put in a machine (ie - maximum memory the motherboard supports) by the same token. On my current PC that means I allocated 6Gb out of a 135Gb disk as swap. I have a separate drive (250Gb) for documents so the first 135Gb drive is only for programs and I have not filled it in the past 5 years so who gives a crap if I waste a few gigs of it. I always try and keep 10% of a hard disk free anyway in case I ever need it for unexpected events. The swap is in case I ever need to run a very memory hungry program as a one off.

      --
      I dont read /. to RTFA, I read /. to offend people in ignorance.
    10. Re:Here's how big by ladoga · · Score: 1

      Ask yourself, if I have 4 GB of RAM, and 500 MB worth of applications running, effectively having 3.5 GB for disk caching. How useful is it to swap out that extra 0.5 GB worth of kernel/programs for even more disk caching? Is 4 GB of disk cache so much more valuable than 3.5 GB? I highly doubt it, so to prevent stupid memory managers from swapping out my favourite programs which I left running for a reason, I just turn off swap.

      Or you could just adjust kernel's tendency to swap using /proc/sys/vm/swappiness (values range from 0 to 100). Default that most of the distros use is 60, which is probably too high for most desktop user's liking. Oftentimes you can prevent unnecessary swapping and thus increase responsiveness by setting swappiness to something like 0 or 10.

      echo 0 > /proc/sys/vm/swappiness to try it out until the next boot and add it to /etc/sysctl.conf (vm.swappiness = 0) if you wish to make it permanent.

      One reason against reducing swappiness is that when stuff gets rarely swapped out you will have more RAM used by it. But hey, what's that RAM for anyway?

    11. Re:Here's how big by mrchaotica · · Score: 1

      That's what cache hints are for. The media player should be opening the file with a hint that it will be read sequentially. On NT, this means that the cache blocks go to the end of the list, the first to be recycled.

      No can do; standard (i.e., POSIX) file-handling APIs don't have cache hints.

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

    12. Re:Here's how big by TheLink · · Score: 1

      "But hey, what's that RAM for anyway?"

      People keep telling me it's for cache.

      But waiting for my app to be swapped back in is more annoying to me than waiting for a disk cache miss - since usually if there's disk access (copying files etc), I'd probably be expecting it, and I expect it to be slow.

      Whereas I want my apps in RAM, that's the reason why I started those apps in the first place, and that's why I bought that much RAM.

      Other people might not mind their apps being swapped in and out, but I personally don't really want to live in the 1950s ;).

      --
    13. Re:Here's how big by BitZtream · · Score: 1

      Not really sure why you were modded Troll, I've seen FAR worse (better?) trolls if it was supposed to be one, which I don't think it was.

      I don't use Firefox on my unix boxes, so its not an issue, but my PostgreSQL user is allowed to use 2 gigs of memory, I'd probably say if I were using Firefox, my user account would probably need at least 2 gigs as well.

      As for the Apache problem, its not just per process, there are also per user and per login limits. So while one process is limited to say 256, the account itself across all processes and logins can be limited to say 1 gig. So the rogue PHP bug just kills off some Apache processes that happen to try allocating at the wrong time (when the limits are hit) but it'll still keep the box from tumbling into swap hell. In my specific case I'd much rather have the box slow down to a essentially unresponsive state where I can at least wait and know that the database server will eventually get its data committed to disk rather than just having it die because I had no swap to work around problems in the mean time.

      And as far as me saying your configuration is wrong, that statement is wrong I guess. Its all up to you and what works best in your enviroment in reality, not what my thoughts about your enviroment are :)

      If I had a machine with 8G of ram, I probably wouldn't have swap on it either. If for instance I calculated out all my 'limits' and found that I could not possibly hit my ram limit, and still left plenty of ram to deal with all the disk caching thats useful, then there really is no need for swap. Assuming the OS can be told to act as if theirs no swap, which will change how the VM system works, since by default most OSes now are going to assume that swap is going to be available and have code to plan to deal with it. A few years back, having no swap would actually cause you more performance problems because the kernels always assumed they could swap, not sure about NT but I know all the modern UNIX type OSes have this sort of support now.

      --
      Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
  166. 32 bit by rossdee · · Score: 2, Interesting

    Is there any point, with a 32bit OS, in having a swapfile bigger than 4 gigabytes?

    I just (today) installed a new hard drive, 1 Terabyte, so I moved the swapfile to that drive, but kept it the same size.(2 gigabytes)
    I have 3 gigabytes of RAM

    1. Re:32 bit by BitZtream · · Score: 2, Informative

      Yes.

      Just because an app can only use '32bit' addressing, doesn't mean the OS does. For instance my '32 bit' processor has '36 bits' of address space. So I have the capability in the processor to address 16 full 32 bit address spaces, even though the OS doesn't let any one app have more than 32bits worth of address space.

      Unfortunately, I run XP which won't let me get even to 32bits for all apps combined, but thats another story.

      Second, when you take 'virtual memory' into account, you can have a 'virtually' unlimited amount of applications that all think they have access to 32bits worth of address space. For instance say I have 3 apps that have memory leaks in them. These 3 apps for whatever reason must run for long periods of time without restarting. They really only use a gig each of active memory, but because they leak all the time, they consume a lot of wasted memory. This wasted memory will never be used again, so the OS can swap it out as needed and continue to let the buggy apps run until they can be patched, hopefully they will complete their long run cycle before exhausting swap as well.

      A better question is, do you really want to deal with those situations? Most of us have no need to. I don't, I know that. And for many people, if they actively need to use 2gb of swap, your dealing with some process that is going to be so painfully slow that you'll probably be willing to plunk down the money for more ram than deal with waitting on the disk light to turn off sometime next May. My swap is set to 8gigs on my XP machine, not because I want/need the swap space, but because I use it as a buffer for free space. When I get low, I turn off swap and reboot and have an extra 8 gigs of space for porn until I can drive my lazy ass to the store to get more tissues and a bigger drive. Not the ideal solution, but it makes me cleanup old crap when I get low on space most of the time and provides an alternative that is just inconvient enough that I don't use it 99.999% of the time.

      --
      Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
  167. Re:separate partitions for / and /home by xPosiMattx · · Score: 1

    I totally agree. In addition, there's also the issue of filling up partitions. Some times its desirable to have a partition (/var) dedicated just to things like logging, so if something goes crazy and uses up too much disk space, your programs are still able to log, and possible leave you clues as to what is going wrong, but I think this is a far less likely situation to occur.

  168. What am I missing? by p3d0 · · Score: 1

    You don't have a gig of swap utilized.

    --
    Patrick Doyle
    I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    1. Re:What am I missing? by dstar · · Score: 1

      No, I've got ~700M used. According to the OP, my system should be thrashing....

  169. What are you using it for? by dkuntz · · Score: 1

    I rarely, if ever, use more than 4G of swap. And I'm talking on machines that do have 16 to 32G of FBDIMMs, and frequently have all of it in use. Why only 4G? Well, I like that number.. I've never once actually reached it. The software we use requires some swap to exist. But, I guess it all depends on WHAT you will be using the system for. If you're using it as a End-User System (I like that better than "Desktop" or "Laptop"), you may find out you need more, depending on what apps you're running. But, as others have stated, even if you create a 2G swap partition... if you run out.. create a swap file.. do a swapon on it etc.. and poof.. now you got that much more swap. It's like Windows' pagefile.. where it can determine how large a file it needs to create up to a certain limit.. but it's not automatic (and I'm sure there's a script/app out there in the linux/unix/bsd world that will automatically adjust your swapfile based on usage.

    But, I think the Swap == 2x RAM deal has mostly gone away. It made sense when people had 256M ram, or on a decent midlevel system, 512 or 768M (I've also heard 1.5x and 2.5x from different sources), but nowadays, where you can have a a dual quadcore xeon with 128G of RAM... does it really really make sense to have 256G of swap? Unless you're doing something really really intensive, it just doesnt. Maybe highend CAD/CAM work, animation, etc, you might need it (Like you're making the next big Pixar movie on your 1 system!). But, really.. most users (even us on slashdot) arent going to need that much swap..

    And I'd hate to tell the others at my company that we can only really use 2 drives in the 3 drive system, because we're using the 2x RAM == swap method, and needed an entire 400gig SATA drive for swap...(yes, using the supermicro systems that hold 192G ram, and quad six-core CPUs).

    --
    OMG... I have a sig?
  170. Re:separate partitions for / and /home by Blakey+Rat · · Score: 1

    Feh. I have a ton of data from high school still available (well, kind of, they are old Mac OS .SIT compressed files, and I don't have any OSes right now that would understand their resource forks) using a slightly different tactic:

    Back up your damned data!

    I'm 29, BTW. The oldest file I have is a game I made in 1997, in Think C 5.0 IIRC.

  171. Re:separate partitions for / and /home by theheadlessrabbit · · Score: 1

    i have 4 partitions on mine:

    1 180(ish) gig fat-32 shared partition
    1 10 gig ntfs windows xp partition
    1 10 gig ext3 ubuntu partition
    1 2 gig swap partition. (none of the responses so far have convinced me that changing this is really necessary)

    this has similar benefits to your method; if i want to install a new distro, i can dump my /home to my shared partition and install away, then copy it all back to my new /home directory after the install.

    (note: it feels neat to have mod points to use in my own /. submission. if it wasn't for this post, i would so be abusing my power right now, mwahaha!)

    --
    -I only code in BASIC.-
  172. Hard drive xfer rate hasn't kept up with RAM by ZeekWatson · · Score: 1

    Swap is useless on modern hardware.

    In the Pentium 1 era EDO RAM maxed out at 256MB/s and hard disk xfer was 10MB/s.

    Now we have 16 GB/s RAM xfer rate and 60 MB/s hard disk.

    Notice the difference? RAM transfer rates have gone up by 60x while hard drives only 6x. Hard drives did not keep pace with RAM and no longer provide a usable alternative to RAM.

    Anyone who recommends swap doesn't understand what they're talking about. Swap is the new cargo-cult!

  173. 4GB Swap Standard by _hAZE_ · · Score: 1

    Over the past few years, colleagues and I have discussed this matter many times, and we seem to have settled on a 4GB swap standard for all UNIX/Linux systems. The majority of what we're working on are web and application servers, and honestly, if any swap ever gets utilized, it's time to add physical RAM. It's really there more as a temporary buffer in the event something spikes, but we monitor the systems close enough where that rarely even occurs.

    When you're dealing with a business-critical application, you shouldn't be relying on swap to save you; if it's important enough to be running on server-class hardware, it's important enough to allocate enough physical RAM to keep the box happy. Yes, disk space is cheap, but RAM is cheap too. Losing business/customers because your server is running slow is not cheap; spend the extra bucks on more RAM.

    --

    Don Head
    UNIX/Linux Administrator
  174. Don't bother with swap. by StarsAreAlsoFire · · Score: 1

    I am one of those crazy power users. I've run multi-day mathmatical models ( GAMS, Integer solvers ), games, tonnes of applications, servers, you name it.

    If you have more than 2Gb of RAM, don't use swap. Just turn it off. Seriously. The only out of memory error I've ever had since I turned off swap was while running a linear model that took 4 hours to finish. The PC had only 2GB of RAM, and JBuilder was using 500+ of it. Four years now.

    With a 32bit OS, as is mentioned, there is no point at all in having a swap. In fact if you have 4GB of RAM and a video card with 512MB of RAM, Windows XP can only address 3.5GB of the RAM.

  175. It's not the size of the swap space by plopez · · Score: 2, Funny

    that matters. It's how you use it....

    --
    putting the 'B' in LGBTQ+
  176. Will 32-bit OS ever map 4GB? by snikulin · · Score: 1

    I am not even sure that with 4GB RAM 32-bit OS will ever try to use swap. Any kernel gurus?

  177. If you're running a 32-bit OS, then 4GB is it by idan · · Score: 1

    If you're running Linux on IA32 then you can only address 4GB. Swap just extends your physical memory, so physical + swap cannot be more than 4GB.

    So ... if you have 2GB of RAM, up to 2GB of swap could conceivably be useful. If you have 4GB Of RAM, then there's no point in swap at all.

    These considerations go away if you use a 64 bit OS, of course.

    1. Re:If you're running a 32-bit OS, then 4GB is it by 1s44c · · Score: 1

      4GB is the maximum RAM that can be addressed by a 32 bit pointer, it's not a limit on the total ram in a 32 bit system since physical address extention ( PAE ) extends it by a few more pins.

      Google for PAE.

  178. RAM + Swap = The important thing by Anonymous Coward · · Score: 0

    If I do not miss any relevant technical detail, what matters in terms of memory capacity is:
    1.- The amount of RAM + Swap
    2.- How much memory your OS + applications demand

    Do not forget this: your PC uses RAM first. When it's full and more memory is requested (by the apps or the OS itself), starts using Swap. And swap is slow as hell (it is mapped in the hard disk. 100 times less bandwidth, 1000000 times more access time. buagh!). So if you can pay for some more GBs of RAM, I advise you to buy them before cause your PC to use Swap regularly.

    So, giving some examples for current days:

    - In an office + internet PC you will have enough with 1 GB. Always if you don't use Vista.

    - In a 2D graphic design station, ... I don't know. May be 2 GB ?, you will have to gauge your needs by yourself. windows' task administrator and ubuntu's system monitor allow to know this numbers.

    - In a 3D design station, probably 4 GB will be needed.

    - In an audio/video edition machine, probably also 4GB or more will be needed.

    One last example: if your OS + apps need 8 GB of memory and you have only 4 GB of RAM, you are doomed to put the remaining 4 GB in form of Swap; otherwise your system will become "out of memory" in the middle of your work session.

  179. How big should your swap be? by Cloin · · Score: 1

    I would recommend setting it to OVER NINE THOOOUUSSAANNNDDD

  180. it depends on the OS swapping logic by Anonymous Coward · · Score: 0

    there have been systems that allocated a page of swap for every page of ram that you have. those systems limited you to whichever was smaller, swap or ram. there have even been linux kernels that did this.

    nowdays this is usually not the case (and defiantly isn't on linux)

    if you end up using very much swap your system is going to be spending so much time accessing the disk that you probably won't be able to use it anyway.

    so the only reason to have a huge swap partition is if you have your system set to write your memory image to the swap partition when you hibernate.

    it defiantly doesn't make sense to always make swap = 2x ram. I am looking at a server that will have 128 G of ram, and uses 144G high-speed drives in a raid 1+0 array. why should I dedicate _four_ hard drives (out of 6 possible in the system) to swap?

    most of my systems are never going to hibernate (I want them running and serving, if I don't need them I can turn them off), so I allocate 1-2G of swap 'just in case' even on machines with 64G+ of ram.

  181. My 2 cents. by Chris+Snook · · Score: 3, Interesting

    Until a few months ago, I regularly answered this question for enterprise Linux customers, so I humbly submit that my anecdotal experience is marginally more informed than most here.

    Memory capacity and bandwidth is improving orders of magnitude faster than disk throughput and latency, and this has been true for decades. If the workload stays the same, you should generally have a lower swap/RAM ratio on newer hardware than older hardware, because it's so much cheaper these days to add more RAM, and adding more swap can actually make your system slower when you finally start using it, because it takes much longer to page in 8 GB of data from disk than 4 GB.

    The kernel virtual memory (VM) subsystem is a briar patch of carefully-tuned code which, whenever altered, almost always causes a regression for some obscure combination of hardware and software that someone somewhere cares an awful lot about. This is not due to inherent bugginess, but rather the fact that the VM is essentially in the business of predicting the future, which is mathematically impossible to always get right. As a result, developers tend to be very conservative about VM optimizations, so the VM tends not to adjust its assumptions about hardware quite as quickly as the hardware itself changes.

    The upshot of all of this is that as time goes by, swap becomes more of a lifeline for worst-case memory shortages and less of an optimization to make the system behave as though it had more memory. This is not to say you should do without it completely, but the ratio tends to keep going down. For desktop use, I've been using a 1:1 ratio for a while, and honestly, that's probably too large for how I use it. Digging out of 2X swap takes *more* than twice as long as digging out of 1X swap, because you end up thrashing back through the stuff you've already paged in and out before you get to the rest. Think of the Tower of Hanoi problem as an extreme worst case. Beyond a certain point, you really want the kernel to refuse memory allocations and/or invoke the OOM-killer to kill off your misbehaving app and restore performance for the rest of the system.

    Whatever you do, you shouldn't go completely swapless unless you really know what you're doing. Having just a few hundred megabytes of swap on a huge 4-socket server gives you a buffer against out-of-memory conditions that could bring down the whole system. In this extreme case, it's actually *good* that swap is slower than RAM, because it stalls userspace page dirtying while waiting for I/O, leaving the CPU free for the kernel to scan for pages that should be paged out, faster than userspace can dirty them.

    If you're stuck on a small system you can't upgrade, having a high swap/RAM ratio might still make sense, but modern hardware tends to have much more and faster RAM and only slightly faster I/O.

    If you've got a carefully tuned database server that's reserving much of its memory for hugepages, you should start your calculation with the amount of *swappable* RAM, which is the RAM not set aside for hugepages. So, if you've got 16 GB of RAM, and 12 GB reserved in hugepages, you only want swap proportional to 4 GB of RAM.

    The proportion itself is still a delicate matter. On a desktop system where you may open lots of applications, and then leave some of them idle for days while using other resource-intensive programs, it may make sense to go as high as 1x. On servers where latency is important, you probably don't want to go higher than 0.25. If you've got a batch compute system where you feed it a huge amount of work and expect it to be done when you come back several hours later, it can still make sense to have upwards of 2x as much swap as RAM. It might be sluggish to give you a login prompt, but that doesn't necessarily mean it's thrashing inefficiently if you have a fairly sequential access pattern.

    If all of this confuses you, and your distribution recommends 2 GB by default at install time, odds are you'll do okay with that, at least for the near future. Once solid-state storage becomes mainstream, most of what I've said in this post will be completely obsolete.

    --
    There's no failure quite as dissatisfying as a complete and total solution to the wrong problem.
    1. Re:My 2 cents. by xdroop · · Score: 1

      Well thought out answer.

      I've recently taken to assigning 1GB at install time, if only to shut the installer up. Compute nodes get 2GB, but I've demonstrated to the engineers that if you ever start to page a working set of more than about 512MB, it's literally faster to stop the job, go buy and install more RAM, and restart the job.

      This is especially true on some of are larger machines -- even with 32GB of RAM, the machine gets 2GB of swap and no more. For swapping working sets of this size, it's literally faster to order RAM through channels.

      --
      you should read everything on the internet as if it had "but I'm probably talking out of my ass" appended to it.
  182. Re:separate partitions for / and /home by Anonymous Coward · · Score: 1, Informative

    From the boot CD:

    `mv /mnt/hd /mnt/hd/old'

    Install, then mv your home directory back. Now you don't need the foresight from college days to realize you'll need 25 GiB for MP3s! Plus now if you have the disk space, you can keep the whole old FS and bring over conf files and binaries as you discover you need them, and even `chroot' into it if you like.

  183. Apply the number against the average by Anonymous Coward · · Score: 0

    A better way to interpret this figure is to apply it against the amount of ram in a new, average PC. How much ram -you- have in particular is not relevant.

    The idea is to give people a reasonable cushion for incremental increases to memory usage over time. A reasonable cushion can be considered 50-100% of the base memory for the average user. This cushion is sufficient even if you have more demanding applications because presumably you bought more physical ram to make up for that, as is the nature of the skepticism here.

    So, say the average right now is 2gb of ram. That means your swap is going to be 3-4gb. But you're a power user, and your app profile needs 8gb of ram. So you've equipped 8gb of ram. That 3-4gb swap cushion is still fine, because it will still cover incremental additions for the foreseeable future, based on the rate of current growth.

  184. Re:Will 32-bit OS ever map 4GB? by Sj0 · · Score: 1

    There was a slashdot article on this a few years ago. It was a debate, but the kernel will try to swap out idle processes whether it's got memory or not.

    --
    It's been a long time.
  185. Think a little! by Anonymous Coward · · Score: 0

    I hate it when idiots quote the 2x formula!
    If you spend a lot of money for a high end server then why would want to page at all? Today, paging space is a safety net. Some of us actually think about memory performance issues on NUMA systems and others are complete idiots who think that it's okay to have a database sga size so huge that it get's paged out to disk.
    Do you know what happens when you have a 32GB paging space and half of it gets used? The system will be thrashing and users will timeout waiting when trying to connect. It will seem like it is hung, but it's not, though it might as well be hung.
    If you tune the system correctly and use a smaller paging space you can have the system start killing processes to fix the problem. I know AIX allows you to specify that root processes are not killed and it will kill the youngest processes first which usually fixes the problem.

  186. Remote partitions for / and /home by Ostracus · · Score: 1

    For even greater flexibility have /home on an external drive and remote mount that. You have the advantage you mentioned and you have automatic backup* and can take it with you.

    *Bonus points for a NAS with RAID.

    --
    Shai Schticks:"You don't make peace with friends, you make peace with enemies"
  187. Re:Will 32-bit OS ever map 4GB? by phtpht · · Score: 1

    Yes. The i386 (whose memory model is still used today in all 'ia32' processors) can address 16 terabytes or so (don't know the exact figure) of _virtual_ memory. So while individual processes are limited by the 4gb (32-bit) barrier, there can be many such processes each with its own 4gb address space. You would then swap individual pages between HDD and system RAM as needed. In P6, PAE was added, so that you could 'swap' into high memory (system RAM addresses from 4gb to 64gb).

  188. if im not mistaken - crash the box by pjr.cc · · Score: 1

    twice-memory came from the old (old) unix days (and is still applicable by the way) because a crash wrote memory to swap. the machine would restart, look for a crash signature in swap and if it existed, suck it back out onto disk for analysis.

    Again, all still very applicable today (for unix).

    having said that, so long as you dont need to analyse your crash dumps, your choice of swap size can be more flexible!

  189. Re:Will 32-bit OS ever map 4GB? by SL+Baur · · Score: 1

    You are unlikely to be able to see all of your RAM unless you have PAE (CONFIG_HIGHMEM64G) enabled. Any memory mapped above 4G will be invisible otherwise.

    Available swap will be used when there's memory pressure so that's a different issue.

  190. Actual need by Anonymous Coward · · Score: 0

    The swap space should be sized for how much the user "actually" needs.
    Light users might only need 128 MB of swap per GB, even no swap if more memory is present.
    However multitasking very memory intensive applications (the gimp, 7zip sometimes Firefox) would probably need 2x maybe 3x of RAM to run without running out of memory and crashing, though it'll slow down the system if the swap is in demand.
    It's also better to over allocate swap if HDD space is available.

  191. Swap partition for hibernate by Cato · · Score: 1

    I don't use swap for paging typically, but having a swap partition (not file) set to the same size as your RAM means that hibernate is possible.

  192. don't forget the behavior of fork() by wangmaster · · Score: 1

    fork() on most platforms needs to reserve the same memory as the parent process. The eventual exec() call may free up most of that memory, but if you don't have enough free memory to handle the fork() you'll get an error trying to fork processes. This is a pretty ugly problem for large enterprise server type of applications where the parent process may have 1, 2, or more GB allocated. In these scenarios, it's not always cost effective to buy more RAM if you know the fork'ed processes will release the vast majority of the memory when the exec() is called. Thus you make sure there's plenty of swap. when configuring such large scale deployments I tend to recommend 2x swap. Disk is cheap, and if you're in an enterprise deployment and you can't afford another disk for swap, something's seroiusly wrong with your budget.

  193. depends by Anonymous Coward · · Score: 0

    There are several things to consider.

    I find there's no point in putting 2xRAM on a home computer - it would not be needed.

    The question is different with servers where availability matters.

    If you are using single servers (i.e. not in high-availability clusters), you want some spare swap in case some service leaks RAM. In this case, 2xRAM seems to be a good rough estimate - it would be sufficient until the system gets really slow from swapping, without getting out of memory and starting to kill services.

    If you are using high-availability clusters, not much swap is usually required at all - you have sufficient amount of RAM for normal duties and if it starts swapping a lot it will get thrown out of the cluster.

    The origins of 2xRAM come from BSD Unixes that first added virtual memory, IIRC. At those times, usable RAM was the amount of swap and physical RAM was just a cache for it - so you needed more swap than RAM to make any use of the swap. Modern systems like Solaris, Linux and Windows use swap as an addition to physical RAM, dunno about modern BSD.

  194. Swap file size by chris.evans · · Score: 1

    Basic rule of thumb is the swap partition/file should be three times that of how much RAM you got installed in your system. Swapsize = (RAMSIZE * 3);

    1. Re:Swap file size by jbolden · · Score: 1

      I agree.

      0x = fastest providing light use
      2x = min swap to get substantial advantage
      3x = sweet spot, best value for your money
      over 3 generally just leads to fragging.

  195. OS/X 10gb+ by Anonymous Coward · · Score: 0

    My mac at work always has a 10+ GB swap file, and I normally only use a text editor, firefox, itunes & many many terminals.

    10GB's for that?? I was shocked too..

    I've seen it up over 20GB's for some of our graphics designers.

    This would be 1:5 in relation to physical RAM. I normally follow the 1:2 rule as well, and it works on every other OS...I dunno why os/x is such a hog.

  196. swap=2xRAM is not necessarily needed by AliasMarlowe · · Score: 1

    I have 1GB RAM on my 6-year-old PC at home, and allocated a 2GB swap partition. Monitoring swap usage suggests that the system rarely uses much of it, and the largest swap usage I have noticed is only 300MB. In principle, I could have allocated an even smaller swap partition, but since it's on a 400GB drive, the lost space is negligible.

    The situation is quite similar on my 5-year-old laptop, which also has 1GB RAM, and a 1.5GB swap partition on its 80GB disk.

    If I had more RAM, I'd have less need for swap space (except for suspend to disk on a laptop).

    --
    Those who can make you believe absurdities can make you commit atrocities. - Voltaire
  197. There are multiple reasons for paging. by Anonymous Coward · · Score: 0

    There are other reasons for splitting the memory into pages than the ability to swap out the memory piecewise. Think protection for example. Think systems with multiple processes, e.g., almost all current systems.

  198. Do not take the decission by yourself by Anonymous Coward · · Score: 0

    Hey, you relied on some other's opinion in the past when choosing the 2x RAM rule. Let's keep on with this criteria and let other people choose the best for you: when installing your OS choose the "autopartition the hard disk" option. You won't need to think about that http://ask.slashdot.org/comments.pl?sid=982541&op=reply&threshold=1&commentsort=0&mode=thread&pid=anymore.

  199. Here by ImNotAtWork · · Score: 1
    --
    open source sub sim. I might start coding again for this. http://dangerdeep.sourceforge.net/contribute/
  200. Cool Performance Tip by Zoxed · · Score: 4, Funny

    Why does everyone put their swap on a slow harddrive ? A Gentoo running mate of mine in the pub showed me how to map the swap file into RAM: runs much faster there.

    (Although suspend does not seem to work now :-(

    1. Re:Cool Performance Tip by TeknoHog · · Score: 1

      Seriously though, you can use unused video RAM for a swap faster than disk. http://hedera.linuxnews.pl/_news/2002/09/03/_long/1445.html

      --
      Escher was the first MC and Giger invented the HR department.
    2. Re:Cool Performance Tip by OneSmartFellow · · Score: 2, Insightful

      Excuse my ignorance, but what's the point of putting swap into RAM. That seems completely self contradictory. The whole point of swap is to make up for the fact you don't actually have enough RAM.

      Does it really surprise you that suspend doesn't work. Where do you think suspend intends to store the current state of volatile memory ? It can't store it onto your file system (other than SWAP) for quite obvious reasons - unless it had its own partition it could use. (which is kind of wastefull when swap is supposed to be there)

    3. Re:Cool Performance Tip by csartanis · · Score: 1

      FWOOSH

    4. Re:Cool Performance Tip by OneSmartFellow · · Score: 1

      Ah, humour. I recall that concept now.

    5. Re:Cool Performance Tip by MWDrexel · · Score: 1

      *WHOOOSH*

    6. Re:Cool Performance Tip by Zoxed · · Score: 1

      > but what's the point of putting swap into RAM
      >...
      > Does it really surprise you that suspend doesn't work.

      Yep: I was going for +Funny, not +Insightfull :-))

  201. h4X by Anonymous Coward · · Score: 0

    Is 4 GB of RAM really neccessary? If it is, then you may want to have the double as a backup for swapping on your hard drive. But more than 4 GB of RAM cannot be handled with 32 bit addresses. So you need at least PAE or even 64 of these bits.

  202. Turn it off! by Anonymous Coward · · Score: 0

    I'm runnning XPSP3, and I have 4GB of RAM. I have turned off my swap file entirely. This has resulted in an enormous speed increase! I swear by it, and if you have enough RAM I always recommend this.

  203. How long will it take to read/write that? by Anonymous Coward · · Score: 1, Informative

    8 gigs on a HDD will take 100-800 seconds to read off.

    If you need that much, buy another 8 gigs of memory.

    THAT'S why you don't double memory as swap.

    1/2 to 1 Gig is plenty. If you start using a lot of it, get more memory.

  204. Do we need swap? by 91degrees · · Score: 1

    These days I'm thinking zero. Disks are slow. Chip based RAM is fairly fast. Linux is certainly less irritating than Windows when memory gets low but still not great.

    If I run out of memory it's usually a lot quicker to get an "out of memory" error and kill a few other applications than to wait for the swapping to sort itself out.

  205. The old rule "swap = 2 x CurrentRAM" is to evolve by nvatvani · · Score: 1

    ... to

    swap = max mainboard RAM capacity

    There should be conditions attached to this new rule though:

    1. Your current RAM installed is greater than or equal to 1GB
    2. Your HDD capacity is greater than or equal to 30GB
    3. Your HDD must have a SATA interface, or equivalent, or faster.
  206. You DO however by Anonymous Coward · · Score: 0

    Need to design the hardware. Which is well hard. Much harder than remembering where base 2 and base 10 is used.

    Serial protocol: in BAUD not bits per second. So you're wrong there. But converting to bits per second still uses a single line. So base 10 and base 2 have the same signalling needs: one line. No addressing.

    Memory: binary computer with binary addressing. So write an address decoder (and TLB/lookahead circuitry) that uses base 10 for a base 2 CPU. Dare ya. Now use base 2. How much easier was that?

    HDD: base requirements are same as computers: they still have to address a block as a "memory" (remember when computers were described as having 20MB of memory? That "memory" was the HDD). Above that, at the CHS level, it has to fit into the size of the tracks (you can't have half a cylinder and it's pointless having half a head/platter) so that can't be a whole number of either base 10 or base 2.

  207. SSD drives and laptops by vagabond_gr · · Score: 1

    With a 750GB hard drive selling under $100, what has changed?

    This is assuming that you have a 750GB drive. I don't. My laptop has 4GB of RAM and about 60GB of SSD disk. So no, I won't waste 8GB for useless swap. And even conventional hard drives for laptops are often not much bigger, MacBook Air come with 64GB, for example.

    My experience: I used a laptop with 2GB ram for 2 years, as my main computer. I was doing quite heavy stuff, like running MySQL/Apache/memcached all the time, lots of open files, often Eclipse and often VirtualBox (which is memory hungry). I didn't see the machine swapping even ONCE, except from cases when I had some bug in my code which allocated infinite memory, in which case no amount of swap could help me. My new laptop does the same. All the servers I monitor do the same.

    So my advice: start with a swap *file*, not partition, of 512MB. This way you have the flexibility to change it very easily and contrary to what some people might say, there's no performance penalty (especially if it's never used!). Quite probably is won't even swap. If it starts swapping you can increase it, or keep less programs open or buy more RAM. In most cases, when the PC swaps it will become so slow that you'll have to do something to make it stop.

    The above assumes you're not interested in hibernation. If you are, then allocate a swap partition of 1x RAM, to be sure you can always hibernate. In theory you can hibernate in swap files, but in practice you'll regret trying.

  208. Standard Desktop PC by Anonymous Coward · · Score: 0

    For a standard desktop PC (or laptop), it will typically have 1+ GB of RAM. Just use 1 GB of swap. If you have 2+ GB of RAM, you'll likly never use the swap anyways. I do this type of setup all the time with machines that have 1 to 3 GB of RAM, and I'll see swap rarely being used. So no, don't follow the 2x rule blindly.

    Obviously, if you forsee use of memory intensive applications, adjust your swap space accordingly.

  209. Common misconceptions about swap by Anonymous Coward · · Score: 0

    Swap USED to be 2x RAM because that made the page finding function easy (1. half = 1:1 RAM mapped, 2. half = additional space to swap to).

    This has long changed, and the swap mapping is no longer as dumb as that (Unix-wise).

    Kernel-hackers suggest a swap-size dependent upon the harddisk speed - for normal IDE disks it should be around 256MB, for really fast disks you might go with 512MB.

  210. Too much by rdebath · · Score: 1

    I haven't bothered to look at the other answers but it's really simple.

    It's best to allocate more swap than you think you will every be able to use.
    Just because when you start to run out of physical memory the machine goes slower. When you run out of virtual memory (swap space) processes start getting killed.

    With a modern disk on a 32bit machine I have had programs that use 3GB of virtual memory on a 512MB machine without a speed problem. So I would now say 4GB is the minimum. With a 64 bit machine you are limited by the SPEED of the disk so the problem is just how random the program is using memory. This is impossible to say as a general case so the twice memory rule is as good as any.

    Of course this doesn't mean the OS needs swap, most will run fine without any but will benefit from a small area (say 128MB) to dump the data areas of programs that are started by never actually used.

  211. the Solaris 10 System Administrator Collection by dovienya · · Score: 2, Informative

    says:
    "The most important factors in determining swap space size are the requirements of the system's software applications. [...] If you are unable to determine swap space requirements from your application vendors, use the following general guidelines based on your system type to allocate swap space."

    Workstation with about 4 Gbytes of physical memory: 1 Gbyte Swap

    Mid-range server with about 8 Gbytes of physical memory: 2 Gbyte Swap

    High-end server with about 16 to 128 Gbytes of physical memory: 4 Gbyte Swap

    http://docs.sun.com/app/docs/doc/817-5093/fsswap-31050?l=en&a=view

  212. Do you even need one? by pthisis · · Score: 1

    I stopped having a swap partition about 7 years ago (whenever my machine's RAM hit the 256MB mark and RAM really stopped being an issue). RAM is copious enough that swap's not needed to run everything I want, and I like not having the chance of swapping sensitive information out to non-volatile storage.

    Some of the suspend-to-disk packages need (or have needed) swap to work well, but most of the machines I run don't bother with swap nowadays.

    --
    rage, rage against the dying of the light
  213. Re:separate partitions for / and /home by FooBarWidget · · Score: 1

    I have. But that doesn't mean I want to bother with restoring from a backup after I've reinstalled my OS.

  214. Re:separate partitions for / and /home by VShael · · Score: 1

    I keep the "If I lose these files, I'd rather just die" stuff burned to disk, copied to my virtual server 1000 miles away, and on my USB keychain drive.

    Man, that must be AWESOME porn. :)

  215. Example from an Enterprise Server (It Depends) by Anonymous Coward · · Score: 0

    As all the prior replies show, the answer is, it depends upon what you're doing with the machine.

    IN MY WORLD
    Right now, I'm looking at TOP from a 12-cpu virtual server running SUSE 10. The system runs DB2, and is running about 100 concurrent transactions for clients in Europe. This is one VM on a massive machine (z10, 64 processors, 256GB main memory) so the physical memory this kernel sees is not what is on the machine.

    Current stats:
    Mem: 6170276k total, 3383108k used, 2787168k free, 64768k buffers

    Swap: 324928k total, 165740k used, 159188k free, 1921828k cached

    If I start to see swap grow, we're going to ask to pin more memory on the VM.

    -end

  216. Re:separate partitions for / and /home by gbjbaanb · · Score: 1

    awesome porn... starring the poster, obviously.

  217. In the year 2008... by Anonymous Coward · · Score: 0

    We're still jabbering about swap space? Really?

    I have run various Linux distros over the past 5+ years without any swap partition or file and had *zero* (noticeable) issues with performance. From small desktops to beefy laptops to rather large servers running all kinds of loads. I even edit swappiness = 0 just to make sure the system doesn't wonder off looking for something that isn't there.

    Now I would *never* do this under Windows, as the performance hits are obvious and immediate when you switch it off.

    Personally memory is so cheap I max out the machine, then buy the biggest HDD. As an example, if your OS is only every using 1GB RAM under your heaviest load, why would a swap space of any size be more useful/better than, say, an additional 3GB of physical RAM you have to spare on a 4GB box?

    Can someone cite specific examples of issues caused by not having any swap?

  218. Desktop: swap for hibernation by Anonymous Coward · · Score: 0

    Being a 900 eeepc user with _no_swap_ and 1GB of RAM, I'm more than happy with it :) I can run Firefox with lots of tabs, MATLAB and openoffice at the same time and Linux doesn't complain about it.

    Being an sysadmin with a server (2GB) some RoR apps, postgre, moin, postfix, mailman, ... I rellied on swap (rule used: RAM=SWAP ) .
    But now, with 8GB and the same 2GB of swap, little swap is used (9MB after 1 month of uptime ;)

    It depends of your use, but for desktop??? Swap is just needed to hibernate (in that case: swap=RAM)

  219. Well..... I thought it was twice your RAM by TheGreatGonzo · · Score: 1

    I have always been told that SWAP should be twice your RAM but no more then 512mb.

    --
    Oh, uh, good question. Now technically speaking, uhh, let's say, put me down as a... 'Whatever'?
  220. I've got by sajes · · Score: 1

    a 5GB swap space. It's rarely ever used, but I don't want to get bit in the ass when I actually do need it and can't have it because resizing partitions isn't an option. I've had 1MB of the 5GB swap space used at the most (so far), so I guess I could tone it down and add 4GB to / . Either way, when you have a large enough hard drive, 5GB doesn't really matter anymore. If you've got an 80GB hard drive (Like I had before I bought my 500GB), it's a pinch. I had 2GB swap on that.

  221. Re:separate partitions for / and /home by pointbeing · · Score: 1

    Is there any point to separate partitions for / and /home?

    IMO there's no other safe way to do it. Here's an example why -

    Let's say a runaway process fills up /var/log, trashing that particular filesystem. If /home is on that filesystem it also gets trashed and is the reason why I always put /var on its own partition if I'm building a server.

    Also, on my test box that doubles as a home media server I tend to run late alpha or beta versions of Linux distributions - if something breaks and /home is on a separate partition I can reinstall or even change distributions without losing data or settings.

    --
    we see things not as as they are, but as we are.
    -- anais nin
  222. Re:Will 32-bit OS ever map 4GB? by TheRaven64 · · Score: 2, Informative

    Each userspace process has its memory divided in to pages. These are typically 4KB. Each process has its own set of page tables, which map each of these pages to a real page in RAM. These entries are 32 bits, with 20 being used to indicate the address of the physical page. The remaining 12 are flags. One of these is the 'present' flag. If this is not set, then the operating system will receive an interrupt and have to set up the mapping correctly before it can proceed.

    If you have a 32-bit OS with two processes, each using 2.5GB of their 4GB address space, then some of this will have to spill over to swap space. Each process will have (for example) 0.5GB of its RAM swapped out to disk. When it attempts to access this, it will be paused while the OS writes some pages that haven't been used recently out to disk and then loads the requested page back in.

    A 32-bit OS just means that each process can only have 4GB of address space and that you can only have 4GB of total RAM. There are some slight fudges to get around this too - on anything more recent than a Pentium Pro, you have Page Address Extensions, which gives you 36 bits of physical address space, so you can address 64GB of RAM, but pointers are still 32 bits, so you still only get 4GB of virtual address space per process.

    --
    I am TheRaven on Soylent News
  223. good point by Anonymous Coward · · Score: 0

    I work at a research institute. We often have 8-12GB image files from an electron microscope. We need large RAM and swap (our image processing workstations are dual quad core with 32GB of RAM).

    That said for the average user I'd say once your kicking around 1GB of swap the rest is useless. Reason: disk is so much slower than RAM that you'll get frustrated that your computer is so slow long before you fill it and you'll close apps. If you find running a modern game, converting a bluray movie, and doing a full virus scan is too much to do at once, guess what? You'll probably close something.

    In practice we don't run into swap issues with any of our systems. For example our biggest (in terms of load/users connected) system at my work, our fileserver that is sharing ~1000 SMB/NFS shares of a total of about 250TB and doing live scanning of the data for backup with "only" 12GB of RAM uses 100-200MB of its 25GB swap file at any time. That doesn't seem to be because of need either because only about 20-40% of the RAM gets used. My guess is that the OS likes to keep some stuff in the swap file regardless of free RAM.

    Anyways, I highly doubt a typical workstation user will hit the load that this thing has on it constantly. So a 2X multiple is probably not needed for most people, I'd say a 0.5-1X is probably fine.

  224. Experiment? by Anonymous Coward · · Score: 0

    Reading the discussion, there doesn't seem to be one answer that suits everybody's needs. Why don't you make a few attempts, record how long it takes to do some of your typical work for each setting, and post your findings here?

    It certainly beats having sleepless nights over this for another 10 years...

  225. Consumer vs Server by Tim12s · · Score: 1

    For windows, if you are a consumer you need 4gb of memory. Always have a small amount of swap (100mb) as I find that windows becomes unstable without it. If your

    RAM -> Swap
    1gb -> 3gb
    2gb -> 2gb
    3gb -> 1gb
    4gb -> 0gb
    5gb -> 0gb *
    6gb -> 0gb *
    8gb -> 0gb *

    * Why do you have more than 4gb memory? You need to look at your applications. If you are using photoshop you may need more memory. Rule of thumb: for each large application (photoshop, database) use an extra 1 GB of swap.

    * If you have 8gb of memory and you are hitting swap you probably need to tune your servers and applications. If you have 10 applications you would have 10gb of swap. A well tuned server should use very little of that.

    * If you have 4gb of ram and have 2 large applications then you have 4gb of memory and 2gb of swap.

    Its basic math - you cannot divorce your needs from your usage and have to recognize that if you overload a server it will be sub-optimal. A server should ideally average 70% CPU and 70% memory usage to cater for spikes. Too much swapping will slow you down.

    With a move to visualization it becomes more important to be friendly with shared resources and thats a whole different topic.

  226. You've got it all backwards. by famebait · · Score: 1

    Your RAM doesn't require any swap space at all.
    If you have enough RAM to run all your apps with no swap space and space to spare, go for it. It's the best. Chances are you will one day hit out of memory errors, though, but then you can just add some swap space again.

    The 2x rule of thumb is meant as a recommended upper limit.
    The whole idea of swap space is based on the assumption that you can never get too much RAM. Since RAM is expensive while disk space is cheap, and not all of the RAM in use is actually being addressed at all times, it makes sense to use some disk space to emulate more RAM than you really have.

    But if you actually use enough memory to fill up more than 3x physical, chances are performance will really start to suffer because most of the time will be spent waiting for disk IO instead of doing jobs designed to work against low-latency RAM. It can still be the right thing to do sometimes, if you really need all that space for one app to work, and can live with the sluggishness, but for most users it would just encourage needlessly bogging down the machine.

    --
    sudo ergo sum
  227. You don't need swap by Kirth · · Score: 1

    We're not in the old times where your 64MB Ram just weren't enough.

    You don't need Swap. Really NOT.

    You might want to have some, in that case a tad more than your RAM, if you want to do suspend-to-disk. But otherwise, Swap is just a waste of space.

    --
    "The more prohibitions there are, The poorer the people will be" -- Lao Tse
  228. Solid state drives suck by Snaller · · Score: 0, Troll

    (and stop modding down people you don't agree with)

    I was excited when i bought one, only to find its not very good, Windows stutters and freezes and is not a fast machine.

    The claim is that it would last about 170 of normal use - but now everybody (like you) are saying ooh, you can't write on it because that will wear it out.

    Blaa

    --
    If Google really cared they would fix Android Chrome to reflow text, instead of discriminating
    1. Re:Solid state drives suck by Snaller · · Score: 1

      (Reposted to combat stupid children who mod everything as troll)

      (and stop modding down people you don't agree with)

      I was excited when i bought one, only to find its not very good, Windows stutters and freezes and is not a fast machine.

      The claim is that it would last about 170 of normal use - but now everybody (like you) are saying ooh, you can't write on it because that will wear it out.

      Blaa

      --
      If Google really cared they would fix Android Chrome to reflow text, instead of discriminating
  229. The "OLD" reason for swap=2xRAM by s.petry · · Score: 1

    This was done so that you would be able to process a kernel core dump. The only way to save core, as the kernel dumping itself into your swap region.

    Sure, swap was also used for paging from real memory, but anyone who works in computing "should" know that disk is much slower than RAM. Applications should only hit disk when absolutely necessary. Hence, if you are in disk swap 100% of the time, then you have under-scaled your hardware for the tasks it's performing.

    Now if you plan on trying to debug kernel core files, keep more swap than memory. Every bit of memory has to be dumped for a proper core.

    For people who are not debugging core files (which is a very large percentage), only create as much swap as you need. AKA. Add file swap when you get "Out of memory" messages.

    --

    -The wise argue that there are few absolutes, the fool argues that there are no probabilities.

  230. Re:separate partitions for / and /home by Bert64 · · Score: 1

    I do the same, but i just have to back up /home and /usr/local first... The issue with separate partitions is you can't always anticipate your space requirements up front..
    But the logical hierarchy unix uses to store it's files makes a lot of sense, and makes it easy to move from one machine or distro to another.

    --
    http://spamdecoy.net - free throwaway anonymous email - avoid spam!
  231. Servey says by C_Kode · · Score: 1

    Double your memory until you reach 1GB of swap. Basically, if your swapping anywhere near a GB you're PC or server is severely memory starved and probably has the performance of a sleeping turtle.

  232. The old days! by Anonymous Coward · · Score: 0

    With most systems coming with 2GB of RAM, I would say swap is no longer necessary. My first computer came with 4k of RAM and there was no need for swap space.

  233. 1xRAM should be enough for EVERYBODY! by helgihg · · Score: 1

    I used the 2xRAM rule of thumb until I got to about 2GB, when I decided 4GB of swap is just ridiculous. Now I put 1xRAM just in case there is some engineering quirk in some software that relies on it. 2xRAM these days simply must be waaaay more than excessive. 4GB of RAM should be enough for everyday *at this particular point in time*. ;)

  234. Re:separate partitions for / and /home by harry666t · · Score: 1

    I usually install stuff to ~/local/PROGRAMNAME/, and then make symlinks from ~/local/PROGRAMNAME/bin/* to ~/bin/, etc. A little like the GoboLinux. It might get trickier when one package depends on another, but I hadn't run into any of such. Also, if you're sharing /home with machines with varying architectures, a more complicated hierarchy would be feasible, like ~/local/ARCHNAME/PROGRAMNAME/, and maybe ~/local/ARCHNAME/bin/ for a collection of all executables for that arch, and a case statement in your .bashrc (or whatever shell you use) to set the PATH depending on the host name or uname.

    I can see at least three advantages if this scheme... You don't need root to install your software, it's easier to maintain the stuff (the additional PROGRAMNAME/ directory), and there's no need to clutter /usr, /usr/local, or have another separate partition.

    Eventually gets trickier if you'd like to share these packages with other users of the machine (that's the only case where I'd use /usr/local).

  235. Simple question by Anonymous Coward · · Score: 0

    I would have a question. I have 512MB of memory on my old laptop and working support for suspending to swap. And lack of space - 30GB.

    Question: Does swap partition needs to be at least as much as 512MB if I want to use suspending to swap? Or simple 300MB will do?

  236. My Relatively Simple Rule by Bos20k · · Score: 1

    My relatively simple rule is twice the amount of RAM until you hit 1GB of RAM. Systems with between 1GB and 8GB of RAM will get a 2GB swap. Systems with 8GB or more I would probably give a 4GB swap.

    That assumes the requirements of the system don't dictate having more swap than the rule above for some reason. And if they did, it probably means the system needs more RAM anyway.

  237. 1.5 times RAM by GunDawg · · Score: 1

    I've read that the minimum should be 1.5 times the size of the installed RAM. The reason: If (or when) the OS crashes, the entire memory dump can fit inside the "swap file". Are you developing software that when it crashes you have to read a memory dump? Would you need to provide a memory dump to a software vendor to assist in resolving crashes on your laptop? If not, the 1.5 rule is probably not necessary in your situation.

  238. why swap? by Anonymous Coward · · Score: 0

    Personally I haven't used swap (or almost haven't used it) since memory sizes went above 1GB. It's way less demanding from you hard drive.

    Windows has a bad habit of swapping memory do disk even when it's not necessary, and in Linux I simply never had to. No application I used completly filled the memory, except from some games which had memory leaks and after some 12 hours of continuous playing crashed. Having swap would have extended that to 36 hours probably but wouldn't have solved the problem.

    Not to mention, if you are still using a 32bit OS, going above 4GB will not help you unless you run multiple applications all having high memory requirements. A single application will not be able to use more than 4GB.

    Some applications may make their own kind of swap by mapping memory to a file on disk, or just plain writing and reading from disk the data they work with. (I have in mind Gimp and Cool Edit).

  239. Use a large swap if /tmp is both large and swapfs by Anonymous Coward · · Score: 0

    Even on a desktop machine with 4GB of RAM, setting swap space at 2*RAM (8 Gig) or even more is perfectly reasonable if you plan to make /tmp a swapfs/tmpfs and you know that /tmp will occasionally be used for large collections of temporary files (for instance: large compiles, copies of mail spools, software installation bundles)

    On my personal Gentoo machine, I have 4GB RAM and an 12GB swap partition, and I have an 8GB tmpfs filesystem mounted on /tmp. portage uses /tmp for it's temporary directory (instead of the default /var/tmp). Thanks to this configuration, the temporary files for most emerges ("emerge" is application compilation and installation) stay completely in RAM, which makes emerges fly, yet I still have enough room in /tmp should I need to emerge a huge app like OpenOffice.

  240. Why so Linux? by MSTCrow5429 · · Score: 2, Insightful

    Why are most of the answers about Linux? Do we know the uber-parent is running Linux? No. Should they have specified? Yes. However, as they didn't, each post that attempts to be useful should, at minimum, cover NT, Linux, and OS X.

    --
    Slashdot: Playing Favorites Since 1997
  241. Re:separate partitions for / and /home by Anonymous Coward · · Score: 0

    You don't want / and /home. What you probably want is / and /home/username/Downloads. home stores a lot of incompatible useless and texty(meaning far larger than they need to be) hidden .config files.

  242. The question isn't how much, but where by Xphile101361 · · Score: 1

    I have a rig with 4 HDDs. 2x Raptors and two larger drives for just mass media.

    One Raptor is used for gaming files (faster hard drive, faster loading of games and maps) and the other raptor is split for Vista and Ubuntu

    The question is what drive should I be putting the swap on, especially if I am going to attempt to get games to work on linux

  243. A rule isn't needed. by Anonymous Coward · · Score: 0

    There is no point in trying to create a "rule" for this. If you have a lot of RAM but don't usually use a lot of it, make your swap a couple gigs. If you use your RAM fully a lot then make your swap bigger. If you had 2 gigs RAM and a 4 gig swap but were still getting low memory warnings you wouldn't say "oh, I can't increase my swap because of the 2x rule", you would just do it. It's going to be different for everyone. Just figure out how you use your computer and set it accordingly.

  244. It depends on your use by Anonymous Coward · · Score: 0

    Most normal desktop users are probably safe with the anaconda (Fedora/Red Hat installer) automatic selection limit of 2GB. That's ample to park the idle system daemons and parts of your login today.

    Ram is fast. Swap is slow.

    If you have a specific application, then measure it and plan appropriately. Does it do well with a lot of swap? Is its worse with a lot of swap. Best to find out and plan.

    We're a chip company with desktop workstations and a compute farm ranging from single processor, 2GB RAM to 16 cores and 128GB of RAM.

    Most EDA applications we've seen (ex: Cadence, Mentor Graphics) deal poorly with having more than 10% of their footprint in swap when doing computation.

    Providing 256GB of swap on our 128GB machines always leads to trouble. Users/tools will try to allocate it and thrash - making progress at less than 1% speed.

    Many of the software licenses for these EDA tools are 10x to 50x the cost of enough RAM to run them effectively anyway. Why destroy the productivity of a $100k software license by trying to save a few thousand on the system running it.

    So we load up on RAM, limit the swap to 2GB, set vm.overcommit_* and have fast, stable machines.

  245. I need a swap partition? by Anonymous Coward · · Score: 0

    Whats a swap partition....?

  246. Memory limit by Anonymous Coward · · Score: 0

    What the meaning of getting 4GB ram and 8GB swap on a 32bits system (without adress extension) ?

  247. Don't go more than one to one at high memory by freedom_surfer · · Score: 1

    Set your swap up in a logical volume. You can always make it larger at some future date if you actually needed it. 99% percent of people won't if you just keep it one to one. Heck, above 4GB I'd start going half. The reason you don't want a large swap is that it takes a long time to write and/or read 8+ GB of data off of a standard hard drive. If you are using that much swap and often, you'd be much better served increasing your system memory. Swapping in general should be avoided because of its high cost, and should just be a safety net for those times you exceed system memory. If you are always exceeding system memory, then again, increase your system memory. IMHO anyway.

  248. Existing documentation and optimisation by Anonymous Coward · · Score: 0
    Perhaps I am late to rate to the max but I'd like to point out that there is the HOWTO: Multi Disk System Tuning that gives specific advice regarding swap (including a strange toilet metaphor).

    More to the point, check out the swap entry of the chapter on file systems features.

  249. Entire HD by nategoose · · Score: 1

    I'd just use the entire hard drive for swap and use RAM disks for my filesystems.

  250. The simple reason why you need as much swap as RAM by Anonymous Coward · · Score: 0

    The reason is simple: fork()

    Say you've got 1 GB of RAM, and you're running a Perl script which has sucked up a large amount of data, and is presently consuming 640 MB of RAM. Now your Perl script wishes to execute cURL to download a file. So what happens?

    Well, Perl tries to do the fork() & exec() thing, but it fails on the fork() think because there isn't enough system memory to have two copies of that script running. Now, yes, when fork() is called, the data isn't actually copied, but instead turned into copy-on-write pages, and yes, when exec() is called, it'll all go away, but for the system to complete the fork(), it needs to have enough memory available to hold two copies of that script, in the unlikely event that fork() isn't followed by exec() but instead each script continues to do its own thing.

    What the swap does is allow the system to say "well, if fork() isn't followed by exec(), then at least there's this swap that can be used" so that the fork() can occur.

    Now, you'll never actually use the swap. Just try "dd if=/dev/sda of=/dev/null bs=1048576 count=1024" to see how long it takes to read a GB from your hard disk. Terribly long time, right? Needless to say, if your system ever actually used that swap, it would become unusable. However, it still has to be there, otherwise your system will never be able to use all of its RAM since it won't be able to overcommit on memory usage during those short periods of time during which it looks like more memory will be used than actually will be.

  251. From an old-timer...... by Anonymous Coward · · Score: 0

    Ok, this really shows my age, but hey it's an opportunity to pass on some wisdom and possibly trivia to all you UNIX/Linux newcomers. I used to work for an AT&T VAR back in the early 80s servicing the old 3B1 and 3B2 and then later the 6386WGS series. Keep in mind that this was back in the day when 2MB Ram and a 30MB drive were enough to run a 4 user, green screen ERP system.

    According to an AT&T UNIX System V systems programmer recommended swap was 2.5x system memory and if swap utilization ever surpassed 50% then more memory was required. The rationalization given was the since swap memory was so significantly slower than RAM, it gave an admin time to find runaway processes and kill/fix them before they consumed all the memory (real and virtual) and hard crashed the system. Yes, you could limit the amount of memory per process and the number of processes per user, but in a multi-user system those limits are useless and they also did not protect you from bugs like memory leaks. The old System V Streams were particularly flakey and account for a lot of problems like this.

    He went into great detail about it all and I would assume that in multi-user systems and network services like SMB, httpd, it still holds true today. In a single user, graphical, desktop environment, I'm not so sure. It is more an issue of sum total memory to accomodate the largest, single app that would be run. I think you should have some swap, but depending on how much RAM you have compared to your largest app. As an example, I would think that a machine with 32GB of RAM certainly wouldn't need more than .5-1x swap if that.

    I would also keep a few more things in mind. The first is that new OSs like Linux are more agressive at memory management than older systems were back when the 2x rule was coined. Linux systems will "park" sleeping processes and daemons in swap to open more RAM for applications. That being the case some swap should be used to make the most of your memory. The second issue is that years ago you didn't have options for swap. It had to be on a "raw" partition (core dumps on kernel panics used this as a default destination as well so if you wanted to do a post mortem on a crash you had to have swap in a partition) and if you ever had to expand it you basically had to wipe the drive clean and repartition, re-install the OS and restore the data. This was very ugly to do so most admins opted to error on the high side. Today you can use a swap file directly on the FS which allows for re-sizing almost at will. What I don't know and maybe someone can answer this is if you still have to have a small raw partition for core dumps.

  252. Low memory by phil42 · · Score: 0

    would someone please tell us what role low memory plays. i have 3 gig of memory and and 8 gig of swap and i often trigger the oom killer because i have run out of low memory.

  253. Re:separate partitions for / and /home by gknoy · · Score: 1

    you can keep the whole old FS and bring over conf files and binaries as you discover you need them, and even `chroot' into it if you like

    Having done this when I upgraded my aging Gentoo box (which I never managedto get configged sensibly) to Ubuntu, I will ALWAYS try to do it in the future. Being able to mount my old drive and copy over things like Apache configurations (or at least read them so that I could see what I wanted to keep vs what I wanted to change) was exceedingly nice.

  254. you don't need anything over 2gb by adese · · Score: 1

    For the average non-graphix oriented linux user in the modern 2-16gb-of-ram-world, a swap space of 2048mb is enough. To go over that means your hard drive takes longer to seek over a larger area. I'm sure there may be situations that demand more than 2gb of swap space, but as an average* linux user with say 4gb of ram, you don't NEED 8gb of swap. its overkill and you will actually see a performance DROP instead of increase. *by average I mean most common uses of linux, not average experience.

  255. Re:separate partitions for / and /home by Anonymous Coward · · Score: 0

    You know, I've always wondered about doing this. When you nuke / and rebuild a new system, what do you do to ensure the user and group ids on the preserved partitions match up to the correct users you (re)create?

    ac

  256. Measure What's Used by Toad-san · · Score: 1

    I'd never had a system with so much RAM before (1GB!), but then I'd never routinely used programs that used so much RAM before (Windows XP, WoW, etc.).

    I wondered about this too (even though I'd used the old rule of thumb: allocate twice RAM size to swap file). So I found a freeware utility that measures how much of my Windows disk cache is actually being used. And then I ran all my usual things, my games, everything, over a period of days.

    Guess what?

    Windows Disk Cache would be used once, approx 25MB or so, at startup (I suspect Windows just feeling around to see what's there), and then never again touched.

    So I pointed my disk cache file at an old raggedy 5GB hard drive I stuck in the system as Drive D: and never looked back :-)

  257. indienick by Anonymous Coward · · Score: 0

    I recall reading in the Gentoo Handbook that on systems with less than 1GB of RAM, you should follow the guidelines of "make your swap partition twice the size of available RAM".

    However, that being said, on my laptop with 2GB of RAM, I have yet to see anything get written to (and consequently read from) my 512MB swap partition.

    Additionally, on systems with SSD (solid state drives), the creation of a swap space may not only be impractical, but also somewhat damaging. SSDs haven't yet gotten to the read/write transaction limits that regular HDDs have, and a swap space that gets made heavy use of may burn out that small space that you have dedicated towards it, thus killing precious space on your already-small SSD.

  258. From a techer in college... by Anonymous Coward · · Score: 0

    From him, I was told 1.25 x RAM. It always seems to have worked for me. Enough to hibernate, plus extra for insurance :P

  259. posix_fadvise and posix_madvise by joe_plastic · · Score: 2, Informative

    posix_fadvise and posix_madvise seem to be standard posixy way to give hints to the cache. madvise(..) and fadvise(..) also exist granted some of the kernels don't properly use the hints.

    1. Re:posix_fadvise and posix_madvise by mrchaotica · · Score: 1

      Hey, I learned something new! Thanks.

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

  260. Re:separate partitions for / and /home by rk · · Score: 1

    That's a good strategy too, and I like the architecture thing you've got... I have a setup kind of like that at work since I sometimes have support i386 and x86_64 Linux, and Solaris SPARC.

    But at home, I do have to have many packages I build available across accounts. I have a "usrlocal" group and /usr/local was set 775, plus a g+s. My primary account is in the usrlocal group, so I can put things there without su or sudo.

  261. What has changed... by tempest69 · · Score: 1
    Memory.. it's cheap.. super duper cheap. 8gb ddr2 800 mhz at $110

    There isnt a good reason to swap when memory can do a much nicer job. The next generation of chipset needs to abuse the cheap ram in wild ways. I want a box that will take 128 gb, and will barely touch the hard drive. I dont want some DLL loading into memory.. I want ready and willing as soon as i need it. I want windows to load, and never need to re-read

    Storm

  262. Slow Swap? Make it fast! by Zoson · · Score: 1

    So the general complaint with people who do not like swap files is that they are slow. Instead of eliminating the need for a swap, why not just bring your swap up to speed with a ramdisk?

    There are two out that I know of. One by Aspacia, and one by Gigabyte. Both of which require external power sources, but connect directly via SATA, or through the PCI bus! You end up with a 'disk' the size of the modules you placed on the ramdisk card, and viola! Stick your swap file or partition on that disk and you now have a swap operating at the saturation point of whatever bus it is connected to.

    Aspacia Rocketdrive: http://www.aspacia.com/Products/Hardware/SSD/rocketdrive.htm
    Gigabyte iRAM: http://www.gigabyte.com.tw/Products/Storage/Products_Overview.aspx?ProductID=2180

    Headache solved.

  263. I run zero... by NerveGas · · Score: 1

        First, I make sure that my machines have adequate RAM for their usage. That includes sufficient disk cache.

        At that point, swap doesn't do a whole lot. I don't need to move programs out of RAM to run new programs. And I don't need to move long-unused programs out to make room for disk cache.

        Now, occasionally, truly obscene things happen that make the machine need far more memory than it actually happens. If the machine has cache, then it starts thrashing, swapping, and going into a big, unresponsive death spiral, affecting all other services on the machine. Not a good solution.

        If the machine doesn't have swap, then the offending memory hogs get killed (or simply can't continue in their consumption), but other services have vastly more chance of continuing undisturbed.

        Swap is nothing more than a way to replace RAM with disk. That made sense when RAM was outrageously expensive, but prices have come down to less than 1/1000th of what they were in those days.

        Except in truly unusual situations, there's simply no more economic reason to replace a good medium with one that has a thousand times more latency, and less than a thousandth of the bandwidth.

    --
    Oh, you're not stuck, you're just unable to let go of the onion rings.
  264. Suspend to disk and virtualization by Anonymous Coward · · Score: 0

    For desktop use I tend to make a swap partition a little larger than the max amount of RAM that machine will have. I have 4 gigs of RAM in my main desktop so the swap has never been used except for suspending to disk. Running multiple virtual machines seem to be the only thing that gets my memory usage over a gig.

  265. 0 GB Swap ?? by bacchu_anjan · · Score: 1

    If you have 4 GB of RAM and you consistency see that a considerable (500 MB) amount of physical memory is FREE, I would NOT suggest that you have a SWAP space at all.

        Then again, I am a windows user, and have 3 GB RAM and 0 GB SWAP. This lets my programs be faster and snappier.

  266. Re:The simple reason why you need as much swap as by NerveGas · · Score: 1

    So... why not spend an extra $10, and have an extra gig of memory that would, at the least, provide more disk cache - and possibly provide for situations when you actually need more than a gig?

    The days of people only being limitted to a gig by economic, chipset, or number-of-slot limitations has mostly past us by. 8 gigs of good, decent memory can be had for less than $100.

    --
    Oh, you're not stuck, you're just unable to let go of the onion rings.
  267. How about lower speed ram? by bussdriver · · Score: 1

    Its all just buffer cache between the CPU's registers and the disk's storage.

    How about a new market for RAM?
    RAM that is larger, lower power and slower to fit between VM and RAM; or possibly replace main memory while the current memory moves towards being a larger form of 3rd level shared cache between CPU (and GPU?)

    It may be an extra level of little benefit at this time but as GPUs and CPUs converge another buffer to address the needs of a big enough class of applications might become viable.

  268. Re:separate partitions for / and /home by element-o.p. · · Score: 1

    I don't break out /usr/local to a separate partition (although I can see why it can be both a good and bad idea to do so), but I definitely break out /var/log. If I have a log file get unusually large (/var/log/syslog due to iptables logging, for example), I don't want to fill / .

    However, I always break out /home into a separate partition for the same reason you do :)

    --
    MCSE? No, sir...I don't do Windows. Yes, I am an idealist. What's your point?
  269. Not a boost at all. by alderX · · Score: 1

    Actually this is the reason why I disabled swap all together on my box. I have 2 GB of RAM in my machine which is totally sufficient. Once I disabled swap the system became really snappy. Before when I Alt+Tab'ed between applications, I always got some time lack before the application appeared. If you don't use more memory than your physical RAM then disable swap! Thats the biggest boost in performance you will get on your desktop - sad but true.

  270. Paging is fundamental to a modern OS by Homburg · · Score: 1

    Paging gives you a lot more than just extra memory when you run out of physical RAM. On a modern OS, disk reads work by mapping the relevant part of the disk to the virtual address space, then transferring these disk sectors to physical RAM when they're read. This way, the disk cache is neatly integrated into the memory manager, which I don't think you'ld want to lose, even if you do decide to get rid of your swap space.

  271. that adds up to by Anonymous Coward · · Score: 0

    a few gigs of faggotry

  272. Keep it simple. by Anonymous Coward · · Score: 0

    Basically.... monitor your memory usage. Get an idea for a peak, and then add your physical memory to that peak, you have a safe amount of memory for most intents and purposes. Typically your swap should atleast be the size of your RAM(unless you have crazy amounts of RAM, like over 4 GB and you don't do 3d rendering, memory-intensive scientific computation.. etc).

    Page/swap can take memory leaks fairly gracefully compared to the system needing to increase its swap to satisfy programs (it may 'freeze' during this process). So more is 'safer' than less. Though you certainly won't see performance increase, unless the extra swap it's used often. VM size varies quite a bit depending on how much you multitask.

    In Windows the swap file is used regardless. So always leave it enabled. If you NEVER use all your RAM, 1(XP)-2(Vista) GB swap should be bare minimum(older computers used for light computing could get away with 512(more or less than 128MB) or even 256 MB(128 MB)). It's really not hard to keep an eye on your mem usage, and discover optimal values that make best use of disk space while providing optimal performance). Some programs purposely use swap. NEVER DISABLE IT! It'll be used anyway and you'll be suffering performance hits. It basically turns it into fully dynamic paging, adjusting as Windows 'thinks' it needs to.

    If you don't atleast have a page file the size of your RAM Windows can't do certain functions like dumping your RAM.

    Performance is best seen when your paging file is not on the same physical drive as your system or programs files or other drives you use often. Ideally it is split between multiple physical hard drives. For instance I have 1 GB of RAM. 3 physical disks. I have 1 GB swap on both of my 500 GB drives, and I use a 30 GB drive for windows and program files. Leaving me with 3 GB of memory. I do heavy multitasking and CAD/rendering and other memory intensive tasks.

  273. Desktop vs multiuser server by Anonymous Coward · · Score: 0

    Depends on the workload. The real benifit of swap is being able to able to swap out idle memory from idle processes.

    Such workloads are hard to find.

    If you're multitasking heavy on a desktop computer, chances are that a lot of swap won't do you much good, as your processes will not spend a lot of time idle.

    You only need enough swap to help warn you via thrashing that your workload is too damn big. Pick too little and you'll have no warning. Pick too much swap and you lose the benifit of the OS killing your hoggy processes for you. This is great big favour if you're not going to do it yourself.

    But, if you're a sysadmin type and prefer killing (or suspending!) your own processes mannually, even under high load (which can be damn hard!), then go with big swap. Whatever you do though, use your ears (heavy hard disk activity) or use your eyes (load monitor) and don't tolerate inapropriate loads. Stop them.

    No matter what though, the quantity of swap you choose will not really make a difference on weather you end up thrashing or not. If you're thrashing, get more physical memory, or do reduce the workload. But please, for the sake of the children don't let the thrashing continue. The sound of a drive working its butt off to load and reload the same pages over and over gain for over a minute gives me nightmares.

    If you don't mind taking responsibility for stoping big loads, you can never have too much swap. The only thing you can have is too much demand, and too much swapping.

    Now, if your workload is one, big, memory intensive app, a lot of swap can be a godsend. It can make the impossible, possible. If you're lucky, you might even be able to avoid thrashing if only a fraction of the pages are in demand at a time. I don't know how often that is actually possible.

    If you can, avoid such applications. Smart programmers don't put everything in RAM, for data heavy apps they use database management systems, and for multimedia/graphics/sound/video heavy stuff they take advantage of thier privledged ability to be able to more acuratly pridict where future demand is, form thier own caches and do thier own paging. In the free world, Audacity comes to mind as a good example, its a non-linear audio editor that keeps little chunks of what you're edditing on disk. Even though it is non-linear, there are strong chances for locality of reference in such an application. Applications that write to disk also benifit from the operating system allocating RAM to disk cache, which makes reads and writes to common pieces of data not very costly. A bad example of putting things in RAM from the free world was GnuCash, which until recently did this. (theier trunk version now uses a DBMS). I never really found it causing me to thrash, but boy! did it ever take a long time to save, which also had the added benifit of being all to XML!

    The thoeretical ideal place for a lot of swap is a multiuser system where many users log in, launch apps, work, lock thier terminal or screen and walk away. A lot of swap here could make it possible for more users to be active, and make RAM availible to the active users for disk cache.

  274. Reasonably small, actually... by Anonymous Coward · · Score: 0

    I've never made a swap partition bigger than 512MB and i've never had a problem.

  275. Swap partition? by Anonymous Coward · · Score: 0

    Just go to Start menu, Control Panel, System, Advanced, Performance Settings, Advanced, Virtual Memory/Change, and set the "Automatically manage paging file size for all drives" checkbox. That's the last you need worry about that.

  276. Where the 2X rule comes from by Pogie · · Score: 2, Interesting

    Forgive me for not reading all the posts, but I did get through those moderated high, and I'd like to clear up the reason (if not the true historical origin) of the 2x RAM rule for swap.

    The actual reason to create a swap area (through file, dedicated partitions, disks, etc) that is sized at 2x physical RAM is so that you can both:

    a) reserve swap pages equal to total ram.
    b) swap out idle process pages equal to total ram.

    Many applications reserve virtual pages in the swap area to ensure that in the event the memory manager pages the application out to swap there will be enough swap available to hold the process. Oracle is a perfect example of an app that, by default, will do a disk page reservation for portions of the SGA and PGA. So if you've got a server with 8GB of memory + 8GB swap on which you've allocated 6GB to the oracle SGA and PGA, you'll see around 5-6GB of swap utilized once oracle's up and running, even though no portion of the process page space is actively residing on disk.

    Now, if that's the case, then what happens when your memory manager needs to actually swap something out of physical memory to virtual (disk) pages? Well, the system has a lot less virtual page space to work with, and it's possible to encounter allocation issues if new processes are started. To avoid that problem, you add another 8GB of swap (working off the 8GB physical ram example). Now, even if you are running 8GB of programs which require a one-to-one ratio between physical pages and virtual page reservations, there is still enough swap available for the memory manager to swap ALL of the processes in physical memory out to disk and allocate physical memory to new processes.

    Now, is it ever going to happen that you actually end up needing to both reserve swap == physical ram AND swap out your system's RAM worth of processes? Not if your admins have the first clue what they are doing, no. :) But by using the 2X rule, you pretty much idiot-proof your memory manager for any application profile and any OS.

    Of course, if you are knowledgeable about your operating system and the actual usage of your server, you will almost never take this generalized approach. Modern Unix OS's and applications normally will have alternative configurations that allow you to avoid swap reservation (v_pinshm, for example, in AIX 5.3 and later), as well as tuning the behavior of the virtual memory manager to better handle situations where the system has a low free page count. It's important to remember, though, that the consequence of allocating too little swap is the memory manager killing processes to recover free pages, and in a production environment, the process it kills will inevitably be the one resulting in you receiving a 4am wakeup call.

    Personally, I will usually run with swap space == total physical memory, and upgrade the server the minute I start seeing page outs to disk. That's probably not an option for the desktop unix crowd, but it's a good rule for any unix servers running an application that requires even the lowest level of guaranteed performance. Swapping is bad. End of story.

    Thanks for your time, and as always, I reserve the right to be wrong.

    1. Re:Where the 2X rule comes from by Chili-71 · · Score: 1

      The real reason for more swap space than RAM was to capture all the data in RAM and CPU registers/cache in when the server would crash. Since O/S crashes are few and far between, it doesn't make a lot of sense to have huge swap spaces. Also, since most users aren't going to try and debug the core dump, you really don't need much swap at all. Farther down the line, since most applications are now better behaved and RAM is pretty cheap there is very little page swapping going on and another reason for smaller swap space.

      I'm not saying zero swap, but you certainly don't need 2x swap or even 1x swap any longer. If you load your system up with applications and actually are doing page swapping, then you will need some swap. If you don't have any page swapping, then set swap space to one quarter or one half of your physical RAM.

      IMHO.

  277. Exchange 2007 by Icyfire0573 · · Score: 1

    If your using Exchange 2007 with 4 gigs of RAM I recommend at least 4 times that for swap, maybe 5, even if you only have a 1GB information store. Other than that (to get it off my chest) I just make it some remainder of the disks I use for a RAID array so for 4 GB on a desktop it comes out to 2GB.

    BTW, exchanges 2007 admins I'd love to get information on what I f*ed up if you don't get that kind of RAM usage because I've done multiple installs that consume these kinds of resources and crash the Information Store.

  278. Having swap can HELP performance. by Meetch · · Score: 1

    1) Donot turn on swap.

    2) If there's ever any problem with memory, create a swap file (if you don't have one yet) and type swapon on a live system.

    1) is not the best idea, at least for Linux. One of the things the Linux kernel can effectively use swap for is defragmenting memory! Swap a chunk of memory out to disk, and read it back in at a more suitable location. A long-running, hard working kernel will reward you even for a measly 256M swap partition - eventually.

    2) Swap files are significantly slower than swap devices. Consider this: Your swap file lives on a filesystem. Your system decides it's struggling with memory and begins trying to swap some cached files out (it may assume that swapping them out and back in again is faster than re-reading off the original disk)... potentially onto the same disk the originals come from, causing more thrashing. It may even have to consider whether it can to swap out bits of the swap file! Plus you're dealing with filesystem layers which will only slow down the process... so give it at least one device/partition as a priority, and add swap files with a lower priority for temporary/emergency purposes only, if you care about performance.

    The amount of swap any system requires is very situation/application dependent. If your system isn't using swap much at all, then good for you! Don't throw a lot of swap at it! But be nice to your Linux kernel, and give it something to use for its own sanity.

  279. Re:separate partitions for / and /home by Anonymous Coward · · Score: 0

    Agreed 100000%. I have gone through god knows how many distros and some multiple times. All while keeping my same /home. Also being able to move /home to different hard drives as size needs increased. My /home has been my /home since 1998 (and it still isnt paid off yet :()

  280. It's not that simple by Anonymous Coward · · Score: 0

    Swap is not the same thing in all cases.

    There's nothing to prevent an OS designer/implementor/maintainer from doing something really oddball that would require 1.33x+ physmem for example.

    However, the two most common possibilities are:
    1) VM = size of swap
    2) VM = size of swap + physical RAM

    Linux has flipped back and forth between #1 and #2 a bit - I'm not sure where it's finally wound up.

    There was a time in the Linux world where if you didn't have at least as much swap as physmem, you'd be fine for a while, but then as soon as there was memory contention, your system would go into a thrashing tailspin that you'd often have to reset out of.

    So don't ask "what size should my swap be?" - instead ask "what size should my swap be for the OS I'm using on this system?"

    And yes, keep in mind things like kdumps that are written to swap (not all dumps go to swap anymore, but certainly some still do), and things like hibernation that will write to swap. Note that sometimes when memory images are written to swap, they'll be compressed - other times not.

  281. RAM is often faster than disk so having swap helps by Sits · · Score: 1

    Here's the thing - unless your main nonvolatile media is as fast and smaller than your RAM swap is still useful. What can happen is that pieces of RAM that are very rarely used (e.g. a program that starts up does something then goes to sleep indefinitely) gets swapped out (which initially seems bad because you're going to pay a large price if you ever have to swap it back in). However that RAM is now free for other uses like caching your disk. So disk access to data you've already read which may involve seeking on rotating media and a lot of waiting now become as fast as your RAM. If you have no swap this tradeoff can never be made and the RAM is effectively never reused.

    Looking around this Kenreltrap article contains a thread where someone asks is swap necessary? which might provide a better explanation than the one I've given.

  282. Where did you get that linux doesn't like none? by Sits · · Score: 1

    The memory manager should be able to cope without swap - there's even a kernel compilation option to not have support for swap at all...

    I'm using an EeePC without swap and (thankfully) it doesn't suddenly burst into OOM errors at the drop of a hat so I'm curious about your final paragraph. Are you thinking of overcommit related issues? Could you link to a reference about the poor Linux MM behaviour when running without swap (note this is different to using memory for cache)?

    1. Re:Where did you get that linux doesn't like none? by 42forty-two42 · · Score: 1

      Here is my source: http://blogs.smugmug.com/don/2008/05/01/mysql-and-the-linux-swap-problem/. It could be that it only shows on certain heavy workloads.

  283. The write speed is low but reading random data... by Sits · · Score: 1

    ..shows a massive improvement. When data you are fetching is scattered over the "disk", the lack of having to wait for the drive to seek to the data before reading it is huge. Sequential throughput of a read on an EeePC SSD is lower (perhaps only 25Mbytes/s?) than that of a regular laptop disk (the speed that both EeePC internal drives get configured to is UDMA 66) but it's hard to arrange for all workloads to be sequentially arranged on disk without perpetually defragging and having only a single reading process at any one time. On parallel read with no writes at all (e.g. early startup) workloads there's often a noticeable win.

  284. No swap by Anonymous Coward · · Score: 0

    It obviously depends on what you are using it for. But, on my systems, I've aimed for 2GB of total virtual memory. I have one machine with 512MB, 1.5GB swap. One has 1GB, 1GB swap. One has like 448MB (because of 64MB shared video memory) so I gave it 1GB+64MB. So with 4GB RAM I would leave swap at *0*, and (if you use Linux exclusively) even consider jettisoning a few sticks and save the cost of RAM if you build a second system... it doesn't chug through RAM the way Windows does.

              On the other hand, my Ubuntu boxes auto-create swap, and for a system with 768MB made like a 2.2GB swap. I didn't override it, although for my use it's a bit excessive.

              (Some) games use lots of RAM. GIS uses lots of RAM. Some times of software development use lots of RAM (I'm running gentoo, though, and 2GB seems to be fine for compiling, openoffice is the biggest and peaks at about 1.5GB while compiling it..) Normal web surfing, word processing, etc. etc. just doesn't use too much.

  285. Preliminary split-lru patches might help by Sits · · Score: 1

    Hmm. That's a real problem alright (but probably only noticeable in longer running but partially idle workloads). There are patches floating around that might help to solve in the form of Rik van Riel's split LRU patches. Note tat patch is not yet in mainstream...

  286. Re:separate partitions for / and /home by Slashdot+Parent · · Score: 1

    Guess how many times I've thanked 8 lb 6 oz baby Jesus that I had the foresight to separate the two? All my data from my college days is still intact under /home.

    I never bothered to separate / and /home way back when. Guess how many times I've cursed 8 lb 6 oz baby Jesus that I didn't bother? Zero.

    I keep these things called "backups". One day, I wanted to switch from Slackware to Debian, so I followed the following procedure:

    1. Run backup process
    2. Nuke /home
    3. Create new partition for /home
    4. Mount it on /home
    5. Run backup restore process for /home

    Glad you did plenty of good praying, though. I'm sure it will help you in the afterlife, despite it's lack of relevance with respect to your superior foresight.

    --
    They don't grade fathers, but if your daughter's a stripper, you fucked up. --Chris Rock