-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisk-read-old-file-ra256.bash
49 lines (36 loc) · 1.11 KB
/
disk-read-old-file-ra256.bash
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
# test size in megabytes
size=400
# timeout fast to limit distraction for other measurements
timeout=30
key=disk-read-old-file-ra256
readahead=256
if [ ! -f /mnt/data/zeros_0 ]; then
echo "Test files not found"
exit 1
fi
# try to avoid the Ceph caches by reading from the least recently accessed file
file=$(ls -u -t /mnt/data/zeros_* | tail -n 1)
date
echo "Measuring $key"
original_readahead=$(/sbin/blockdev --getra /dev/vdb)
echo "Setting readahead to $readahead"
/sbin/blockdev --setra $readahead /dev/vdb
/sbin/blockdev --getra /dev/vdb
t0=$(date +%s%N)
timeout $timeout dd if=$file of=/dev/null bs=1M count=$size 2>&1
exit_val=$?
if [ $exit_val -eq 0 ] ; then
t1=$(date +%s%N)
time=$(echo "($t1 - $t0) / 10^9" | bc -l)
bytes=$(echo "$size * 10^6" | bc -l)
value=$(echo "$bytes / $time" | bc -l)
else
echo "Timeout"
value=0
fi
echo "Restore readahead to $original_readahead"
/sbin/blockdev --setra $original_readahead /dev/vdb
/sbin/blockdev --getra /dev/vdb
echo $bytes $time $value
curl -i -XPOST 'http://localhost:8086/write?db=db' --data-binary "$key value=$value $t0"
echo $key $t0 $value