[mythtv-users] Draft revisions to HowTo section 3.3, second try

Bruce Markey bjm at lvcm.com
Thu Apr 24 02:16:57 UTC 2003


Ben Bucksch wrote:
> Bruce Markey wrote:
> 
>> Ray Olszewski wrote:
>>
>>> For that reason, a swap partition is effectively useless.
>>
>>
>> [The last sentence is unnecessary and misleading. This
>> shouldn't imply that you should not have a swap partition.
>> If anything, maybe:]
>>
>>   You will want to have enough RAM so that memory paging
>>   will not impact your system performance.
> 
> 
> Personally, I really prefer not to have any swap partition.

Great, but let's first establish that this is off-topic. No
application documentation should tell anyone that a Linux
system should not have a swap partition. Ray's comment doesn't
say that but it seems misleading.

> Swap is a 
> total perf killer (given today's RAM prices) and only hides problems.

Swap is a performance win that alleviates a lot of problems that
would otherwise be fatal. It's the lack of swap in your example
that 'hides' the problem and solution.

> I'd rather have a mythfilldatabase process die because of too little RAM 
> (this did happen here with 128 MB) than to have it cause swapping, which 
> might bring down a recording in process.

So, you deliberately allow malloc() to fail as a preventative
measure against possible page-outs? Not a good idea. When
you do run out of virtual memory, what's to say that it isn't
mythbackend that next fails to malloc and is the process that
dies (or cron or syslogd or inetd)? Running out of virtual
memory is a nasty thing whether or not swap space is involved.
Relying on malloc failures (BTW lots of programs don't check
the return status of malloc()) isn't what you want.

When you have swap space, as active processes need more memory,
pages from inactive processes can be moved out and left out
until they become active again. This is normally a one time
thing. The behavior you are worried about is when the active
processes need more memory than the amount of physical memory.
In that case, active pages need to be constantly moved in and
out. The solution to this thrashing is to buy more memory
regardless of how much swap space you have.

The problem with not having a swap partition is that there is
no place to put memory allocated to inactive processes.
Therefore you shrink the amount of memory available for the
active processes which exasperates your memory shortage.

Not having a swap partition may seem like a sure fire way to
prevent thrashing but it doesn't fix anything, it only makes
your memory usage less efficient and increases the chances of
crashes and mis-behavior.

--  bjm




More information about the mythtv-users mailing list