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.

This is exactly the kind of work you shouldn't do in the web server process while a browser is waiting for a response. Instead, queue the job for a background daemon to process. You can show your client a pretty progress screen with updates from the background job. If you don't already have some sort of job queue you might consider Gearman (which I've used) or TheSchwartz (which I have not).

Now 15 minutes might be too long even if it's done in the background. If that's the case your next step should be to use a profiler (like Devel::DProf or Devel::Profiler) to figure out what's taking all the time. You might find it's something unexpected like a slow NFS share or DNS lookup timeouts.

-sam


In reply to Re: SFTP more than 50+ files by samtregar
in thread 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.