How to swap more often












0















My PC has swappiness set to 60.



cat /proc/sys/vm/swappiness
60


Even so, swap only occurred when the PC runs out of RAM. So, every time I fill the RAM, it stops responding for a while while it is swapping into its HDD.



I thought that with swappiness of 60, proximately 60% of (full size of) RAM would be mirrored on swap so it is already there when needed to be swapped out... But that is not what I am experiencing.



I've read the manual and many different answers here but none is about having swappiness on the right value and swap not occurring until the very last moment.










share|improve this question




















  • 2





    afaik swap is not a mirror but more like an extension of your ram.

    – RoVo
    6 hours ago













  • @RoVo Is it more clear with the changes I did?

    – brunoais
    6 hours ago











  • How much RAM and Swap space do you have, and what makes your machine run out of RAM?

    – Soren A
    4 hours ago
















0















My PC has swappiness set to 60.



cat /proc/sys/vm/swappiness
60


Even so, swap only occurred when the PC runs out of RAM. So, every time I fill the RAM, it stops responding for a while while it is swapping into its HDD.



I thought that with swappiness of 60, proximately 60% of (full size of) RAM would be mirrored on swap so it is already there when needed to be swapped out... But that is not what I am experiencing.



I've read the manual and many different answers here but none is about having swappiness on the right value and swap not occurring until the very last moment.










share|improve this question




















  • 2





    afaik swap is not a mirror but more like an extension of your ram.

    – RoVo
    6 hours ago













  • @RoVo Is it more clear with the changes I did?

    – brunoais
    6 hours ago











  • How much RAM and Swap space do you have, and what makes your machine run out of RAM?

    – Soren A
    4 hours ago














0












0








0








My PC has swappiness set to 60.



cat /proc/sys/vm/swappiness
60


Even so, swap only occurred when the PC runs out of RAM. So, every time I fill the RAM, it stops responding for a while while it is swapping into its HDD.



I thought that with swappiness of 60, proximately 60% of (full size of) RAM would be mirrored on swap so it is already there when needed to be swapped out... But that is not what I am experiencing.



I've read the manual and many different answers here but none is about having swappiness on the right value and swap not occurring until the very last moment.










share|improve this question
















My PC has swappiness set to 60.



cat /proc/sys/vm/swappiness
60


Even so, swap only occurred when the PC runs out of RAM. So, every time I fill the RAM, it stops responding for a while while it is swapping into its HDD.



I thought that with swappiness of 60, proximately 60% of (full size of) RAM would be mirrored on swap so it is already there when needed to be swapped out... But that is not what I am experiencing.



I've read the manual and many different answers here but none is about having swappiness on the right value and swap not occurring until the very last moment.







18.04 performance swap memory-usage






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 6 hours ago







brunoais

















asked 7 hours ago









brunoaisbrunoais

1115




1115








  • 2





    afaik swap is not a mirror but more like an extension of your ram.

    – RoVo
    6 hours ago













  • @RoVo Is it more clear with the changes I did?

    – brunoais
    6 hours ago











  • How much RAM and Swap space do you have, and what makes your machine run out of RAM?

    – Soren A
    4 hours ago














  • 2





    afaik swap is not a mirror but more like an extension of your ram.

    – RoVo
    6 hours ago













  • @RoVo Is it more clear with the changes I did?

    – brunoais
    6 hours ago











  • How much RAM and Swap space do you have, and what makes your machine run out of RAM?

    – Soren A
    4 hours ago








2




2





afaik swap is not a mirror but more like an extension of your ram.

– RoVo
6 hours ago







afaik swap is not a mirror but more like an extension of your ram.

– RoVo
6 hours ago















@RoVo Is it more clear with the changes I did?

– brunoais
6 hours ago





@RoVo Is it more clear with the changes I did?

– brunoais
6 hours ago













How much RAM and Swap space do you have, and what makes your machine run out of RAM?

– Soren A
4 hours ago





How much RAM and Swap space do you have, and what makes your machine run out of RAM?

– Soren A
4 hours ago










1 Answer
1






active

oldest

votes


















0














Swappiness is just a parameter that the kernel uses to calculate a swap tendency. I read the manual and I was unable to find where it states that /proc/sys/vm/swappiness is some kind of threshold.



About this topic, Red Hat Knowledge Base states:




this parameter sets the kernel's balance between reclaiming pages from the page cache and reclaiming pages by swapping out process memory




Also, another answer in Ask Ubuntu states:




Swapping is a slow and costly operation, so the system avoids it unless it calculates that the trade-off in cache performance will make up for it overall, or if it's necessary to avoid killing processes.



A lot of the time people will look at their system that is thrashing the disk heavily and using a lot of swap space and blame swapping for it. That's the wrong approach to take. If swapping ever reaches this extreme, it means that swapping is your system's attempt to deal with low memory problems, not the cause of the problem.




Hence, I think you are working on a misconception about how swap and swappiness works.






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1109629%2fhow-to-swap-more-often%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Swappiness is just a parameter that the kernel uses to calculate a swap tendency. I read the manual and I was unable to find where it states that /proc/sys/vm/swappiness is some kind of threshold.



    About this topic, Red Hat Knowledge Base states:




    this parameter sets the kernel's balance between reclaiming pages from the page cache and reclaiming pages by swapping out process memory




    Also, another answer in Ask Ubuntu states:




    Swapping is a slow and costly operation, so the system avoids it unless it calculates that the trade-off in cache performance will make up for it overall, or if it's necessary to avoid killing processes.



    A lot of the time people will look at their system that is thrashing the disk heavily and using a lot of swap space and blame swapping for it. That's the wrong approach to take. If swapping ever reaches this extreme, it means that swapping is your system's attempt to deal with low memory problems, not the cause of the problem.




    Hence, I think you are working on a misconception about how swap and swappiness works.






    share|improve this answer




























      0














      Swappiness is just a parameter that the kernel uses to calculate a swap tendency. I read the manual and I was unable to find where it states that /proc/sys/vm/swappiness is some kind of threshold.



      About this topic, Red Hat Knowledge Base states:




      this parameter sets the kernel's balance between reclaiming pages from the page cache and reclaiming pages by swapping out process memory




      Also, another answer in Ask Ubuntu states:




      Swapping is a slow and costly operation, so the system avoids it unless it calculates that the trade-off in cache performance will make up for it overall, or if it's necessary to avoid killing processes.



      A lot of the time people will look at their system that is thrashing the disk heavily and using a lot of swap space and blame swapping for it. That's the wrong approach to take. If swapping ever reaches this extreme, it means that swapping is your system's attempt to deal with low memory problems, not the cause of the problem.




      Hence, I think you are working on a misconception about how swap and swappiness works.






      share|improve this answer


























        0












        0








        0







        Swappiness is just a parameter that the kernel uses to calculate a swap tendency. I read the manual and I was unable to find where it states that /proc/sys/vm/swappiness is some kind of threshold.



        About this topic, Red Hat Knowledge Base states:




        this parameter sets the kernel's balance between reclaiming pages from the page cache and reclaiming pages by swapping out process memory




        Also, another answer in Ask Ubuntu states:




        Swapping is a slow and costly operation, so the system avoids it unless it calculates that the trade-off in cache performance will make up for it overall, or if it's necessary to avoid killing processes.



        A lot of the time people will look at their system that is thrashing the disk heavily and using a lot of swap space and blame swapping for it. That's the wrong approach to take. If swapping ever reaches this extreme, it means that swapping is your system's attempt to deal with low memory problems, not the cause of the problem.




        Hence, I think you are working on a misconception about how swap and swappiness works.






        share|improve this answer













        Swappiness is just a parameter that the kernel uses to calculate a swap tendency. I read the manual and I was unable to find where it states that /proc/sys/vm/swappiness is some kind of threshold.



        About this topic, Red Hat Knowledge Base states:




        this parameter sets the kernel's balance between reclaiming pages from the page cache and reclaiming pages by swapping out process memory




        Also, another answer in Ask Ubuntu states:




        Swapping is a slow and costly operation, so the system avoids it unless it calculates that the trade-off in cache performance will make up for it overall, or if it's necessary to avoid killing processes.



        A lot of the time people will look at their system that is thrashing the disk heavily and using a lot of swap space and blame swapping for it. That's the wrong approach to take. If swapping ever reaches this extreme, it means that swapping is your system's attempt to deal with low memory problems, not the cause of the problem.




        Hence, I think you are working on a misconception about how swap and swappiness works.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 5 hours ago









        PEdroArthurPEdroArthur

        37124




        37124






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1109629%2fhow-to-swap-more-often%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            香粉寮

            GameSpot