priority queue

J

j

Hi all ,

I am trying to implement a priority queue where people will submit some
job through cgi written in perl and then another independent perl script
will clear the queue. Different submitter has different priority. What's the
best way to implement a global queue that can be accessed by the cgi and the
perl script concurrently? We cannot use database though.

Thanks.

Perseus
 
S

Sundial Services

j said:
Hi all ,

I am trying to implement a priority queue where people will submit
some
job through cgi written in perl and then another independent perl script
will clear the queue. Different submitter has different priority. What's
the best way to implement a global queue that can be accessed by the cgi
and the perl script concurrently? We cannot use database though.


Perhaps a named pipe would be the best approach.
 
P

pkent

Why can you not use a database? Without knowing the rationale behind that
restriction, it's kind of hard to predict what solutions are available that
you *can* use.

At work we have a distributed batch queueing systems where jobs are
submitted from anywhere in our network and the various jobs are taken
off the queue and done on any one of several worker machines. The whole
thing is tied together with a single MySQL database runnign on a central
server which stores the state of all the jobs, queues, etc. So my advice
is "network-accessible database"

If you can't use a database then I suppose a filesystem implementation
is the way to go - e.g. each job is represented by a file, you use a
lockfile somewhere to ensure that only one process modifies the folder
of jobs at any one time. Place all that behind an API so that you can,
if you want, move to another implementation without rewriting the whole
thing. The problem with the filesystem is that you need to be careful to
avoid race conditions (whereas I'd think a database handles that all for
you) and flock() might not work on all OSes or over NFS.

You could, I suppose, use a dbm file, or shared memory or some kind of
client/server approach. Still, maybe you don't want to limit the system
to running on a single machine.

P
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top