nbdkit-multi-conn-filter(1) | NBDKIT | nbdkit-multi-conn-filter(1) |
nbdkit-multi-conn-filter - enable, emulate or disable multi-conn
nbdkit --filter=multi-conn plugin [multi-conn-mode=MODE] [multi-conn-track-dirty=LEVEL] [multi-conn-exportname=BOOL] [plugin-args...]
"NBD_FLAG_CAN_MULTI_CONN" ("multi-conn") is an NBD protocol feature that permits multiple clients to connect to the same export simultaneously, guaranteeing that flush operations are consistent across connections. Specifically a sequence of getting a write response, sending and waiting for a flush response, then sending a read request will behave the same whether all three commands shared a single connection or were split among three connections. When an NBD client and server are able to negotiate this feature it can provide significant performance benefits. Conversely if the feature is not advertised, clients must presume that separate connections can cache writes independently (so even after waiting for a flush on one connection, a read on another connection may see stale data from a cache). The NBD standard advises clients not to multiplex commands across connections if the server does not support multi-conn.
nbdkit(1) plugins must normally opt in to multi-conn, after carefully ensuring the implementation meets the consistency requirements. This filter can emulate flush-consistent semantics across multiple connections for plugins that do not advertise this feature.
This filter also has additional modes useful for evaluating performance and correctness of client and plugin multi-conn behaviors.
This filter assumes that multiple connections to a plugin will eventually share data, other than any caching effects. It is not suitable for use with a plugin that produces completely independent data per connection from the same export name. An example of a plugin that must not be used with this filter is nbdkit-tmpdisk-plugin(1).
Additional control over the behavior of client flush commands is possible by combining this filter with nbdkit-fua-filter(1). Note that nbdkit-cache-filter(1) is also able to provide multi-connection flush consistency, but at the expense of an extra layer of caching not needed with this filter.
In other words, this mode advertises multi-conn to the client exactly when the plugin supports or can be made to support multiple simultaneous connections.
This mode assumes that flushing each connection is enough to clear any per-connection cached data, in order to give each connection a consistent view of the image; therefore, this mode advertises multi-conn to the client.
Note that in this mode, a client will be unable to connect if the plugin lacks support for flush, as there would be no way to emulate cross-connection flush consistency.
The filter tracks whether a given connection is dirty (any write, zero, or trim commands since the last flush on the given connection, and any read since the last flush on any other connection); if the connection is clean, a flush command to that connection (whether directly from the client, or replicated by multi-conn-mode=emulate is ignored rather than sent on to the plugin. This mode may result in more flush calls than multi-conn-track-dirty=fast, but in turn is safe to use with multi-conn-mode=plugin.
Provide consistent cross-connection flush semantics on top of a plugin that lacks it natively:
nbdkit --filter=multi-conn vddk /absolute/path/to/file.vmdk
Minimize the number of expensive flush operations performed when utilizing a plugin that has multi-conn consistency from a client that blindly flushes across every connection:
nbdkit --filter=multi-conn file multi-conn-mode=plugin \ multi-conn-track-dirty=fast disk.img
Use "nbdkit --dump-config" to find the location of $filterdir.
"nbdkit-multi-conn-filter" first appeared in nbdkit 1.26.
nbdkit(1), nbdkit-file-plugin(1), nbdkit-vddk-plugin(1), nbdkit-filter(3), nbdkit-cache-filter(1), nbdkit-fua-filter(1), nbdkit-nocache-filter(1), nbdkit-noextents-filter(1), nbdkit-noparallel-filter(1), nbdkit-nozero-filter(1), https://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md
Eric Blake
Copyright (C) 2018-2021 Red Hat Inc.
Redistribution 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.
2023-01-04 | nbdkit-1.32.5 |