forked from richrein/cassandra.bin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbenchmark_storage_quick_dd
More file actions
executable file
·55 lines (45 loc) · 1.97 KB
/
Copy pathbenchmark_storage_quick_dd
File metadata and controls
executable file
·55 lines (45 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
#
# Trivial disk write and read test.
# use FIO for a more useful test
#
# test should be big enough to flood the buffering of the system and use the direct io flag if you dd supports ig
BLOCKSIZE=10240000
BLOCKCOUNT=150
SUDO=sudo
export thisCommand=`basename $0`
if [ x"$1" == x ]; then
echo "Error: missing directory name"
echo "Usage: $thisCommand dir"
exit 1
else
dirName="$1"; shift
if [ ! -d "$dirName" ]; then echo "No such dir: $dirName"; exit 1; fi
fi
trap "$SUDO rm -f $dirName/loadtest.removeme" EXIT
set -x
:
: Write test
:
time $SUDO dd if=/dev/zero of="$dirName/loadtest.removeme" bs=$BLOCKSIZE count=$BLOCKCOUNT iflag=fullblock oflag=direct # always use direct io is supported by your dd
:
: Read test
:
time $SUDO dd if="$dirName/loadtest.removeme" bs=$BLOCKSIZE count=$BLOCKCOUNT iflag=fullblock iflag=direct >&- # always use direct io is supported by your dd
# Todo:
# From: http://askubuntu.com/questions/122857/can-i-copy-large-files-faster-without-using-the-file-cache
#
# There is the nocache utility, which can prepended to a command like ionice and nice.
# It works by preloading a library which adds posix_fadvise with the POSIX_FADV_DONTNEED flag to any open calls.
#
# In simple terms, it advises the kernel that caching is not needed for that particular file; the kernel will then
# normally not cache the file. See here for the technical details.
#
# It does wonders for any huge copy jobs, e. g. if you want to backup a multi terabyte disk in the background
# with the least possible impact on you running system, you can do something along
# > nice -n19 ionice -c3 nocache cp -a /vol /vol2.
#
# A package will be available in Ubuntu 13.10 and up.
# If you are on a previous release you can either install the 13.10 package or opt for this 12.04 backport by François Marier.
# See: https://launchpad.net/ubuntu/+source/nocache
# And: https://launchpad.net/~fmarier/+archive/ubuntu/ppa/+index?field.series_filter=precise&batch=75&memo=75&start=75