Calculating blocksize from iostat -xnz
Sample of the result:Result:
LUN r/s w/s kr/s wr/s
c1t0d0: 0.39 18.40 2.64 124.25
c1t1d0: 431.05 323.43 5239.21 13422.86
Perl script to analyze iostat -xnz output:
#!/usr/bin/perl
use strict;
use warnings;
my %totals = ();
my $fd;
open($fd, "<", "1.out") || die "Failed to open\n";
my %count;
for my $line (<$fd>) {
$line =~ s/^\s+//;
$line =~ s/\s+$//;
next if ($line !~ /^\d+/);
my @items = split(/\s+/, $line);
my $lun = $items[-1];
unless (exists($totals{$lun})) {
$totals{$lun} = [0, 0, 0, 0];
$count{$lun} = 0;
}
for my $idx (0 .. 3) {
$totals{$lun}->[$idx] += $items[$idx];
}
$count{$lun} += 1;
}
close($fd);
print sprintf("%10s %10s %10s %10s %10s\n", "LUN", "r/s", "w/s", "kr/s", "wr/s");
for my $lun (keys(%totals)) {
print sprintf("%10s:", $lun);
for my $item (@{$totals{$lun}}) {
print sprintf("%10.2f ", $item / $count{$lun});
}
print "\n";
Sample of the result:Result:
LUN r/s w/s kr/s wr/s
c1t0d0: 0.39 18.40 2.64 124.25
c1t1d0: 431.05 323.43 5239.21 13422.86
For Reads: Block size = Read throughput / IOps = 5239.21 (kr/s) / 431.05 (r/s) = 12.15kB block size
For Writes: Block size = Write throughput / IOps = 13422.86 (wr/s) / 323.43 (w/s) = 41.5kB block size
Perl script to analyze iostat -xnz output:
#!/usr/bin/perl
use strict;
use warnings;
my %totals = ();
my $fd;
open($fd, "<", "1.out") || die "Failed to open\n";
my %count;
for my $line (<$fd>) {
$line =~ s/^\s+//;
$line =~ s/\s+$//;
next if ($line !~ /^\d+/);
my @items = split(/\s+/, $line);
my $lun = $items[-1];
unless (exists($totals{$lun})) {
$totals{$lun} = [0, 0, 0, 0];
$count{$lun} = 0;
}
for my $idx (0 .. 3) {
$totals{$lun}->[$idx] += $items[$idx];
}
$count{$lun} += 1;
}
close($fd);
print sprintf("%10s %10s %10s %10s %10s\n", "LUN", "r/s", "w/s", "kr/s", "wr/s");
for my $lun (keys(%totals)) {
print sprintf("%10s:", $lun);
for my $item (@{$totals{$lun}}) {
print sprintf("%10.2f ", $item / $count{$lun});
}
print "\n";