|
NAMEnbdkit-cache-filter - nbdkit caching filterSYNOPSISnbdkit --filter=cache plugin [cache=writeback|writethrough|unsafe] [cache-max-size=SIZE] [cache-high-threshold=N] [cache-low-threshold=N] [cache-on-read=true|false] [plugin-args...] DESCRIPTION"nbdkit-cache-filter" is a filter that adds caching on top of a plugin. This is useful if a plugin is slow or expensive to use, because nbdkit will try to minimize requests to the plugin by caching previous requests.Note that many NBD clients are able to do caching, and because the caching happens on the client side it will usually be more effective than caching inside the server. This filter can be used if the client does not have effective caching, or (with "cache=unsafe") to defeat flush requests from the client (which is unsafe and can cause data loss, as the name suggests). Note that the use of this filter rounds the image size down to a multiple of the caching granularity (the larger of 4096 or the "f_bsize" field of fstatvfs(3)), to ease the implementation. If you need to round the image size up instead to access the last few bytes, combine this filter with nbdkit-truncate-filter(1). This filter only caches image contents. To cache image metadata, use nbdkit-cacheextents-filter(1) between this filter and the plugin. To accelerate sequential reads, use nbdkit-readahead-filter(1) instead. PARAMETERS
CACHE MAXIMUM SIZEBy default the cache can grow to any size (although not larger than the virtual size of the underlying plugin) and you have to ensure there is sufficient space in $TMPDIR for it.Using the parameters "cache-max-size", "cache-high-threshold" and "cache-low-threshold" you can limit the maximum size of the cache. This requires kernel and filesystem support (for fallocate(2) "FALLOC_FL_PUNCH_HOLE"), so it may not work on all platforms. Some examples:
The way this works is once the size of the cache exceeds "SIZE" ✕ the high threshold, the filter works to reduce the size of the cache until it is less than "SIZE" ✕ the low threshold. Once the size is below the low threshold, no more reclaim work is done until the size exceeds the high threshold again. The default thresholds are high 95% and low 80%. You must set 0 < low < high. The thresholds are expressed as integer percentages of "cache-max-size". Least recently used blocks are discarded first. ENVIRONMENT VARIABLES
FILES
VERSION"nbdkit-cache-filter" first appeared in nbdkit 1.2.SEE ALSOnbdkit(1), nbdkit-file-plugin(1), nbdkit-cacheextents-filter(1), nbdkit-readahead-filter(1), nbdkit-truncate-filter(1), nbdkit-filter(3), qemu-img(1).AUTHORSEric BlakeRichard W.M. Jones COPYRIGHTCopyright (C) 2018-2020 Red Hat Inc.LICENSERedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Visit the GSP FreeBSD Man Page Interface. |