Sluggish system response over time ? memory release.

Sluggish system response over time ? memory release.

Post by Henry Hollenber » Tue, 15 Jul 1997 04:00:00



This is a top with only CDE and a few other programs running for 5 days.  It has
gradually worked from 30 Megs or so to 119 Megs as this output shows:

  8:19pm  up 5 days, 20:17,  1 user,  load average: 2.79, 2.93, 4.15
52 processes: 47 sleeping, 5 running, 0 zombie, 0 stopped
CPU states:  5.9% user, 94.0% system, 99.6% nice,  0.3% idle
Mem:  127924K av, 119732K used,  8192K free, 32452K shrd, 69300K buff
Swap: 130748K av,     0K used, 130748K free               25280K cached

  PID USER     PRI  NI  SIZE  RSS SHARE STAT  LIB %CPU %MEM   TIME COMMAND
  698 speed     10   0  1148 1148   980 R       0 33.1  0.8 3369:35 dtexec
 2118 speed     10   0  1148 1148   980 R       0 32.9  0.8 104:30 dtexec
 2081 speed     10   0  1148 1148   980 R       0 32.7  0.8 109:18 dtexec
  859 speed      1   0   496  496   360 R       0  0.9  0.3  70:12 top
  699 speed      0   0  3480 3480  2592 R       0  0.1  2.7  11:38 dtterm
    1 root       0   0   304  304   236 S       0  0.0  0.2   0:14 init
    2 root       0   0     0    0     0 SW      0  0.0  0.0   0:00 kflushd
    3 root     -12 -12     0    0     0 SW<     0  0.0  0.0   0:00 kswapd
    4 root       0   0     0    0     0 SW      0  0.0  0.0   0:00 nfsiod
    5 root       0   0     0    0     0 SW      0  0.0  0.0   0:00 nfsiod
    6 root       0   0     0    0     0 SW      0  0.0  0.0   0:00 nfsiod
    7 root       0   0     0    0     0 SW      0  0.0  0.0   0:00 nfsiod
  221 root       0   0   312  312   240 S       0  0.0  0.2   0:00 getty
  695 root       0   0   312  312   240 S       0  0.0  0.2   0:00 getty
  179 root       0   0    96   96    68 S       0  0.0  0.0   0:00 rpc.rstatd
   32 root       0   0   224  224   176 S       0  0.0  0.1   1:17 update
   89 root       0   0   340  340   264 S       0  0.0  0.2   0:00 inetd
   91 bin        0   0   344  344   268 S       0  0.0  0.2   0:00 rpc.portmap
  104 root       0   0   332  332   248 S       0  0.0  0.2   0:00 syslogd
  106 root       0   0   320  320   244 S       0  0.0  0.2   0:00 klogd
  158 root       0   0   420  420   332 S       0  0.0  0.3   0:00 rpc.mountd
  133 root     -12 -12   500  500   348 S <     0  0.0  0.3   0:00 xntpd
  141 daemon     0   0   520  520   412 S       0  0.0  0.4   0:00 lpd
  160 root       0   0   424  424   332 S       0  0.0  0.3   0:00 rpc.nfsd
  164 daemon     0   0   384  384   316 S       0  0.0  0.3   0:00 atd
  150 root       0   0   500  500   392 S       0  0.0  0.3   0:00 amd
  151 root       0   0   384  384   300 S       0  0.0  0.3   0:00 crond
  169 root       0   0   692  692   508 S       0  0.0  0.5   0:00 sendmail
  176 root       0   0   288  288   216 S       0  0.0  0.2   0:00 brumenud
  190 nobody     0   0   588  588   512 S       0  0.0  0.4   0:00 httpd.apache
  187 root       0   0   608  608   520 S       0  0.0  0.4   0:00 httpd.apache
  223 root       0   0   312  312   240 S       0  0.0  0.2   0:00 getty
  203 root       0   0   424  424   332 S       0  0.0  0.3   0:01 sshd
  209 root       0   0   884  884   772 S       0  0.0  0.6   0:00 dtlogin
  224 root       0   0   312  312   240 S       0  0.0  0.2   0:00 getty
  225 root       0   0   312  312   240 S       0  0.0  0.2   0:00 getty
  226 root       0   0   312  312   240 S       0  0.0  0.2   0:00 getty
  254 root       0   0 11408 11408   688 S       0  0.0  8.9 406:31 Xaccel
  637 root       0   0  1172 1172   896 S       0  0.0  0.9   0:00 dtlogin
  666 speed      0   0   612  612   496 S       0  0.0  0.4   0:00 Xsession
  686 speed      0   0  4296 4296  2720 S       0  0.0  3.3   0:13 dtsession
  682 speed      0   0   544  544   428 S       0  0.0  0.4   0:00 bash
  291 root       0   0  1560 1560   948 S       0  0.0  1.2   0:00 rpc.ttdbserver
  685 speed      0   0  2048 2048  1224 S       0  0.0  1.6   0:03 ttsession
  692 speed      0   0  4636 4636  3416 S       0  0.0  3.6   0:32 dtwm
  700 speed      0   0   680  680   516 S       0  0.0  0.5   0:00 bash
 2082 speed      0   0  3428 3428  2596 S       0  0.0  2.6   0:01 dtterm
 2083 speed      0   0   680  680   516 S       0  0.0  0.5   0:00 bash
 2084 speed      0   0   528  528   392 S       0  0.0  0.4   0:00 telnet
 2119 speed      0   0   532  532   424 S       0  0.0  0.4   0:00 sh
 2120 speed      0   0  4956 4956  3232 S       0  0.0  3.8   0:04 netscape
 2119 speed      0   0   532  532   424 S       0  0.0  0.4   0:00 sh

and why the big load?,  I'm running to xterms and netscape right now.  That is
usually a load of .1 or so right after a boot.

The machine is P6-200, 512 L2 with 128 Meg Ram on a Dual (Daughtercard) ASUS
motherboard.  kernel 2.0.25 from Caldera.

Thanks

--
Henry Hollenberg

 
 
 

Sluggish system response over time ? memory release.

Post by Timothy Watso » Tue, 15 Jul 1997 04:00:00


Is it sluggish? The buffers and cached data is used to speed up system
response.

So, try mem used - buffers - cached to figure out memory usage. Is it
actually sluggish?

--
________________________________________________________________________
T    i    m    o    t    h    y              W    a    t    s    o    n

  __/| Something there is that doesn't love a wall, that wants it down

 
 
 

Sluggish system response over time ? memory release.

Post by Shang Xi » Tue, 15 Jul 1997 04:00:00


This brought up the issue I posted a few months ago which has not been
answered yet. I don't about much about how these "buffers" or "cached" work
but I do feel that these slow down the machine. I remember when I running
kernel 1.2.13 with only 16M ram and 16 swap, the machine did not swap so
heavily. Now I have 32M ram and 68M swap, but look at what I got here:

        total   used    free    shared  buffers cached
Mem:    30996   30484   512     12268   724     8100
-/+ buffer      21660   9336
Swap:   68540   42668   25872

At this moment, I have only one netscape session, xrn (as I read this news
group), and 6 xterm open, and of course a PPP session. I believe that 32 ram
should handle those pretty well. However, instead, the programs keep using
swap and leaving the cached ram alone. I feel that after each program running,
some of ram were lost (or cached) and never been reused. Of course, after
a new reboot, I would be able to run the above-mentioned programs without
swaping. However, after I quited those programs, and restart them again,
the thing would be different. My machine has been up for only 3 days this
time, and as you may see, the "free" reports that 42668 swap has been used.
Is it normal or I have some problem with my machine? I don't like to reboot
my machine from time to time, so any help would be greatly appreciated.
I am running kernel 2.0.28.


|> Is it sluggish? The buffers and cached data is used to speed up system
|> response.
|>
|> So, try mem used - buffers - cached to figure out memory usage. Is it
|> actually sluggish?
|>
|> --
|> ________________________________________________________________________
|> T    i    m    o    t    h    y              W    a    t    s    o    n

|>   __/| Something there is that doesn't love a wall, that wants it down

 
 
 

Sluggish system response over time ? memory release.

Post by Owen Taylo » Tue, 15 Jul 1997 04:00:00



> [ ... ] Now I have 32M ram and 68M swap, but look at what I got
> here:

>    total   used    free    shared  buffers cached
> Mem:       30996   30484   512     12268   724     8100
> -/+ buffer 21660   9336
> Swap:      68540   42668   25872

> At this moment, I have only one netscape session, xrn (as I read
> this news group), and 6 xterm open, and of course a PPP session. I
> believe that 32 ram should handle those pretty well. However,
> instead, the programs keep using swap and leaving the cached ram
> alone. I feel that after each program running, some of ram were lost
> (or cached) and never been reused. [ ... ]

This looks a bit fishy to me... 70 megs in use for those programs is
a lot ... with 32M ram, 7 xterm (just opened a few more), netscape,
2 emacs, (+ other system stuff), my free looks something like

             total       used       free     shared    buffers     cached
Mem:         31192      30712        480      29572        396       8968
-/+ buffers:            21348       9844
Swap:        49388       3116      46272

So something seems to be eating your memory unecessarily. The best
candidate is probably X: if programs are allocating lots and lots of X
resources, since processes can't (usually) shrink in size, the server
will keep growing until you restart it. But that memory should be
swapped out and not cause performance problems... Try a 'ps -aux' --
that should tell you what is taking all the memory. If it is the X
server, you could periodically look at the 'ps -aux' output and
see when it goes up drastically, which should identify the culprit.

Hope this helps,
                                        Owen

 
 
 

Sluggish system response over time ? memory release.

Post by Bernd Mey » Wed, 16 Jul 1997 04:00:00



>Is it sluggish? The buffers and cached data is used to speed up system
>response.
>So, try mem used - buffers - cached to figure out memory usage. Is it
>actually sluggish?

The reason for it being sluggish would have been the three CPU burning
jobs at the top of his "top" output. It seems some user processes had gone
wild and were eating as much CPU as they could get --- which, not surprisingly,
results in a bit of sluggishness.

Bernie
--
============================================================================
"It's a magical world, Hobbes ol' buddy...
                                           ...let's go exploring"
Calvin's final words, on December 31st, 1995

 
 
 

Sluggish system response over time ? memory release.

Post by Stephen C. Tweed » Wed, 16 Jul 1997 04:00:00


Hi all,


> This brought up the issue I posted a few months ago which has not been
> answered yet.

It has been answered, multiple times...

Quote:> I don't about much about how these "buffers" or "cached" work
> but I do feel that these slow down the machine. I remember when I running
> kernel 1.2.13 with only 16M ram and 16 swap, the machine did not swap so
> heavily. Now I have 32M ram and 68M swap, but look at what I got here:

>    total   used    free    shared  buffers cached
> Mem:       30996   30484   512     12268   724     8100
> -/+ buffer 21660   9336
> Swap:      68540   42668   25872

> At this moment, I have only one netscape session, xrn (as I read this news
> group), and 6 xterm open, and of course a PPP session. I believe that 32 ram
> should handle those pretty well. However, instead, the programs keep using
> swap and leaving the cached ram alone.

There are two things you're not counting:

*ALL* running programs count as "cached".  The 2.0 kernel cannot
execute a page of code from a program or a library without first
loading it into the new page cache (1.2 did not have such a cache).
The code pages loaded into cache are then directly mapped into the
running process' virtual address spaces: there is no wastage of
physical memory.  This cached memory is *not* unused.  I don't think
that 8MB of mapped program and library pages is excessive.  It might
even be too low, depending on your useage.

Secondly, the swap system has a special property: when you swap a page
of data out of memory and then swap it back in, it remains on disk
until the page in memory becomes dirty.  That way, if we want to swap
it back out after a while, we don't have to write it out to disk
again.  If you've got a lot of programs (such as X) which allocate
memory and then store static data in it, then for performance reasons
that data may well end up both in memory and on swap.  As a result,
the used swap space does not just include memory which is not
currently resident.

Cheers,
 Stephen.

 
 
 

Sluggish system response over time ? memory release.

Post by Timothy Watso » Wed, 16 Jul 1997 04:00:00



Quote:> *ALL* running programs count as "cached".  The 2.0 kernel cannot

Ok, sorry. Shared + cached = memory used by programs?

- better use ps -u or top

--
________________________________________________________________________
T    i    m    o    t    h    y              W    a    t    s    o    n

  __/| Something there is that doesn't love a wall, that wants it down

 
 
 

Sluggish system response over time ? memory release.

Post by Henry Hollenbe » Thu, 17 Jul 1997 04:00:00


Stephen C. Tweedie said:

Quote:>>  I don't think

that 8MB of mapped program and library pages is excessive.  It might
even be too low, depending on your useage.<<

What about 125Meg getting used on a system running CDE, dtmail, and
three dtterm's (tin, top, idle)?  Seems high to me.  But I don't
understand the break-down of Mem, used, free, shrd, buff, cached, etc.
completely so maybe I'm missing something.

I am pursuing the cpu hungry "dtexec" processes with Xig.  I.E.:

  7:25pm  up 7 days, 19:22,  2 users,  load average: 0.74, 0.57, 0.55
55 processes: 51 sleeping, 4 running, 0 zombie, 0 stopped
CPU states:  8.0% user, 91.9% system, 99.5% nice,  0.3% idle
Mem:  127924K av, 125852K used,  2072K free, 42108K shrd, 54160K buff
Swap: 130748K av,     0K used, 130748K free               40696K cached

  PID USER     PRI  NI  SIZE  RSS SHARE STAT  LIB %CPU %MEM   TIME COMMAND
  698 speed     11   0  1120 1120   952 R       0 98.6  0.8 6148:25 dtexec
  859 speed      1   0   500  500   360 R       0  0.9  0.3  97:38 top
  254 root       0   0 11236 11236   592 R       0  0.1  8.7 409:41 Xaccel
  699 speed      0   0  3452 3452  2564 R       0  0.1  2.6  15:30 dtterm
    1 root       0   0   304  304   236 S       0  0.0  0.2   0:19 init

    Thanks
    Henry Hollenberg

--

 
 
 

Sluggish system response over time ? memory release.

Post by David Konerdi » Thu, 17 Jul 1997 04:00:00



>Stephen C. Tweedie said:
>What about 125Meg getting used on a system running CDE, dtmail, and
>three dtterm's (tin, top, idle)?  Seems high to me.  But I don't
>understand the break-down of Mem, used, free, shrd, buff, cached, etc.
>completely so maybe I'm missing something.

>I am pursuing the cpu hungry "dtexec" processes with Xig.  I.E.:

>  7:25pm  up 7 days, 19:22,  2 users,  load average: 0.74, 0.57, 0.55
>55 processes: 51 sleeping, 4 running, 0 zombie, 0 stopped
>CPU states:  8.0% user, 91.9% system, 99.5% nice,  0.3% idle
>Mem:  127924K av, 125852K used,  2072K free, 42108K shrd, 54160K buff
>Swap: 130748K av,     0K used, 130748K free               40696K cached

Henry,
                                                           ^^^^^^^

nearly 100MB of the memory being used on your sytstem is in buffers
or cache.  Try starting netscape once, then quit, and restart-
you'll notice it restarts rapidly.  That's 'cause intelligent OSs
cache their recently loaded code in RAM.  Cached code appears as
buffers/cache, but is available upon demand to be used by other
processes which may need memory.  

(folks, correct me if I'm wrong...)

Quote:

>  PID USER     PRI  NI  SIZE  RSS SHARE STAT  LIB %CPU %MEM   TIME COMMAND
>  698 speed     11   0  1120 1120   952 R       0 98.6  0.8 6148:25 dtexec
>  859 speed      1   0   500  500   360 R       0  0.9  0.3  97:38 top
>  254 root       0   0 11236 11236   592 R       0  0.1  8.7 409:41 Xaccel
>  699 speed      0   0  3452 3452  2564 R       0  0.1  2.6  15:30 dtterm
>    1 root       0   0   304  304   236 S       0  0.0  0.2   0:19 init

--
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Snail: Graduate Group in Biophysics
Medical Sciences 926, Box 0446
University of California
San Francisco, CA 94143
 
 
 

Sluggish system response over time ? memory release.

Post by Stephen C. Tweed » Fri, 18 Jul 1997 04:00:00


Hi,



> > *ALL* running programs count as "cached".  The 2.0 kernel cannot

> Ok, sorry. Shared + cached = memory used by programs?

If only it was so simple. :)

"cached" is just the size of the page cache.  *All* file data which is
cached by ext2fs is cached in the page cache.  The only things that
the buffer cache is used for are for filesystem metadata, for
write-behind data, and for read caching for certain filesystems which
don't understand the page cache.

The way programs are loaded is via memory-mapped files.  The program
loader just maps a region of the binary file or library into a region
of virtual memory, where it gets paged in on demand.  When the memory
is referenced, the filesystem first of all reads the data into the
page cache, and then the page is mapped into the process's page
tables.  So, the page cache does include all program text pages, but
it also includes all other filesystem cached data.

And the "shared" count isn't completely straight-forward either.
Every page in the page cache being used to map a program will count as
shared, because it is shared both by the cache and by the process.
However, pages shared more than once (eg. library pages mapped by
multiple processes) will count more than once in the "shared" count.
In other words, "shared" counts the amount of sharing going on, not
just the number of shared pages.

To summarise: memory management in a modern unified VM system is too
complicated to be adequately summarised by a quick one-line output
from "free". :)

Cheers,
 Stephen.

 
 
 

Sluggish system response over time ? memory release.

Post by Timothy Watso » Tue, 22 Jul 1997 04:00:00




> > Ok, sorry. Shared + cached = memory used by programs?

> If only it was so simple. :)

Sorry for the stupidity. Pages cached/in memory don't mean that pages
in memory aren't mirrored to disk (swap gets updated if pages get
dirty), or even that the pages are of use anymore (they "age" and are
swaaped out if not used, that doesn't meant that they are going to be
used later.

--
________________________________________________________________________
T    i    m    o    t    h    y              W    a    t    s    o    n

  __/| Something there is that doesn't love a wall, that wants it down