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.
80
82 nbdkit(1), nbdkit-filter(3), nbdkit-curl-plugin(1),
83 nbdkit-file-plugin(1), xz(1).
84
86 Richard W.M. Jones
87
89 Copyright (C) 2013-2018 Red Hat Inc.
90
92 Redistribution and use in source and binary forms, with or without
93 modification, are permitted provided that the following conditions are
94 met:
95
96 · Redistributions of source code must retain the above copyright
97 notice, this list of conditions and the following disclaimer.
98
99 · Redistributions in binary form must reproduce the above copyright
100 notice, this list of conditions and the following disclaimer in the
101 documentation and/or other materials provided with the
102 distribution.
103
104 · Neither the name of Red Hat nor the names of its contributors may
105 be used to endorse or promote products derived from this software
106 without specific prior written permission.
107
108 THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
109 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
110 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
111 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
112 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
113 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
114 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
115 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
116 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
117 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
118 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
119
120
121
122nbdkit-1.16.1 2019-12-03 nbdkit-xz-filter(1)