1nbdkit-xz-plugin(1) NBDKIT nbdkit-xz-plugin(1)
2
3
4
6 nbdkit-xz-plugin - nbdkit xz plugin
7
9 nbdkit xz file=FILENAME.xz
10
12 "nbdkit-xz-plugin" is a file serving plugin for nbdkit(1).
13
14 It serves the named "FILENAME.xz" over NBD, uncompressing it on the
15 fly. The plugin only supports read-only connections.
16
17 GETTING BEST RANDOM ACCESS PERFORMANCE FROM XZ
18 xz(1) files are split into streams and blocks. Most xz files contain
19 only one stream which contains one or more blocks. You can find out
20 how many streams and blocks are in an xz file by doing:
21
22 $ xz --list winxp.img.xz
23 Strms Blocks Compressed Uncompressed Ratio Check Filename
24 1 1 2,100.0 MiB 6,144.0 MiB 0.342 CRC64 winxp.img.xz
25 ↑↑↑ ↑↑↑
26 streams blocks
27
28 xz files are seekable on block boundaries only. Seeking is done by
29 seeking directly to the lower block boundary, then uncompressing data
30 until the precise byte is reached. As uncompressing xz data is slow,
31 to get best random access performance, you must prepare your xz files
32 with many small blocks.
33
34 Use the --block-size option with a small-ish block size. For example
35 this is the same image compressed with a 16 MB block size:
36
37 $ xz --best --block-size=16777216 winxp.img
38 ─────────────────────
39 $ xz --list winxp.img.xz
40 Strms Blocks Compressed Uncompressed Ratio Check Filename
41 1 384 2,120.1 MiB 6,144.0 MiB 0.345 CRC64 winxp.img.xz
42 ↑↑↑
43 blocks
44
45 This file can be accessed randomly. At most 16 MB will have to be
46 uncompressed to seek to any byte.
47
48 As you would expect, xz cannot compress as efficiently when using a
49 smaller block size. The space penalty in the above example is < 1% of
50 the compressed file size.
51
53 file=FILENAME.xz
54 Serve the file named "FILENAME.xz".
55
56 This parameter is required.
57
58 maxblock=SIZE
59 The maximum block size that the plugin will read. The plugin will
60 refuse to read xz files that contain any block larger than this
61 size.
62
63 See the discussion above about creating xz files with small block
64 sizes in order to reduce memory usage and increase performance.
65
66 This parameter is optional. If not specified it defaults to 512M.
67
68 maxdepth=N
69 Maximum number of blocks stored in the LRU block cache.
70
71 This parameter is optional. If not specified it defaults to 8.
72
73 The plugin may allocate up to maximum block size in file * maxdepth
74 bytes of memory per connection.
75
77 nbdkit(1), nbdkit-plugin(3), xz(1).
78
80 Richard W.M. Jones
81
83 Copyright (C) 2013 Red Hat Inc.
84
86 Redistribution and use in source and binary forms, with or without
87 modification, are permitted provided that the following conditions are
88 met:
89
90 · Redistributions of source code must retain the above copyright
91 notice, this list of conditions and the following disclaimer.
92
93 · Redistributions in binary form must reproduce the above copyright
94 notice, this list of conditions and the following disclaimer in the
95 documentation and/or other materials provided with the
96 distribution.
97
98 · Neither the name of Red Hat nor the names of its contributors may
99 be used to endorse or promote products derived from this software
100 without specific prior written permission.
101
102 THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
103 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
104 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
105 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
106 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
107 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
108 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
109 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
110 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
111 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
112 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
113
114
115
116nbdkit-1.6.2 2018-09-18 nbdkit-xz-plugin(1)