protocol More tracing of meta context handshakes
[nbdkit/ericb.git] / BENCHMARKING
blobe1aeee7dad73a98089bf9bff7e84136f45d72f2d
1 A guide to benchmarking nbdkit
2 ==============================
5 General comments
6 ----------------
8 * The plugin matters!  Different plugins have completely difference
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 old 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.  Also make sure you are
17   using recent versions.
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 ----------------------------------------------------------------------
35 [test]
36 rw=randrw
37 size=64m
38 directory=/var/tmp/nbd
39 ioengine=libaio
40 iodepth=4
41 direct=1
42 numjobs=8
43 group_reporting
44 time_based
45 runtime=120
46 ----------------------------------------------------------------------
48 (3) Run nbdkit.
50 From the nbdkit source directory:
52 rm /tmp/sock
53 ./nbdkit -f -U /tmp/sock memory size=1G
55 (4) Loop mount the NBD server:
57 modprobe nbd
58 nbd-client -C 8 -b 512 -unix /tmp/sock /dev/nbd0
59 mkfs.xfs -f /dev/nbd0
60 mkdir /var/tmp/nbd
61 mount /dev/nbd0 /var/tmp/nbd
63 (5) Run the fio test:
65 fio /var/tmp/test.fio
68 Variations
69 ----------
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 size=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.
85 * Someone needs to write an NBD I/O engine for fio.