From owner-freebsd-threads@FreeBSD.ORG Tue Apr 27 22:01:15 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 54C4C106566B for ; Tue, 27 Apr 2010 22:01:15 +0000 (UTC) (envelope-from kmatthew.macy@gmail.com) Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com [209.85.221.181]) by mx1.freebsd.org (Postfix) with ESMTP id 0CB9B8FC1D for ; Tue, 27 Apr 2010 22:01:14 +0000 (UTC) Received: by qyk11 with SMTP id 11so17217207qyk.13 for ; Tue, 27 Apr 2010 15:01:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:reply-to:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=n+4y38ZQQlJ2GxLZb+MwgqIte2x+OjR0AOVFvrmmiqE=; b=Qnuhr5Ddi6FrQgttA/sRVtJSYjY72qvFEYa+UDYJbYbVpbVIboqQd8QWrF6u9RB0CC 4R6okDq+n8irSfiIpQhgkXyYhPOk2iGEYi5Z2OjwWGQX0VBqyh6zca9N5A0Qvwjo/mGi Jn8pW36CFe5ZKuPmmW5AhegvtHQmgKkE80cAU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:reply-to:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=uJhrN0Yyx8+NzfWeDq9jaC3wRhoXEtMdxOMQQJM+jXcdUzH1cex7XuQvIfET5pNu+K U7WMvnjTEZ32HIkPt1f0GPyoDzj7xQCZGGeLgtCF/4y5GP3L5Jt1v+F+vTnhYyBqPIZr wpJoFOiM8oG3Yj9Hp/xCxJcasU5EQH+TRjxzk= MIME-Version: 1.0 Received: by 10.229.226.1 with SMTP id iu1mr8172259qcb.19.1272404249682; Tue, 27 Apr 2010 14:37:29 -0700 (PDT) Sender: kmatthew.macy@gmail.com Received: by 10.229.231.18 with HTTP; Tue, 27 Apr 2010 14:37:29 -0700 (PDT) In-Reply-To: <4BD737AA.3000200@eranet.pl> References: <6AD0A971B01FA1DE632BAF65@HPQuadro64.dmpriest.net.uk> <4BD737AA.3000200@eranet.pl> Date: Tue, 27 Apr 2010 14:37:29 -0700 X-Google-Sender-Auth: 14381f6dd4aa9693 Message-ID: From: "K. Macy" To: Piotr Honik Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: 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 Reply-To: kmacy@freebsd.org List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Apr 2010 22:01:15 -0000 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. -Kip 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+ threa= ds > 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: > =A0- the size of =A0the 'pool' controlled easily > =A0- mutexes locked only by one thread > =A0- worker threads don't care about db connection, they only talk to the > manager > =A0- 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= " >