StorScore/recipes/write_impact_check.rcp

99 строки
3.4 KiB
Perl

# vim: set filetype=perl:
# StorScore
#
# Copyright (c) Microsoft Corporation
#
# All rights reserved.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# ISSUE-REVIEW: This could be made to work w/raw_disk if it's ever important
unless( $cmd_line->raw_disk )
{
my $desc_prefix = "Targeted Test Write Impact";
foreach my $block_size ( qw( 4K 8K 64K ) )
{
my %workload = (
write_percentage => 0,
access_pattern => "random",
block_size => $block_size,
queue_depth => 1,
warmup_time => 60,
run_time => 3600
);
my $desc = "$desc_prefix $block_size Random";
# Run the workload once undisturbed as a baseline.
my %baseline =
test( %workload, description => "$desc Baseline" );
my $read_tput_KBps = $baseline{'MB/sec Total'} * 1000;
my @write_workloads = (
["Random", 5],
["Sequential", 10]
);
# Run again, this time with an aggressor process injecting
# writes in the background. The aggressor is rate-limited
# to a fraction of the baseline read throughput.
foreach my $write_workload ( @write_workloads )
{
my ($write_pattern, $write_pct) = @$write_workload;
my $write_tput_KBps =
int ( ( $write_pct / 100 ) * $read_tput_KBps );
my $bg_desc = "$write_pct% Injected Writes";
my $cmd = "write_forever.cmd ";
$cmd .= "-b256K ";
$cmd .= "-r " if $write_pattern =~ /random/i;
$cmd .= "-g$write_tput_KBps "; # Rate limit
$cmd .= $target->file_name;
# We must do our own purge/initialize, so we can "sneak"
# the bg_exec in between these steps and the actual test.
# If we didn't do this, the purge would occur after the
# bg_exec, effectively destroying the target volume and
# causing the backgrounded process to die with an error.
purge();
initialize();
bg_exec(
description => $bg_desc,
command => $cmd,
);
test(
%workload,
description => "$desc $bg_desc",
purge => 0,
initialize => 0,
);
bg_killall();
}
}
}