-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBLKR
50 lines (46 loc) · 1.13 KB
/
BLKR
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
############################
# BLKR - core engine
# zfs blk size 128k #####################
my $size = 128000;
# .0035sec * 12,000,000 = 43k sec = 12 hrs per terabyte
# USB3 8T time: { real-26.10m, user-5.16m, sys-3.29m }
# WCPU 30% SIZE 58304K
# vs
# raidz2 time: { real-134.31m, user-5.18m, sys-3.28m }
# WCPU 6% SIZE 58304K
# 99999 size ############
# 0.015 sec per block
# 0.015 * 12,000,000 = 180k sec = 50 hrs per terabyte
# NFS ######################
# .08 sec per block
# .08 sec * 12,000,000 = 960k sec = 11 days per terabyte
sub blkr
{
my ($i) = @_;
my $block = 0;
my $ipath = $path.'pool/'.$i;
open(my $ifh, '<', "$ipath") || die "Cant open $i: $!\n";
binmode($ifh);
my $istart = gettimeofday();
my $cunt = 0;
while (read($ifh, $block, $size))
{
my $bsha = sha256_hex($block);
my $bname = $path.'sea/'.$bsha;
open(my $fh, '>', "$bname");
binmode($fh);
print $fh $block;
key($i, $bsha);
$cunt++;
}
print $Lfh "YAY $i\n";
my $elapsed = gettimeofday()-$istart;
print "$i : $cunt : $elapsed \n";
}
sub key
{
my ($i, $bsha) = @_;
my $kpath = $path.'key/'.$i;
open(my $kfh, '>>', "$kpath");
print $kfh "$bsha\n";
}