mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 19:28:53 +03:00
OpenZFS 7290 - ZFS test suite needs to control what utilities it can run
Authored by: John Wren Kennedy <john.kennedy@delphix.com> Reviewed by: Dan Kimmel <dan.kimmel@delphix.com> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Dan McDonald <danmcd@omniti.com> Approved by: Gordon Ross <gordon.w.ross@gmail.com> Ported-by: Brian Behlendorf <behlendorf1@llnl.gov> Ported-by: George Melikov <mail@gmelikov.ru> Porting Notes: - Utilities which aren't available under Linux have been removed. - Because of sudo's default secure path behavior PATH must be explicitly reset at the top of libtest.shlib. This avoids the need for all users to customize secure path on their system. - Updated ZoL infrastructure to manage constrained path - Updated all test cases - Check permissions for usergroup tests - When testing in-tree create links under bin/ - Update fault cleanup such that missing files during cleanup aren't fatal. - Configure su environment with constrained path OpenZFS-issue: https://www.illumos.org/issues/7290 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/1d32ba6 Closes #5903
This commit is contained in:
committed by
Brian Behlendorf
parent
7a4500a101
commit
c1d9abf905
@@ -10,7 +10,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2015 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2015, 2016 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2016, Intel Corporation.
|
||||
#
|
||||
|
||||
@@ -34,7 +34,7 @@ function get_sync_str
|
||||
|
||||
[[ $sync -eq 0 ]] && sync_str='async'
|
||||
[[ $sync -eq 1 ]] && sync_str='sync'
|
||||
$ECHO $sync_str
|
||||
echo $sync_str
|
||||
}
|
||||
|
||||
#
|
||||
@@ -67,14 +67,14 @@ function do_fio_run
|
||||
|
||||
if $do_recreate; then
|
||||
recreate_perfpool
|
||||
log_must $ZFS create $PERF_FS_OPTS \
|
||||
log_must zfs create $PERF_FS_OPTS \
|
||||
$TESTFS
|
||||
fi
|
||||
|
||||
if $clear_cache; then
|
||||
# Clear the ARC
|
||||
$ZPOOL export $PERFPOOL
|
||||
$ZPOOL import $PERFPOOL
|
||||
zpool export $PERFPOOL
|
||||
zpool import $PERFPOOL
|
||||
fi
|
||||
|
||||
export RUNTIME=$PERF_RUNTIME
|
||||
@@ -82,7 +82,7 @@ function do_fio_run
|
||||
export NUMJOBS=$threads
|
||||
export SYNC_TYPE=$sync
|
||||
export BLOCKSIZE=$iosize
|
||||
$SYNC
|
||||
sync
|
||||
|
||||
# Start the data collection
|
||||
do_collect_scripts $threads $sync $iosize
|
||||
@@ -91,12 +91,12 @@ function do_fio_run
|
||||
typeset suffix="$sync_str.$iosize-ios.$threads-threads"
|
||||
|
||||
# Define output file
|
||||
typeset logbase="$(get_perf_output_dir)/$($BASENAME \
|
||||
typeset logbase="$(get_perf_output_dir)/$(basename \
|
||||
$SUDO_COMMAND)"
|
||||
typeset outfile="$logbase.fio.$suffix"
|
||||
|
||||
# Start the load
|
||||
log_must $FIO --output $outfile $FIO_SCRIPTS/$script
|
||||
log_must fio --output $outfile $FIO_SCRIPTS/$script
|
||||
done
|
||||
done
|
||||
done
|
||||
@@ -124,17 +124,17 @@ function do_collect_scripts
|
||||
typeset oIFS=$IFS
|
||||
IFS=','
|
||||
for item in $PERF_COLLECT_SCRIPTS; do
|
||||
collect_scripts+=($($ECHO $item | $SED 's/^ *//g'))
|
||||
collect_scripts+=($(echo $item | sed 's/^ *//g'))
|
||||
done
|
||||
IFS=$oIFS
|
||||
|
||||
typeset idx=0
|
||||
while [[ $idx -lt "${#collect_scripts[@]}" ]]; do
|
||||
typeset logbase="$(get_perf_output_dir)/$($BASENAME \
|
||||
typeset logbase="$(get_perf_output_dir)/$(basename \
|
||||
$SUDO_COMMAND)"
|
||||
typeset outfile="$logbase.${collect_scripts[$idx + 1]}.$suffix"
|
||||
|
||||
$TIMEOUT $PERF_RUNTIME ${collect_scripts[$idx]} >$outfile 2>&1 &
|
||||
timeout $PERF_RUNTIME ${collect_scripts[$idx]} >$outfile 2>&1 &
|
||||
((idx += 2))
|
||||
done
|
||||
|
||||
@@ -147,9 +147,9 @@ function do_collect_scripts
|
||||
function get_perf_output_dir
|
||||
{
|
||||
typeset dir="$(pwd)/perf_data"
|
||||
[[ -d $dir ]] || $MKDIR -p $dir
|
||||
[[ -d $dir ]] || mkdir -p $dir
|
||||
|
||||
$ECHO $dir
|
||||
echo $dir
|
||||
}
|
||||
|
||||
#
|
||||
@@ -167,14 +167,14 @@ function recreate_perfpool
|
||||
if [[ -n $PERFPOOL_CREATE_CMD ]]; then
|
||||
log_must $PERFPOOL_CREATE_CMD
|
||||
else
|
||||
log_must eval "$ZPOOL create -f $PERFPOOL $DISKS"
|
||||
log_must eval "zpool create -f $PERFPOOL $DISKS"
|
||||
fi
|
||||
}
|
||||
|
||||
function get_max_arc_size
|
||||
{
|
||||
if is_linux; then
|
||||
typeset -l max_arc_size=`$AWK '$1 == "c_max" { print $3 }' \
|
||||
typeset -l max_arc_size=`awk '$1 == "c_max" { print $3 }' \
|
||||
/proc/spl/kstat/zfs/arcstats`
|
||||
else
|
||||
typeset -l max_arc_size=$(dtrace -qn 'BEGIN {
|
||||
@@ -185,7 +185,7 @@ function get_max_arc_size
|
||||
|
||||
[[ $? -eq 0 ]] || log_fail "get_max_arc_size failed"
|
||||
|
||||
$ECHO $max_arc_size
|
||||
echo $max_arc_size
|
||||
}
|
||||
|
||||
# Create a file with some information about how this system is configured.
|
||||
@@ -193,26 +193,26 @@ function get_system_config
|
||||
{
|
||||
typeset config=$PERF_DATA_DIR/$1
|
||||
|
||||
$ECHO "{" >>$config
|
||||
echo "{" >>$config
|
||||
if is_linux; then
|
||||
$ECHO " \"ncpus\": \"$($NPROC --all)\"," >>$config
|
||||
$ECHO " \"physmem\": \"$($FREE -b | \
|
||||
$AWK '$1 == "Mem:" { print $2 }')\"," >>$config
|
||||
$ECHO " \"c_max\": \"$(get_max_arc_size)\"," >>$config
|
||||
$ECHO " \"hostname\": \"$($UNAME -n)\"," >>$config
|
||||
$ECHO " \"kernel version\": \"$($UNAME -sr)\"," >>$config
|
||||
echo " \"ncpus\": \"$(nproc --all)\"," >>$config
|
||||
echo " \"physmem\": \"$(free -b | \
|
||||
awk '$1 == "Mem:" { print $2 }')\"," >>$config
|
||||
echo " \"c_max\": \"$(get_max_arc_size)\"," >>$config
|
||||
echo " \"hostname\": \"$(uname -n)\"," >>$config
|
||||
echo " \"kernel version\": \"$(uname -sr)\"," >>$config
|
||||
else
|
||||
$DTRACE -qn 'BEGIN{
|
||||
dtrace -qn 'BEGIN{
|
||||
printf(" \"ncpus\": %d,\n", `ncpus);
|
||||
printf(" \"physmem\": %u,\n", `physmem * `_pagesize);
|
||||
printf(" \"c_max\": %u,\n", `arc_stats.arcstat_c_max.value.ui64);
|
||||
printf(" \"kmem_flags\": \"0x%x\",", `kmem_flags);
|
||||
exit(0)}' >>$config
|
||||
$ECHO " \"hostname\": \"$($UNAME -n)\"," >>$config
|
||||
$ECHO " \"kernel version\": \"$($UNAME -v)\"," >>$config
|
||||
echo " \"hostname\": \"$(uname -n)\"," >>$config
|
||||
echo " \"kernel version\": \"$(uname -v)\"," >>$config
|
||||
fi
|
||||
if is_linux; then
|
||||
$LSBLK -dino NAME,SIZE | $AWK 'BEGIN {
|
||||
lsblk -dino NAME,SIZE | awk 'BEGIN {
|
||||
printf(" \"disks\": {\n"); first = 1}
|
||||
{disk = $1} {size = $2;
|
||||
if (first != 1) {printf(",\n")} else {first = 0}
|
||||
@@ -246,7 +246,7 @@ function get_system_config
|
||||
done
|
||||
printf "\n }\n" >>$config
|
||||
else
|
||||
$IOSTAT -En | $AWK 'BEGIN {
|
||||
iostat -En | awk 'BEGIN {
|
||||
printf(" \"disks\": {\n"); first = 1}
|
||||
/^c/ {disk = $1}
|
||||
/^Size: [^0]/ {size = $2;
|
||||
@@ -254,13 +254,13 @@ function get_system_config
|
||||
printf(" \"%s\": \"%s\"", disk, size)}
|
||||
END {printf("\n },\n")}' >>$config
|
||||
|
||||
$SED -n 's/^set \(.*\)[ ]=[ ]\(.*\)/\1=\2/p' /etc/system | \
|
||||
$AWK -F= 'BEGIN {printf(" \"system\": {\n"); first = 1}
|
||||
sed -n 's/^set \(.*\)[ ]=[ ]\(.*\)/\1=\2/p' /etc/system | \
|
||||
awk -F= 'BEGIN {printf(" \"system\": {\n"); first = 1}
|
||||
{if (first != 1) {printf(",\n")} else {first = 0};
|
||||
printf(" \"%s\": %s", $1, $2)}
|
||||
END {printf("\n }\n")}' >>$config
|
||||
fi
|
||||
$ECHO "}" >>$config
|
||||
echo "}" >>$config
|
||||
}
|
||||
|
||||
function num_jobs_by_cpu
|
||||
@@ -268,13 +268,13 @@ function num_jobs_by_cpu
|
||||
if is_linux; then
|
||||
typeset ncpu=$($NPROC --all)
|
||||
else
|
||||
typeset ncpu=$($PSRINFO | $WC -l)
|
||||
typeset ncpu=$(psrinfo | $WC -l)
|
||||
fi
|
||||
typeset num_jobs=$ncpu
|
||||
|
||||
[[ $ncpu -gt 8 ]] && num_jobs=$($ECHO "$ncpu * 3 / 4" | $BC)
|
||||
[[ $ncpu -gt 8 ]] && num_jobs=$(echo "$ncpu * 3 / 4" | bc)
|
||||
|
||||
$ECHO $num_jobs
|
||||
echo $num_jobs
|
||||
}
|
||||
|
||||
#
|
||||
@@ -287,28 +287,28 @@ function pool_to_lun_list
|
||||
typeset lun_list=':'
|
||||
|
||||
if is_linux; then
|
||||
ctds=$($ZPOOL list -HLv $pool | \
|
||||
$AWK '/sd[a-z]*|loop[0-9]*|dm-[0-9]*/ {print $1}')
|
||||
ctds=$(zpool list -HLv $pool | \
|
||||
awk '/sd[a-z]*|loop[0-9]*|dm-[0-9]*/ {print $1}')
|
||||
|
||||
for ctd in $ctds; do
|
||||
lun_list="$lun_list$ctd:"
|
||||
done
|
||||
else
|
||||
ctds=$($ZPOOL list -v $pool |
|
||||
$AWK '/c[0-9]*t[0-9a-fA-F]*d[0-9]*/ {print $1}')
|
||||
ctds=$(zpool list -v $pool |
|
||||
awk '/c[0-9]*t[0-9a-fA-F]*d[0-9]*/ {print $1}')
|
||||
|
||||
for ctd in $ctds; do
|
||||
# Get the device name as it appears in /etc/path_to_inst
|
||||
devname=$($READLINK -f /dev/dsk/${ctd}s0 | $SED -n \
|
||||
devname=$(readlink -f /dev/dsk/${ctd}s0 | sed -n \
|
||||
's/\/devices\([^:]*\):.*/\1/p')
|
||||
# Add a string composed of the driver name and instance
|
||||
# number to the list for comparison with dev_statname.
|
||||
lun=$($SED 's/"//g' /etc/path_to_inst | $GREP \
|
||||
$devname | $AWK '{print $3$2}')
|
||||
lun=$(sed 's/"//g' /etc/path_to_inst | grep \
|
||||
$devname | awk '{print $3$2}')
|
||||
un_list="$lun_list$lun:"
|
||||
done
|
||||
fi
|
||||
$ECHO $lun_list
|
||||
echo $lun_list
|
||||
}
|
||||
|
||||
# Create a perf_data directory to hold performance statistics and
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2015 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2015, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
@@ -32,10 +32,10 @@
|
||||
function cleanup
|
||||
{
|
||||
# kill fio and iostat
|
||||
$PKILL ${FIO##*/}
|
||||
$PKILL ${IOSTAT##*/}
|
||||
log_must_busy $ZFS destroy $TESTFS
|
||||
log_must_busy $ZPOOL destroy $PERFPOOL
|
||||
pkill ${fio##*/}
|
||||
pkill ${iostat##*/}
|
||||
log_must_busy zfs destroy $TESTFS
|
||||
log_must_busy zpool destroy $PERFPOOL
|
||||
}
|
||||
|
||||
trap "log_fail \"Measure IO stats during random read load\"" SIGTERM
|
||||
@@ -45,7 +45,7 @@ log_onexit cleanup
|
||||
|
||||
export TESTFS=$PERFPOOL/testfs
|
||||
recreate_perfpool
|
||||
log_must $ZFS create $PERF_FS_OPTS $TESTFS
|
||||
log_must zfs create $PERF_FS_OPTS $TESTFS
|
||||
|
||||
# Aim to fill the pool to 50% capacity while accounting for a 3x compressratio.
|
||||
export TOTAL_SIZE=$(($(get_prop avail $TESTFS) * 3 / 2))
|
||||
@@ -70,20 +70,20 @@ fi
|
||||
# of the available files.
|
||||
export NUMJOBS=$(get_max $PERF_NTHREADS)
|
||||
export FILE_SIZE=$((TOTAL_SIZE / NUMJOBS))
|
||||
log_must $FIO $FIO_SCRIPTS/mkfiles.fio
|
||||
log_must fio $FIO_SCRIPTS/mkfiles.fio
|
||||
|
||||
# Set up the scripts and output files that will log performance data.
|
||||
lun_list=$(pool_to_lun_list $PERFPOOL)
|
||||
log_note "Collecting backend IO stats with lun list $lun_list"
|
||||
if is_linux; then
|
||||
export collect_scripts=("$ZPOOL iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
|
||||
"$VMSTAT 1" "vmstat" "$MPSTAT -P ALL 1" "mpstat" "$IOSTAT -dxyz 1"
|
||||
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
|
||||
"vmstat 1" "vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1"
|
||||
"iostat")
|
||||
else
|
||||
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
|
||||
"$VMSTAT 1" "vmstat" "$MPSTAT 1" "mpstat" "$IOSTAT -xcnz 1" "iostat")
|
||||
"vmstat 1" "vmstat" "mpstat 1" "mpstat" "iostat -xcnz 1" "iostat")
|
||||
fi
|
||||
|
||||
log_note "Random reads with $PERF_RUNTYPE settings"
|
||||
do_fio_run random_reads.fio $FALSE $TRUE
|
||||
do_fio_run random_reads.fio false true
|
||||
log_pass "Measure IO stats during random read load"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2015 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2015, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
@@ -32,10 +32,10 @@
|
||||
function cleanup
|
||||
{
|
||||
# kill fio and iostat
|
||||
$PKILL ${FIO##*/}
|
||||
$PKILL ${IOSTAT##*/}
|
||||
log_must_busy $ZFS destroy $TESTFS
|
||||
log_must_busy $ZPOOL destroy $PERFPOOL
|
||||
pkill ${fio##*/}
|
||||
pkill ${iostat##*/}
|
||||
log_must_busy zfs destroy $TESTFS
|
||||
log_must_busy zpool destroy $PERFPOOL
|
||||
}
|
||||
|
||||
trap "log_fail \"Measure IO stats during random read load\"" SIGTERM
|
||||
@@ -45,7 +45,7 @@ log_onexit cleanup
|
||||
|
||||
export TESTFS=$PERFPOOL/testfs
|
||||
recreate_perfpool
|
||||
log_must $ZFS create $PERF_FS_OPTS $TESTFS
|
||||
log_must zfs create $PERF_FS_OPTS $TESTFS
|
||||
|
||||
# Aim to fill the pool to 50% capacity while accounting for a 3x compressratio.
|
||||
export TOTAL_SIZE=$(($(get_prop avail $TESTFS) * 3 / 2))
|
||||
@@ -70,20 +70,20 @@ fi
|
||||
# a subset of the available files.
|
||||
export NUMJOBS=$(get_max $PERF_NTHREADS)
|
||||
export FILE_SIZE=$((TOTAL_SIZE / NUMJOBS))
|
||||
log_must $FIO $FIO_SCRIPTS/mkfiles.fio
|
||||
log_must fio $FIO_SCRIPTS/mkfiles.fio
|
||||
|
||||
# Set up the scripts and output files that will log performance data.
|
||||
lun_list=$(pool_to_lun_list $PERFPOOL)
|
||||
log_note "Collecting backend IO stats with lun list $lun_list"
|
||||
if is_linux; then
|
||||
export collect_scripts=("$ZPOOL iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
|
||||
"$VMSTAT 1" "vmstat" "$MPSTAT -P ALL 1" "mpstat" "$IOSTAT -dxyz 1"
|
||||
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
|
||||
"vmstat 1" "vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1"
|
||||
"iostat")
|
||||
else
|
||||
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
|
||||
"$VMSTAT 1" "vmstat" "$MPSTAT 1" "mpstat" "$IOSTAT -xcnz 1" "iostat")
|
||||
"vmstat 1" "vmstat" "mpstat 1" "mpstat" "iostat -xcnz 1" "iostat")
|
||||
fi
|
||||
|
||||
log_note "Random reads and writes with $PERF_RUNTYPE settings"
|
||||
do_fio_run random_readwrite.fio $FALSE $TRUE
|
||||
do_fio_run random_readwrite.fio false true
|
||||
log_pass "Measure IO stats during random read and write load"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2015 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2015, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
@@ -31,10 +31,10 @@
|
||||
function cleanup
|
||||
{
|
||||
# kill fio and iostat
|
||||
$PKILL ${FIO##*/}
|
||||
$PKILL ${IOSTAT##*/}
|
||||
log_must_busy $ZFS destroy $TESTFS
|
||||
log_must_busy $ZPOOL destroy $PERFPOOL
|
||||
pkill ${fio##*/}
|
||||
pkill ${iostat##*/}
|
||||
log_must_busy zfs destroy $TESTFS
|
||||
log_must_busy zpool destroy $PERFPOOL
|
||||
}
|
||||
|
||||
trap "log_fail \"Measure IO stats during random read load\"" SIGTERM
|
||||
@@ -44,7 +44,7 @@ log_onexit cleanup
|
||||
|
||||
export TESTFS=$PERFPOOL/testfs
|
||||
recreate_perfpool
|
||||
log_must $ZFS create $PERF_FS_OPTS $TESTFS
|
||||
log_must zfs create $PERF_FS_OPTS $TESTFS
|
||||
|
||||
# Aim to fill the pool to 50% capacity while accounting for a 3x compressratio.
|
||||
export TOTAL_SIZE=$(($(get_prop avail $TESTFS) * 3 / 2))
|
||||
@@ -68,14 +68,14 @@ fi
|
||||
lun_list=$(pool_to_lun_list $PERFPOOL)
|
||||
log_note "Collecting backend IO stats with lun list $lun_list"
|
||||
if is_linux; then
|
||||
export collect_scripts=("$ZPOOL iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
|
||||
"$VMSTAT 1" "vmstat" "$MPSTAT -P ALL 1" "mpstat" "$IOSTAT -dxyz 1"
|
||||
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
|
||||
"vmstat 1" "vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1"
|
||||
"iostat")
|
||||
else
|
||||
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
|
||||
"$VMSTAT 1" "vmstat" "$MPSTAT 1" "mpstat" "$IOSTAT -xcnz 1" "iostat")
|
||||
"vmstat 1" "vmstat" "mpstat 1" "mpstat" "iostat -xcnz 1" "iostat")
|
||||
fi
|
||||
|
||||
log_note "Random writes with $PERF_RUNTYPE settings"
|
||||
do_fio_run random_writes.fio $TRUE $FALSE
|
||||
do_fio_run random_writes.fio true false
|
||||
log_pass "Measure IO stats during random write load"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2015 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2015, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
@@ -32,10 +32,10 @@
|
||||
function cleanup
|
||||
{
|
||||
# kill fio and iostat
|
||||
$PKILL ${FIO##*/}
|
||||
$PKILL ${IOSTAT##*/}
|
||||
log_must_busy $ZFS destroy $TESTFS
|
||||
log_must_busy $ZPOOL destroy $PERFPOOL
|
||||
pkill ${fio##*/}
|
||||
pkill ${iostat##*/}
|
||||
log_must_busy zfs destroy $TESTFS
|
||||
log_must_busy zpool destroy $PERFPOOL
|
||||
}
|
||||
|
||||
trap "log_fail \"Measure IO stats during random read load\"" SIGTERM
|
||||
@@ -45,7 +45,7 @@ log_onexit cleanup
|
||||
|
||||
export TESTFS=$PERFPOOL/testfs
|
||||
recreate_perfpool
|
||||
log_must $ZFS create $PERF_FS_OPTS $TESTFS
|
||||
log_must zfs create $PERF_FS_OPTS $TESTFS
|
||||
|
||||
# Aim to fill the pool to 50% capacity while accounting for a 3x compressratio.
|
||||
export TOTAL_SIZE=$(($(get_prop avail $TESTFS) * 3 / 2))
|
||||
@@ -70,21 +70,21 @@ fi
|
||||
# of the available files.
|
||||
export NUMJOBS=$(get_max $PERF_NTHREADS)
|
||||
export FILE_SIZE=$((TOTAL_SIZE / NUMJOBS))
|
||||
log_must $FIO $FIO_SCRIPTS/mkfiles.fio
|
||||
log_must fio $FIO_SCRIPTS/mkfiles.fio
|
||||
|
||||
# Set up the scripts and output files that will log performance data.
|
||||
lun_list=$(pool_to_lun_list $PERFPOOL)
|
||||
log_note "Collecting backend IO stats with lun list $lun_list"
|
||||
if is_linux; then
|
||||
export collect_scripts=("$ZPOOL iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
|
||||
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch" "$VMSTAT 1"
|
||||
"vmstat" "$MPSTAT -P ALL 1" "mpstat" "$IOSTAT -dxyz 1" "iostat")
|
||||
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
|
||||
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch" "vmstat 1"
|
||||
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat")
|
||||
else
|
||||
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
|
||||
"$PERF_SCRIPTS/prefetch_io.d $PERFPOOL 1" "prefetch" "$VMSTAT 1"
|
||||
"vmstat" "$MPSTAT 1" "mpstat" "$IOSTAT -xcnz 1" "iostat")
|
||||
"$PERF_SCRIPTS/prefetch_io.d $PERFPOOL 1" "prefetch" "vmstat 1" "vmstat"
|
||||
"mpstat 1" "mpstat" "iostat -xcnz 1" "iostat")
|
||||
fi
|
||||
|
||||
log_note "Sequential reads with $PERF_RUNTYPE settings"
|
||||
do_fio_run sequential_reads.fio $FALSE $TRUE
|
||||
do_fio_run sequential_reads.fio false true
|
||||
log_pass "Measure IO stats during sequential read load"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2015 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2015, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
@@ -31,10 +31,10 @@
|
||||
function cleanup
|
||||
{
|
||||
# kill fio and iostat
|
||||
$PKILL ${FIO##*/}
|
||||
$PKILL ${IOSTAT##*/}
|
||||
log_must_busy $ZFS destroy $TESTFS
|
||||
log_must_busy $ZPOOL destroy $PERFPOOL
|
||||
pkill ${fio##*/}
|
||||
pkill ${iostat##*/}
|
||||
log_must_busy zfs destroy $TESTFS
|
||||
log_must_busy zpool destroy $PERFPOOL
|
||||
}
|
||||
|
||||
trap "log_fail \"Measure IO stats during random read load\"" SIGTERM
|
||||
@@ -44,7 +44,7 @@ log_onexit cleanup
|
||||
|
||||
export TESTFS=$PERFPOOL/testfs
|
||||
recreate_perfpool
|
||||
log_must $ZFS create $PERF_FS_OPTS $TESTFS
|
||||
log_must zfs create $PERF_FS_OPTS $TESTFS
|
||||
|
||||
# Make sure the working set can be cached in the arc. Aim for 1/2 of arc.
|
||||
export TOTAL_SIZE=$(($(get_max_arc_size) / 2))
|
||||
@@ -69,21 +69,21 @@ fi
|
||||
# of the available files.
|
||||
export NUMJOBS=$(get_max $PERF_NTHREADS)
|
||||
export FILE_SIZE=$((TOTAL_SIZE / NUMJOBS))
|
||||
log_must $FIO $FIO_SCRIPTS/mkfiles.fio
|
||||
log_must fio $FIO_SCRIPTS/mkfiles.fio
|
||||
|
||||
# Set up the scripts and output files that will log performance data.
|
||||
lun_list=$(pool_to_lun_list $PERFPOOL)
|
||||
log_note "Collecting backend IO stats with lun list $lun_list"
|
||||
if is_linux; then
|
||||
export collect_scripts=("$ZPOOL iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
|
||||
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch" "$VMSTAT 1"
|
||||
"vmstat" "$MPSTAT -P ALL 1" "mpstat" "$IOSTAT -dxyz 1" "iostat")
|
||||
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
|
||||
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch" "vmstat 1"
|
||||
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat")
|
||||
else
|
||||
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
|
||||
"$PERF_SCRIPTS/prefetch_io.d $PERFPOOL 1" "prefetch" "$VMSTAT 1"
|
||||
"vmstat" "$MPSTAT 1" "mpstat" "$IOSTAT -xcnz 1" "iostat")
|
||||
"$PERF_SCRIPTS/prefetch_io.d $PERFPOOL 1" "prefetch" "vmstat 1" "vmstat"
|
||||
"mpstat 1" "mpstat" "iostat -xcnz 1" "iostat")
|
||||
fi
|
||||
|
||||
log_note "Sequential cached reads with $PERF_RUNTYPE settings"
|
||||
do_fio_run sequential_reads.fio $FALSE $FALSE
|
||||
do_fio_run sequential_reads.fio false false
|
||||
log_pass "Measure IO stats during sequential cached read load"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2015 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2015, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
@@ -37,10 +37,10 @@
|
||||
function cleanup
|
||||
{
|
||||
# kill fio and iostat
|
||||
$PKILL ${FIO##*/}
|
||||
$PKILL ${IOSTAT##*/}
|
||||
log_must_busy $ZFS destroy $TESTFS
|
||||
log_must_busy $ZPOOL destroy $PERFPOOL
|
||||
pkill ${fio##*/}
|
||||
pkill ${iostat##*/}
|
||||
log_must_busy zfs destroy $TESTFS
|
||||
log_must_busy zpool destroy $PERFPOOL
|
||||
}
|
||||
|
||||
trap "log_fail \"Measure IO stats during random read load\"" SIGTERM
|
||||
@@ -50,7 +50,7 @@ log_onexit cleanup
|
||||
|
||||
export TESTFS=$PERFPOOL/testfs
|
||||
recreate_perfpool
|
||||
log_must $ZFS create $PERF_FS_OPTS $TESTFS
|
||||
log_must zfs create $PERF_FS_OPTS $TESTFS
|
||||
|
||||
# Make sure the working set can be cached in the arc. Aim for 1/2 of arc.
|
||||
export TOTAL_SIZE=$(($(get_max_arc_size) / 2))
|
||||
@@ -75,7 +75,7 @@ fi
|
||||
# of the available files.
|
||||
export NUMJOBS=$(get_max $PERF_NTHREADS)
|
||||
export FILE_SIZE=$((TOTAL_SIZE / NUMJOBS))
|
||||
log_must $FIO $FIO_SCRIPTS/mkfiles.fio
|
||||
log_must fio $FIO_SCRIPTS/mkfiles.fio
|
||||
|
||||
log_note "Creating snapshot, $TESTSNAP, of $TESTFS"
|
||||
create_snapshot $TESTFS $TESTSNAP
|
||||
@@ -91,15 +91,15 @@ export TESTFS=$PERFPOOL/$TESTCLONE
|
||||
lun_list=$(pool_to_lun_list $PERFPOOL)
|
||||
log_note "Collecting backend IO stats with lun list $lun_list"
|
||||
if is_linux; then
|
||||
export collect_scripts=("$ZPOOL iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
|
||||
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch" "$VMSTAT 1"
|
||||
"vmstat" "$MPSTAT -P ALL 1" "mpstat" "$IOSTAT -dxyz 1" "iostat")
|
||||
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
|
||||
"$PERF_SCRIPTS/prefetch_io.sh $PERFPOOL 1" "prefetch" "vmstat 1"
|
||||
"vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1" "iostat")
|
||||
else
|
||||
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
|
||||
"$PERF_SCRIPTS/prefetch_io.d $PERFPOOL 1" "prefetch" "$VMSTAT 1"
|
||||
"vmstat" "$MPSTAT 1" "mpstat" "$IOSTAT -xcnz 1" "iostat")
|
||||
"$PERF_SCRIPTS/prefetch_io.d $PERFPOOL 1" "prefetch" "vmstat 1" "vmstat"
|
||||
"mpstat 1" "mpstat" "iostat -xcnz 1" "iostat")
|
||||
fi
|
||||
|
||||
log_note "Sequential cached reads from $TESTFS with $PERF_RUNTYPE settings"
|
||||
do_fio_run sequential_reads.fio $FALSE $FALSE
|
||||
do_fio_run sequential_reads.fio false false
|
||||
log_pass "Measure IO stats during sequential cached read load"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2015 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2015, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
@@ -34,17 +34,17 @@ log_onexit cleanup
|
||||
function cleanup
|
||||
{
|
||||
# kill fio and iostat
|
||||
$PKILL ${FIO##*/}
|
||||
$PKILL ${IOSTAT##*/}
|
||||
log_must_busy $ZFS destroy $TESTFS
|
||||
log_must_busy $ZPOOL destroy $PERFPOOL
|
||||
pkill ${fio##*/}
|
||||
pkill ${iostat##*/}
|
||||
log_must_busy zfs destroy $TESTFS
|
||||
log_must_busy zpool destroy $PERFPOOL
|
||||
}
|
||||
|
||||
trap "log_fail \"Measure IO stats during random read load\"" SIGTERM
|
||||
|
||||
export TESTFS=$PERFPOOL/testfs
|
||||
recreate_perfpool
|
||||
log_must $ZFS create $PERF_FS_OPTS $TESTFS
|
||||
log_must zfs create $PERF_FS_OPTS $TESTFS
|
||||
|
||||
# Aim to fill the pool to 50% capacity while accounting for a 3x compressratio.
|
||||
export TOTAL_SIZE=$(($(get_prop avail $TESTFS) * 3 / 2))
|
||||
@@ -68,14 +68,14 @@ fi
|
||||
lun_list=$(pool_to_lun_list $PERFPOOL)
|
||||
log_note "Collecting backend IO stats with lun list $lun_list"
|
||||
if is_linux; then
|
||||
export collect_scripts=("$ZPOOL iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
|
||||
"$VMSTAT 1" "vmstat" "$MPSTAT -P ALL 1" "mpstat" "$IOSTAT -dxyz 1"
|
||||
export collect_scripts=("zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat"
|
||||
"vmstat 1" "vmstat" "mpstat -P ALL 1" "mpstat" "iostat -dxyz 1"
|
||||
"iostat")
|
||||
else
|
||||
export collect_scripts=("$PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
|
||||
"$VMSTAT 1" "vmstat" "$MPSTAT 1" "mpstat" "$IOSTAT -xcnz 1" "iostat")
|
||||
"vmstat 1" "vmstat" "mpstat 1" "mpstat" "iostat -xcnz 1" "iostat")
|
||||
fi
|
||||
|
||||
log_note "Sequential writes with $PERF_RUNTYPE settings"
|
||||
do_fio_run sequential_writes.fio $TRUE $FALSE
|
||||
do_fio_run sequential_writes.fio true false
|
||||
log_pass "Measure IO stats during sequential write load"
|
||||
|
||||
@@ -17,13 +17,6 @@
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
[[ -z $FIO ]] && log_fail "Missing fio"
|
||||
[[ -z $FREE ]] && log_fail "Missing free"
|
||||
[[ -z $IOSTAT ]] && log_fail "Missing iostat"
|
||||
[[ -z $LSBLK ]] && log_fail "Missing lsblk"
|
||||
[[ -z $MPSTAT ]] && log_fail "Missing mpstat"
|
||||
[[ -z $VMSTAT ]] && log_fail "Missing vmstat"
|
||||
|
||||
verify_runnable "global"
|
||||
verify_disk_count "$DISKS" 3
|
||||
|
||||
|
||||
@@ -22,14 +22,11 @@
|
||||
|
||||
zfs_kstats="/proc/spl/kstat/zfs"
|
||||
|
||||
AWK=${AWK:-awk}
|
||||
DATE=${DATE:-date}
|
||||
|
||||
function get_prefetch_ios
|
||||
{
|
||||
typeset -l data_misses=`$AWK '$1 == "prefetch_data_misses" \
|
||||
typeset -l data_misses=`awk '$1 == "prefetch_data_misses" \
|
||||
{ print $3 }' $zfs_kstats/arcstats`
|
||||
typeset -l metadata_misses=`$AWK '$1 == "prefetch_metadata_misses" \
|
||||
typeset -l metadata_misses=`awk '$1 == "prefetch_metadata_misses" \
|
||||
{ print $3 }' $zfs_kstats/arcstats`
|
||||
typeset -l total_misses=$(( $data_misses + $metadata_misses ))
|
||||
|
||||
@@ -38,7 +35,7 @@ function get_prefetch_ios
|
||||
|
||||
function get_prefetched_demand_reads
|
||||
{
|
||||
typeset -l demand_reads=`$AWK '$1 == "demand_hit_predictive_prefetch" \
|
||||
typeset -l demand_reads=`awk '$1 == "demand_hit_predictive_prefetch" \
|
||||
{ print $3 }' $zfs_kstats/arcstats`
|
||||
|
||||
echo $demand_reads
|
||||
@@ -46,7 +43,7 @@ function get_prefetched_demand_reads
|
||||
|
||||
function get_sync_wait_for_async
|
||||
{
|
||||
typeset -l sync_wait=`$AWK '$1 == "sync_wait_for_async" \
|
||||
typeset -l sync_wait=`awk '$1 == "sync_wait_for_async" \
|
||||
{ print $3 }' $zfs_kstats/arcstats`
|
||||
|
||||
echo $sync_wait
|
||||
@@ -67,7 +64,7 @@ sync_wait_for_async=$(get_sync_wait_for_async)
|
||||
while true
|
||||
do
|
||||
new_prefetch_ios=$(get_prefetch_ios)
|
||||
printf "%u\n%-24s\t%u\n" $($DATE +%s) "prefetch_ios" \
|
||||
printf "%u\n%-24s\t%u\n" $(date +%s) "prefetch_ios" \
|
||||
$(( $new_prefetch_ios - $prefetch_ios ))
|
||||
prefetch_ios=$new_prefetch_ios
|
||||
|
||||
|
||||
Reference in New Issue
Block a user