Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

SFTP is too slow...

by sched (Initiate)
on Dec 18, 2006 at 19:31 UTC ( [id://590529]=perlquestion: print w/replies, xml ) Need Help??

sched has asked for the wisdom of the Perl Monks concerning the following question:

Hi Folks,
I'm trying to make some tests using SFTP::Foreign, but the Perl script took too much time for get a file in another server in my network.

I'm trying get a file with 1GB from another server LAN, and the Perl Script using SFTP::Foreign took around of 11 minutes and the SFTP binary in /usr/bin/sftp in only 3 minutes gets the file, the same file.
How can I reduce the time of Perl SFTP::Foreign ?
timex ./sftp.pl
real 11:52.86 user 1:33.81 sys 24.19
The SFTP::Foreign is the last release, and the binary SFTP is OpenSSH_3.8p1 over Solaris 5.9.
Thank you very much guys!!
use Net::SFTP::Foreign; my $host = 'server'; my $sftp = Net::SFTP::Foreign->new($host); $sftp->get("remote_file", "local_file");

Replies are listed 'Best First'.
Re: SFTP is too slow...
by andyford (Curate) on Dec 18, 2006 at 19:48 UTC

    Since the latest release of Net::SFTP::Foreign is marked "Development" (in big red letters!), you might wanna try contacting the author or using the bug reporting mechanism on CPAN as well. Have you tried an older, non-development release?

    That said, I would recommend checking that the module is using the same defaults as the binary. Perhaps some combination of compression, data encryption and/or cipher is biting you.

    non-Perl: Andy Ford

Re: SFTP is too slow...
by jettero (Monsignor) on Dec 18, 2006 at 19:46 UTC
    Is there some compelling reason the binary won't do the job you need? For huge files like that, I guess I'd just system('scp', $host, $file, $etc) the transfer rather than trying to do it in native perl. Hrm, actually, it looks to me like Net::SFTP::Foreign forks an binary ssh anyway, so the slowness may be in the module — and probably isn't related to the slowness of Net::SFTP which is slow for different reasons.

    -Paul

Re: SFTP is too slow...
by runrig (Abbot) on Dec 18, 2006 at 19:42 UTC
    I would just go ahead and use the binary sftp on a file that large especially if time is an issue.
Re: SFTP is too slow...
by salva (Canon) on Dec 19, 2006 at 11:16 UTC
    it's a bug in Net::SFTP::Foreign. I will be uploading a new version to CPAN shortly!

    update: Done! the new version (0.90_15) should be almost as fast as the binary sftp client.

      Salva !! You are the guy!!
      Take a look on the new times over 0.90_15...
      real 3:22.79
      and the SFTP binary over OpenSSh
      real 3:38.99
      GOOD JOB!! Thks
Re: SFTP is too slow...
by chargrill (Parson) on Dec 18, 2006 at 19:44 UTC

    Hi sched,

    Try googling for a bevy of answers.



    --chargrill
    s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://590529]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-19 21:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found