From owner-freebsd-threads@FreeBSD.ORG Tue Apr 27 22:19:29 2010 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCDCD106566B; Tue, 27 Apr 2010 22:19:29 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id AC9828FC0C; Tue, 27 Apr 2010 22:19:29 +0000 (UTC) Received: by elvis.mu.org (Postfix, from userid 1192) id A49C71A3C41; Tue, 27 Apr 2010 15:05:42 -0700 (PDT) Date: Tue, 27 Apr 2010 15:05:42 -0700 From: Alfred Perlstein To: "K. Macy" Message-ID: <20100427220542.GH35381@elvis.mu.org> References: <6AD0A971B01FA1DE632BAF65@HPQuadro64.dmpriest.net.uk> <4BD737AA.3000200@eranet.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: Piotr Honik , freebsd-threads@freebsd.org Subject: Re: Advice / best practice - thread connection pools / mutexes X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Apr 2010 22:19:29 -0000 * K. Macy [100427 15:01] wrote: > I used lock-less ring buffer for passing newly accepted sockets to a > thread pool. > > I can post the code if it is of interest. That would be very interesting! please do. > > > On Tue, Apr 27, 2010 at 12:14 PM, Piotr Honik wrote: > > Why don't you consider implementing a full manager-worker model? > > Tracking multiple mutexes and conditional waiting when you hit 100+ threads > > isn't going to give you good performance. > > I would be looking at a separate thread doing one thing only - performing > > database queries on behalf of worker threads. > > > > This approach has several advantages: > > ?- the size of ?the 'pool' controlled easily > > ?- mutexes locked only by one thread > > ?- worker threads don't care about db connection, they only talk to the > > manager > > ?- good starting point to develop a complete round-robin solution with > > several db servers > > > > PH. > > _______________________________________________ > > freebsd-threads@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-threads > > To unsubscribe, send any mail to "freebsd-threads-unsubscribe@freebsd.org" > > > _______________________________________________ > freebsd-threads@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-threads > To unsubscribe, send any mail to "freebsd-threads-unsubscribe@freebsd.org" -- - Alfred Perlstein