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:
13 * [NVMe driver](http://www.spdk.io/doc/nvme.html)
14 * [I/OAT (DMA engine) driver](http://www.spdk.io/doc/ioat.html)
15 * [NVMe over Fabrics target](http://www.spdk.io/doc/nvmf.html)
16 * [iSCSI target](http://www.spdk.io/doc/iscsi.html)
17 * [vhost target](http://www.spdk.io/doc/vhost.html)
18 * [Virtio-SCSI driver](http://www.spdk.io/doc/virtio.html)
22 * [Documentation](#documentation)
23 * [Prerequisites](#prerequisites)
24 * [Source Code](#source)
26 * [Unit Tests](#tests)
28 * [Advanced Build Options](#advanced)
29 * [Shared libraries](#shared)
30 * [Hugepages and Device Binding](#huge)
31 * [Example Code](#examples)
32 * [Contributing](#contributing)
34 <a id="documentation"></a>
37 [Doxygen API documentation](http://www.spdk.io/doc/) is available, as
38 well as a [Porting Guide](http://www.spdk.io/doc/porting.html) for porting SPDK to different frameworks
39 and operating systems.
45 git clone https://github.com/spdk/spdk
47 git submodule update --init
50 <a id="prerequisites"></a>
53 The dependencies can be installed automatically by `scripts/pkgdep.sh`.
59 <a id="libraries"></a>
70 Note: Make sure you have the matching kernel source in /usr/src/ and
71 also note that CONFIG_COVERAGE option is not available right now
83 ./test/unit/unittest.sh
86 You will see several error messages when running the unit tests, but they are
87 part of the test suite. The final message at the end of the script indicates
93 A [Vagrant](https://www.vagrantup.com/downloads.html) setup is also provided
94 to create a Linux VM with a virtual NVMe controller to get up and running
95 quickly. Currently this has only been tested on MacOS and Ubuntu 16.04.2 LTS
96 with the [VirtualBox](https://www.virtualbox.org/wiki/Downloads) provider. The
97 [VirtualBox Extension Pack](https://www.virtualbox.org/wiki/Downloads) must
98 also be installed in order to get the required NVMe support.
100 Details on the Vagrant setup can be found in the
101 [SPDK Vagrant documentation](http://spdk.io/doc/vagrant.html).
103 <a id="advanced"></a>
104 ## Advanced Build Options
106 Optional components and other build-time configuration are controlled by
107 settings in the Makefile configuration file in the root of the repository. `CONFIG`
108 contains the base settings for the `configure` script. This script generates a new
109 file, `mk/config.mk`, that contains final build settings. For advanced configuration,
110 there are a number of additional options to `configure` that may be used, or
111 `mk/config.mk` can simply be created and edited by hand. A description of all
112 possible options is located in `CONFIG`.
114 Boolean (on/off) options are configured with a 'y' (yes) or 'n' (no). For
115 example, this line of `CONFIG` controls whether the optional RDMA (libibverbs)
120 To enable RDMA, this line may be added to `mk/config.mk` with a 'y' instead of
121 'n'. For the majority of options this can be done using the `configure` script.
125 ./configure --with-rdma
128 Additionally, `CONFIG` options may also be overridden on the `make` command
135 Users may wish to use a version of DPDK different from the submodule included
136 in the SPDK repository. Note, this includes the ability to build not only
137 from DPDK sources, but also just with the includes and libraries
138 installed via the dpdk and dpdk-devel packages. To specify an alternate DPDK
139 installation, run configure with the --with-dpdk option. For example:
144 ./configure --with-dpdk=/path/to/dpdk/x86_64-native-linuxapp-gcc
151 ./configure --with-dpdk=/path/to/dpdk/x86_64-native-bsdapp-clang
155 The options specified on the `make` command line take precedence over the
156 values in `mk/config.mk`. This can be useful if you, for example, generate
157 a `mk/config.mk` using the `configure` script and then have one or two
158 options (i.e. debug builds) that you wish to turn on and off frequently.
163 By default, the build of the SPDK yields static libraries against which
164 the SPDK applications and examples are linked.
165 Configure option `--with-shared` provides the ability to produce SPDK shared
166 libraries, in addition to the default static ones. Use of this flag also
167 results in the SPDK executables linked to the shared versions of libraries.
168 SPDK shared libraries by default, are located in `./build/lib`. This includes
169 the single SPDK shared lib encompassing all of the SPDK static libs
170 (`libspdk.so`) as well as individual SPDK shared libs corresponding to each
171 of the SPDK static ones.
173 In order to start a SPDK app linked with SPDK shared libraries, make sure
174 to do the following steps:
175 - run ldconfig specifying the directory containing SPDK shared libraries
176 - provide proper `LD_LIBRARY_PATH`
181 ./configure --with-shared
183 ldconfig -v -n ./build/lib
184 LD_LIBRARY_PATH=./build/lib/ ./app/spdk_tgt/spdk_tgt
188 ## Hugepages and Device Binding
190 Before running an SPDK application, some hugepages must be allocated and
191 any NVMe and I/OAT devices must be unbound from the native kernel drivers.
192 SPDK includes a script to automate this process on both Linux and FreeBSD.
193 This script should be run as root.
196 sudo scripts/setup.sh
199 Users may wish to configure a specific memory size. Below is an example of
200 configuring 8192MB memory.
203 sudo HUGEMEM=8192 scripts/setup.sh
206 <a id="examples"></a>
209 Example code is located in the examples directory. The examples are compiled
210 automatically as part of the build process. Simply call any of the examples
211 with no arguments to see the help output. You'll likely need to run the examples
212 as a privileged user (root) unless you've done additional configuration
213 to grant your user permission to allocate huge pages and map devices through
216 <a id="contributing"></a>
219 For additional details on how to get more involved in the community, including
220 [contributing code](http://www.spdk.io/development) and participating in discussions and other activities, please
221 refer to [spdk.io](http://www.spdk.io/community)