Hi Repected Monks,

I have been using Net::SSH2 and implemented this module into one of the critical project for creation of a Web-based interface for distribution of files onto remote systems. Initially this project was implemented with Net::FTP module and then the client was very happy with the product and he wanted to make it secure, so asked us to use SSH module which was highly secure for him.( As we have to anyways be with the SSH protocol only).

Initially we went in for Net::SSH::Perl, but faced lot of dependencies and even after successfull installation of all the modules. We cld see that the application was using very high CPU usage for the execution of the applications in solaris platform.

We went for the Net::SSH2::SFTP module which was a new one. It is a handy and easy to use. So we went along and developed the application, which is working very fine at our end. But latter the client as usually came up and said that he wants to transfer more than 50-60 + files to 30 + remote systems. We used Net::SSH2 and threads to connect to remote systems parally. And when he tried the same the application was taking around 15 mins with cpu utilization reaching to the maximum levels ( 90+) and as expected the browser also timed out. Which made the product to halt.

My main concern is can we be able transfer more than 50 - 60 + files to remote system with less cpu utilization. We checked out the Perl modules and could not find a better module for the above scenario. So is there any module which could be handy for the above requirement.

This is the part of code which transfer the files to remote systems

my $ssh2 = Net::SSH2->new(); die " can't connect " unless $ssh2->connect($h); die " can't authenticate " unless $ssh2->auth(username=>$u, password=> +$p); $ftp_res= $ssh2->scp_put("$flname","$full_path"); ### (local_path, re +mote_path )
Hope you do the needfull.
Thanks in advance,

Sushil Kumar


In reply to SFTP more than 50+ files by msk_0984

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.