Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Jun 2003 04:36:37 -0400
From:      Paul Chvostek <paul+fbsd@it.ca>
To:        freebsd-questions@freebsd.org
Subject:   buffered fifo?
Message-ID:  <20030612083637.GA80880@mail.it.ca>

next in thread | raw e-mail | index | archive | help

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@it.ca>
  it.canada                                            http://www.it.ca/
  Free PHP web hosting!                            http://www.it.ca/web/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030612083637.GA80880>