-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARC is not used for zvol #7897
Comments
@aaronjwood what you're observing is the result of generic kernel block layer double caching what's already in the ARC. This additional cache is the space you see consumed as buffered and inactive. As that cache increases in size the ARC will automatically reduce its own size in order to leave enough free space available on the system. This additional cache is also likely responsible for your reduced hit rate. It not only reduces the size of the ARC, but since it will handle cache hits without notifying ZFS the ARC may get a distorted view of the most critical blocks to keep cached. Unfortunately, the kernel doesn't provide a way I'm aware of to disable or limit this additional layer of caching. I've tagged this a a performance issue we do want to investigate. Thanks for filing such a clear issue so we can track this. |
I don't see this effect on a server with kernel 4.4.6, zfs 0.6.5 and LIO iSCSI exporting zvols to ~20 diskless Windows clients (~1TB logicalused in total) using backstore/block (emulate_write_cache=0 in LIO and sync=disabled on the zvols). The same machine is also serving TB sized databases accessed by these clients (postgres and, sadly, also legacy flat files on SMB shares) and the usual SMB shares in a windows environment (user profiles with folder redirection for %appdata% and such, business data dumps, ...)
Running that system with zfs_arc_max=52000000000 (to avoid OOM killer as zfs 0.6 has problems shrinking ARC on demand). Peaks with arc hit% below 90 are possible as the databases dosn't fit into RAM (most of it is cold and the parts becoming hot on a day get relieably cached). |
The proper method to avoid double buffering when writing to a ZVOL is to use the @aaronjwood how are you sharing the disk via iSCSI? What iSCSI stack are you using? |
I'm using |
Yes, I think you are using LIO underneath. ZVOLs already supports the O_DIRECT flag, which bypasses the system pagecache but not the ARC. Try using |
I added
I don't see any |
Hmm...it looks like write caching is already off for my iSCSI drive. |
The |
Interesting. I'll do some tests in the coming days; lets see if I can replicate this. |
I was able to resolve it and match the behavior @GregorKopka is seeing. I ditched |
@aaronjwood There are two flavours of targetcli (original targetcli and the fork at https://github.com/open-iscsi/targetcli-fb), the latter works better (at least for the systems I have iSCSI active) - as it dosn't have the problems of the former with loading/saving configurations. |
Thanks, good to know. I had installed targetcli-fb so I guess I'll stick with that :) |
Excellent! If the problem is solved, remember to close the issue ;) |
I'm not sure if it's right to close it since the issue exists if anyone uses a zvol in ways other than with iSCSI. Is there some generic way to do what |
In my opinion, it is not a zvol-related problem. Writing to any block devices without O_DIRECT will result in heavy buffering from the host kernel. The proper solution to avoid double-buffering is using O_DIRECT from the application writing to the zvol. I strongly suspect that |
Makes sense, after doing some more reading on O_DIRECT it sounds like a valid scenario. @behlendorf did you want to leave this open since you mentioned it needed investigation or should I close it? At least in the case of iSCSI there is a way to solve the problem. |
Let's close it out since the root cause was identified and the behavior is as expected. |
System information
Describe the problem you're observing
I'm exposing a zvol via iSCSI to a Windows machine. The zvol is in a second pool of mine and is almost 1 TB in size. I'm seeing that any reads or writes to the zvol continually decrease the ARC size while increasing the buffered and inactive memory amounts.
Here's an overview of my memory usage for the past hour (I started using the zvol at the point where the ARC size started to decrease):
And some of my ZFS stats for the same period (you can see that my ARC hit ratio has gone to 80%; my ratio normally is never below 90%):
See that there are no ARC hits or misses as the Linux buffers/inactive counts are growing.
Describe how to reproduce the problem
Create a zvol in a pool, expose this zvol to Windows via iSCSI, have Windows use it and format the block device with NTFS, start using the block device in Windows and watch the ARC size go down while the buffered and inactive amounts go up.
The text was updated successfully, but these errors were encountered: