From owner-freebsd-questions@FreeBSD.ORG Thu Jun 12 01:37:10 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2EE8D37B401 for ; Thu, 12 Jun 2003 01:37:07 -0700 (PDT) Received: from haggis.it.ca (haggis.it.ca [216.126.86.9]) by mx1.FreeBSD.org (Postfix) with ESMTP id F379843FBD for ; Thu, 12 Jun 2003 01:37:06 -0700 (PDT) (envelope-from paul@haggis.it.ca) Received: from haggis.it.ca (paul@localhost [127.0.0.1]) by haggis.it.ca (8.12.9/8.12.9) with ESMTP id h5C8abVD088118 for ; Thu, 12 Jun 2003 04:36:37 -0400 (EDT) (envelope-from paul@haggis.it.ca) Received: (from paul@localhost) by haggis.it.ca (8.12.9/8.12.6/Submit) id h5C8abB9088117 for freebsd-questions@freebsd.org; Thu, 12 Jun 2003 04:36:37 -0400 (EDT) (envelope-from paul) Date: Thu, 12 Jun 2003 04:36:37 -0400 From: Paul Chvostek To: freebsd-questions@freebsd.org Message-ID: <20030612083637.GA80880@mail.it.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Subject: buffered fifo? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jun 2003 08:37:10 -0000 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 it.canada http://www.it.ca/ Free PHP web hosting! http://www.it.ca/web/