swap problems

Joep L. Blom jlblom at neuroweave.nl
Wed Jun 8 21:45:31 UTC 2011


On 08/06/11 16:09, Jordon Bedwell wrote:
> On 6/8/2011 7:36 AM, Joep L. Blom wrote:
>> My system (AMD Phenom II 4-core with 4 Gb memory) uses gradually more

Jordan,
Thanks for your reply.
> This is typical of any computer.
>
> Yes this is logical.  This is how memory and swap work (at basic):
>
> Active: Go to memory unless real memory OOM. Then use SWAP.
>
> Sleeping:
> Stay in memory until another program needs it.
> Move to swap if needed to free up memory for an active program.
>
> Cache: Stay in memory until a program needs memory, then move to SWAP.
>

Sorry for stating the obvious which I actually know of course ,being 
computer-educated since 1966. However, I stated these things on purpose, 
preventing people telling the obvious. Sorry I didn't mention I was 
aware of this.

> Generally on any optimised operating system remnants will remain cached,
> this is typical of Windows, OS X, Linux, and even your computers
> processor. Doing this helps make applications more responsive.  Compare
> the first time you open up Firefox on cold boot to the second time you
> open up Firefox and you will see what I mean.  Normally these parts will
> stay in the memory until another program needs that memory and then move
> to SWAP and theoretically even using SWAP should be better than a cold
> application start.
I wrote (with my team) in the seventies and eighties many programs with 
time-critical subroutines for real-time recording of biological signals 
and as we had not the current luxury of an unlimited memory space, we 
took very much care no remnant code remained in memory after subroutines 
were removed and we never used swap space.

>
> You can use valgrind to profile, monitor and spot memory leaks in
> applications. Some applications (well actually quite a lot) you can top
> spot memory leaks, for example, Firefox, you can literally spot a memory
> leak like many computer "newbs" have.

I didn't know of valgrind. I'll try that thanks for the tip.
>
> If this is happening then this might mean you truly do have a real
> memory OOM situation that is pushing active applications to the SWAP and
> you really are using all of your real memory, which means you need to
> evaluate what programs are using up all your memory:
>
Well, with 700 Mb free I find that unlikely but I don't know the ins and 
outs of current programs. We used FORTRAN and PASCAL and both were 3rd 
generation languages which you could easily debug and follow the flow, 
even (PASCAL) when using OOP (Object Oriented Programming) (by the way: 
what do you mean by OOM?) the flow was not too difficult to follow.
> ps -eo pmem,pcpu,user,args | sort -k 1 -r
> free -m; sync; echo 3>  /proc/sys/vm/drop_caches; free -m
>
> Post those two lines back to us using Ubuntu paste or whatever tool.
>

>
> Please, do hesitate from making ignorant, misinformed and incorrect
> statements.  While I like to help, it's statements like this that make
> me wonder how much people actually know and whether or not it's just
> about spreading FUD through lies to get new users instead of showing how
> awesome Linux is.  That is not the Microsoft way, and please try to show
> a little respect to a company even if you do dislike them.  It's
> Microsoft not M$.
Jordan, I stand corrected. However, it's a leftover from my active 
programming time where we had to use Microsoft DOS (I never used Windows 
as we wrote our own graphic environment using commercial software) and 
spilled days on end due to the sloppy programming of the DOS routines 
and the sparse documentation (we actually rewrote many of them but as 
you know that costs time=money).
>
> If I may add too, on the clusters we design for clients using Debian,
> when they are heavy traffic HA-clusters, we would rather the server OOM
> and crash out and the server remove itself from the cluster until it's
> back up (by automatic restart) then to SWAP at all, even a little.  This
> is especially important on our MySQL clusters, there is already enough
> overhead without it flowing into overhead added on by heavy SWAP.  I
> guess that means our servers do it the Microsoft way right?
>
I wouldn't dare to comment on that!!
I will tomorrow follow your suggestions as it is now bed time 23:45).
Thanks again,
Joep





More information about the ubuntu-users mailing list