5 Replies Latest reply on Feb 26, 2016 8:57 AM by Eze-Oracle

    How can I free-up the cache/memory in Solaris 11?

    Eldho Varghese

      Hi all,

       

      I'm running Solaris 11 in my virtual box and it is configured with 6 GB RAM. While I was performing Zone migration ( gzipping the zone using zfs send command) it consumed 4 GB memory. However after execution of the command still system didn't release the memory back to system. Finally I had to reboot the host.

      How I can clear the cache/Memory in such situation ? In Linux, I use sync ; echo 3 > /proc/sys/vm/drop_cache to release the cache.

       

      How can I release the cache in Solaris without rebooting

       

      root@solaris11:/proc# echo ::memstat | mdb -k

      Page Summary                 Pages             Bytes  %Tot

      ----------------- ----------------  ----------------  ----

      Kernel                      258207           1008.6M   16%

      Guest                            0                 0    0%

      ZFS Metadata                 38080            148.7M    2%

      ZFS File Data              1050249              4.0G   67%

      Anon                         61004            238.2M    4%

      Exec and libs                 3863             15.0M    0%

      Page cache                    4569             17.8M    0%

      Free (cachelist)              1585              6.1M    0%

      Free (freelist)             150586            588.2M   10%

      Total                      1568143              5.9G

       

      root@solaris11:/proc# kstat zfs::arcstats:size

      module: zfs                             instance: 0  

      name:   arcstats                        class:    misc

      size                            2497018160  <------2.5G

       

      I would appreciate if someone can clarify this in details.

       

      Thanks in Advance

      Eldho Varghese

        • 1. Re: How can I free-up the cache/memory in Solaris 11?
          Eze-Oracle

          Hello

           

          You can limit using this parameteer in /etc/system    zfs_arc_max

           

          http://docs.oracle.com/cd/E19253-01/817-0404/gjhec/index.html

           

          There is an example in this doc : How to Check and Analyze Solaris Memory Usage (Doc ID 1009500.1)

           

          -- snip --

           

          In case the amount of ZFS File Data is too high on the system, you might to consider to limit the ARC cache
          by setting zfs:zfs_arc_max in /etc/system
          set zfs:zfs_arc_max = [size]
          i.e. limit the cache to 1 GB in size
          set zfs:zfs_arc_max = 1073741824

          Please check the following documents to check/limit the ARC
          How to Understand "ZFS File Data" Value by mdb and ZFS ARC Size. (Doc ID 1430323.1)

          Oracle Solaris Tunable Parameters Reference Manual

           

           

           

          Regards

          Eze

           

          Please don't forget to mark the answer as helpful or correct this will help other customers

          • 2. Re: How can I free-up the cache/memory in Solaris 11?
            Glynn Foster-Oracle

            If you are using Solaris 11.2 or later, please create a file in /etc/system.d instead of trying to modify /etc/system. See the Darren's blog post for details: https://blogs.oracle.com/darren/entry/using_etc_system_d_rather

            • 3. Re: How can I free-up the cache/memory in Solaris 11?
              Eldho Varghese

              This happens to one of our LDOM in T4 server today. totally confused about the swap utilization in Solaris

               

              -bash-4.1# uname -a

              SunOS akl0zp907 5.11 11.2 sun4v sparc sun4v

              -bash-4.1#

               

              -bash-4.1# prtconf -vp |grep Memory

              Memory size: 65536 Megabytes   ------->64GB Physical memory assigned to this LDOM

               

              -bash-4.1# swap -lh

              swapfile             dev    swaplo   blocks     free

              /dev/zvol/dsk/rpool/swap 287,1        8K      48G      48G    ---->What is this Free means ?

               

              We have 64G Physical and 48G SWAP So total 112G But....


              -bash-4.1# swap -sh

              total: 36G allocated + 47G reserved = 83G used, 1.3G available     ----->> What is this actually means?

              36G Allocated from SWAP or Physical or Both?

              47G Reserved from SWAP or Physical Or Both ?

              If the above are allocated from Both Why top shows 48G free swap? Why Only 1.3G is available ?

               

              Top Shows me as follows....

               

              -bash-4.1# top

              last pid: 10158;  load avg:  3.72,  3.84,  3.90;  up 2+13:56:06                                                                         10:56:44

              1049 processes: 1045 sleeping, 1 stopped, 3 on cpu

              CPU states: 84.5% idle,  7.7% user,  7.7% kernel,  0.0% iowait,  0.0% swap

              Kernel: 13451 ctxsw, 24635 trap, 12493 intr, 54431 syscall, 215 fork, 12929 flt, 1408 pgin, 24 pgout

              Memory: 64G phys mem, 7366M free mem, 48G total swap, 48G free swap   -------------------------------------->>>

               

              -bash-4.1# echo ::memstat | mdb -k

              Page Summary                 Pages             Bytes  %Tot

              ----------------- ----------------  ----------------  ----

              Kernel                     1185942              9.0G   14%

              Defdump prealloc            188822              1.4G    2%

              Guest                            0                 0    0%

              ZFS Metadata                114698            896.0M    1%

              ZFS File Data               296861              2.2G    4%

              Anon                       4699457             35.8G   56%   -------------->>>

              Exec and libs                58823            459.5M    1%

              Page cache                  960179              7.3G   11%

              Free (cachelist)             28106            219.5M    0%

              Free (freelist)             855720              6.5G   10%

              Total                      8388608               64G ------------------>>>

               

              -bash-4.1# kstat zfs::arcstats:size

              module: zfs                             instance: 0

              name:   arcstats                        class:    misc

                      size                            3147692944  ------>> 3.1G

              -------------------------------------------------------------------------------------------------------

              -bash-4.1# vmstat 5

              kthr      memory            page            disk          faults      cpu

              r b w   swap  free  re  mf pi po fr de sr vc vc vc vc   in   sy   cs us sy id

              0 4 0 37517936 18049832 2004 3179 5630 870 870 0 2 20 6 6 7 11766 36762 14388 8 3 89

              1 2 0 1392168 7586904 2682 12257 2768 0 0 0 0 30 19 0 0 14222 53635 14864 9 8 84------------- > 1.3G free Swap and 7.5G Free Phycical

              0 1 0 1383032 7583200 2770 12267 4165 0 0 0 0 32 0 0 0 14430 51267 15213 9 8 84

              0 3 0 1405384 7589904 2555 12097 2846 0 0 0 0 17 0 0 15 14171 49759 15098 9 8 83

               

              Top and VMstat shows 7.5G physical memory is free.

              Top show 48GB swap free but vmstat shows 1.3G swap free  --- Confusing

              swap -sh shows ..... 1.3G available 83G used out of 112G

              -bash-4.1# swap -sh

              total: 36G allocated + 47G reserved = 83G used, 1.3G available 

               

              Total confusion.. Please help

              • 4. Re: How can I free-up the cache/memory in Solaris 11?
                Eze-Oracle

                Hello Eldho

                 

                You have to undestand what is VM and physical mem, and physical Swap, and how a process do the reservation of memory when it starts. It is not easy but it is the way this works

                 

                // Swap -s is virutal memory

                 

                bash-4.1# swap -sh 

                 

                total: 36G allocated + 47G reserved = 83G used, 1.3G available     ----->> What is this actually means?

                 

                36G Allocated from SWAP or Physical or Both?

                47G Reserved from SWAP or Physical Or Both ?

                 

                If the above are allocated from Both Why top shows 48G free swap?  —>>>> because reserved doesn’t mean allocated yet.

                Why Only 1.3G is available ?   ——> becasue the rest of VM is allocated or reserved, and it is not available to start process and do the allocation to grow the heap

                 

                The answer is on this doc

                 

                Interpreting swap -s and swap -l output (Doc ID 1009356.1)

                 

                Cheers

                Eze.

                • 5. Re: How can I free-up the cache/memory in Solaris 11?
                  Eze-Oracle

                  Hello

                   

                  I have just seen this dtrace script on other thread that can help you too

                   

                  /usr/dtrace/DTT/Mem/swapinfo.d

                   

                  Regards

                  eze