My service call is not slow, the time it takes to return the data is long!

Aren't those the same thing? Or does "it" refer to the processing of your CGI script?

How do I output lines while processing? Could you elaborate on that please?

It really depends on what this "processing" of yours means. Where does it take time? What sort of structure does it have? Do post code if possible.

Anyway, you should be looking into chopping the processing into smaller pieces by e.g. converting it to an iterator, and doing the intermediate output between those stages.

If all your processing time is taken inside a single subroutine call you can't modify, there isn't much you can do; some things may be possible to solve with alarm(), but it's usually not a good fit for this.

However, since you mentioned that the request takes four or five minutes, it is a good idea to not do the processing on the web server at all, but do it in the background with a separate process: you'll just need to communicate with it (e.g. through a file or database) to queue a job with it. Needs a bit more infrastructure but is probably the easiest approach!


In reply to Re^3: Using parent and child processes in perl by Anonymous Monk
in thread Using parent and child processes in perl by perl-nun

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.