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