1dcbf3bd6SGeorge Wilson#!/usr/bin/ksh
2dcbf3bd6SGeorge Wilson
3dcbf3bd6SGeorge Wilson#
4dcbf3bd6SGeorge Wilson# This file and its contents are supplied under the terms of the
5dcbf3bd6SGeorge Wilson# Common Development and Distribution License ("CDDL"), version 1.0.
6dcbf3bd6SGeorge Wilson# You may only use this file in accordance with the terms of version
7dcbf3bd6SGeorge Wilson# 1.0 of the CDDL.
8dcbf3bd6SGeorge Wilson#
9dcbf3bd6SGeorge Wilson# A full copy of the text of the CDDL should have accompanied this
10dcbf3bd6SGeorge Wilson# source.  A copy of the CDDL is also available via the Internet at
11dcbf3bd6SGeorge Wilson# http://www.illumos.org/license/CDDL.
12dcbf3bd6SGeorge Wilson#
13dcbf3bd6SGeorge Wilson
14dcbf3bd6SGeorge Wilson#
151d32ba66SJohn Wren Kennedy# Copyright (c) 2015, 2016 by Delphix. All rights reserved.
16dcbf3bd6SGeorge Wilson#
17dcbf3bd6SGeorge Wilson
18dcbf3bd6SGeorge Wilson#
19dcbf3bd6SGeorge Wilson# Description:
20dcbf3bd6SGeorge Wilson# Trigger fio runs using the sequential_reads job file. The number of runs and
21dcbf3bd6SGeorge Wilson# data collected is determined by the PERF_* variables. See do_fio_run for
22dcbf3bd6SGeorge Wilson# details about these variables.
23dcbf3bd6SGeorge Wilson#
24dcbf3bd6SGeorge Wilson# The files to read from are created prior to the first fio run, and used
25dcbf3bd6SGeorge Wilson# for all fio runs. The ARC is cleared with `zinject -a` prior to each run
26dcbf3bd6SGeorge Wilson# so reads will go to disk.
27dcbf3bd6SGeorge Wilson#
28859bfeadSStephen Blinick# Thread/Concurrency settings:
29859bfeadSStephen Blinick#    PERF_NTHREADS defines the number of files created in the test filesystem,
30859bfeadSStephen Blinick#    as well as the number of threads that will simultaneously drive IO to
31859bfeadSStephen Blinick#    those files.  The settings chosen are from measurements in the
32859bfeadSStephen Blinick#    PerfAutoESX/ZFSPerfESX Environments, selected at concurrency levels that
33859bfeadSStephen Blinick#    are at peak throughput but lowest latency.  Higher concurrency introduces
34859bfeadSStephen Blinick#    queue time latency and would reduce the impact of code-induced performance
35859bfeadSStephen Blinick#    regressions.
36859bfeadSStephen Blinick#
37dcbf3bd6SGeorge Wilson
38dcbf3bd6SGeorge Wilson. $STF_SUITE/include/libtest.shlib
39dcbf3bd6SGeorge Wilson. $STF_SUITE/tests/perf/perf.shlib
40dcbf3bd6SGeorge Wilson
41dcbf3bd6SGeorge Wilsonfunction cleanup
42dcbf3bd6SGeorge Wilson{
43c373aa8bSJohn Wren Kennedy	recreate_perf_pool
44dcbf3bd6SGeorge Wilson}
45dcbf3bd6SGeorge Wilson
46dcbf3bd6SGeorge Wilsonlog_onexit cleanup
47dcbf3bd6SGeorge Wilson
48c373aa8bSJohn Wren Kennedyrecreate_perf_pool
49c373aa8bSJohn Wren Kennedypopulate_perf_filesystems
50dcbf3bd6SGeorge Wilson
51dcbf3bd6SGeorge Wilson# Aim to fill the pool to 50% capacity while accounting for a 3x compressratio.
52c373aa8bSJohn Wren Kennedyexport TOTAL_SIZE=$(($(get_prop avail $PERFPOOL) * 3 / 2))
53dcbf3bd6SGeorge Wilson
54dcbf3bd6SGeorge Wilson# Variables for use by fio.
55dcbf3bd6SGeorge Wilsonif [[ -n $PERF_REGRESSION_WEEKLY ]]; then
56dcbf3bd6SGeorge Wilson	export PERF_RUNTIME=${PERF_RUNTIME:-$PERF_RUNTIME_WEEKLY}
57dcbf3bd6SGeorge Wilson	export PERF_RUNTYPE=${PERF_RUNTYPE:-'weekly'}
58859bfeadSStephen Blinick	export PERF_NTHREADS=${PERF_NTHREADS:-'8 16 32 64'}
59c373aa8bSJohn Wren Kennedy	export PERF_NTHREADS_PER_FS=${PERF_NTHREADS_PER_FS:-'0'}
60dcbf3bd6SGeorge Wilson	export PERF_SYNC_TYPES=${PERF_SYNC_TYPES:-'1'}
61*65d28c0bSJohn Wren Kennedy	export PERF_IOSIZES=${PERF_IOSIZES:-'8k 64k 128k'}
62dcbf3bd6SGeorge Wilsonelif [[ -n $PERF_REGRESSION_NIGHTLY ]]; then
63dcbf3bd6SGeorge Wilson	export PERF_RUNTIME=${PERF_RUNTIME:-$PERF_RUNTIME_NIGHTLY}
64dcbf3bd6SGeorge Wilson	export PERF_RUNTYPE=${PERF_RUNTYPE:-'nightly'}
65859bfeadSStephen Blinick	export PERF_NTHREADS=${PERF_NTHREADS:-'8 16'}
66c373aa8bSJohn Wren Kennedy	export PERF_NTHREADS_PER_FS=${PERF_NTHREADS_PER_FS:-'0'}
67dcbf3bd6SGeorge Wilson	export PERF_SYNC_TYPES=${PERF_SYNC_TYPES:-'1'}
68dcbf3bd6SGeorge Wilson	export PERF_IOSIZES=${PERF_IOSIZES:-'128k 1m'}
69dcbf3bd6SGeorge Wilsonfi
70dcbf3bd6SGeorge Wilson
71dcbf3bd6SGeorge Wilson# Layout the files to be used by the read tests. Create as many files as the
72dcbf3bd6SGeorge Wilson# largest number of threads. An fio run with fewer threads will use a subset
73dcbf3bd6SGeorge Wilson# of the available files.
74dcbf3bd6SGeorge Wilsonexport NUMJOBS=$(get_max $PERF_NTHREADS)
75dcbf3bd6SGeorge Wilsonexport FILE_SIZE=$((TOTAL_SIZE / NUMJOBS))
76c373aa8bSJohn Wren Kennedyexport DIRECTORY=$(get_directory)
771d32ba66SJohn Wren Kennedylog_must fio $FIO_SCRIPTS/mkfiles.fio
78dcbf3bd6SGeorge Wilson
79dcbf3bd6SGeorge Wilson# Set up the scripts and output files that will log performance data.
80dcbf3bd6SGeorge Wilsonlun_list=$(pool_to_lun_list $PERFPOOL)
81dcbf3bd6SGeorge Wilsonlog_note "Collecting backend IO stats with lun list $lun_list"
82c373aa8bSJohn Wren Kennedyexport collect_scripts=(
83c373aa8bSJohn Wren Kennedy    "kstat zfs:0 1"  "kstat"
84*65d28c0bSJohn Wren Kennedy    "vmstat -T d 1"       "vmstat"
85*65d28c0bSJohn Wren Kennedy    "mpstat -T d 1"       "mpstat"
86*65d28c0bSJohn Wren Kennedy    "iostat -T d -xcnz 1" "iostat"
87c373aa8bSJohn Wren Kennedy    "dtrace -Cs $PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
88c373aa8bSJohn Wren Kennedy    "dtrace -Cs $PERF_SCRIPTS/prefetch_io.d $PERFPOOL 1"  "prefetch"
89c373aa8bSJohn Wren Kennedy    "dtrace  -s $PERF_SCRIPTS/profile.d"                  "profile"
90c373aa8bSJohn Wren Kennedy)
91dcbf3bd6SGeorge Wilson
92dcbf3bd6SGeorge Wilsonlog_note "Sequential reads with $PERF_RUNTYPE settings"
931d32ba66SJohn Wren Kennedydo_fio_run sequential_reads.fio false true
94dcbf3bd6SGeorge Wilsonlog_pass "Measure IO stats during sequential read load"
95