Um...

Bytes_read => 40960, BlockSize => 40960,

that's 40kb, not 4kb: 4096. And 4096 may not be the best setting on all systems. Ie. yours. You'd need to try various different settings.

You should also perform your testing with a considerably larger file than that 2kb README.

Also, try using Net::FTP itself rather than Net::FTP::Robust & Net::FTP::Throttle. Whilst they may be valuable, they are almost certainly going to slow things down somewhat.

But mostly, try turning off Debug--that will also slow things down.

I used a modified version of your script to grab the same 5MB file using Net::FTP and wget, and both achieve remarkably similar throughputs, with Net::FTP actually beating wget when I used a 4096 byte blocksize:

c:\test>wget --passive-ftp ftp://ftp.perl.org/pub/CPAN/ports/win32/Sta +ndard/x86/perl-5.6.0.tar.gz --04:26:04-- ftp://ftp.perl.org/pub/CPAN/ports/win32/Standard/x86/per +l-5.6.0.tar.gz => `perl-5.6.0.tar.gz.1' Resolving ftp.perl.org... done. Connecting to ftp.perl.org[193.136.239.1]:21... connected. Logging in as anonymous ... Logged in! ==> SYST ... done. ==> PWD ... done. ==> TYPE I ... done. ==> CWD /pub/CPAN/ports/win32/Standard/x86 ... d +one. ==> PASV ... done. ==> RETR perl-5.6.0.tar.gz ... done. Length: 5,443,601 (unauthoritative) 100%[====================================>] 5,443,601 278.97K/s +ETA 00:00 04:26:24 (278.97 KB/s) - `perl-5.6.0.tar.gz.1' saved [5443601] c:\test>ftp-get -SIZE=81920 Got 5443601 bytes at 273685.318/second c:\test>ftp-get -SIZE=40960 Got 5443601 bytes at 286686.382/second c:\test>ftp-get -SIZE=4096 Got 5443601 bytes at 300668.379/second

Hardly definitive, but worth a few trials.

The code I used:

#!/usr/bin/perl use strict; use warnings; use Time::HiRes qw[ time ]; use Net::FTP; ##::Robust; ##use Net::FTP::Throttle; ##use Log::Report; use constant HOST => 'ftp.perl.org'; use constant DIR => '/pub/CPAN/ports/win32/Standard/x86'; use constant FILE => 'perl-5.6.0.tar.gz'; our $SIZE ||= 4096; my $start = time; my $ftp = Net::FTP->new( HOST, #Debug => 1, Passive => 1, Timeout => 1, Bytes_read => $SIZE, BlockSize => $SIZE, # MegabitsPerSecond => 2 ) or die "Couldn't connect: $@\n"; $ftp->login('anonymous'); $ftp->cwd(DIR); $ftp->binary; $ftp->get(FILE); my $size = $ftp->size(FILE); $ftp->quit; printf "Got %d bytes at %.3f/second\n", $size, $size / ( time() - $start );

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP PCW

In reply to Re^3: Net FTP Speed check and increase by BrowserUk
in thread Net FTP Speed check and increase by Selvakumar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.