[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] Thread Pooling
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] Thread Pooling |
Date: |
Wed, 4 Mar 2009 22:54:29 -0700 |
User-agent: |
KMail/1.11.0 (Linux/2.6.27-11-generic; KDE/4.2.0; i686; ; ) |
On Wednesday 04 March 2009 10:03:08 pm Richard Alimi wrote:
> Hi Christian,
[lots of stuff not requiring any discussion deleted here]
> It certainly is trickier if load balancing is a target. I'll first cleanup
> the existing thread pool patch, then consider the second (integration with
> select/epoll) as a second item.
>
> It seems to me there could be some possible steps towards load balancing:
>
> (1) When accepting a new connection, add it to the thread with the fewest
> number of active connections. Connections never move between threads.
>
> (2) Allow connections to move between threads. One simple metric is to try
> to equalize the number of connections per thread.
>
> (3) Allow the library user to influence load balancing to take into account
> the application's processing overhead per request. I don't currently have
> a good idea for how something like this could be done in a clean way,
> though.
>
> What do you think?
I'd say let's keep it simple: add new connections to the thread with the
fewest number of active connections. Given that most will be short-lived and
most connections will have similar characteristics, I think this should result
in at least decent load balancing. Moving connections between threads would
require locking which would then possibly be a bigger bottleneck then what
would be caused by a possible imbalance. Asking the application for help would
really complicate the API so that's really not a good idea in my book.
My 2 cents.
Christian