Re: swap space size

From: Alexis Huxley (ahuxley_at_gmx.net)
Date: 10/22/04

  • Next message: Paul Johnson: "Re: [OT] Debian advocacy for Smart but Scared People With Lives"
    To: debian-user@lists.debian.org
    Date: Fri, 22 Oct 2004 07:21:20 +0000 (UTC)
    
    

    On 2004-10-21, Gilbert, Joseph <jgilbert@insuresuite.com> wrote:

    > taken for rote. I was told back when I first started working with Unix that
    > the swap space needed to be at least twice the size of physical memory in
    > order to ensure a stable system.

    I believe this was just a rule of thumb when memory was so expensive.

    Think about it, if you want to dramatically improve the performance
    of a system then you add so much memory to it that the system stops
    swapping. And if it stops swapping, then what purpose does having
    "two times 'so much'" swap space have? Well, none, 'cos you've
    deliberately ensured that it won't be used.

    But some programs are so inactive that they'll get pushed in to swap
    (by some user's 'qsort() routine or other short-lived memory eater)
    and may never come back because they're waiting for something that may
    never happen (e.g. 'at' daemon waiting for next 'at' job when nobody
    actually uses 'at'), so adding memory to stop processes like these
    being swapped (out, once) in the first place is a waste of money;
    it brings no performance increase.

    Of course there should always be swap space, because you *cannot*
    guarantee that someone won't run perl in slurp mode, or qsort on
    a massive data set, etc, and, generally, "I don't want to ever
    encounter the error message 'out of memory'" is a hard requirement,
    but the comparatively (very) slow access speeds of swap space should
    give you some idea of how often you should actually be regularly
    (by which I mean swapping in and out, not just out) using it, and
    when disk space is so cheap then, hell, you can make the swap ten
    times the memory and probably not notice less disk space. It's a
    small price to pay to meet that hard requirement.

    Harder is working out the memory requirements.

    I would say one needs some experience of how many users you get,
    what they sort of thing they run, how often, for how long, in order
    to get a 'feel' for how much memory and swap are required.

    Maybe formulating some statements about your requirements is
    helpful. E.g. the aforementioned "I never want to run out of memory",
    (which really means swap) but also something more real-worldly soft
    requirements like "If 95% of user processes, do not get swapped 95%
    of the time then that is acceptable."

    Maybe run 'sar' and archive the logs monthly (otherwise they'll be
    overwritten) and then you can try to work out the memory and swap
    required to meet your requirements.

    And talk to your users, then you'll know if the requirements you've
    set are actually acceptable.

    Alexis

    -- 
    To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org 
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
    

  • Next message: Paul Johnson: "Re: [OT] Debian advocacy for Smart but Scared People With Lives"

    Relevant Pages

    • Re: WARNING: Sorry, no swap space to grow stack for pid 4456
      ... > What I meant was on another machine, swap -l shows ... Virtual memory is made up of three "resources" that are put together ... if RAM isn't available, the data is written to the file instead of swap. ... state of affairs might be to have a little swap space used every now ...
      (comp.unix.solaris)
    • Re: Swapping even when turned off?
      ... P.S. I've got 4GB of RAM, with 2GB swap files on each of two physical hard ... > Swapping memory is used for one thing and one thing only: ... > Swapping them out would free memory, but that memory would not be used, ... >> What on earth would prompt someone to turn off the swap file. ...
      (microsoft.public.windowsxp.general)
    • [HPADM] RE: -SUMMARY- Clarification on swapinfo/glance output
      ... Memory allocation under HP-UX can be a little odd, ... the system needs to swap out a portion of that program, ... configured swap space, you will no longer be able to run more programs (they ... The pseudo swap is enabled by default by ...
      (HP-UX-Admin)
    • Re: Slow FC4, perhaps swap is to blame
      ... kind of memory leak that builds up in the swap space over time. ... I did manage to find a command which I somehow got to work at least ...
      (Fedora)
    • Summary swap rules.
      ... So it looks as if swap is mostly not used anymore and can be kept pretty ... Tim Bradshaw stated what I privately felt- that 1:1 swap to memory is ... so it's really only around for memory leaks and core dumps. ... think) which are written to swap space. ...
      (SunManagers)