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 about "the performance of nbdkit" without mentioning what
11 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. Make sure you are using
17 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.
23 Testing using Linux kernel client and fio
24 -----------------------------------------
26 (1) Install Jens Axboe's fio (Flexible I/O tester)
28 https://github.com/axboe/fio
30 (2) Create the fio configuation file:
32 Create /var/tmp/test.fio containing:
34 ----------------------------------------------------------------------
38 directory=/var/tmp/nbd
46 ----------------------------------------------------------------------
50 From the nbdkit source directory:
53 ./nbdkit -f -U /tmp/sock memory 1G
55 (4) Loop mount the NBD server:
58 nbd-client -C 8 -b 512 -unix /tmp/sock /dev/nbd0
61 mount /dev/nbd0 /var/tmp/nbd
71 * Try turning multi-conn on or off or adjusting the number of
72 connections. See the nbd-client -C option.
74 * Try adjusting the number of fio threads.
76 * Run nbdkit under perf:
78 perf record -a -g --call-graph=dwarf -- \
79 server/nbdkit -f -U /tmp/sock \
80 ./plugins/memory/.libs/nbdkit-memory-plugin.so 1G
82 * Use other plugins. nbdkit-file-plugin is an important one to test.
83 It might also be worth devising a test using a readonly plugin.
89 * Write an NBD I/O engine for fio.