7 Replies Latest reply: Apr 17, 2014 6:02 AM by Dude! RSS

    Swap is not using at all!!!




      I'm quite concern about anything special in my linux server.  My linux server is running web logic and quite intensively being used with memory.  However, I found a strange thing that its swap is almost not used at all....

      [root@linuxhost ~]# free

                   total       used       free     shared    buffers     cached

      Mem:       4102628    3884776     217852          0     135808     997816

      -/+ buffers/cache:    2751152    1351476

      Swap:      2104504          0    2104504



      The swap is not being used at all.... is it normal?



        • 1. Re: Swap is not using at all!!!
          Ratnesh Kumar Roy


          Run this command and then see the result.


          [root@ex ~]#  sync; echo 3 > /proc/sys/vm/drop_caches


          [root@ex ~]# free -g

          • 2. Re: Swap is not using at all!!!

            It can depend on your web logic memory configuration, system load and swappiness kernel parameter, but just looking at your output from the free command it seems that your kernel has allocated most of your physical RAM for the file system cache. If swap space is not used, a value of 0 is normal. The kernel file system buffering is a normal behavior and only happens when your server has more than enough physical RAM to handle the current memory demands. It does however not mean that your swap is working when required or whether or not your web logic application is properly configured.


            Here might be an interesting article: 2.6 swapping behavior [LWN.net]

            • 3. Re: Swap is not using at all!!!

              Share the output of below cmd

              vmstat -s | grep swap


              vmstat -s | grep swap


                    3280792  swap cache

                    8388600  total swap

                     350524  used swap

                    8038076  free swap

                      36439 pages swapped in

                     123312 pages swapped out


              • 4. Re: Swap is not using at all!!!

                Looks your physical memory is totally used here.


                Did you try to run the command at peak and off peak hours and tried to compare the output of both?

                • 5. Re: Swap is not using at all!!!

                  It's a normal behavior. Any unused RAM would be a wasted resource. That's why the kernel uses available memory for the filesystem buffer/cache to improve performance. The kernel buffer cache is dynamic and is relocated to applications when necessary. The output of the OP shows that pretty much all RAM is allocated to the kernel buffer cache, which looks like there is nothing else running or the web logic server has a very small memory footprint.

                  • 6. Re: Swap is not using at all!!!

                    Okay but at Peak hours the memory utilization might be high and so it is possible to use SWAP space. This will show whether the SWAP is in used or not.


                    am I correct ?

                    • 7. Re: Swap is not using at all!!!

                      High memory utilization alone is not a reason for swap - it depends on what memory is being used for. For instance, the buffer cache and hugepages are never swapped out. If an application demands more memory, the kernel will automatically reduce the buffer cache to make more memory available.