DragonFly kernel List (threaded) for 2005-04
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
Re: Swapping
:`Regarding how the DragonFly VM handles swapping and caching.
:For example I have a 256m ram + 256 swap system which performs nicely
:for daily tasks. If I was to add 256m ram wouldn't it be better to
:turn off the swap partition.
Do a 'pstat -s' and see how much swap you are currently using (do this
after the machine has had at leat 2 days of uptime so you can see what
real impact there is, if any).
:Can swap provide performance improvements by allowing unused memory
:to be replaced with often used memory?
Yes. If the machine's working set (running programs plus the entire
contents of the files they read or write) exceeds available memory
then having swap will allow the system to free up memory associated
with entirely idle processes, like getty's, allowing that memory
to be reused by the programs that are running.
:If executables and libraries usually stay in the filesystem cache.
:When swapping is disabled and there is memory pressure are they
:evicted from memory? Will it feel the same or worse as swapping if the
:VM evicts from the cache instead because the programs can be read from
:the disk anyway?
Executables and libaries are mostly backed by the binary and library
files that they were loaded from. They get evicted based on memory
pressure in a mechanism that is independant of the swap mechanism.
:Does swap affect the VM's decisions?
:If yes does the VM work faster or slower when swap is turned off?
Swap does affect the VM's decisions. VM does not go any faster or
slower with swap turned off, however.
:Except for additional space/memory and coredumps are there other
:benefits from having a swap partition?
It's a good idea to have swap space even if you don't think you
will ever need it. There are several reasons for this.
* You might occassionally need to run a program which eats a lot
of memory like, say, 'gimp', or processes a lot of files (say, like
a large CVS repository), which goes beyond your normal use of the
machine. Having some swap allows the machine to page out anonymous
(non-file-backed) memory associated with idle processes and reuse
that for the new workload.
* You can characterize your machine's current needs but you never know
what you might want to do with it in the future.
* It's a good safety net in case a program runs away or the machine gets
attacked or something unexpected happens.
* It holds kernel cores.
* In the future the journaling code will be able to use swap space as
an emergency spool.
And other reasons. crater.dragonflybsd.org has 1G of memory and 2G
of configured swap and it basically doesn't use any of the swap under
normal operation. The developer machine, leaf, is in the same
situation. My workstation has 512MB of ram and 1GB of swap and only
very occassionally digs into the swap space (like once a month or so).
:Can swapping be tuned or regulated?
:..
:TIA
:--
: Eduardo Tongson
: <pornadmin.net/~tongson>
Not much. People with multiple hard disks will often put a swap
partition on each hard disk. The VM system will then interleave any
swap related I/O between the two disks which makes it more efficient.
There are a couple of sysctl's that can be used to tune how aggressive
the system is in using swap:
vm.swap_async_max
vm.swap_idle_threshold1
vm.swap_idle_threshold2
vm.swap_idle_enabled
vm.defer_swapspace_pageouts
vm.disable_swapspace_pageouts
Mostly you do not want to mess with these, however. 'man tuning' will
give you some information on e.g. swap idle thresholds. But for the
most part these sysctls are meant to be used to manage swap on heavily
loaded multi-user boxes.
-Matt
Matthew Dillon
<dillon@xxxxxxxxxxxxx>
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]