> From: tech-boun...@lists.lopsa.org [mailto:tech-boun...@lists.lopsa.org]
> On Behalf Of Andrew Hume
> 
> err, that is the whole point.
> SwapTotal - SwapFree reflects the high water mark problem.
> for example, if we are swapping, and process P1 has 20GB of swap,
> then SwapTotal - SwapFree = 20GB. if i start a new process P2 which uses

OMG, holy crap.  I don't care how big your processes are, or how much memory 
you have in your system, you should never be swapping active memory.  You can 
always solve this problem by either adding more memory, or using a memory 
mapped file in your process.  

If it is a given, that you have a process that will consume more active storage 
than what's physically in your system, then the memory mapped file is much more 
desirable over swapping, because if you allow the system to swap the active 
memory, you will force all the useful cache out of cache, and you will force 
all the other active processes in the system to swap out, grinding the system 
to a near-halt.  So badly, that often, it appears the system has halted, and 
processes and network connections begin to timeout and fail.  The reliability 
and performance of a system swapping active is far worse than the reliability 
and performance of a system with a couple of processes using memory mapped 
files.

That's an inappropriate use for swap.

Here is what swap is meant for:

At every opportunity, the kernel will grow the system buffer & cache to consume 
all physical memory in the system.  It is normal to see near-zero "free" memory 
in the system, provided that you have a large cache & buffer.  

If you give some swap to the kernel, then it has an extra degree of freedom.  
The kernel now has freedom to choose, which it would rather lose:  Some fairly 
cold cache, or some idle memory?  It is normal for some processes to sit almost 
completely idle for the life of the computer.  Or some process dies in a zombie 
state, or whatever.  Swap is useful, so the kernel can push these things out of 
memory and use that memory for caching instead.  Swapping is meant to increase 
performance.

_______________________________________________
Tech mailing list
Tech@lists.lopsa.org
https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech
This list provided by the League of Professional System Administrators
 http://lopsa.org/

Reply via email to