Swappiness setting benefits/questions

  • I'm curious about the benefits of vm.swappiness = 0 that "jensk" was referring to in post viewtopic.php?f=13&t=2417#p15334


    Zitat von "jensk"


    I am always running vm.swappiness = 0 on my linux servers except if they have very little ram. A swappiness set to 0 doesn't mean that it won't swap if it runs out of physical memory. With other settings to swappiness linux will swap processes even though all memory isn't used - just to be memory efficient.


    Swappiness=0 just tells the kernel to only swap when it is absolutely necessary - like no free memory for a process. IMHO this is the best setting for linux servers.


    In the current case like a clean OMV system I would think you could set vm.swappiness = 0 if you have more that 2g ram.


    Also it seems the vm.min_free_kbytes = ???? should be set to some value as well. Because it is added to my Raspberry Pi sysctl.conf file as vm.min_free_kbytes = 8192. Is there some ratio or guideline based on installed memory?


    Reading about what swappiness does and by reducing it from the default of 60 may also reduce the writes to an SSD which could help extend it's life.


    My questions then are. Would OMV users see an increase of performance or not? Would this apply to OMV users who have installed Plex, OwnCloud and other installed stand alone packages?

  • As I already told in the other thread, there are benefits of setting swappiness to zero but there are also disadvantages.
    Also you should take into consideration how much RAM you have and if you can keep all programs in the ram all the time, if you can't you might run into a selfmade bottleneck!


    Greetings
    David

    "Well... lately this forum has become support for everything except omv" [...] "And is like someone is banning Google from their browsers"


    Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

    Upload Logfile via WebGUI/CLI
    #openmediavault on freenode IRC | German & English | GMT+1
    Absolutely no Support via PM!

  • As I understand the vm.swappiness parameter it - in more human terms - controls how eager the OS to swap mamory just to be prepared to what might happen next ie. will the user suddently demand a great chunk of memory to data or programs. If the OS is not prepared for this the bottleneck that Davidh2k describes will occur.


    OMV is a dedicated system with a relatively small amount of program and processes. There won't be many users suddently load a huge database app og graphics program. Thus there are no need to be prepared by swapping out proceses as long as there are memory enough. As long as more than 60% or the avaible memory are used for buffers (ie. disk cache) it would be vaste of cache memory also caching the swapped out memory.


    On my OMV i have 8G memory and i run subsonic, Minecraft server and two KVm machines. According to "top" more than 75% of my 8gig are used for buffers.


    So i have set vm.swappiness to zero to maximize memory utilizatiion. I haven't noticed any performance penalties but then again how should I?


    But I might have misunderrstod the effect of vm.swappiness

  • I've done some more reading on vm.swappiness and like you say it seems to be how eager it is to write out the memory to the swap file. Also while the settings of vm.swappiness range from 0-100 a setting of 0 does not mean it will not swap. It will at the last moment though and may cause an Out Of Memory (OOM) error. Then the OOM killer process will begin killing processes to free memory. Note that once it kills a process it does not restart it.


    So a lower setting than the default of 60 will save writing to the swap file which will reduce writes to all media in particular SSD's. Which is good. So what would be a good vm.swappiness setting? I don't know. Though I did run across this script to autoadjust it.


    Looking at a couple of lines of the code;


    Code
    ...
    result=$(echo $used \* 100 / $total | bc -q)
    echo $result > /proc/sys/vm/swappiness
    ...


    it would seem to me by adding a few lines of code between them to;
    - add to or reduce the value of the variable result for fine tuning to your system
    - ensure certain limits are not passed, like a minimum of 10 and maximum of 60


    Just my thoughts.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!