Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Update on controlling long-running processes via CGI

by sundialsvc4 (Abbot)
on Nov 13, 2014 at 03:45 UTC ( [id://1107050]=note: print w/replies, xml ) Need Help??


in reply to Update on controlling long-running processes via CGI

Broadly speaking, this sort of activity needs to be treated as “a background job.”   The web-page ... Apache-based or otherwise ... therefore should be seen merely as a user interface by which the user can submit work to be processed, query the present status of the work in progress, and retrieve the output.   There are many “batch job monitoring systems” out there for all operating systems, including those that are designed to be cross-platform.   There are CPAN modules, as well.

An elementary implementation of this idea ... which, by the way, is probably the most common one ... is to have one-or-more workers that are launched by means of cron, with an SQL database acting as the job-queue.   The workers query the database to find work-to-do and, using an SQL transaction to provide atomicity, select one.   Then they carry out the work, ensuring that any exceptions that may be thrown will be caught.   And this they do forever.

A key aspect of this arrangement is that, no matter how many units of work may be requested, and no matter how rapidly they come in, the work is always carried out in a predictable and controlled way.   The web page is, and the web page remains, only the user-interface:   the means by which the user can interact with the batch system, but not a player in the game.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-19 18:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found