Re: Plattform independent queuing of computations



Stefan Heinrichsen wrote:
On 20 Jan., 16:44, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:
Stefan Heinrichsen wrote:
Hello,
my applicatio does some complex computation which sometimes take a
long time but sometimes only a few seconds. If multiple of these
computation are running concurently it could cause corrupt data. So I
want to put the computations into a queue and let them handle by an
external process.
The idea ist to put the computation jobs into a database which is read
by the external task. The external task uses the database as a queue
and always checks for new jobs if idle.
The problem is how I can make sure the process is still running? I
could periodical put a timestamp to a file/database and check if this
timestamp is too old. But here is a problem in choosing the correct
timeout. Does someone knows a could framework for things like that? Or
at least how to do process control in a platform independent way?
I think if I were to do something like this, I'd look at doing it in C.
You can easily build a C program to do your computations in a platform
independent way. Sure, it would have to be compiled for different
platforms, but that's all. [...]

Yes that may had been the better way. But the code for the computation
is already finished and written in PHP. And I even just don't know
much about C.


That doesn't mean it's not still the right way to go. Use the correct tool for the job, don't make the job fit the tool.

Alternatively, you could use the shared memory functions in PHP, to do it.

The shared memory functions on windows are only available for PHP as a
webserver module.
And the external task doing the computation will run as PHP CLI. If I
make it as a normal PHP site and trigger the "download" by another
website the socket will be closed when the script is finished and the
computation gets terminated, isn't it that way? And even if I handle
the triggered script not to stop, I have to use different php.ini
files for the compuation script and the others (think of execution
time or memory limit).

Regards Stefan

That is true. You can keep the computations going in the web module, but it will cause delays for the user. And if the rest of the code doesn't have problems with loops, you can set the execution time longer and memory larger. They should be set large enough to handle your longest/most memory scripts, anyway.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.



Relevant Pages

  • Re: Netcat question
    ... Also, I apologize since I think you might have provided this already, but can we see the virtual device script? ... Maybe a quick & dirty hack fix is to have the virtual device script always append something unobtrusive to the collected print data for no other reason than to garuntee that the print jobs are always at least a few bytes. ... It uses a cheap-o single port print server that snaps onto the centronics plug just like that netgear ps101. ...
    (comp.unix.sco.misc)
  • Re: Netcat question
    ... If you write the virtual device script to simply throw out all output from ... than to garuntee that the print jobs are always at least a few bytes. ... It uses a cheap-o single port print server that snaps onto the centronics ...
    (comp.unix.sco.misc)
  • Re: Biztalk 2006 with SQL-Express - Gert
    ... This is the link for the list of BizTalk 2006 Maintenance Jobs ... Below I provide the details of the execution script with the interval. ... Interval: 1 Minute / Recurring ...
    (microsoft.public.biztalk.general)
  • Re: prevent users from running system statistic tools
    ... > routines to see how their jobs were running. ... > I considered a script that would issue a talk command to the user. ... Have your manager have a chat with their ...
    (comp.unix.solaris)
  • Re: Plattform independent queuing of computations
    ... The external task uses the database as a queue ... at least how to do process control in a platform independent way? ... is already finished and written in PHP. ... website the socket will be closed when the script is finished and the ...
    (comp.lang.php)