On Sat, 5 Sep 2009, Yves Dorfsman wrote:

> Edward Ned Harvey wrote:
>  >
>> I know this seems counterintuitive - but - I have experience to the
>> contrary.  In traditional thinking, of course, swap is slower so you don't
>> want to use it, but in modern thinking, having swap available boosts your
>> system performance because the system can trade swap for cache.
>>
>> Here's the reasoning:
>>
>> At all times, the kernel will grow to the maximum available ram
>> (buffering/caching disk reads/writes).  So obviously the more memory
>> available, the better, and the less required in user space the better...
>> but ... This means at all times the kernel is choosing which disk blocks to
>> keep in cache, as user processes grow, whatever is deemed to be the least
>> valuable cached disk block is dropped out of ram.
>>
>> If you have plenty of swap available, it gives the kernel another degree of
>> freedom to work with.  The kernel now has the option available to page out
>> some idle process that it deems to be less valuable than the cached disk
>> blocks.
>
> Right, and that's why I mentioned the swappiness mess on Linux (and I think
> "maxperm" on AIX, it's been a long time).
>
> As far as I am concerned, what you are talking about is fine on a server
> that is primarily used as a file server, assuming those still exist, but if
> I run any kind of application, then:
>
> I am more than happy for the kernel to use any memory NOT used by an apps to
> cache the file system I do not want, under any circumstances, the kernel to
> free the application from memory at the profit of cache.
>
>
> I ended learning about these memory tweak when I witnessed these behaviours:
>
> -applications servers being slow every week, or every few weeks, for what
> seems a few hours in the morning. After investigation, it seemed to
> correlate with full backup, the morning after the full backup, the apps
> would be slow. Killing the backup client in the morning, would not help.
> Think about it, the backup reads the disk, a lot, while the applications are
> not used, so the kernel frees up both apps and data from memory so it can
> cache the file system really well (cache using LRU make this problem worse).

note that there is a flag that the backup software should be using to tell 
the system that it's not going to be accessing this data again.

> -Linux workstations with default value for swappiness: you minimize your
> email client, do a bunch of work, try to bring the email client up, and, it
> takes 4 or 5 seconds to come up, while you can hear the disk chugging.
> Worse, you take a phone call for ten minutes, your screen saver/lock kicks
> in, once you are done the machine seems frozen for a few minutes (all the
> apps were idle, even without any i/o activity, the memory for the apps got
> freed up).

what else is running on the system that is asking for memory? the kernel 
won't throw away memory unless something else is asking for it.

> The only case I can think of swappiness > 0 making any sense is if you start
> start a lot of applications, but only use a few, and do not change from apps
> to apps very often.

I don't think 0 is the right value, but for a long time the kernel did 
default to a much to high value, within the last year or so the efault was 
greatly reduced.

David Lang
_______________________________________________
Tech mailing list
[email protected]
http://lopsa.org/cgi-bin/mailman/listinfo/tech
This list provided by the League of Professional System Administrators
 http://lopsa.org/

Reply via email to