Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Apr 2010 21:14:50 +0200
From:      Piotr Honik <piotr.honik@eranet.pl>
To:        freebsd-threads@freebsd.org
Subject:   Re: Advice / best practice - thread connection pools / mutexes
Message-ID:  <4BD737AA.3000200@eranet.pl>
In-Reply-To: <6AD0A971B01FA1DE632BAF65@HPQuadro64.dmpriest.net.uk>
References:  <6AD0A971B01FA1DE632BAF65@HPQuadro64.dmpriest.net.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



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