priority queue

Discussion in 'Perl Misc' started by j, Jul 18, 2003.

  1. j

    j Guest

    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
     
    j, Jul 18, 2003
    #1
    1. Advertising

  2. j wrote:

    > 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.
     
    Sundial Services, Jul 18, 2003
    #2
    1. Advertising

  3. j

    pkent Guest

    In article <20030722134425.296$>,
    wrote:
    > "j" <> wrote:
    > > 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.

    >
    > 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

    --
    pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
    Remove the tea to reply
     
    pkent, Jul 23, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Navhpf

    priority queue

    Navhpf, Feb 23, 2004, in forum: Java
    Replies:
    3
    Views:
    1,002
    Navhpf
    Feb 23, 2004
  2. Aaron W. LaFramboise

    Stable priority queue

    Aaron W. LaFramboise, Apr 5, 2004, in forum: C++
    Replies:
    19
    Views:
    1,546
    Claudio Puviani
    Apr 7, 2004
  3. Russell Warren

    Is Queue.Queue.queue.clear() thread-safe?

    Russell Warren, Jun 22, 2006, in forum: Python
    Replies:
    4
    Views:
    685
    Russell Warren
    Jun 27, 2006
  4. Marcel Müller
    Replies:
    3
    Views:
    565
    Marcel Müller
    Apr 27, 2009
  5. Kris
    Replies:
    0
    Views:
    488
Loading...

Share This Page