Re: Plattform independent queuing of computations
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Wed, 21 Jan 2009 06:15:00 -0500
Stefan Heinrichsen wrote:
On 20 Jan., 16:44, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:Stefan Heinrichsen wrote:Hello,I think if I were to do something like this, I'd look at doing it in C.
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?
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
==================
.
- Follow-Ups:
- Re: Plattform independent queuing of computations
- From: Curtis Dyer
- Re: Plattform independent queuing of computations
- References:
- Plattform independent queuing of computations
- From: Stefan Heinrichsen
- Re: Plattform independent queuing of computations
- From: Jerry Stuckle
- Re: Plattform independent queuing of computations
- From: Stefan Heinrichsen
- Plattform independent queuing of computations
- Prev by Date: Re: testing for https
- Next by Date: Re: ban ip addresses
- Previous by thread: Re: Plattform independent queuing of computations
- Next by thread: Re: Plattform independent queuing of computations
- Index(es):
Relevant Pages
|