Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from gaborigloi/benchmark
Add script for benchmarking
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |