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 not cleared to ensure that all data is cached.
26dcbf3bd6SGeorge Wilson#
27dcbf3bd6SGeorge Wilson
28dcbf3bd6SGeorge Wilson. $STF_SUITE/include/libtest.shlib
29dcbf3bd6SGeorge Wilson. $STF_SUITE/tests/perf/perf.shlib
30dcbf3bd6SGeorge Wilson
31dcbf3bd6SGeorge Wilsonfunction cleanup
32dcbf3bd6SGeorge Wilson{
33c373aa8bSJohn Wren Kennedy	recreate_perf_pool
34dcbf3bd6SGeorge Wilson}
35dcbf3bd6SGeorge Wilson
36dcbf3bd6SGeorge Wilsonlog_onexit cleanup
37dcbf3bd6SGeorge Wilson
38c373aa8bSJohn Wren Kennedyrecreate_perf_pool
39c373aa8bSJohn Wren Kennedypopulate_perf_filesystems
40dcbf3bd6SGeorge Wilson
41dcbf3bd6SGeorge Wilson# Make sure the working set can be cached in the arc. Aim for 1/2 of arc.
42dcbf3bd6SGeorge Wilsonexport TOTAL_SIZE=$(($(get_max_arc_size) / 2))
43dcbf3bd6SGeorge Wilson
44dcbf3bd6SGeorge Wilson# Variables for use by fio.
45dcbf3bd6SGeorge Wilsonif [[ -n $PERF_REGRESSION_WEEKLY ]]; then
46dcbf3bd6SGeorge Wilson	export PERF_RUNTIME=${PERF_RUNTIME:-$PERF_RUNTIME_WEEKLY}
47dcbf3bd6SGeorge Wilson	export PERF_RUNTYPE=${PERF_RUNTYPE:-'weekly'}
48*65d28c0bSJohn Wren Kennedy	export PERF_NTHREADS=${PERF_NTHREADS:-'8 16 32 64'}
49c373aa8bSJohn Wren Kennedy	export PERF_NTHREADS_PER_FS=${PERF_NTHREADS_PER_FS:-'0'}
50dcbf3bd6SGeorge Wilson	export PERF_SYNC_TYPES=${PERF_SYNC_TYPES:-'1'}
51*65d28c0bSJohn Wren Kennedy	export PERF_IOSIZES=${PERF_IOSIZES:-'8k 64k 128k'}
52dcbf3bd6SGeorge Wilsonelif [[ -n $PERF_REGRESSION_NIGHTLY ]]; then
53dcbf3bd6SGeorge Wilson	export PERF_RUNTIME=${PERF_RUNTIME:-$PERF_RUNTIME_NIGHTLY}
54dcbf3bd6SGeorge Wilson	export PERF_RUNTYPE=${PERF_RUNTYPE:-'nightly'}
55dcbf3bd6SGeorge Wilson	export PERF_NTHREADS=${PERF_NTHREADS:-'64 128'}
56c373aa8bSJohn Wren Kennedy	export PERF_NTHREADS_PER_FS=${PERF_NTHREADS_PER_FS:-'0'}
57dcbf3bd6SGeorge Wilson	export PERF_SYNC_TYPES=${PERF_SYNC_TYPES:-'1'}
58dcbf3bd6SGeorge Wilson	export PERF_IOSIZES=${PERF_IOSIZES:-'128k 1m'}
59dcbf3bd6SGeorge Wilsonfi
60dcbf3bd6SGeorge Wilson
61dcbf3bd6SGeorge Wilson# Layout the files to be used by the read tests. Create as many files as the
62dcbf3bd6SGeorge Wilson# largest number of threads. An fio run with fewer threads will use a subset
63dcbf3bd6SGeorge Wilson# of the available files.
64dcbf3bd6SGeorge Wilsonexport NUMJOBS=$(get_max $PERF_NTHREADS)
65dcbf3bd6SGeorge Wilsonexport FILE_SIZE=$((TOTAL_SIZE / NUMJOBS))
66c373aa8bSJohn Wren Kennedyexport DIRECTORY=$(get_directory)
671d32ba66SJohn Wren Kennedylog_must fio $FIO_SCRIPTS/mkfiles.fio
68dcbf3bd6SGeorge Wilson
69dcbf3bd6SGeorge Wilson# Set up the scripts and output files that will log performance data.
70dcbf3bd6SGeorge Wilsonlun_list=$(pool_to_lun_list $PERFPOOL)
71dcbf3bd6SGeorge Wilsonlog_note "Collecting backend IO stats with lun list $lun_list"
72c373aa8bSJohn Wren Kennedyexport collect_scripts=(
73c373aa8bSJohn Wren Kennedy    "kstat zfs:0 1"  "kstat"
74*65d28c0bSJohn Wren Kennedy    "vmstat -T d 1"       "vmstat"
75*65d28c0bSJohn Wren Kennedy    "mpstat -T d 1"       "mpstat"
76*65d28c0bSJohn Wren Kennedy    "iostat -T d -xcnz 1" "iostat"
77c373aa8bSJohn Wren Kennedy    "dtrace -Cs $PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io"
78c373aa8bSJohn Wren Kennedy    "dtrace -Cs $PERF_SCRIPTS/prefetch_io.d $PERFPOOL 1"  "prefetch"
79c373aa8bSJohn Wren Kennedy    "dtrace  -s $PERF_SCRIPTS/profile.d"                  "profile"
80c373aa8bSJohn Wren Kennedy)
81dcbf3bd6SGeorge Wilson
82dcbf3bd6SGeorge Wilsonlog_note "Sequential cached reads with $PERF_RUNTYPE settings"
831d32ba66SJohn Wren Kennedydo_fio_run sequential_reads.fio false false
84dcbf3bd6SGeorge Wilsonlog_pass "Measure IO stats during sequential cached read load"
85