Swap utilization (mirroring??) (ration of memory to swap?)

Swap utilization (mirroring??) (ration of memory to swap?)

Post by Daniel Kiracof » Tue, 20 Oct 1998 04:00:00



Quote:> When my Xwindows starts up, it automatically opens 4 or 5 xterms, emacs,
> netscape, and the control panel. I have 64 megs of memory and I rarely need
> to swap.  I have a 128 meg swap partition but the only time I've ever used
> it all is in using the program 'convert' to resize a 5500x5500 pixel jpeg
> image to a smaller size. Unless you are going to be using memory intensive
> programs like graphics, scientific simulations/calculations, or whatever, I
> wouldn't feel compelled at all to make a large swap partition if you have 64
> megs or more of memory. Unless you absolutely need the best performance you
> can get out of swapping, I wouldn't feel guilty recommending a 64 meg swap
> partition. If you have the space on your hard drive and don't care, make it
> bigger. Any flexibility you need beyond this can be achieved with swap
> files. In the case of 'convert', I simply made a swap file and reran the
> program. For the curious, it maxed out at 230 megs of memory. If you are
> running a workstation or network server, s*everything I said and

                           ~~~~~~~~~~~~~~

Quote:> make it big.

 I must disagree here.  Depending on your definition of server (I'm
think proxying server, http server, etc) if you have to have lots of
swap used, your performance is going to suck!  Latency will go through
the roof.  On all of my servers, I try to make sure swap space used is
minimal.  One machine has 64 Megs of ram with a swap file of 8 Megs.
That swap file is never above 50% utilization...

--
/* Daniel */
WWW: http://www.veryComputer.com/

"Fear is only afraid of the absence of itself" - Mediocrates

 
 
 

Swap utilization (mirroring??) (ration of memory to swap?)

Post by Glen Turne » Wed, 21 Oct 1998 04:00:00



>  I must disagree here.  Depending on your definition of server (I'm
> think proxying server, http server, etc) if you have to have lots of
> swap used, your performance is going to suck!  Latency will go through
> the roof.  On all of my servers, I try to make sure swap space used is
> minimal.  One machine has 64 Megs of ram with a swap file of 8 Megs.
> That swap file is never above 50% utilization...

Misses the point a bit.  A server should be designed to
never use any allocated swap space.

But if the server is faced with the choice of swapping
or killing a process, then it *should* swap.

So, put in enough physical memory so that a process
will never use swap.  Then allocate enough swap space
so that the server doesn't die on that day when you
get that temporary order-of-magnitude increase in load
or that DoS attack.

 
 
 

Swap utilization (mirroring??) (ration of memory to swap?)

Post by Seth Van Oor » Wed, 21 Oct 1998 04:00:00


I definitely see the point your making though. If you really needed the best
performance, you would just get more memory. However, considering it from
the swap angle I think the answer is still fine.

Seth


>> When my Xwindows starts up, it automatically opens 4 or 5 xterms, emacs,
>> netscape, and the control panel. I have 64 megs of memory and I rarely
need
>> to swap.  I have a 128 meg swap partition but the only time I've ever
used
>> it all is in using the program 'convert' to resize a 5500x5500 pixel jpeg
>> image to a smaller size. Unless you are going to be using memory
intensive
>> programs like graphics, scientific simulations/calculations, or whatever,
I
>> wouldn't feel compelled at all to make a large swap partition if you have
64
>> megs or more of memory. Unless you absolutely need the best performance
you
>> can get out of swapping, I wouldn't feel guilty recommending a 64 meg
swap
>> partition. If you have the space on your hard drive and don't care, make
it
>> bigger. Any flexibility you need beyond this can be achieved with swap
>> files. In the case of 'convert', I simply made a swap file and reran the
>> program. For the curious, it maxed out at 230 megs of memory. If you are
>> running a workstation or network server, s*everything I said and
>    ~~~~~~~~~~~~~~
>> make it big.

> I must disagree here.  Depending on your definition of server (I'm
>think proxying server, http server, etc) if you have to have lots of
>swap used, your performance is going to suck!  Latency will go through
>the roof.  On all of my servers, I try to make sure swap space used is
>minimal.  One machine has 64 Megs of ram with a swap file of 8 Megs.
>That swap file is never above 50% utilization...

>--
>/* Daniel */
>WWW: http://www.veryComputer.com/

>"Fear is only afraid of the absence of itself" - Mediocrates

 
 
 

Swap utilization (mirroring??) (ration of memory to swap?)

Post by Brian McCaule » Fri, 23 Oct 1998 04:00:00



>   How is swap space used by the Linux kernel?

This is something that's changed quite a bit over the years.

Quote:>  My knowledge of swap space is
> limited and I am looking for good references or a reply from someone who can
> fill me in.  I know that swap space is used when memory is low.  Memory is
> freed for active processes by swapping out (in blocks of pages) memory used
> by inactive processes to disk.     [I realize that an 'inactive' process might
> just be part of a very large active process that is not being addressed at
> the moment].  MY QUESTION IS does linux 'mirror' its memory to swap space??
> I know other Unix operating systems do this (or used to do this anyway).  The
> way it was explained to me is that when resources are available inactive
> pages of memory are copied to swap space but left in memory.

This is something like what goes one with the kswapd thread.  The
source of kswapd is in linux/mm/vmscan.  I don't pretend to understand
it but it's well commented it makes very interesting reading.

I doubt that any other refence material is better than the source.

The funny thing is that when you go looking for the swapping code in
the recent Linux kernels you can't find it.  Swapping is just a
special case of mmap() - well more-or-less.

--

  .  _\\__[oo   faeces from    | Phones: +44 121 471 3789 (home)

 .  l___\\    /~~) /~~[  /   [ | PGP-fp: D7 03 2A 4B D8 3A 05 37...
  # ll  l\\  ~~~~ ~   ~ ~    ~ | http://www.wcl.bham.ac.uk/~bam/
 ###LL  LL\\ (Brian McCauley)  |

 
 
 

1. memory utilization, swapping, (?)

I have a small C program that is as follows:

    #include <stdio.h>
    #include <unistd.h>
    #include <malloc.h>
    main()
    {
      int i;
      char *big=(char *)malloc(128*8*1024*1024);
      for(i=0;i<128*8*1024*1024;i++)
        big[i]=0;
      while(1)
        sleep(1000);
    }

If I run one copy on a Solaris system (2.6, 7 or 8) with 2GB of memory and 4GB
of swap, I can watch the process with top and see SIZE always is 1024M, and
the RES value increases from zero up to 1024M.  If I run a second copy, I watch
the process do very much the same thing, but then I notice the system slow down
dramatically, then in top, both test programs show SIZE of 1024M and RES of 0K.
Running a third instance of this program nearly immediately shows RES of 0K,
but this number occasionally changes to 30M or 50M, then back to zero, and I
don't see any marked change in the amount of real memory used or the amount of
swap being used.  I also don't see a whole lot of activity from 'sar -g', and
the system becomes terribly sluggish.

Can anybody explain what might be going on, and why the system becomes so
sluggish?  If there isn't a lot of swapping/paging activity going on, then what
is causing these results?

Any ideas would be helpful...  Thanks in advance!

Dave Thompson

2. xmms equalizer

3. Is swap space in SCO only swap space or is it consider virtual memory

4. PPPoE Quick Question

5. Swap Space Utilization.

6. X window bus address

7. Determining process swap space/mem utilization with 'ps' and 'pstat' listings

8. Looking for QIC-02 tape drive

9. Swap memory , RAM memory and available space disk on a Sun MicroSystem under Solaris 2.6 ?

10. 32 Meg Memory+64 Meg Swap = No free Memory

11. mm/memory.c, 2.4.1 : memory leak with swap cache (updated)

12. Low memory and no swap memory

13. MS-DOS Swap File vs. Swap Partition