Showing posts with label zfs_arc_min. Show all posts
Showing posts with label zfs_arc_min. Show all posts

Thursday 18 May 2017

How to limit ZFS arc cache size on Solaris server

If you are working on Solaris operating system then you normally facing the ZFS cache size issue while running multiple database on Solaris local zones.

As per oracle suggested if your physical Solaris server have 64 GB physical RAM then ZFS cache arc minimum size should be 2 GB, and if physical server have 128 GB RAM then ZFS arc cache size should be 4 GB. Minimum you can set the ZFS arc cache size to 512MB only.

In this post, I will show you how to limit the ZFS arc cache size on Solaris server operating system.

➤ Let's suppose your Solaris server have 128 GB physical RAM, in this case you need to set the ZFS arc cache size to 4 GB minimum.

Before doing that you must check the current cache size which are running on the server

!-[solaris]# kstat zfs:0:arcstats:size | grep size | awk '{printf "%2dMB\n",  $2/1024/1024+0.5}'
1024MB

If you see the above command output, you can see the current running cache arc size is around 1 GB.

➤ If you want to check current "zfs_arc_max" & "zfs_arc_min" cache size, then please run the below command to check this.

!-[solaris]# kstat -p zfs:0:arcstats | head -4
zfs:0:arcstats:buf_size  55652720
zfs:0:arcstats:c             1073741824
zfs:0:arcstats:c_max    1073741824
zfs:0:arcstats:c_min     268435456

If you see the current above command output the "zfs_arc_max" cache size is 1 GB approx and  zfs_zrc_min size is approx 256 MB.

➤ As in my above post, you can see, as per Oracle, the cache size should be minimum 4 GB if physical RAM of the server 128 GB. So in this step , we will change the parameter.

To set the new ZFS ARC parameter, you need to go "/etc/system" file where old cache parameter was written.

!-[solaris]# vi /etc/system

Please change the parameter according to 128 GB physical RAM, so in our case zfs_arc_max would be 6 GB and zfs_arc_min would be 4 GB.

set zfs:zfs_arc_max = 6442450944
set zfs:zfs_arc_min = 4294967296

You can set the above parameter in /etc/system file. The ZFS cache size max would be 8 GB but on my machine I used it to 6 GB only.

➤ Once you set the above step ZFS ARC parameter in the system file, you need to take a reboot of Solaris server to effect these new size permanently. 

Once the server is up , you can run the below command to check the new ZFS cache size.

!-[solaris]# kstat zfs:0:arcstats:size | grep size | awk '{printf "%2dMB\n",  $2/1024/1024+0.5}'
6144MB

If you see the above output, you can see the ZFS cache max size vary to 6 GB.

➤ You can  also use the below command to check the max. cache size on global zone.

!-[solaris]# kstat zfs::arcstats:size
module: zfs                              instance: 0
name:    arcstats                       class:    misc
              size                             6445232256
You can see the above command output, its clearly show you the new current ZFS arc cache size for 128 GB physical Sun Solaris server.

Please post the comment on this blog, if you have any query related to this topic.