Advice / best practice - thread connection pools / mutexes

K. Macy kmacy at
Tue Apr 27 22:01:15 UTC 2010

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.


On Tue, Apr 27, 2010 at 12:14 PM, Piotr Honik <piotr.honik at> 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 at mailing list
> To unsubscribe, send any mail to "freebsd-threads-unsubscribe at"

More information about the freebsd-threads mailing list