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