1#!/usr/bin/ksh 2# file and its contents are supplied under the terms of the 3# Common Development and Distribution License ("CDDL"), version 1.0. 4# You may only use this file in accordance with the terms of version 5# 1.0 of the CDDL. 6# 7# A full copy of the text of the CDDL should have accompanied this 8# source. A copy of the CDDL is also available via the Internet at 9# http://www.illumos.org/license/CDDL. 10# 11 12# 13# Copyright (c) 2017 by Delphix. All rights reserved. 14# 15 16# 17# Description: 18# Trigger fio runs using the random_readwrite_fixed job file. The number of runs and 19# data collected is determined by the PERF_* variables. See do_fio_run for 20# details about these variables. 21# 22# The files to read and write from are created prior to the first fio run, 23# and used for all fio runs. The ARC is cleared with `zinject -a` prior to 24# each run so reads will go to disk. 25# 26 27. $STF_SUITE/include/libtest.shlib 28. $STF_SUITE/tests/perf/perf.shlib 29 30function cleanup 31{ 32 recreate_perf_pool 33} 34 35log_onexit cleanup 36 37recreate_perf_pool 38populate_perf_filesystems 39 40# Aim to fill the pool to 50% capacity while accounting for a 3x compressratio. 41export TOTAL_SIZE=$(($(get_prop avail $PERFPOOL) * 3 / 2)) 42 43# Variables for use by fio. 44if [[ -n $PERF_REGRESSION_WEEKLY ]]; then 45 export PERF_RUNTIME=${PERF_RUNTIME:-$PERF_RUNTIME_WEEKLY} 46 export PERF_RUNTYPE=${PERF_RUNTYPE:-'weekly'} 47 export PERF_NTHREADS=${PERF_NTHREADS:-'8 16 32 64'} 48 export PERF_NTHREADS_PER_FS=${PERF_NTHREADS_PER_FS:-'0'} 49 export PERF_SYNC_TYPES=${PERF_SYNC_TYPES:-'0 1'} 50 export PERF_IOSIZES='8k 64k' 51elif [[ -n $PERF_REGRESSION_NIGHTLY ]]; then 52 export PERF_RUNTIME=${PERF_RUNTIME:-$PERF_RUNTIME_NIGHTLY} 53 export PERF_RUNTYPE=${PERF_RUNTYPE:-'nightly'} 54 export PERF_NTHREADS=${PERF_NTHREADS:-'64 128'} 55 export PERF_NTHREADS_PER_FS=${PERF_NTHREADS_PER_FS:-'0'} 56 export PERF_SYNC_TYPES=${PERF_SYNC_TYPES:-'1'} 57 export PERF_IOSIZES='8k' 58fi 59 60# Layout the files to be used by the readwrite tests. Create as many files 61# as the largest number of threads. An fio run with fewer threads will use 62# a subset of the available files. 63export NUMJOBS=$(get_max $PERF_NTHREADS) 64export FILE_SIZE=$((TOTAL_SIZE / NUMJOBS)) 65export DIRECTORY=$(get_directory) 66log_must fio $FIO_SCRIPTS/mkfiles.fio 67 68# Set up the scripts and output files that will log performance data. 69lun_list=$(pool_to_lun_list $PERFPOOL) 70log_note "Collecting backend IO stats with lun list $lun_list" 71export collect_scripts=( 72 "kstat zfs:0 1" "kstat" 73 "vmstat -T d 1" "vmstat" 74 "mpstat -T d 1" "mpstat" 75 "iostat -T d -xcnz 1" "iostat" 76 "dtrace -Cs $PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io" 77 "dtrace -s $PERF_SCRIPTS/profile.d" "profile" 78) 79 80log_note "Random reads and writes with $PERF_RUNTYPE settings" 81do_fio_run random_readwrite_fixed.fio false true 82log_pass "Measure IO stats during random read and write load" 83