Samba + ZFS Cache

Hi all,

For a long time, I've noticed that my ZFS file servers running FreeBSD don't use RAM cache when the files are accessed through Samba. As a simple test, I just did a copy of a 10GB folder to the local disk of the client, and monitoring the server with htop, I can't see any RAM memory increase. The server stays all the time using more or less 30MB of RAM (This server has a 20TB storage with 32GB total RAM). But, when I copy the same folder through the command line (like cp -rv folder folder.bak) I can clearly see the memory being increased during the copy.
This server is accessed for 10 users at the same time and I can't see any use of cache!
Is there any trick to improve the cache use for samba file servers ? Or some way to turn the ZFS cache use more "agressive" ?


Thanks in advance,

Danilo
 
As far as I'm aware the ZFS cache is already pretty aggressive. Are you sure htop is actually showing kernel memory in use? I know my system currently has 600MB of data in ARC but normal top doesn't make this obvious (it's geared more to displaying non-kernel memory used by applications).

I would suggest installing the sysutils/zfs-stats and seeing what that tells you. The -A and -E options will show you exactly how much data ZFS has in the ARC and the hit rates. This is a really useful utility for any ZFS system.

E.g. (I've cut out some of the information to make it shorter)

Code:
# zfs-stats -A
ARC Size:                               46.46%  568.98  MiB
        Target Size: (Adaptive)         100.00% 1.20    GiB
        Min Size (Hard Limit):          12.50%  153.07  MiB
        Max Size (High Water):          8:1     1.20    GiB

Code:
# zfs-stats -E
ARC Efficiency:                                 2.25b
        Cache Hit Ratio:                97.60%  2.20b
        Cache Miss Ratio:               2.40%   54.10m
        Actual Hit Ratio:               97.06%  2.18b
 
Hi Matt,

Thank you for your reply. I really didn't know about the zfs-stat and I really were looking for some tool like that.
And comparing the statistics from zfs-stat command with the htop memory usage, I could see that htop really shows me the kernel memory usage too and it seems like, when the files are accessed through Samba, the cache is less used. I'm doing these tests with simple copies through the network and local copies from the local pool to itself. I don't know if this is the right way to test the cache usage.


Thank you!
 
Back
Top