1 A guide to benchmarking nbdkit
2 ==============================
8 * The plugin matters! Different plugins have completely different
9 uses, implementations and threading models. There is little point
10 in talking generically about “the performance of nbdkit” without
11 mentioning what plugin you are testing.
13 * The client matters! Does the client support multi-conn? Does the
14 client use the oldstyle or newstyle protocol? Has the client been
15 written with performance in mind? The currently best clients are
16 (a) the Linux kernel (nbd.ko), (b) qemu, and (c) fio. Make sure you
17 are using recent versions and have multi-conn enabled.
19 * Filters affect performance. When benchmarking you should never use
20 filters unless filters are what you are trying to benchmark.
26 FIO is a Flexible I/O tester written by Jens Axboe, and it is the
27 primary tool used for generating the load to test filesystems and
32 (2) Clone and compile fio:
34 https://github.com/axboe/fio
38 ./configure --enable-libnbd
40 (3) Edit the test file in examples/nbd.fio, if required.
42 (4) Run nbdkit and fio together. From the fio source directory:
45 nbdkit -f -U /tmp/socket null 1G --run './fio examples/nbd.fio'
47 If you want to use nbdkit from the source directory too, change
48 ‘nbdkit’ to the path of the wrapper, eg:
51 ../nbdkit/nbdkit -f -U /tmp/socket null 1G --run './fio examples/nbd.fio'
57 * Try adjusting the number of fio jobs (threads).
59 * Try adjusting the number of nbdkit threads (nbdkit -t option).
61 * Use other plugins. Both nbdkit-memory-plugin and nbdkit-file-plugin
62 are important ones to test.
64 * Run nbdkit under perf:
66 perf record -a -g --call-graph=dwarf -- \
67 server/nbdkit -f -U /tmp/socket \
68 ./plugins/null/.libs/nbdkit-null-plugin.so 1G
71 Testing using the Linux kernel client
72 -------------------------------------
74 Step (1) is the same as above - obtain or compile fio.
76 (2) Create the fio configuation file.
78 Create /var/tmp/test.fio containing:
80 ----------------------------------------------------------------------
84 directory=/var/tmp/nbd
92 ----------------------------------------------------------------------
96 From the nbdkit source directory:
99 ./nbdkit -f -U /tmp/socket memory 1G
101 (4) Loop mount the NBD server:
104 nbd-client -C 8 -b 512 -unix /tmp/socket /dev/nbd0
105 mkfs.xfs -f /dev/nbd0
107 mount /dev/nbd0 /var/tmp/nbd
109 (5) Run the fio test:
111 fio /var/tmp/test.fio