Advice / best practice - thread connection pools / mutexes
alfred at freebsd.org
Tue Apr 27 22:19:29 UTC 2010
* K. Macy <kmacy at freebsd.org> [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!
> On Tue, Apr 27, 2010 at 12:14 PM, Piotr Honik <piotr.honik at eranet.pl> 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 freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-threads
> > To unsubscribe, send any mail to "freebsd-threads-unsubscribe at freebsd.org"
> freebsd-threads at freebsd.org mailing list
> To unsubscribe, send any mail to "freebsd-threads-unsubscribe at freebsd.org"
- Alfred Perlstein
More information about the freebsd-threads