S
sonet
/dev/sda2 49594228 1373972 45660300 3% /usr/local
/dev/ram0 96828 11976 84852 13%
/usr/local/Portal/cache
/usr/local/Portal/tesing (real filesystem)
/usr/local/Portal/cache/testing (ramdisk)
The file size is about 6M.
#--------------------------result-------------------------------
open file on ramdisk:6.60419464111328e-05
write file on ramdisk:0.0180449485778809
close file on ramdisk:4.10079956054688e-05
read data on ramdisk:0.179691076278687
=====================================
open file on disk:0.000105142593383789
write file on disk:0.0202229022979736
close file on disk:4.41074371337891e-05
read data on disk:0.0468909740447998
#---------------------------code--------------------------------
#!/usr/bin/perl
use strict;
use warnings;
use Time::HiRes();
my $t1=Time::HiRes::gettimeofday;
open(my $HH,">/usr/local/Portal/cache/testing");
print "open file on ramdisk:" . (Time::HiRes::gettimeofday -$t1) . "\n";
my $str='';
for (my $i=0;$i<=1000000;$i++){
$str.=$i;
}
$t1=Time::HiRes::gettimeofday;
print $HH $str;
print "write file on ramdisk:" . (Time::HiRes::gettimeofday -$t1) . "\n";
$t1=Time::HiRes::gettimeofday;
close($HH);
print "close file on ramdisk:" . (Time::HiRes::gettimeofday -$t1) . "\n";
$t1=Time::HiRes::gettimeofday;
open($HH,"/usr/local/Portal/cache/testing");
my $a=join('',<$HH>);
close($HH);
print "read data on ramdisk:" . (Time::HiRes::gettimeofday -$t1) . "\n";
$a='';
$t1=Time::HiRes::gettimeofday;
print "=====================================\n";
open($HH,">/usr/local/Portal/testing");
print "open file on disk:" . (Time::HiRes::gettimeofday -$t1) . "\n";
$str='';
for (my $i=0;$i<=1000000;$i++){
$str.=$i;
}
$t1=Time::HiRes::gettimeofday;
print $HH $str;
print "write file on disk:" . (Time::HiRes::gettimeofday -$t1) . "\n";
$t1=Time::HiRes::gettimeofday;
close($HH);
print "close file on disk:" . (Time::HiRes::gettimeofday -$t1) . "\n";
$t1=Time::HiRes::gettimeofday;
open($HH,"/usr/local/Portal/testing");
$a=join('',<$HH>);
close($HH);
print "read data on disk:" . (Time::HiRes::gettimeofday -$t1) . "\n";
$a='';
/dev/ram0 96828 11976 84852 13%
/usr/local/Portal/cache
/usr/local/Portal/tesing (real filesystem)
/usr/local/Portal/cache/testing (ramdisk)
The file size is about 6M.
#--------------------------result-------------------------------
open file on ramdisk:6.60419464111328e-05
write file on ramdisk:0.0180449485778809
close file on ramdisk:4.10079956054688e-05
read data on ramdisk:0.179691076278687
=====================================
open file on disk:0.000105142593383789
write file on disk:0.0202229022979736
close file on disk:4.41074371337891e-05
read data on disk:0.0468909740447998
#---------------------------code--------------------------------
#!/usr/bin/perl
use strict;
use warnings;
use Time::HiRes();
my $t1=Time::HiRes::gettimeofday;
open(my $HH,">/usr/local/Portal/cache/testing");
print "open file on ramdisk:" . (Time::HiRes::gettimeofday -$t1) . "\n";
my $str='';
for (my $i=0;$i<=1000000;$i++){
$str.=$i;
}
$t1=Time::HiRes::gettimeofday;
print $HH $str;
print "write file on ramdisk:" . (Time::HiRes::gettimeofday -$t1) . "\n";
$t1=Time::HiRes::gettimeofday;
close($HH);
print "close file on ramdisk:" . (Time::HiRes::gettimeofday -$t1) . "\n";
$t1=Time::HiRes::gettimeofday;
open($HH,"/usr/local/Portal/cache/testing");
my $a=join('',<$HH>);
close($HH);
print "read data on ramdisk:" . (Time::HiRes::gettimeofday -$t1) . "\n";
$a='';
$t1=Time::HiRes::gettimeofday;
print "=====================================\n";
open($HH,">/usr/local/Portal/testing");
print "open file on disk:" . (Time::HiRes::gettimeofday -$t1) . "\n";
$str='';
for (my $i=0;$i<=1000000;$i++){
$str.=$i;
}
$t1=Time::HiRes::gettimeofday;
print $HH $str;
print "write file on disk:" . (Time::HiRes::gettimeofday -$t1) . "\n";
$t1=Time::HiRes::gettimeofday;
close($HH);
print "close file on disk:" . (Time::HiRes::gettimeofday -$t1) . "\n";
$t1=Time::HiRes::gettimeofday;
open($HH,"/usr/local/Portal/testing");
$a=join('',<$HH>);
close($HH);
print "read data on disk:" . (Time::HiRes::gettimeofday -$t1) . "\n";
$a='';