buffered fifo?

Paul Chvostek paul+fbsd at it.ca
Thu Jun 12 01:37:10 PDT 2003


Hi all.

I need to write a simple server that will take input and "do" stuff with
it as it comes in.  Server function is atomic-per-item, but I want to
have multiple clients submitting requests.  The submission rate averages
about 20000 per day, sometimes many per second, often slower.  And to
make things fun, the server gets written in bash.  :-)

mkfifo is dandy for handling one-to-one relationships, but it forces the
submitter to block until the fifo's been cleared.  So if it takes the
server a minute to "do" stuff once in a while, the clients will all be
waiting, which is unacceptable.

The ideal solution would of course be something that allows many-to-many
client-server relationships; the ability to have N clients pop things on
to one end of the queue and M servers popping things off the other end,
servers blocking while they wait for input.  But I'd settle for single-
server-multiple-client (i.e. a single `tail -f fifo | while read line`
and dot-locking for the clients).

I don't care if data gets lost in a crash, but I'd really rather not get
into alot of programming.  Is there an elegant way to achieve any of
this in shell?

Thanks.  :)

-- 
  Paul Chvostek                                             <paul at it.ca>
  it.canada                                            http://www.it.ca/
  Free PHP web hosting!                            http://www.it.ca/web/



More information about the freebsd-questions mailing list