Use 32 as the default number of zvol threads. #567
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the
zvol_threads
variable, which controls the number of worker threads which process items from the ZVOL queues, is set to the number of available CPUs.This choice seems to be based on the assumption that ZVOL threads are CPU-bound. This is not necessarily true, especially for synchronous writes. Consider the situation described in the comments for
zil_commit()
, which is called insidezvol_write()
for synchronous writes:We can easily deduce that, in the case of ZVOLs, there can be a maximum of
zvol_threads
cthreads and qthreads. The default value forzvol_threads
is typically between 1 and 8, which is way too low in this case. This means there will be a lot of small commits to the ZIL, which is very inefficient compared to a few big commits, especially since we have to wait for the data to be on stable storage. Increasing the number of threads will increase the amount of data waiting to be commited and thus the size of the individual commits.On my system, in the context of VM disk image storage (lots of small synchronous writes), increasing
zvol_threads
from 8 to 32 results in a 50% increase in sequential synchronous write performance.We should choose a more sensible default for
zvol_threads
. Unfortunately the optimal value is difficult to determine automatically, since it depends on the synchronous write latency of the underlying storage devices. In any case, a hardcoded value of 32 would probably be better than the current situation. Having a lot of ZVOL threads doesn't seem to have any real downside anyway.Fixes #392.