Re: queue system
From: Federico (es_at_yahoo.fedeabascal)
Date: 09/03/04
- Previous message: Don S: "Re: hd online without a reboot"
- In reply to: P Gentry: "Re: queue system"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 03 Sep 2004 13:42:26 +0200
Uff... thanks a lot guys. How much information.
What I want is very similar to what Christopher suggested, but the
problem is that the programs are waiting until the program finishes, but
then how could I now which program is next?
I explain it better: the user sends information to my server and I run a
program that can take some hours. I notify the user that when his work
is finished he will receive an email. Only one copy of the program
should run at a given time. If more users send request for running it,
and it is already running, they should wait (well, not the user but the
requests).
I programmed something similar some time ago: the program requests were
appended (writen) to a file, and when a program finishes, it removes its
request from the top of the file (locking while those file operations
were carried out, and putting waiting programs to sleep for 5 minutes).
But I was thinking it will be better to use a better (standard, already
built) queue system. If I had so, I could say: there can be two programs
running at once instead only one, for example.
Well... thanks again,
Federico
P Gentry wrote:
> Federico <es@yahoo.fedeabascal> wrote in message news:<ch75cv$bjc$1@nsnmrro2-gest.nuria.telefonica-data.net>...
>
>>Hello, people
>>
>>I have to build a web page for running a program. But I want no more
>>that one copy of the program running at a given time: I want a queue
>>system. Can anyone suggest which one could I use? or where to find this
>>information?
>>
>>Thanks a lot,
>>Federico
>
>
> Hmmm .... assuming that you mean at the server end. If you mean one
> process per client, just use/require cookies.
>
> Remember that http is stateless -- you deliver a page that indicates
> it can launch a program, but back at the server it's a no-go :-(
>
> How do you let the client know what is going on and how do let them
> know it's OK? You can't!
>
> Now, if the program is small enough that it runs to completion quickly
> (like a typical cgi request), thus opening the possibility for the
> next queued request to run, you _may_ get by...
>
> But what if the program hangs, returns an error, fails to release
> resources indicating it's busy, etc.? What if the client leaves while
> waiting?
>
> I think I would look for a better solution before going down this
> road. Preferably you would handle all contingencies on the server
> without having to truck back and forth informing an impatient client
> why it's not "working" as they expect. Cryptic error messages do not
> confidence build ...
>
> If you were more specific with what you're trying for and why you
> think this is the best/only way to go (eg., the "program" to run is
> out of your control), then I would feel more confident offering
> suggestions. As is, I'm not sure what to offer other than that I
> don't care for this straight, linear (serializing/fifo) of requests
> (even with semaphores and polling) -- it can and _is_ often done, but
> requires more work than you might imagine. It's why _concurrency_ is
> such a big deal with databases (and difficult to implement) in a way
> that keeps everbody happy.
>
> Why can't you spawn/fork a different process for each request?
> Usaully this is a multiple writers problem -- is this the case?
>
> If it's that important, why not a single process that launches mutiple
> threads? Agreed, these are not easy to carry off, but your idea (over
> the web) might even be _more_ trouble to implement. Clients don't
> like to hear, "wish I could help, but stuff has happened at this end
> that means you have to wait or try again later".
>
> I know this doesn't help in a concrete sense, but, like I said, it's
> hard to know how/where to go from what you've said.
>
> regards,
> prg
> email above disabled
- Previous message: Don S: "Re: hd online without a reboot"
- In reply to: P Gentry: "Re: queue system"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|