1 # Storage Performance Development Kit
3 [![Build Status](https://travis-ci.org/spdk/spdk.svg?branch=master)](https://travis-ci.org/spdk/spdk)
5 The Storage Performance Development Kit ([SPDK](http://www.spdk.io)) provides a set of tools
6 and libraries for writing high performance, scalable, user-mode storage
7 applications. It achieves high performance by moving all of the necessary
8 drivers into userspace and operating in a polled mode instead of relying on
9 interrupts, which avoids kernel context switches and eliminates interrupt
12 The development kit currently includes:
14 * [NVMe driver](http://www.spdk.io/doc/nvme.html)
15 * [I/OAT (DMA engine) driver](http://www.spdk.io/doc/ioat.html)
16 * [NVMe over Fabrics target](http://www.spdk.io/doc/nvmf.html)
17 * [iSCSI target](http://www.spdk.io/doc/iscsi.html)
18 * [vhost target](http://www.spdk.io/doc/vhost.html)
19 * [Virtio-SCSI driver](http://www.spdk.io/doc/virtio.html)
23 * [Documentation](#documentation)
24 * [Prerequisites](#prerequisites)
25 * [Source Code](#source)
27 * [Unit Tests](#tests)
30 * [Advanced Build Options](#advanced)
31 * [Shared libraries](#shared)
32 * [Hugepages and Device Binding](#huge)
33 * [Example Code](#examples)
34 * [Contributing](#contributing)
36 <a id="documentation"></a>
39 [Doxygen API documentation](http://www.spdk.io/doc/) is available, as
40 well as a [Porting Guide](http://www.spdk.io/doc/porting.html) for porting SPDK to different frameworks
41 and operating systems.
47 git clone https://github.com/spdk/spdk
49 git submodule update --init
52 <a id="prerequisites"></a>
55 The dependencies can be installed automatically by `scripts/pkgdep.sh`.
56 The `scripts/pkgdep.sh` script will automatically install the bare minimum
57 dependencies required to build SPDK.
58 Use `--help` to see information on installing dependencies for optional components
64 <a id="libraries"></a>
75 Note: Make sure you have the matching kernel source in /usr/src/ and
76 also note that CONFIG_COVERAGE option is not available right now
88 ./test/unit/unittest.sh
91 You will see several error messages when running the unit tests, but they are
92 part of the test suite. The final message at the end of the script indicates
98 A [Vagrant](https://www.vagrantup.com/downloads.html) setup is also provided
99 to create a Linux VM with a virtual NVMe controller to get up and running
100 quickly. Currently this has been tested on MacOS, Ubuntu 16.04.2 LTS and
101 Ubuntu 18.04.3 LTS with the VirtualBox and Libvirt provider.
102 The [VirtualBox Extension Pack](https://www.virtualbox.org/wiki/Downloads)
103 or [Vagrant Libvirt] (https://github.com/vagrant-libvirt/vagrant-libvirt) must
104 also be installed in order to get the required NVMe support.
106 Details on the Vagrant setup can be found in the
107 [SPDK Vagrant documentation](http://spdk.io/doc/vagrant.html).
112 The following setup is known to work on AWS:
114 Before running `setup.sh`, run `modprobe vfio-pci`
115 then: `DRIVER_OVERRIDE=vfio-pci ./setup.sh`
117 <a id="advanced"></a>
118 ## Advanced Build Options
120 Optional components and other build-time configuration are controlled by
121 settings in the Makefile configuration file in the root of the repository. `CONFIG`
122 contains the base settings for the `configure` script. This script generates a new
123 file, `mk/config.mk`, that contains final build settings. For advanced configuration,
124 there are a number of additional options to `configure` that may be used, or
125 `mk/config.mk` can simply be created and edited by hand. A description of all
126 possible options is located in `CONFIG`.
128 Boolean (on/off) options are configured with a 'y' (yes) or 'n' (no). For
129 example, this line of `CONFIG` controls whether the optional RDMA (libibverbs)
134 To enable RDMA, this line may be added to `mk/config.mk` with a 'y' instead of
135 'n'. For the majority of options this can be done using the `configure` script.
139 ./configure --with-rdma
142 Additionally, `CONFIG` options may also be overridden on the `make` command
149 Users may wish to use a version of DPDK different from the submodule included
150 in the SPDK repository. Note, this includes the ability to build not only
151 from DPDK sources, but also just with the includes and libraries
152 installed via the dpdk and dpdk-devel packages. To specify an alternate DPDK
153 installation, run configure with the --with-dpdk option. For example:
158 ./configure --with-dpdk=/path/to/dpdk/x86_64-native-linuxapp-gcc
165 ./configure --with-dpdk=/path/to/dpdk/x86_64-native-bsdapp-clang
169 The options specified on the `make` command line take precedence over the
170 values in `mk/config.mk`. This can be useful if you, for example, generate
171 a `mk/config.mk` using the `configure` script and then have one or two
172 options (i.e. debug builds) that you wish to turn on and off frequently.
177 By default, the build of the SPDK yields static libraries against which
178 the SPDK applications and examples are linked.
179 Configure option `--with-shared` provides the ability to produce SPDK shared
180 libraries, in addition to the default static ones. Use of this flag also
181 results in the SPDK executables linked to the shared versions of libraries.
182 SPDK shared libraries by default, are located in `./build/lib`. This includes
183 the single SPDK shared lib encompassing all of the SPDK static libs
184 (`libspdk.so`) as well as individual SPDK shared libs corresponding to each
185 of the SPDK static ones.
187 In order to start a SPDK app linked with SPDK shared libraries, make sure
188 to do the following steps:
190 - run ldconfig specifying the directory containing SPDK shared libraries
191 - provide proper `LD_LIBRARY_PATH`
196 ./configure --with-shared
198 ldconfig -v -n ./build/lib
199 LD_LIBRARY_PATH=./build/lib/ ./build/bin/spdk_tgt
203 ## Hugepages and Device Binding
205 Before running an SPDK application, some hugepages must be allocated and
206 any NVMe and I/OAT devices must be unbound from the native kernel drivers.
207 SPDK includes a script to automate this process on both Linux and FreeBSD.
208 This script should be run as root.
211 sudo scripts/setup.sh
214 Users may wish to configure a specific memory size. Below is an example of
215 configuring 8192MB memory.
218 sudo HUGEMEM=8192 scripts/setup.sh
221 <a id="examples"></a>
224 Example code is located in the examples directory. The examples are compiled
225 automatically as part of the build process. Simply call any of the examples
226 with no arguments to see the help output. You'll likely need to run the examples
227 as a privileged user (root) unless you've done additional configuration
228 to grant your user permission to allocate huge pages and map devices through
231 <a id="contributing"></a>
234 For additional details on how to get more involved in the community, including
235 [contributing code](http://www.spdk.io/development) and participating in discussions and other activities, please
236 refer to [spdk.io](http://www.spdk.io/community)