6

I am trying to understand the inner workings of the ZFS ARC. However, I am confused with several things:

  1. actual (zfs:0:arcstats:size) vs target size (zfs:0:arcstats:c). I understand that actual size is allocated and stores cached contents. But, what is the target size then? What is the difference between these two?

  2. mru_size (zfs:0:arcstats:p) + mfu_size (zfs:0:arcstats:c - zfs:0:arcstats:p) vs data_size (zfs:0:arcstats:data_size). Shouldn't data_size be the sum of mru_size and mfu_size? What is the correct ARC size breakdown? According to http://lists.freebsd.org/pipermail/freebsd-fs/2012-June/014643.html, it should be hdr_size + data_size (mru_size + mfu_size + anon_size) + other_size + l2_hdr_size, but it doesn't make any sense as mru_size is usually bigger than data_size.

  3. what is arc memory throttle used for?

Thanks for any answers/pointers.

growse
  • 7,830
  • 11
  • 72
  • 114
Guest
  • 61
  • 1
  • 2

2 Answers2

1

Well, I am some years late, but I hope that this can help others.

  • c is the target ARC size. It is 50% of total RAM by default, but it can shrink on demand if the system is under memory pressure
  • size is the current ARC size. Given enough time, it will tend to c
  • data_size is the size of cached user data. It does not include metadata (and this is the reason why it can be significantly smaller than MRU and/or MFU when facing metadata-heavy workload)
  • metadata_size is the size of cached metadata
  • hdr_size is the size of L2ARC headers stored in main ARC
  • overhead_size is the size of various buffer which are allocated when decompressing dentries
shodanshok
  • 44,038
  • 6
  • 98
  • 162
0

I believe the target size ARC is how big it can grow to and actual is how much it's using currently. I see this on my server, where I give it 12 gigs, but it won't actually sit at 12 gigs unless I'm hitting it. And it normally likes to sit at 10-11 gigs.

Here's a link to explain the memory throttle. Looks like ZFS was not originally programed to eat all your memory, that's most likely why it's there. (http://www.zfsbuild.com/2012/04/18/let-zfs-use-all-of-your-ram/)

And about #2, I'm not sure. Sorry.

Hopes this helps!

Austin Harsh
  • 51
  • 2
  • 5
  • No its there so you can tune whether you want to cache your data in arc, or maybe the application, eg mysql. Limiting arc means it will never become overly large, and have to free itself back to the system. Eg what is the point of arc grabbing all your ram if you are going to start a DB not long after boot that will quickly want 80% of the system ram. It can sometimes help with memory fragmentation issues, due to it not constantly resizing. – krad Aug 15 '18 at 14:33
  • I noticed that my ARC size was also limited to the size of the SWAP in FreeBSD. I cannot find any documentation on this. When I had a swap of 2Gb the ARC was 2Gb. When I increased the swap to 4Gb the ARC went to 3.8Gb. (my physical memory is 8Gb). – Lexib0y Dec 02 '18 at 19:01