Re: [kde-linux] VM and Swap problems



On Sunday 28 January 2007 18:33:39 Randy Kramer wrote:

The VM and swap work fine till the swap space is half full. But, after
swap is half full the system starts removing swap until it is exactly
half full. When this happens, the VM system starts to thrash and the
system won't do anything till the thrashing stops.

512Mb swap? That's a fair amount of swapspace, more than you should need for
desktop use. Maybe one of your applications leak memory (I have a webpage
that makes konqueror leak insane amount of memory). Try checking with top
what applications use lots of memory.


* Another possible workaround might be to drastically increase the
amount of swap, so it is very difficult to reach the 50% usage figure. (I
originally couldn't decide whether my thrashing / slow response problems
were at the 50% of swap figure, or swap usage ~= available RAM (because in
most previous installations I installed (per the rule of thumb) swap equal
to two times RAM. In my most recent install, my swap is 3x RAM, and the
slowed response still occurs at 50% swap usage. (I'm not 100% sure the
problem is thrashing, but it is as good a guess as any--the disk does see a
lot of activity at this point.)

I can't see the scenario where adding lots of swap would really help. Having a
bit of swapspace is nice because you can swap unused memory there, but once
you have that bit swapped out, you won't gain much by adding more.


Some other things I do:
* run as little as possible especially servers--for example, I do not
run an MTA

Good advice, if mostly because running unneeded services is sort of pointless.


Some other possible contributing causes (IMHO):
* I often wonder if this problem is partially a result of the
(seemingly) Linux philosophy that memory not in use is wasted memory? (For
other reasons, I'd like to have a pool of memory that is not in use at any
particular time, for example, so that when I go to start a new app, memory
is immediately available for it.)

Unused memory will be used as disk buffers. This memory is, in practical
terms, immediately available for applications.

* Similarly, I wonder if this problem is partially a result of the Linux
design of having one kernel (and memory handling philosophy, etc.) for both
workstations and servers? I'd really prefer to have memory handling
customized for my use as a workstation rather than any bias that might
exist towards handling it (memory) for a server.

I am not sure how to do this customizing. There are a number of out-of-mem
handlers, but that is sort of different. Likewise, process scheduling and IO
scheduling comes in several flavors, some of them useful for servers, some
for desktop use.


Another thing I don't like about Linux and its use of memory is (maybe it
is mentioned above--maybe it is the unused memory is wasted memory
philosophy) is the way it keeps expanding.

Several times over the years I've drastically increased the amount of RAM
memory in my systems (I mean like doubling, first, iirc, from 8 to 16 MB
;-)

Each time I did that I initially did not change the distro (revision) I was
using (so I could compare memory / swap behavior before and after the
addition of RAM)--every time, with the same mix of applications, the RAM
memory in use and the swap usage increased to fill the available memory to
about the same percentage as before. In some cases I did notice improved
performance, in other cases it was so minor as to be undetectable (to me).

All memory gets filled in time, but most of the new memory should go to IO
buffers, which isn't really taken, and is never swapped to disk. The
command "free" reports buffers separately, e.g on my system right now:

esben@spurv:~$ free -m
total used free shared buffers cached
Mem: 1002 994 8 0 301 223
-/+ buffers/cache: 469 532
Swap: 3992 0 3992

Notice how it says 8 free, but then adds that with buffers, 532 is available
for the system. The swap just tells you I have insane amounts of swap
available, and use none.

Oh, wait, it had something to do with letting me have tools to control (or
influence) the use of memory in *my* system. Oh, and oh yes, I'm aware of
and have experimented with swappiness. That didn't seem very helpful to
me--somewhere I have some notes, but it seemed that I either maintained
about the same performance as before (i.e., the slowdown at 50% of swap in
use), or started having crashes. (Around this time I was using systems
with 512 to 768 MB--the most my motherboards could handle.)

swappines is fun to play with, but I'd recommend just leaving it. It should
automatically adjust in most distros.

Anyway, at least now there are two of us who have seen problems along this
line. (Maybe if we both write to Linus he will do something to make things
better ;-)

I think the real problem is that your memory (768Mb should be enough for most
purposes) is filling up to the point where several hundred megabytes are in
use. That's where I would look... I haven't seen this unless I really was
doing something huge.

--
kind regards, Esben

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___________________________________________________
This message is from the kde-linux mailing list.
Account management: https://mail.kde.org/mailman/listinfo/kde-linux.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.



Relevant Pages

  • Re: OT (slightly) swap limits
    ... influence your decision on how much swap was enough. ... processes due to lack of memory. ... I've run machines with 1Gig or more RAM with NO SWAP. ... Linux possible when before on Unix it wasn't? ...
    (Debian-User)
  • Re: How to set up a Linux machine that occupies the minimum memory footprint ?
    ... >> memory and hence causes the kernel to 'thrash' thus slowing down the ... 4GB physical RAM + 4GB swap area) the application will think that it can ... You've said in another message that your app is ...
    (comp.os.linux.setup)
  • Re: How to set up a Linux machine that occupies the minimum memory footprint ?
    ... >> memory and hence causes the kernel to 'thrash' thus slowing down the ... 4GB physical RAM + 4GB swap area) the application will think that it can ... You've said in another message that your app is ...
    (comp.os.linux.misc)
  • Re: fedora-list Digest, Vol 10, Issue 167
    ... Well, I have two 433 MHz Celerons and 288 MB RAM, and no performance ... > The memory usage is always around 400MB. ... I'd like to introduce you to the vmstat command. ... > I know that SWAP should be double the Physical RAM but I don't have ...
    (Fedora)
  • Re: FreeBSD data size tuning
    ... It seems there is a memory issue in 4.9 where they adapted 5.x things ... RAM and using 2500MB of swap on ide disk, ... With 1GB of RAM you should be able to run squid without any ...
    (freebsd-performance)