forked from evanj/mmap-pause
-
Notifications
You must be signed in to change notification settings - Fork 0
/
diskload.sh
executable file
·36 lines (31 loc) · 907 Bytes
/
diskload.sh
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
#!/bin/bash
#
# Generates disk load to trigger long mmap write pauses
set -e
#set -x
PARALLEL_DD=${PARALLEL_DD:-"2"}
MAX_PARALLEL_DD=${MAX_PARALLEL_DD:-"8"}
# Generate random bytes in case some weird disk system uses compression
echo "generating random source data with $MAX_PARALLEL_DD processes ..."
date
for i in `seq $MAX_PARALLEL_DD`; do
dd if=/dev/urandom of=rnd-1g-$i bs=1M count=1024 &
done
wait
echo "generating parallel load with $PARALLEL_DD dd processes"
for i in `seq 1000000`; do
date
# Drop files from kernel file cache
for j in `seq $PARALLEL_DD`; do
dd of=rnd-1g-$j oflag=nocache conv=notrunc,fdatasync count=0
dd of=rnd-1g-$j-2 oflag=nocache conv=notrunc,fdatasync count=0
done
for j in `seq $PARALLEL_DD`; do
dd if=rnd-1g-$j of=rnd-1g-$j-2 bs=1M &
done
wait
# Sync output files to disk
for j in `seq $PARALLEL_DD`; do
sync rnd-1g-$j-2
done
done