Implementing a Queue in a process
Shantanu Bhadoria
shantanu at cpan.org
Tue Nov 22 07:16:13 GMT 2011
Hey people,
Here is a interesting problem that I am facing right now. I need to
implement a process(in perl) that would sit and wait for someone to push
tasks into its queue, each task consists of a set of information in its
data structure w.r.t the task details.
Now I need to figure out two things:
- How to implement this queue in a perl process. (remote shared
Database:mysql?, internal data structure, local SQLite?)
- How do I push new tasks into this queue ( i.e. interprocess
communication, Simpler(uglier) for a shared database, but I would prefer a
process like that to sit in isolation and accept requests and manage them
on its own so whats the ideal inter-process communication format for
it?named pipes?).
I would really love to know your opinions on the best way to do it. The
straightforward but ugly way to do this would probably be putting tasks
into a database and have the other process ping the database for new tasks
in queue every second. But I believe there has gotta be a better way to do
it and what better place to figure it out then ask you folks. :)
So what do you guys think is the best implementation for such a requirement?
cheers,
-Shantanu
More information about the london.pm
mailing list