swapfile takes a long time to “get cleared”

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
4
down vote

favorite












I have a swap file /swapfile of 1GB size in accordance with the procedure described in the ubuntu swap faq.



When doing a RAM intensive task, I use the "System Monitor" to check the load on my Memory and my Swap. When the task is done, the Memory load goes down quickly ... however, the Swap load stays high for a very long time and only trickles down very slowly (see image).



system monitor gui



When calling sudo swapoff -a && swapon -a, I can clear the Swap manually ... but I'd rather know:



  1. Why is Swap taking so long to be cleared?

  2. Is this impacting the performance?






share|improve this question
























    up vote
    4
    down vote

    favorite












    I have a swap file /swapfile of 1GB size in accordance with the procedure described in the ubuntu swap faq.



    When doing a RAM intensive task, I use the "System Monitor" to check the load on my Memory and my Swap. When the task is done, the Memory load goes down quickly ... however, the Swap load stays high for a very long time and only trickles down very slowly (see image).



    system monitor gui



    When calling sudo swapoff -a && swapon -a, I can clear the Swap manually ... but I'd rather know:



    1. Why is Swap taking so long to be cleared?

    2. Is this impacting the performance?






    share|improve this question






















      up vote
      4
      down vote

      favorite









      up vote
      4
      down vote

      favorite











      I have a swap file /swapfile of 1GB size in accordance with the procedure described in the ubuntu swap faq.



      When doing a RAM intensive task, I use the "System Monitor" to check the load on my Memory and my Swap. When the task is done, the Memory load goes down quickly ... however, the Swap load stays high for a very long time and only trickles down very slowly (see image).



      system monitor gui



      When calling sudo swapoff -a && swapon -a, I can clear the Swap manually ... but I'd rather know:



      1. Why is Swap taking so long to be cleared?

      2. Is this impacting the performance?






      share|improve this question












      I have a swap file /swapfile of 1GB size in accordance with the procedure described in the ubuntu swap faq.



      When doing a RAM intensive task, I use the "System Monitor" to check the load on my Memory and my Swap. When the task is done, the Memory load goes down quickly ... however, the Swap load stays high for a very long time and only trickles down very slowly (see image).



      system monitor gui



      When calling sudo swapoff -a && swapon -a, I can clear the Swap manually ... but I'd rather know:



      1. Why is Swap taking so long to be cleared?

      2. Is this impacting the performance?








      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 19 at 12:33









      S.A.

      1435




      1435




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          Short answer: if your computer is not acting very slowly, it's fine.



          Linux will only get the contents out of swap if they are needed, otherwise, there's no point in loading something that isn't in use from swap into RAM, thereby reducing the cache.



          A way to check if your system is being limited by swap is checking



          vmstat 1


          and looking at the wa column, which shows how long it takes before a process can run. Also, use a tool such as htop and see how many processes are in disk sleep(D).



          Also, you should have a bit more swap. According to the SwapFAQ:



           RAM(MB) No hibernation With Hibernation Maximum
          256 256 512 512
          512 512 1024 1024
          1024 1024 2048 2048

          RAM(GB) No hibernation With Hibernation Maximum
          1 1 2 2
          2 1 3 4
          3 2 5 6
          4 2 6 8
          5 2 7 10
          6 2 8 12
          8 3 11 16
          12 3 15 24
          16 4 20 32
          24 5 29 48
          32 6 38 64
          64 8 72 128
          128 11 139 256


          If you have 16GB of RAM, you should have between 4GB and 32GB






          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',
            convertImagesToLinks: true,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            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%2f1026384%2fswapfile-takes-a-long-time-to-get-cleared%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            3
            down vote



            accepted










            Short answer: if your computer is not acting very slowly, it's fine.



            Linux will only get the contents out of swap if they are needed, otherwise, there's no point in loading something that isn't in use from swap into RAM, thereby reducing the cache.



            A way to check if your system is being limited by swap is checking



            vmstat 1


            and looking at the wa column, which shows how long it takes before a process can run. Also, use a tool such as htop and see how many processes are in disk sleep(D).



            Also, you should have a bit more swap. According to the SwapFAQ:



             RAM(MB) No hibernation With Hibernation Maximum
            256 256 512 512
            512 512 1024 1024
            1024 1024 2048 2048

            RAM(GB) No hibernation With Hibernation Maximum
            1 1 2 2
            2 1 3 4
            3 2 5 6
            4 2 6 8
            5 2 7 10
            6 2 8 12
            8 3 11 16
            12 3 15 24
            16 4 20 32
            24 5 29 48
            32 6 38 64
            64 8 72 128
            128 11 139 256


            If you have 16GB of RAM, you should have between 4GB and 32GB






            share|improve this answer
























              up vote
              3
              down vote



              accepted










              Short answer: if your computer is not acting very slowly, it's fine.



              Linux will only get the contents out of swap if they are needed, otherwise, there's no point in loading something that isn't in use from swap into RAM, thereby reducing the cache.



              A way to check if your system is being limited by swap is checking



              vmstat 1


              and looking at the wa column, which shows how long it takes before a process can run. Also, use a tool such as htop and see how many processes are in disk sleep(D).



              Also, you should have a bit more swap. According to the SwapFAQ:



               RAM(MB) No hibernation With Hibernation Maximum
              256 256 512 512
              512 512 1024 1024
              1024 1024 2048 2048

              RAM(GB) No hibernation With Hibernation Maximum
              1 1 2 2
              2 1 3 4
              3 2 5 6
              4 2 6 8
              5 2 7 10
              6 2 8 12
              8 3 11 16
              12 3 15 24
              16 4 20 32
              24 5 29 48
              32 6 38 64
              64 8 72 128
              128 11 139 256


              If you have 16GB of RAM, you should have between 4GB and 32GB






              share|improve this answer






















                up vote
                3
                down vote



                accepted







                up vote
                3
                down vote



                accepted






                Short answer: if your computer is not acting very slowly, it's fine.



                Linux will only get the contents out of swap if they are needed, otherwise, there's no point in loading something that isn't in use from swap into RAM, thereby reducing the cache.



                A way to check if your system is being limited by swap is checking



                vmstat 1


                and looking at the wa column, which shows how long it takes before a process can run. Also, use a tool such as htop and see how many processes are in disk sleep(D).



                Also, you should have a bit more swap. According to the SwapFAQ:



                 RAM(MB) No hibernation With Hibernation Maximum
                256 256 512 512
                512 512 1024 1024
                1024 1024 2048 2048

                RAM(GB) No hibernation With Hibernation Maximum
                1 1 2 2
                2 1 3 4
                3 2 5 6
                4 2 6 8
                5 2 7 10
                6 2 8 12
                8 3 11 16
                12 3 15 24
                16 4 20 32
                24 5 29 48
                32 6 38 64
                64 8 72 128
                128 11 139 256


                If you have 16GB of RAM, you should have between 4GB and 32GB






                share|improve this answer












                Short answer: if your computer is not acting very slowly, it's fine.



                Linux will only get the contents out of swap if they are needed, otherwise, there's no point in loading something that isn't in use from swap into RAM, thereby reducing the cache.



                A way to check if your system is being limited by swap is checking



                vmstat 1


                and looking at the wa column, which shows how long it takes before a process can run. Also, use a tool such as htop and see how many processes are in disk sleep(D).



                Also, you should have a bit more swap. According to the SwapFAQ:



                 RAM(MB) No hibernation With Hibernation Maximum
                256 256 512 512
                512 512 1024 1024
                1024 1024 2048 2048

                RAM(GB) No hibernation With Hibernation Maximum
                1 1 2 2
                2 1 3 4
                3 2 5 6
                4 2 6 8
                5 2 7 10
                6 2 8 12
                8 3 11 16
                12 3 15 24
                16 4 20 32
                24 5 29 48
                32 6 38 64
                64 8 72 128
                128 11 139 256


                If you have 16GB of RAM, you should have between 4GB and 32GB







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 19 at 13:50









                NerdOfLinux

                1,499830




                1,499830



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1026384%2fswapfile-takes-a-long-time-to-get-cleared%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    pylint3 and pip3 broken

                    Missing snmpget and snmpwalk

                    How to enroll fingerprints to Ubuntu 17.10 with VFS491