Saturday 20 September 2014

how to release zfs cache memory online?

problem:-
server have 128GB RAM only application using 97 GB but top command showing 127.3 GB used & 0.7 free
solution:-
zfs consumes more meory.
1)TO CHECK KERNAL MEMORY STATUS
# echo "::memstat" |mdb -k
Page Summary                Pages                MB  %Tot
------------     ----------------  ----------------  ----
Kernel                     299058              2336   10%
ZFS File Data             1221918              34359738   40%
Anon                      1457002             11382   47%
Exec and libs                1484                11    0%
Page cache                  27856               217    1%
Free (cachelist)            12098                94    0%
Free (freelist)             66007               515    2%
Total                     3085423             24104
Physical                  3071311             23994
2)MAKE A LARGE FILE IN /tmp DIRECTORY
 # cd /tmp
 # ls
crontab.1647             crontab.1945             gdm-auth-cookies-.raWbc  hsperfdata_oracle        hsperfdata_root          sh1647.1
# du -sh *
   0K   crontab.1647
   0K   crontab.1945
   8K   XYZ
 104K   hsperfdata_oracle_ABC
   8K   hsperfdata_oracle_BAC
   8K   sh1647.1
 # mkfile 50G test
3)CHECK MEMORY STATUS
# echo "::memstat" |mdb -k
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: retry: Resource temporarily unavailable
Page Summary                Pages                MB  %Tot
------------     ----------------  ----------------  ----
Kernel                     288926              2257    9%
ZFS File Data              570593              4457   18%
Anon                      1397923             10921   45%
Exec and libs                 613                 4    0%
Page cache                 752637              5879   24%
Free (cachelist)            10285                80    0%
Free (freelist)             64446               503    2%
Total                     3085423             24104
Physical                  3071311             23994
making permenant
a.checking memory usage in user wise. out of 128GB , 97 GB is used rest of memory disappear
     Example:
          prstat -s size -–a
          NPROC USERNAME  SWAP   RSS MEMORY      TIME  CPU                          
              32 sybase     96G   96G    75%  42:38:04 0.2%
              72 root      367M  341M   0.3%   9:38:11 0.0%
               6 daemon   7144K 9160K   0.0%   0:01:01 0.0%
               1 smmsp    2048K 6144K   0.0%   0:00:22 0.0
b. to total physical memory:
          prtdiag | grep -i Memory
          Memory size: 131072 Megabytes
3. approx 75% of the physical memory is used under typical load.  Add a few percent for headroom (let’s call it 80).
4. 25% of 128GB is 32GB = 34359738368 bytes
5. Configure ZFS ARC Cache limit in /etc/system
   set zfs:zfs_arc_max=34359738368
6.Reboot system

No comments:

Post a Comment