Skip to content

Commit

Permalink
Merge pull request #123 from gaborigloi/benchmark
Browse files Browse the repository at this point in the history
Add script for benchmarking
  • Loading branch information
mseri committed Mar 9, 2018
2 parents 741d037 + d442c3a commit 247e7c2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
Expand Up @@ -18,6 +18,10 @@ clean:
test:
jbuilder runtest

# requires sudo access, nbd-client, and hdparm
benchmark: build
./benchmark.sh

# requires odoc
doc:
jbuilder build @doc
Expand Down
32 changes: 32 additions & 0 deletions benchmark.sh
@@ -0,0 +1,32 @@
#!/bin/bash

# Run this script to benchmark the NBD server using nbd-client and hdparm.

set -eux

dd if=/dev/zero of=/tmp/test bs=1M count=100
_build/default/cli/main.exe serve --no-tls /tmp/test &
SERVER_PROCESS=$!
echo $SERVER_PROCESS

function stop_server {
kill $(jobs -p)
}
trap stop_server EXIT


sudo modprobe nbd

sudo nbd-client -N test localhost /dev/nbd0

function stop_client {
sudo nbd-client -d /dev/nbd0
stop_server
}
trap stop_client EXIT

sudo hdparm -t /dev/nbd0
sudo hdparm -t /dev/nbd0
sudo hdparm -t /dev/nbd0
sudo hdparm -t /dev/nbd0
sudo hdparm -t /dev/nbd0

0 comments on commit 247e7c2

Please sign in to comment.